Docpick

io.github.ArkNill由 GitHub 帳號 ArkNill 發布v0.1.2更新於 Oct 25, 2026

Schema-driven document extraction with local OCR + LLM. Document in, Structured JSON out.

已驗證STDIO僅桌面檔案與儲存資料與分析

概覽

AI 產生的概覽

Docpick 是在本機執行、以結構描述驅動的文件擷取工具,透過本機 OCR 與本機 LLM 將發票、收據與表單轉成經驗證的結構化 JSON。

可以做什麼
使用內建或自訂 Pydantic/JSON 結構描述,從 PDF 與圖片擷取結構化 JSON,並提供逐欄位信心分數與失敗時的部分結果。僅執行 OCR,支援韓文、英文等多種語言,並在 PaddleOCR、EasyOCR、GOT-OCR2.0 與 VLM 引擎間自動回退。以檢查碼演算法、跨欄位規則與跨文件一致性檢查驗證擷取結果。以平行工作程序批次處理整個目錄,並列出或檢視八個內建結構描述。
適用情境
適合需要把發票、收據、提單、稅務表單、銀行對帳單或身分證件等業務文件轉為結構化資料,同時讓資料完全留在本機的情境。也適合批次處理文件目錄以及驗證一整套貿易單據。
執行需求
以 Python 套件形式在本機執行(Python 3.11+),透過 pip 安裝,可選裝 OCR 附加元件。需要本機或相容 OpenAI 的 LLM 端點,例如 vLLM 或 Ollama,並透過 CLI 或 YAML 設定。GOT-OCR2.0 與 VLM 引擎需要 GPU,PaddleOCR 與 EasyOCR 用 CPU 即可。
安裝前請注意
擷取結果可能包含身分證件、銀行對帳單與稅務表單中的敏感個人與財務資訊,應保護本機 LLM 端點與輸出檔案。流程會寫入結果檔案與批次輸出目錄。擷取可能回傳部分或未通過驗證的資料,依賴結果前應查看驗證錯誤與信心分數。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Docpick,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

Docpick

[PyPI] [Python] [License] [Tests]

한국어 문서 · llms.txt

Document in, Structured JSON out. Locally. With your schema.

docpick is a lightweight, schema-driven document extraction pipeline that combines local OCR engines with local LLMs to extract structured JSON from any document — invoices, receipts, bills of lading, tax forms, and more.

  • Zero cloud dependency — runs entirely on your machine (CPU or GPU)
  • Custom schemas — define your own Pydantic models or use 8 built-in document schemas
  • Validation built-in — checkdigit verification, cross-field rules, cross-document consistency
  • Apache 2.0 — no GPL/AGPL dependencies

Install

bash
pip install docpick            # core (LLM extraction only)pip install docpick[paddle]    # + PaddleOCR (recommended)pip install docpick[easyocr]   # + EasyOCR (Korean-optimized)pip install docpick[got]       # + GOT-OCR2.0 (GPU, vision-language)pip install docpick[all]       # all OCR backends

Requirements: Python 3.11+ / LLM endpoint (vLLM, Ollama, or OpenAI-compatible)

Quick Start

Python API

python
from docpick import DocpickPipelinefrom docpick.schemas import InvoiceSchema
pipeline = DocpickPipeline()result = pipeline.extract("invoice.pdf", schema=InvoiceSchema)
print(result.data)           # Structured dict matching schemaprint(result.validation)     # Validation errors/warningsprint(result.confidence)     # Per-field confidence scores

CLI

bash
# Extract structured datadocpick extract invoice.pdf --schema invoice --output result.json
# OCR only (no LLM)docpick ocr document.png --lang ko,en
# Validate extracted JSONdocpick validate result.json --schema invoice
# Batch process a directorydocpick batch ./documents/ --schema invoice --output ./results/ --concurrency 4
# List available schemasdocpick schemas list
# Show schema detailsdocpick schemas show invoice

Built-in Schemas

SchemaDocument TypeKey Validations
invoiceCommercial invoicesLine item sums, tax ID checkdigit, date order
receiptRetail/restaurant receiptsTotal = subtotal + tax + tip
bill_of_ladingOcean/air B/LContainer weight sums, ISO 6346, HS code format
purchase_orderPurchase ordersPO total = line items, delivery date order
kr_tax_invoiceKorean e-tax invoice (세금계산서)Business number checkdigit (x2), supply/tax/total sums
bank_statementBank statementsIBAN mod97, period date order
id_documentPassport/ID (ICAO 9303)MRZ, ISO 3166 country codes, date ranges
certificate_of_originCertificate of OriginISO 3166 alpha-2 country codes

Custom Schemas

Define your own schema with Pydantic:

python
from pydantic import BaseModelfrom docpick import DocpickPipelinefrom docpick.validation.rules import SumEqualsRule, RequiredFieldRule
class MyDocument(BaseModel):    """Custom document schema."""    company_name: str | None = None    total_amount: float | None = None    tax_amount: float | None = None    net_amount: float | None = None    items: list[dict] | None = None
    class ValidationRules:        rules = [            RequiredFieldRule("company_name"),            SumEqualsRule(["net_amount", "tax_amount"], "total_amount"),        ]
pipeline = DocpickPipeline()result = pipeline.extract("my_document.pdf", schema=MyDocument)

Or use a JSON Schema file:

bash
docpick extract document.pdf --schema my_schema.json

Validation

Check Digit Algorithms

AlgorithmUse Case
kr_business_numberKorean business registration number (10 digits)
luhnCredit card numbers
iso_6346Shipping container numbers
iban_mod97International bank account numbers
awb_mod7Air waybill numbers
mrzMachine Readable Zone (passport/ID)

Cross-Field Rules

RuleDescription
SumEqualsRuleSum of fields equals target (with tolerance)
DateBeforeRuleDate A must precede Date B
RequiredFieldRuleField must be non-null and non-empty
FieldEqualsRuleTwo fields must be equal
RangeRuleNumeric field within min/max bounds
RegexRuleField matches regex pattern

Cross-Document Validation

Validate consistency across related documents (e.g., Invoice + B/L + Packing List):

python
from docpick.validation.cross_document import create_trade_document_validator
validator = create_trade_document_validator()result = validator.validate({    "invoice": invoice_data,    "bl": bl_data,    "packing_list": packing_list_data,    "certificate": certificate_data,})print(result.is_valid)

OCR Engines

EngineTypeGPULanguagesBest For
PaddleOCRTraditional OCROptional111General documents (default)
EasyOCRTraditional OCROptional80+Korean text
GOT-OCR2.0Vision-LanguageRequiredMultiComplex layouts
VLMVision-LanguageRequiredMultiDirect image → JSON

2-Tier Auto Engine

The default auto engine uses confidence-based fallback:

  1. Tier 1 (CPU): PaddleOCR → EasyOCR
  2. Tier 2 (GPU): GOT-OCR2.0 → VLM

If Tier 1 average confidence falls below threshold (default 0.7), automatically escalates to Tier 2.

LLM Providers

ProviderEndpointDefault Model
vLLMhttp://localhost:8000/v1Qwen/Qwen3.5-32B-AWQ
Ollamahttp://localhost:11434qwen3.5:7b

Configure via CLI or YAML:

bash
docpick config set llm.provider ollamadocpick config set llm.base_url http://localhost:11434docpick config set llm.model qwen3.5:7b

Error Handling

The pipeline is designed to be resilient:

  • OCR failure → automatic fallback to next available engine
  • LLM JSON parse failure → automatic retry with correction prompt (up to 1 retry)
  • Partial results → returns whatever was extracted, with errors logged in result.errors
  • Document load failure → returns empty result with error message
python
result = pipeline.extract("damaged.pdf", schema=InvoiceSchema)if result.errors:    print("Pipeline warnings:", result.errors)if result.data:    print("Partial extraction:", result.data)

Batch Processing

Process entire directories with parallel workers:

python
from docpick.batch import BatchProcessorfrom docpick.schemas import InvoiceSchema
processor = BatchProcessor(concurrency=4)result = processor.process_directory(    "./invoices/",    schema=InvoiceSchema,    recursive=True,)
print(f"Processed {result.succeeded}/{result.total} files")for path, extraction in result.results.items():    print(f"{path}: {extraction.data.get('total_amount')}")

Architecture

mermaid
flowchart TD    A["📄 Document\n(PDF / Image)"] --> B["DocumentLoader\n(pypdfium2)"]    B --> C["Tier 1: OCR\n(PaddleOCR / EasyOCR)\nCPU"]    C --> D{"Confidence\n≥ threshold?"}    D -->|"yes"| F["LLM Extractor\n(vLLM / Ollama)\nSchema prompt"]    D -->|"no"| E["Tier 2: VLM\n(GOT / VLM)\nGPU"]    E --> F    F --> G["Pydantic Validation"]    G --> H["✅ ExtractionResult"]

License

Apache 2.0 — all dependencies are Apache 2.0 or MIT licensed.


Part of the QuartzUnit ecosystem — composable Python libraries for data collection, extraction, search, and AI agent safety.

來源:README.md,提交 173a35d

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.1.2最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分