原始内容
name: local-document-ai-openvino description: Private local document AI for Intel hardware. Parse PDFs, invoices, screenshots, and diagrams with MinerU 2.5 on OpenVINO GenAI, keep the model warm in a local service, and output structured JSON/Markdown with user-defined invoice fields.
Private Document AI with OpenVINO
Turn local PDFs, invoices, screenshots, and diagrams into one of two useful outcomes:
to-data: classify the document and extract structured fields, tables, and JSON, including user-requested key fields.to-code: turn screenshots, forms, and architecture diagrams into code or Jupyter notebook scaffolds.
Everything runs locally and is built for Intel CPU/GPU acceleration with OpenVINO GenAI.
The default device is CPU for workshop stability. Set MINERU_OPENVINO_DEVICE=GPU or AUTO only after validating the target AI PC.
The default user experience is app-like:
- the first call auto-starts a local service
- HTTP/FastAPI service is preferred when available
- the standard-library IPC service is used as a fallback
- direct CLI parsing remains available with
--no-server - the model stays resident after warmup so later calls avoid repeat model loading
The default runtime path in this release is:
- MinerU 2.5 Pro
- preconverted OpenVINO INT4 model bundle
- local PDF rendering with
pypdfium2 - no local model export step
Why install this skill
Install this when you want one local workflow for:
- invoice and receipt extraction
- private PDF understanding
- table and key-value extraction
- architecture diagram to notebook generation
- screenshot to HTML/React scaffold generation
This skill is especially good for demos because it already includes:
- medical invoice
to-dataflows - restaurant invoice
to-dataflows - custom invoice field extraction such as invoice number, date, seller, and amount due
- architecture diagram
to-code -> jupyter-notebookflows - local HTML reports for easy review and screenshots
30-second start
Check the environment:
python "{baseDir}/scripts/check_env.py"
Install with the fastest available local installer path:
powershell -ExecutionPolicy Bypass -File "{baseDir}/scripts/install.ps1"
Warm up the local document AI service:
python "{baseDir}/scripts/run_skill.py" --warmup-server
Or run directly from the CLI. Server mode is automatic by default:
python "{baseDir}/scripts/run_skill.py" --mode to-data --file "/absolute/path/to/invoice.pdf" --out "/absolute/path/to/artifacts/invoice_data" --extract "tables,entities,kv_pairs"
For invoice demos with custom key fields:
python "{baseDir}/scripts/run_skill.py" --mode to-data --file "/absolute/path/to/invoice.pdf" --out "/absolute/path/to/artifacts/invoice_data" --extract "tables,entities,kv_pairs" --fields "invoice_number,invoice_date,total_amount,vendor_name"
For repeated workshop demos, prefer the persistent local server mode:
python "{baseDir}/scripts/run_skill.py" --warmup-server
python "{baseDir}/scripts/run_skill.py" --mode to-data --file "/absolute/path/to/invoice.pdf" --out "/absolute/path/to/artifacts/invoice_data" --extract "tables,entities,kv_pairs" --fields "invoice_number,invoice_date,total_amount,vendor_name"
One-command invoice demo:
powershell -ExecutionPolicy Bypass -File "{baseDir}/scripts/demo_invoice.ps1"
Example prompts
Use prompts like these in OpenClaw:
Use $local-document-ai-openvino to parse this local PDF and give me a structured report.
Use $local-document-ai-openvino to extract invoice fields, tables, and key-value pairs from this medical invoice.
Use $local-document-ai-openvino to classify this receipt and return normalized JSON.
Use $local-document-ai-openvino to extract only these invoice fields from this file: invoice_number, invoice_date, total_amount, vendor_name. Return a structured JSON result with just those requested fields.
Use $local-document-ai-openvino to extract these custom fields from this invoice: buyer_tax_id, seller_tax_id, amount_due, check_code. Save the full parse artifacts, but highlight the requested fields in the final structured output.
Use $local-document-ai-openvino to turn this architecture diagram into a Jupyter notebook scaffold.
Use $local-document-ai-openvino to convert this UI screenshot into an HTML scaffold.
What you get
Typical outputs include:
parsed.jsonparsed.mdresult_report.htmltask_output/structured_record.jsontask_output/normalized.jsontask_output/requested_fields.jsontask_output/requested_fields_record.jsontask_output/notebook.ipynbcode_preview.html
Best demo paths
If you are evaluating the skill for the first time, start here:
- run
--warmup-serveronce to start the persistent local parser and preload the model to-dataon an invoice PDF; local service mode is automatic- review
result_report.html - inspect
structured_record.json - rerun with
--fieldsand inspectrequested_fields_record.json - then try
to-codewith a diagram image and targetjupyter-notebook
Persistent local server mode
Use server mode when the same machine will parse multiple PDFs/images. This is the default path.
Why this helps:
- The first request loads and compiles the MinerU/OpenVINO GenAI runtime once.
- Later agent calls send lightweight local IPC requests to the resident process.
- Model weights stay in the process memory instead of being moved repeatedly.
- The HTTP service layer makes future Web UI, desktop UI, and multi-agent integrations easier.
- The standard-library IPC server remains as a fallback when HTTP dependencies are unavailable.
- The normal CLI path remains available for one-off runs and debugging with
--no-server.
Warm up the server before a hands-on session:
python "{baseDir}/scripts/run_skill.py" --warmup-server
Inspect the server:
python "{baseDir}/scripts/run_skill.py" --server-status
Run through the resident server:
python "{baseDir}/scripts/run_skill.py" --mode to-data --file "/absolute/path/to/invoice.pdf" --out "/absolute/path/to/artifacts/invoice_data" --extract "tables,entities,kv_pairs" --fields "invoice_number,invoice_date,total_amount,vendor_name"
Force a specific local service transport if needed:
python "{baseDir}/scripts/run_skill.py" --server-kind http --server-status
python "{baseDir}/scripts/run_skill.py" --server-kind ipc --server-status
Disable service mode for debugging:
python "{baseDir}/scripts/run_skill.py" --no-server --mode parse --file "/absolute/path/to/file.pdf"
Release memory after the workshop:
python "{baseDir}/scripts/run_skill.py" --shutdown-server
Server mode uses these implementation files:
{baseDir}/scripts/parse_client.py{baseDir}/scripts/http_parse_server.py{baseDir}/scripts/persistent_parse_server.py
The server listens only on 127.0.0.1 loopback by default and does not bind to external network interfaces.
If the default port is occupied, set LOCAL_DOCUMENT_AI_SERVER_PORT before starting the server.
For HTTP service mode, set LOCAL_DOCUMENT_AI_HTTP_PORT if port 47274 is occupied.
Custom key-field extraction
After the skill is installed, users can ask for a custom field list at call time. This is the recommended pattern for invoice demos.
Use the fields parameter with to-data:
- CLI:
--fields "invoice_number,invoice_date,total_amount,vendor_name" - config JSON:
"fields": "invoice_number,invoice_date,total_amount,vendor_name" - slash-command style:
fields=invoice_number,invoice_date,total_amount,vendor_name
The skill will:
- parse the full document locally with MinerU on OpenVINO
- keep the standard
kv_pairs,entities,tables, and traceability artifacts - resolve the requested field names to canonical keys when possible
- write a focused structured output for only those requested fields
The two demo-friendly outputs are:
task_output/requested_fields.jsonThis includes each requested field, the matched canonical key, whether it was found, the primary match, and all matches.task_output/requested_fields_record.jsonThis is the compact final record keyed by the user-requested field names.
Recommended invoice demo field names:
invoice_numberinvoice_codecheck_codeinvoice_datebuyer_tax_idseller_tax_idvendor_namecustomer_namesubtotaltax_amounttotal_amountamount_due
Common aliases are also supported when they can be normalized to canonical keys, for example:
sellerbuyerinvoice noinvoice datetotalamount due
Core pipeline
Use this skill as a local document-to-action pipeline:
- Parse the document into a canonical structured representation.
- Optionally continue into
to-dataorto-code. - Save outputs into a predictable artifact folder with traceability.
Read only if needed
Load these references when you need the schema or output contracts:
{baseDir}/references/schema.md{baseDir}/references/mode_guide.md{baseDir}/references/output_contracts.md
Primary entrypoint
Use this published entrypoint:
- CLI orchestrator:
{baseDir}/scripts/run_skill.py - recommended default path:
{baseDir}/scripts/run_skill.py --mode to-data --file ... - one-command invoice demo:
{baseDir}/scripts/demo_invoice.ps1
Do not call these implementation scripts directly from the skill:
parse_document.pyparse_client.pypersistent_parse_server.pytransform_doc_to_data.pytransform_doc_to_code.py
Local readiness
Check the environment before processing real documents:
python "{baseDir}/scripts/check_env.py"
For workshops, the simplest setup is installing into a skill-local .vendor directory.
The installer uses uv pip when uv is available and falls back to pip.
The entry scripts auto-detect the skill-local .vendor, so you do not need to edit PYTHONPATH:
python "{baseDir}/scripts/install_local_runtime.py"
If you prefer, a normal virtual environment also works:
python -m pip install -r "{baseDir}/requirements.txt"
Download the preconverted MinerU OpenVINO model bundle into the skill-local models/ folder, or point the skill at it with an environment variable:
set MINERU_OPENVINO_MODEL_DIR=C:\absolute\path\to\MinerU2.5-Pro-2604-1.2B-int4-ov
For the most stable hands-on setup, keep the default CPU path. To test acceleration on a validated Intel AI PC:
set MINERU_OPENVINO_DEVICE=GPU
Recommended model bundle:
https://www.modelscope.cn/models/snake7gun/MinerU2.5-Pro-2604-1.2B-int4-ov
Workshop-friendly download example:
git clone --depth 1 https://www.modelscope.cn/snake7gun/MinerU2.5-Pro-2604-1.2B-int4-ov.git "{baseDir}/models/MinerU2.5-Pro-2604-1.2B-int4-ov"
Run a quick orchestration smoke test:
python "{baseDir}/scripts/smoke_test.py"
Model assets are discovered from:
MINERU_OPENVINO_MODEL_DIRMINERU_MODEL_DIR{baseDir}/models/MinerU2.5-Pro-2604-1.2B-int4-ov/{baseDir}/models/mineru2.5-int4-ov/
Prefer using a predownloaded model bundle for workshops. This skill does not require local export or automatic model download.
Supported modes
parse
Use when the user wants the structured parse only.
Outputs:
parsed.jsonparsed.mdresult_report.html- extracted layout, tables, or figures when available
to-data
Use when the user wants structured extraction, normalization, or document classification.
Typical outputs under task_output/:
entities.jsonkv_pairs.jsontable_index.jsonnormalized.jsonstructured_record.jsonrequested_fields.jsonrequested_fields_record.jsontraceability.json
to-code
Use when the user wants implementation-oriented output from the parse result.
Supported targets:
reacthtml-cssjson-schemajupyter-notebook
Typical outputs under task_output/:
component_map.jsonfield_schema.jsonui_blueprint.jsonnotes.mdtraceability.json- target-specific artifacts such as
app.jsx,index.html,styles.css,schema.json,notebook.ipynb, ornotebook_plan.json
Treat all generated code and notebooks as drafts. Review them before running, publishing, or connecting them to real systems.
Published package scope
The published ClawHub bundle is intentionally CLI-first.
- main workflow:
scripts/run_skill.py - diagnostics:
scripts/check_env.py - smoke verification:
scripts/smoke_test.py
Developer-only local UI helpers are kept out of the public release bundle.
Pipeline rules
Always follow these rules:
- Prefer local execution.
- Always parse first into
parsed.json. - Generate downstream artifacts from
parsed.json, not raw OCR text alone. - Preserve page numbers, reading order, block types, and source anchors when possible.
- Write traceability for downstream outputs.
- Mark low-confidence regions or assumptions explicitly.
- Do not silently drop tables, figures, formulas, charts, or key-value regions.
- Save outputs into one artifact folder per run.
- For confidential documents, prefer an explicit private
--outdirectory and remove artifacts after review.
Output contract
Default output folder:
./artifacts/<document_stem>/
Expected top-level outputs:
effective_config.jsonrun_report.jsonparsed.jsonparsed.mdresult_report.htmltask_output/
to-code runs may also emit:
code_preview.html
CLI examples
Parse
python "{baseDir}/scripts/run_skill.py" \
--mode parse \
--file "/absolute/path/to/report.pdf" \
--out "/absolute/path/to/artifacts/report_parse"
To-data
python "{baseDir}/scripts/run_skill.py" \
--mode to-data \
--file "/absolute/path/to/invoice.pdf" \
--out "/absolute/path/to/artifacts/invoice_data" \
--extract "tables,entities,kv_pairs"
To-data with custom fields
python "{baseDir}/scripts/run_skill.py" \
--mode to-data \
--file "/absolute/path/to/invoice.pdf" \
--out "/absolute/path/to/artifacts/invoice_data" \
--extract "tables,entities,kv_pairs" \
--fields "invoice_number,invoice_date,total_amount,vendor_name"
To-code
python "{baseDir}/scripts/run_skill.py" \
--mode to-code \
--file "/absolute/path/to/ui_mockup.png" \
--out "/absolute/path/to/artifacts/ui_code" \
--target "react" \
--title "Generated App"
To-code notebook target
python "{baseDir}/scripts/run_skill.py" \
--mode to-code \
--file "/absolute/path/to/architecture_diagram.png" \
--out "/absolute/path/to/artifacts/notebook_code" \
--target "jupyter-notebook" \
--title "OpenVINO Notebook"
Slash-command examples
/skill local-document-ai-openvino parse file=./docs/report.pdf
/skill local-document-ai-openvino to-data file=./docs/invoice.pdf extract=tables,entities,kv_pairs
/skill local-document-ai-openvino to-data file=./docs/invoice.pdf extract=tables,entities,kv_pairs fields=invoice_number,invoice_date,total_amount,vendor_name
/skill local-document-ai-openvino to-code file=./mockups/architecture.png target=jupyter-notebook
Optional local demo UI
Start the local UI when the user wants an interactive demo page:
python "{baseDir}/scripts/serve_skill_ui.py"
The UI lets the user:
- preview a local file
- choose
parse,to-data, orto-code - choose the
to-codetarget - run the pipeline and inspect the generated local HTML reports
The bundled UI only allows preview/run access for local files under the skill directory and common user content folders such as Downloads, Documents, Desktop, and Pictures.
Failure behavior
If a run fails:
- state which stage failed
- do not claim outputs were created if they were not
- prefer writing
error.jsonwith failure details - recommend
parsefirst when the downstream request is ambiguous - surface stderr or a concise failure summary when available
Safety notes
- Use a virtual environment for dependency installation.
- Review and approve model downloads only when you explicitly intend to.
- Keep outputs in a private local folder when documents are sensitive.
- Review generated code and notebooks before execution.
- Delete artifacts when they are no longer needed.
- The wrapper always uses the bundled local scripts and the current Python interpreter. It does not allow custom interpreter or script-directory overrides.
Short reminder
Present this skill as a local document-understanding workflow with downstream actions and customizable field extraction, not as a plain OCR wrapper.