The architecture separates document preprocessing from online retrieval. This makes intermediate outputs inspectable and reusable without repeating ingestion for every question. The implemented input format is PDF: pages are represented as images for multimodal extraction by default, and sending each page as a PDF is also supported in the configuration. OpenAI also handles text cleaning and structuring. The code validates extracted pages, records issues and preserves metadata, including hashes, pages, sections and document classification.
Chunking analyses the Markdown hierarchy and recognises structures such as tables, frequently asked questions and clauses. It combines small blocks where appropriate and splits large ones, with a target of approximately 500 tokens, a maximum of 900 and an overlap of 80. Each chunk retains its original content and representations tailored to lexical and vector search, together with document references. This adapts indexing without losing the link to the source.
Retrieval combines BM25, which favours terminology matches, with text-embedding-3-large embeddings persisted in Chroma, which support semantic similarity search. A deterministic Spanish tokenizer normalises accents and preserves codes and business terms. Since the scores from the two methods are not directly comparable, Reciprocal Rank Fusion (RRF) combines their ranking positions. The jina-reranker-v3 reranker, accessed through an API, can refine the candidate list before selecting the final evidence; it can be disabled. Generation uses the OpenAI Responses API, with gpt-5-mini as the configurable default model. The context numbers chunks and their sources; if the configured minimum number of sources is not met, it skips the model call and returns an insufficient-evidence response.
Interaction is available through a CLI and a simple web interface served locally. Persistent intermediate contracts and component separation make models and parameters easier to replace or adjust. Although configurations and unit tests with simulated clients are available, this version does not provide a quantified comparison that would establish superiority over other retrieval approaches or models. These choices are presented as implementation decisions.