All work

italianRAG

Document AI for Italian corporate filings. It turns financial statements, statutes and Chamber of Commerce reports into typed facts and answers that cite their source page.

My role
Design and implementation
Where
Internship at InfoCamere, Padova
When
March to May 2026
Stack
Python, FastAPI, Pydantic, SQLite, Qdrant
Two routes share one parser. Fields that can be verified are extracted deterministically, and retrieval handles everything else.

The problem

Corporate PDFs don't share a layout. Some are digital and some are scans, and many pack their key values into dense tables. The same value can be missing in one document, ambiguous in another and contradicted by a third.

A fluent answer isn't enough when someone has to check it against the original. The goal was a prototype that could be inspected: structured facts, the page that supports each one, and a way to measure changes without relying on demos.

Two routes

Deterministic routes handle fields with a known shape: registered office and company identity, share capital, governance, financial values and multi-year series, and the fields of a registry report. Each returns a typed value, a field state (present, missing, uncertain or not applicable), the evidence and a processing trace.

Retrieval handles the questions that don't map to an extractor. It filters by document and company metadata in Qdrant and returns context linked to its source, so generated text is never presented as a verified fact.

Across documents

Facts are stored per company, so the system can compare several documents: financial values over multiple years, a statute against the registry report, or a timeline across registry reports. Disagreements and gaps are reported as they are, and never merged into a single answer.

Evaluation

answers correct
116/116
supported by a citation
116/116
verified against the gold standard
116/116

The benchmark has 116 cases that cover the deterministic routes. It runs with a deterministic provider, so routing, extraction and citation are tested without the variability of a remote model.

The result applies to this dataset and these routes. It is a regression baseline: it doesn't measure open-ended questions, scanned documents or companies outside the set.

Decisions

  • Deterministic extraction stays next to RAG. Structured fields need repeatable parsing and explicit semantics for missing values. Retrieval is for exploration.
  • The simple parser stayed the default. I compared alternatives, including an OCR and vision-model path for scans. pypdf was fast and good enough for searchable PDFs, so the heavier paths are opt-in.
  • Evidence travels with every answer. Page references, excerpts, the route and the trace are part of the response, which helps with debugging, review and benchmark adjudication.

What I worked on

  • The FastAPI service and the local workspace.
  • Typed extraction and document-specific routing.
  • The SQLite fact model and the field states.
  • Qdrant retrieval, metadata filters and reranking experiments.
  • Cross-document financial and registry analysis.
  • Benchmark datasets, adjudication tools, regression tests and dashboards.
  • The parser comparison and the opt-in OCR and vision-model recovery.
  • Technical documentation and diagrams.

The code is private because I wrote it during the internship. This page describes the design without any internship material.