diff --git a/AGENTS.md b/AGENTS.md index 72bce4d..9c965fd 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -150,7 +150,7 @@ Input File - An Odoo XML file (unless blocked by low confidence). - A sidecar JSON file with metadata, timings, and confidence. 3. If review confidence is below the configured threshold, mark the invoice for human review and do not generate final XML (or generate a draft with a warning flag). -4. Never send invoice data outside the local model endpoints. +4. Never send invoice data outside the local model endpoints. For production, "local" means a model endpoint reachable on the same host or within a trusted, on-premise runtime. A shared LAN endpoint (e.g. a dedicated Ollama server on the local network) is acceptable for integration testing and staging, but production deployments should keep invoice data on the same host as the model runtime unless explicitly approved. ## Review Stage Rules diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..7214b47 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,42 @@ +# Changelog + +All notable changes to `odoo-ocr` are documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +### Added + +- End-to-end CLI pipeline (`odoo-ocr process`) that orchestrates classifier → OCR branch → extraction → review → XML/sidecar. +- Document classifier with heuristic fallback to a small VLM (`Qwen2.5-VL-3B`). +- Four OCR/processing branches: `digital_pdf`, `scanned_print`, `handwritten`, and `mixed_unknown`. +- Unified `BaseVLMClient` interface supporting Ollama (primary) and future llama.cpp server integration. +- Per-model-call metrics logging (latency, tokens, prompt hash) and exponential-backoff retries for transient failures. +- File-based LLM response cache keyed by prompt, image hashes, model, temperature, response format, and max tokens. +- Structured extraction and review stages using Pydantic `ExtractedInvoice` and `ReviewResult` schemas. +- Vision review stage that compares the original invoice image(s) with the extracted JSON and can emit a corrected invoice. +- Odoo Enterprise vendor-bill XML generation with `res.partner`, `account.move`, `account.move.line`, and deterministic `account.tax` records. +- Confidence-based XML gating: + - `>= 0.90`: final XML. + - `0.75–0.89`: XML with a human-review advisory comment. + - `< 0.75`: sidecar JSON only; XML generation refused. +- Strict ISO 8601 date validation for `invoice_date` and `due_date`. +- Test coverage: 38 unit/integration tests across schemas, cache, classifier, branches, reviewer, XML builder, and CLI. + +### Changed + +- Bumped `tool.mypy.python_version` to `3.12` so third-party stubs parse cleanly, while `requires-python` stays at `>=3.11`. + +### Project Rules + +- Clarified the local-only / privacy constraint: production deployments must keep invoice data on the same host as the model runtime unless explicitly approved; shared LAN endpoints (e.g. a dedicated Ollama server on the local network) are acceptable for integration testing and staging. + +## [0.1.0] - 2026-08-21 + +### Added + +- Initial project scaffold: local invoice OCR pipeline with Ollama, classifier branches, structured extraction, review, and Odoo XML export. + +[Unreleased]: https://github.com/ixsol/odoo_ocr/compare/v0.1.0...HEAD diff --git a/pyproject.toml b/pyproject.toml index 1ac0acd..b4bf6b8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,13 @@ [project] name = "odoo-ocr" -version = "0.1.0" +version = "0.1.0-dev" description = "Local-first invoice OCR pipeline that produces Odoo Enterprise XML." requires-python = ">=3.11" +classifiers = [ + "Development Status :: 3 - Alpha", + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", +] dependencies = [ "pydantic>=2.0", "pydantic-settings>=2.0",