{"id":24492648,"url":"https://github.com/icereed/paperless-gpt","last_synced_at":"2025-05-15T13:08:13.937Z","repository":{"id":258220520,"uuid":"861746639","full_name":"icereed/paperless-gpt","owner":"icereed","description":"Use LLMs and LLM Vision (OCR) to handle paperless-ngx - Document Digitalization powered by AI","archived":false,"fork":false,"pushed_at":"2025-05-11T15:54:19.000Z","size":16970,"stargazers_count":888,"open_issues_count":47,"forks_count":43,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-05-11T16:37:39.170Z","etag":null,"topics":["ai","chatgpt","llm","mistral","ocr","ollama","paperless","paperless-ngx"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/icereed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"icereed","buy_me_a_coffee":"icereed"}},"created_at":"2024-09-23T12:55:43.000Z","updated_at":"2025-05-11T15:54:23.000Z","dependencies_parsed_at":"2024-10-26T10:50:18.181Z","dependency_job_id":"8176621b-8991-4d2f-a874-f7986b9d11f8","html_url":"https://github.com/icereed/paperless-gpt","commit_stats":null,"previous_names":["icereed/paperless-gpt"],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icereed%2Fpaperless-gpt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icereed%2Fpaperless-gpt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icereed%2Fpaperless-gpt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icereed%2Fpaperless-gpt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icereed","download_url":"https://codeload.github.com/icereed/paperless-gpt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254346624,"owners_count":22055808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","chatgpt","llm","mistral","ocr","ollama","paperless","paperless-ngx"],"created_at":"2025-01-21T19:02:24.982Z","updated_at":"2025-05-15T13:08:08.891Z","avatar_url":"https://github.com/icereed.png","language":"Go","funding_links":["https://github.com/sponsors/icereed","https://buymeacoffee.com/icereed"],"categories":["Go","NLP","ChatGPT-based applications for regular users and specialized problems"],"sub_categories":["Other sdk/libraries"],"readme":"# paperless-gpt\n\n[![License](https://img.shields.io/github/license/icereed/paperless-gpt)](LICENSE)\n[![Discord Banner](https://img.shields.io/badge/Join%20us%20on-Discord-blue?logo=discord)](https://discord.gg/fJQppDH2J7)\n[![Docker Pulls](https://img.shields.io/docker/pulls/icereed/paperless-gpt)](https://hub.docker.com/r/icereed/paperless-gpt)\n[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)\n[![GitHub Sponsors](https://img.shields.io/badge/Sponsor-icereed-ea4aaa?logo=github-sponsors)](https://github.com/sponsors/icereed)\n\n![Screenshot](./paperless-gpt-screenshot.png)\n\n**paperless-gpt** seamlessly pairs with [paperless-ngx][paperless-ngx] to generate **AI-powered document titles** and **tags**, saving you hours of manual sorting. While other tools may offer AI chat features, **paperless-gpt** stands out by **supercharging OCR with LLMs**-ensuring high accuracy, even with tricky scans. If you're craving next-level text extraction and effortless document organization, this is your solution.\n\nhttps://github.com/user-attachments/assets/bd5d38b9-9309-40b9-93ca-918dfa4f3fd4\n\n\u003e **❤️ Support This Project**  \n\u003e If paperless-gpt is helping you organize your documents and saving you time, please consider [sponsoring its development](https://github.com/sponsors/icereed). Your support helps ensure continued improvements and maintenance!\n\n---\n\n## Key Highlights\n\n1. **LLM-Enhanced OCR**  \n   Harness Large Language Models (OpenAI or Ollama) for **better-than-traditional** OCR—turn messy or low-quality scans into context-aware, high-fidelity text.\n\n2. **Use specialized AI OCR services**\n\n   - **LLM OCR**: Use OpenAI or Ollama to extract text from images.\n   - **Google Document AI**: Leverage Google's powerful Document AI for OCR tasks.\n   - **Azure Document Intelligence**: Use Microsoft's enterprise OCR solution.\n\n3. **Automatic Title, Tag \u0026 Created Date Generation**  \n   No more guesswork. Let the AI do the naming and categorizing. You can easily review suggestions and refine them if needed.\n\n4. **Supports DeepSeek reasoning models in Ollama**  \n   Greatly enhance accuracy by using a reasoning model like `deepseek-r1:8b`. The perfect tradeoff between privacy and performance! Of course, if you got enough GPUs or NPUs, a bigger model will enhance the experience.\n\n5. **Automatic Correspondent Generation**  \n   Automatically identify and generate correspondents from your documents, making it easier to track and organize your communications.\n\n6. **Extensive Customization**\n\n   - **Prompt Templates**: Tweak your AI prompts to reflect your domain, style, or preference.\n   - **Tagging**: Decide how documents get tagged—manually, automatically, or via OCR-based flows.\n\n7. **Simple Docker Deployment**  \n   A few environment variables, and you're off! Compose it alongside paperless-ngx with minimal fuss.\n\n8. **Unified Web UI**\n\n   - **Manual Review**: Approve or tweak AI's suggestions.\n   - **Auto Processing**: Focus only on edge cases while the rest is sorted for you.\n\n---\n\n## Table of Contents\n\n- [Key Highlights](#key-highlights)\n- [Getting Started](#getting-started)\n  - [Prerequisites](#prerequisites)\n  - [Installation](#installation)\n    - [Docker Compose](#docker-compose)\n    - [Manual Setup](#manual-setup)\n- [OCR Providers](#ocr-providers)\n  - [LLM-based OCR](#1-llm-based-ocr-default)\n  - [Azure Document Intelligence](#2-azure-document-intelligence)\n  - [Google Document AI](#3-google-document-ai)\n  - [Comparing OCR Providers](#comparing-ocr-providers)\n  - [Choosing the Right Provider](#choosing-the-right-provider)\n- [Configuration](#configuration)\n  - [Environment Variables](#environment-variables)\n  - [Custom Prompt Templates](#custom-prompt-templates)\n    - [Prompt Templates Directory](#prompt-templates-directory)\n    - [Mounting the Prompts Directory](#mounting-the-prompts-directory)\n    - [Editing the Prompt Templates](#editing-the-prompt-templates)\n    - [Template Syntax and Variables](#template-syntax-and-variables)\n- [OCR using AI](#llm-based-ocr-compare-for-yourself)\n- [Usage](#usage)\n- [Contributing](#contributing)\n- [Support the Project](#support-the-project)\n- [License](#license)\n- [Star History](#star-history)\n- [Disclaimer](#disclaimer)\n\n---\n\n## Getting Started\n\n### Prerequisites\n\n- [Docker][docker-install] installed.\n- A running instance of [paperless-ngx][paperless-ngx].\n- Access to an LLM provider:\n  - **OpenAI**: An API key with models like `gpt-4o` or `gpt-3.5-turbo`.\n  - **Ollama**: A running Ollama server with models like `deepseek-r1:8b`.\n\n### Installation\n\n#### Docker Compose\n\nHere's an example `docker-compose.yml` to spin up **paperless-gpt** alongside paperless-ngx:\n\n```yaml\nservices:\n  paperless-ngx:\n    image: ghcr.io/paperless-ngx/paperless-ngx:latest\n    # ... (your existing paperless-ngx config)\n\n  paperless-gpt:\n    image: icereed/paperless-gpt:latest\n    environment:\n      PAPERLESS_BASE_URL: \"http://paperless-ngx:8000\"\n      PAPERLESS_API_TOKEN: \"your_paperless_api_token\"\n      PAPERLESS_PUBLIC_URL: \"http://paperless.mydomain.com\" # Optional\n      MANUAL_TAG: \"paperless-gpt\" # Optional, default: paperless-gpt\n      AUTO_TAG: \"paperless-gpt-auto\" # Optional, default: paperless-gpt-auto\n      LLM_PROVIDER: \"openai\" # or 'ollama'\n      LLM_MODEL: \"gpt-4o\" # or 'deepseek-r1:8b'\n      # Optional, but recommended for Ollama\n      TOKEN_LIMIT: 1000\n      OPENAI_API_KEY: \"your_openai_api_key\"\n      # Optional - OPENAI_BASE_URL: 'https://litellm.yourinstallationof.it.com/v1'\n      LLM_LANGUAGE: \"English\" # Optional, default: English\n\n      # OCR Configuration - Choose one:\n      # Option 1: LLM-based OCR\n      OCR_PROVIDER: \"llm\" # Default OCR provider\n      VISION_LLM_PROVIDER: \"ollama\" # openai or ollama\n      VISION_LLM_MODEL: \"minicpm-v\" # minicpm-v (ollama) or gpt-4o (openai)\n      OLLAMA_HOST: \"http://host.docker.internal:11434\" # If using Ollama\n\n      # Option 2: Google Document AI\n      # OCR_PROVIDER: 'google_docai'       # Use Google Document AI\n      # GOOGLE_PROJECT_ID: 'your-project'  # Your GCP project ID\n      # GOOGLE_LOCATION: 'us'              # Document AI region\n      # GOOGLE_PROCESSOR_ID: 'processor-id' # Your processor ID\n      # GOOGLE_APPLICATION_CREDENTIALS: '/app/credentials.json' # Path to service account key\n\n      # Option 3: Azure Document Intelligence\n      # OCR_PROVIDER: 'azure'              # Use Azure Document Intelligence\n      # AZURE_DOCAI_ENDPOINT: 'your-endpoint' # Your Azure endpoint URL\n      # AZURE_DOCAI_KEY: 'your-key'        # Your Azure API key\n      # AZURE_DOCAI_MODEL_ID: 'prebuilt-read' # Optional, defaults to prebuilt-read\n      # AZURE_DOCAI_TIMEOUT_SECONDS: '120'  # Optional, defaults to 120 seconds\n\n      AUTO_OCR_TAG: \"paperless-gpt-ocr-auto\" # Optional, default: paperless-gpt-ocr-auto\n      OCR_LIMIT_PAGES: \"5\" # Optional, default: 5. Set to 0 for no limit.\n      LOG_LEVEL: \"info\" # Optional: debug, warn, error\n    volumes:\n      - ./prompts:/app/prompts # Mount the prompts directory\n      # For Google Document AI:\n      - ${HOME}/.config/gcloud/application_default_credentials.json:/app/credentials.json\n    ports:\n      - \"8080:8080\"\n    depends_on:\n      - paperless-ngx\n```\n\n**Pro Tip**: Replace placeholders with real values and read the logs if something looks off.\n\n#### Manual Setup\n\n1. **Clone the Repository**\n   ```bash\n   git clone https://github.com/icereed/paperless-gpt.git\n   cd paperless-gpt\n   ```\n2. **Create a `prompts` Directory**\n   ```bash\n   mkdir prompts\n   ```\n3. **Build the Docker Image**\n   ```bash\n   docker build -t paperless-gpt .\n   ```\n4. **Run the Container**\n   ```bash\n   docker run -d \\\n     -e PAPERLESS_BASE_URL='http://your_paperless_ngx_url' \\\n     -e PAPERLESS_API_TOKEN='your_paperless_api_token' \\\n     -e LLM_PROVIDER='openai' \\\n     -e LLM_MODEL='gpt-4o' \\\n     -e OPENAI_API_KEY='your_openai_api_key' \\\n     -e LLM_LANGUAGE='English' \\\n     -e VISION_LLM_PROVIDER='ollama' \\\n     -e VISION_LLM_MODEL='minicpm-v' \\\n     -e LOG_LEVEL='info' \\\n     -v $(pwd)/prompts:/app/prompts \\\n     -p 8080:8080 \\\n     paperless-gpt\n   ```\n\n---\n## OCR Providers\n\npaperless-gpt supports three different OCR providers, each with unique strengths and capabilities:\n\n### 1. LLM-based OCR (Default)\n- **Key Features**:\n  - Uses vision-capable LLMs like gpt-4o or MiniCPM-V\n  - High accuracy with complex layouts and difficult scans\n  - Context-aware text recognition\n  - Self-correcting capabilities for OCR errors\n- **Best For**:\n  - Complex or unusual document layouts\n  - Poor quality scans\n  - Documents with mixed languages\n- **Configuration**:\n  ```yaml\n  OCR_PROVIDER: \"llm\"\n  VISION_LLM_PROVIDER: \"openai\" # or \"ollama\"\n  VISION_LLM_MODEL: \"gpt-4o\" # or \"minicpm-v\"\n  ```\n\n### 2. Azure Document Intelligence\n- **Key Features**:\n  - Enterprise-grade OCR solution\n  - Prebuilt models for common document types\n  - Layout preservation and table detection\n  - Fast processing speeds\n- **Best For**:\n  - Business documents and forms\n  - High-volume processing\n  - Documents requiring layout analysis\n- **Configuration**:\n  ```yaml\n  OCR_PROVIDER: \"azure\"\n  AZURE_DOCAI_ENDPOINT: \"https://your-endpoint.cognitiveservices.azure.com/\"\n  AZURE_DOCAI_KEY: \"your-key\"\n  AZURE_DOCAI_MODEL_ID: \"prebuilt-read\" # optional\n  AZURE_DOCAI_TIMEOUT_SECONDS: \"120\" # optional\n  ```\n\n### 3. Google Document AI\n- **Key Features**:\n  - Specialized document processors\n  - Strong form field detection\n  - Multi-language support\n  - High accuracy on structured documents\n- **Best For**:\n  - Forms and structured documents\n  - Documents with tables\n  - Multi-language documents\n- **Configuration**:\n  ```yaml\n  OCR_PROVIDER: \"google_docai\"\n  GOOGLE_PROJECT_ID: \"your-project\"\n  GOOGLE_LOCATION: \"us\"\n  GOOGLE_PROCESSOR_ID: \"processor-id\"\n  ```\n\n## Configuration\n\n### Environment Variables\n\n# **Note:** When using Ollama, ensure that the Ollama server is running and accessible from the paperless-gpt container.\n\n| Variable                         | Description                                                                                                      | Required | Default                |\n| -------------------------------- | ---------------------------------------------------------------------------------------------------------------- | -------- | ---------------------- |\n| `PAPERLESS_BASE_URL`             | URL of your paperless-ngx instance (e.g. `http://paperless-ngx:8000`).                                           | Yes      |                        |\n| `PAPERLESS_API_TOKEN`            | API token for paperless-ngx. Generate one in paperless-ngx admin.                                                | Yes      |                        |\n| `PAPERLESS_PUBLIC_URL`           | Public URL for Paperless (if different from `PAPERLESS_BASE_URL`).                                               | No       |                        |\n| `MANUAL_TAG`                     | Tag for manual processing.                                                                                       | No       | paperless-gpt          |\n| `AUTO_TAG`                       | Tag for auto processing.                                                                                         | No       | paperless-gpt-auto     |\n| `LLM_PROVIDER`                   | AI backend (`openai` or `ollama`).                                                                               | Yes      |                        |\n| `LLM_MODEL`                      | AI model name, e.g. `gpt-4o`, `gpt-3.5-turbo`, `deepseek-r1:8b`.                                                 | Yes      |                        |\n| `OPENAI_API_KEY`                 | OpenAI API key (required if using OpenAI).                                                                       | Cond.    |                        |\n| `OPENAI_BASE_URL`                | OpenAI base URL (optional, if using a custom OpenAI compatible service like LiteLLM).                            | No       |                        |\n| `LLM_LANGUAGE`                   | Likely language for documents (e.g. `English`).                                                                  | No       | English                |\n| `OLLAMA_HOST`                    | Ollama server URL (e.g. `http://host.docker.internal:11434`).                                                    | No       |                        |\n| `OCR_PROVIDER`                   | OCR provider to use (`llm`, `azure`, or `google_docai`).                                                        | No       | llm                    |\n| `VISION_LLM_PROVIDER`            | AI backend for LLM OCR (`openai` or `ollama`). Required if OCR_PROVIDER is `llm`.                                | Cond.    |                        |\n| `VISION_LLM_MODEL`               | Model name for LLM OCR (e.g. `minicpm-v`). Required if OCR_PROVIDER is `llm`.                                    | Cond.    |                        |\n| `AZURE_DOCAI_ENDPOINT`           | Azure Document Intelligence endpoint. Required if OCR_PROVIDER is `azure`.                                        | Cond.    |                        |\n| `AZURE_DOCAI_KEY`                | Azure Document Intelligence API key. Required if OCR_PROVIDER is `azure`.                                         | Cond.    |                        |\n| `AZURE_DOCAI_MODEL_ID`           | Azure Document Intelligence model ID. Optional if using `azure` provider.                                         | No       | prebuilt-read          |\n| `AZURE_DOCAI_TIMEOUT_SECONDS`    | Azure Document Intelligence timeout in seconds.                                                                   | No       | 120                    |\n| `GOOGLE_PROJECT_ID`              | Google Cloud project ID. Required if OCR_PROVIDER is `google_docai`.                                             | Cond.    |                        |\n| `GOOGLE_LOCATION`                | Google Cloud region (e.g. `us`, `eu`). Required if OCR_PROVIDER is `google_docai`.                               | Cond.    |                        |\n| `GOOGLE_PROCESSOR_ID`            | Document AI processor ID. Required if OCR_PROVIDER is `google_docai`.                                            | Cond.    |                        |\n| `GOOGLE_APPLICATION_CREDENTIALS` | Path to the mounted Google service account key. Required if OCR_PROVIDER is `google_docai`.                      | Cond.    |                        |\n| `AUTO_OCR_TAG`                   | Tag for automatically processing docs with OCR.                                                                  | No       | paperless-gpt-ocr-auto |\n| `LOG_LEVEL`                      | Application log level (`info`, `debug`, `warn`, `error`).                                                        | No       | info                   |\n| `LISTEN_INTERFACE`               | Network interface to listen on.                                                                                  | No       | 8080                   |\n| `AUTO_GENERATE_TITLE`            | Generate titles automatically if `paperless-gpt-auto` is used.                                                   | No       | true                   |\n| `AUTO_GENERATE_TAGS`             | Generate tags automatically if `paperless-gpt-auto` is used.                                                     | No       | true                   |\n| `AUTO_GENERATE_CORRESPONDENTS`   | Generate correspondents automatically if `paperless-gpt-auto` is used.                                           | No       | true                   |\n| `AUTO_GENERATE_CREATED_DATE`     | Generate the created dates automatically if `paperless-gpt-auto` is used.                                        | No       | true                   |\n| `OCR_LIMIT_PAGES`                | Limit the number of pages for OCR. Set to `0` for no limit.                                                      | No       | 5                      |\n| `TOKEN_LIMIT`                    | Maximum tokens allowed for prompts/content. Set to `0` to disable limit. Useful for smaller LLMs.                | No       |                        |\n| `CORRESPONDENT_BLACK_LIST`       | A comma-separated list of names to exclude from the correspondents suggestions. Example: `John Doe, Jane Smith`. | No       |                        |\n\n### Custom Prompt Templates\n\npaperless-gpt's flexible **prompt templates** let you shape how AI responds:\n\n1. **`title_prompt.tmpl`**: For document titles.\n2. **`tag_prompt.tmpl`**: For tagging logic.\n3. **`ocr_prompt.tmpl`**: For LLM OCR.\n4. **`correspondent_prompt.tmpl`**: For correspondent identification.\n5. **`created_date_prompt.tmpl`**: For setting of document's created date.\n\nMount them into your container via:\n\n```yaml\nvolumes:\n  - ./prompts:/app/prompts\n```\n\nThen tweak at will—**paperless-gpt** reloads them automatically on startup!\n\n#### Template Variables\n\nEach template has access to specific variables:\n\n**title_prompt.tmpl**:\n- `{{.Language}}` - Target language (e.g., \"English\")\n- `{{.Content}}` - Document content text\n- `{{.Title}}` - Original document title\n\n**tag_prompt.tmpl**:\n- `{{.Language}}` - Target language\n- `{{.AvailableTags}}` - List of existing tags in paperless-ngx\n- `{{.OriginalTags}}` - Document's current tags\n- `{{.Title}}` - Document title\n- `{{.Content}}` - Document content text\n\n**ocr_prompt.tmpl**:\n- `{{.Language}}` - Target language\n\n**correspondent_prompt.tmpl**:\n- `{{.Language}}` - Target language\n- `{{.AvailableCorrespondents}}` - List of existing correspondents\n- `{{.BlackList}}` - List of blacklisted correspondent names\n- `{{.Title}}` - Document title\n- `{{.Content}}` - Document content text\n\n**created_date_prompt.tmpl**:\n- `{{.Language}}` - Target language\n- `{{.Content}}` - Document content text\n\nThe templates use Go's text/template syntax. paperless-gpt automatically reloads template changes on startup.\n\n---\n\n## Usage\n\n1. **Tag Documents**\n\n   - Add `paperless-gpt` tag to documents for manual processing\n   - Add `paperless-gpt-auto` for automatic processing\n   - Add `paperless-gpt-ocr-auto` for automatic OCR processing\n\n2. **Visit Web UI**\n\n   - Go to `http://localhost:8080` (or your host) in your browser\n   - Review documents tagged for processing\n\n3. **Generate \u0026 Apply Suggestions**\n\n   - Click \"Generate Suggestions\" to see AI-proposed titles/tags/correspondents\n   - Review and approve or edit suggestions\n   - Click \"Apply\" to save changes to paperless-ngx\n\n4. **OCR Processing**\n   - Tag documents with appropriate OCR tag to process them\n   - Monitor progress in the Web UI\n   - Review results and apply changes\n---\n\n## LLM-Based OCR: Compare for Yourself\n\n\u003cdetails\u003e\n\u003csummary\u003eClick to expand the vanilla OCR vs. AI-powered OCR comparison\u003c/summary\u003e\n\n### Example 1\n\n**Image**:\n\n![Image](demo/ocr-example1.jpg)\n\n**Vanilla Paperless-ngx OCR**:\n\n```\nLa Grande Recre\n\nGentre Gommercial 1'Esplanade\n1349 LOLNAIN LA NEWWE\nTA BERBOGAAL Tel =. 010 45,96 12\nTicket 1440112 03/11/2006 a 13597:\n4007176614518. DINOS. TYRAMNESA\nTOTAET.T.LES\nReslE par Lask-Euron\nRencu en Cash Euro\nV.14.6 -Hotgese = VALERTE\nTICKET A-GONGERVER PORR TONT. EEHANGE\nHERET ET A BIENTOT\n```\n\n**LLM-Powered OCR (OpenAI gpt-4o)**:\n\n```\nLa Grande Récré\nCentre Commercial l'Esplanade\n1348 LOUVAIN LA NEUVE\nTVA 860826401 Tel : 010 45 95 12\nTicket 14421 le 03/11/2006 à 15:27:18\n4007176614518 DINOS TYRANNOSA 14.90\nTOTAL T.T.C. 14.90\nRéglé par Cash Euro 50.00\nRendu en Cash Euro 35.10\nV.14.6 Hôtesse : VALERIE\nTICKET A CONSERVER POUR TOUT ECHANGE\nMERCI ET A BIENTOT\n```\n\n---\n\n### Example 2\n\n**Image**:\n\n![Image](demo/ocr-example2.jpg)\n\n**Vanilla Paperless-ngx OCR**:\n\n```\nInvoice Number: 1-996-84199\n\nFed: Invoica Date: Sep01, 2014\nAccaunt Number: 1334-8037-4\nPage: 1012\n\nFod£x Tax ID 71.0427007\n\nIRISINC\nSHARON ANDERSON\n4731 W ATLANTIC AVE STE BI\nDELRAY BEACH FL 33445-3897 ’ a\nInvoice Questions?\n\nBing, ‚Account Shipping Address: Contact FedEx Reı\n\nISINC\n4731 W ATLANTIC AVE Phone: (800) 622-1147 M-F 7-6 (CST)\nDELRAY BEACH FL 33445-3897 US Fax: (800) 548-3020\n\nInternet: www.fedex.com\n\nInvoice Summary Sep 01, 2014\n\nFodEx Ground Services\nOther Charges 11.00\nTotal Charges 11.00 Da £\n\u003e\npolo) Fz// /G\nTOTAL THIS INVOICE .... usps 11.00 P 2/1 f\n\n‘The only charges accrued for this period is the Weekly Service Charge.\n\nThe Fedix Ground aceounts teferencedin his involce have been transteired and assigned 10, are owned by,andare payable to FedEx Express:\n\nTo onsurs propor credit, plasa raturn this portion wirh your payment 10 FodEx\n‚Please do not staple or fold. Ploase make your chack payablı to FedEx.\n\n[TI For change ol address, hc har and camphat lrm or never ide\n\nRemittance Advice\nYour payment is due by Sep 16, 2004\n\nNumber Number Dus\n\n1334803719968 41993200000110071\n\nAT 01 0391292 468448196 A**aDGT\n\nIRISINC Illallun elalalssollallansdHilalellund\nSHARON ANDERSON\n\n4731 W ATLANTIC AVE STEBI FedEx\n\nDELRAY BEACH FL 334453897 PO. Box 94516\n\nPALATINE IL 60094-4515\n```\n\n**LLM-Powered OCR (OpenAI gpt-4o)**:\n\n```\nFedEx.                                                                                      Invoice Number: 1-996-84199\n                                                                                           Invoice Date: Sep 01, 2014\n                                                                                           Account Number: 1334-8037-4\n                                                                                           Page: 1 of 2\n                                                                                           FedEx Tax ID: 71-0427007\n\nI R I S INC\nSHARON ANDERSON\n4731 W ATLANTIC AVE STE B1\nDELRAY BEACH FL 33445-3897\n                                                                                           Invoice Questions?\nBilling Account Shipping Address:                                                          Contact FedEx Revenue Services\nI R I S INC                                                                                Phone: (800) 622-1147 M-F 7-6 (CST)\n4731 W ATLANTIC AVE                                                                        Fax: (800) 548-3020\nDELRAY BEACH FL 33445-3897 US                                                              Internet: www.fedex.com\n\nInvoice Summary Sep 01, 2014\n\nFedEx Ground Services\nOther Charges                                                                 11.00\n\nTotal Charges .......................................................... USD $          11.00\n\nTOTAL THIS INVOICE .............................................. USD $                 11.00\n\nThe only charges accrued for this period is the Weekly Service Charge.\n\n                                                                                           RECEIVED\n                                                                                           SEP _ 8 REC'D\n                                                                                           BY: _\n\n                                                                                           posted 9/21/14\n\nThe FedEx Ground accounts referenced in this invoice have been transferred and assigned to, are owned by, and are payable to FedEx Express.\n\nTo ensure proper credit, please return this portion with your payment to FedEx.\nPlease do not staple or fold. Please make your check payable to FedEx.\n\n❑ For change of address, check here and complete form on reverse side.\n\nRemittance Advice\nYour payment is due by Sep 16, 2004\n\nInvoice\nNumber\n1-996-84199\n\nAccount\nNumber\n1334-8037-4\n\nAmount\nDue\nUSD $ 11.00\n\n133480371996841993200000110071\n\nAT 01 031292 468448196 A**3DGT\n\nI R I S INC\nSHARON ANDERSON\n4731 W ATLANTIC AVE STE B1\nDELRAY BEACH FL 33445-3897\n\nFedEx\nP.O. Box 94515\n```\n\n---\n\n\u003c/details\u003e\n\n**Why Does It Matter?**\n\n- Traditional OCR often jumbles text from complex or low-quality scans.\n- Large Language Models interpret context and correct likely errors, producing results that are more precise and readable.\n- You can integrate these cleaned-up texts into your **paperless-ngx** pipeline for better tagging, searching, and archiving.\n\n### How It Works\n\n- **Vanilla OCR** typically uses classical methods or Tesseract-like engines to extract text, which can result in garbled outputs for complex fonts or poor-quality scans.\n- **LLM-Powered OCR** uses your chosen AI backend—OpenAI or Ollama—to interpret the image's text in a more context-aware manner. This leads to fewer errors and more coherent text.\n\n---\n\n## Troubleshooting\n\n### Working with Local LLMs\n\nWhen using local LLMs (like those through Ollama), you might need to adjust certain settings to optimize performance:\n\n#### Token Management\n\n- Use `TOKEN_LIMIT` environment variable to control the maximum number of tokens sent to the LLM\n- Smaller models might truncate content unexpectedly if given too much text\n- Start with a conservative limit (e.g., 1000 tokens) and adjust based on your model's capabilities\n- Set to `0` to disable the limit (use with caution)\n\nExample configuration for smaller models:\n\n```yaml\nenvironment:\n  TOKEN_LIMIT: \"2000\" # Adjust based on your model's context window\n  LLM_PROVIDER: \"ollama\"\n  LLM_MODEL: \"deepseek-r1:8b\" # Or other local model\n```\n\nCommon issues and solutions:\n\n- If you see truncated or incomplete responses, try lowering the `TOKEN_LIMIT`\n- If processing is too limited, gradually increase the limit while monitoring performance\n- For models with larger context windows, you can increase the limit or disable it entirely\n\n## Contributing\n\n**Pull requests** and **issues** are welcome!\n\n1. Fork the repo\n2. Create a branch (`feature/my-awesome-update`)\n3. Commit changes (`git commit -m \"Improve X\"`)\n4. Open a PR\n\nCheck out our [contributing guidelines](CONTRIBUTING.md) for details.\n\n---\n\n## Support the Project\n\nIf paperless-gpt is saving you time and making your document management easier, please consider supporting its continued development:\n\n- **[GitHub Sponsors](https://github.com/sponsors/icereed)**: Help fund ongoing development and maintenance\n- **Share** your success stories and use cases\n- **Star** the project on GitHub\n- **Contribute** code, documentation, or bug reports\n\nYour support helps ensure paperless-gpt remains actively maintained and continues to improve!\n\n---\n\n## License\n\npaperless-gpt is licensed under the [MIT License](LICENSE). Feel free to adapt and share!\n\n---\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=icereed/paperless-gpt\u0026type=Date)](https://star-history.com/#icereed/paperless-gpt\u0026Date)\n\n---\n\n## Disclaimer\n\nThis project is **not** officially affiliated with [paperless-ngx][paperless-ngx]. Use at your own risk.\n\n---\n\n**paperless-gpt**: The **LLM-based** companion your doc management has been waiting for. Enjoy effortless, intelligent document titles, tags, and next-level OCR.\n\n[paperless-ngx]: https://github.com/paperless-ngx/paperless-ngx\n[docker-install]: https://docs.docker.com/get-docker/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficereed%2Fpaperless-gpt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficereed%2Fpaperless-gpt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficereed%2Fpaperless-gpt/lists"}