Design and functional verification of a hybrid RAG prototype for technical document consultation

  • Moises Alexander Felix Romero Universidad Católica Sedes Sapientiae image/svg+xml
Keywords: document traceability, information retrieval, retrieval augmented generation, software verification, technical assistance

Abstract

Technical document consultation through language models requires distinguishing source retrieval, answer generation, and content verification. This paper presented the design and functional verification of a web-based retrieval-augmented generation prototype for Spanish-language document queries. The study followed a technological development approach combining source-code inspection, review of evidence from an academic demonstration, and execution of isolated software tests. The implementation integrated FastAPI, PostgreSQL with pgvector, and Gemini services. It combined dense retrieval and lexical search through reciprocal rank fusion, preserved document locators, and supported optional reranking. The existing test suite completed with 18 passing tests and no failures. Eight additional characterization scenarios examined abstention, fallback to lexical retrieval, and the handling of generated responses and execution logs. The analysis identified a distinction between returning retrieved sources and verifying generated claims, together with limitations in the propagation of textual abstention and confirmation of log persistence. Previously recorded demonstration evidence illustrates document ingestion, a query response, and a controlled provider failure using fictional material. These findings concern software verification and do not estimate semantic accuracy, production latency, or reductions in service resolution time. The contribution is a traceable description of the implemented artifact and its limitations, supported by an explicit protocol for subsequent document-level and operational evaluation. The study provides a bounded basis for further development without treating automated test success as evidence of real-world effectiveness.

Downloads

Download data is not yet available.

References

P. Lewis et al., “Retrieval-augmented generation for knowledge-intensive NLP tasks,” Advances in Neural Information Processing Systems, vol. 33, pp. 9459–9474, 2020. https://arxiv.org/abs/2005.11401

Y. Gao et al., “Retrieval-augmented generation for large language models: A survey,” arXiv:2312.10997, 2023, versión 5, 2024. https://arxiv.org/abs/2312.10997

V. F. Manchay García, “Desarrollo de un prototipo de chatbot inteligente basado en arquitectura de generación aumentada por recuperación (RAG), para la automatización de consultas frecuentes en la mesa de ayuda de una empresa de servicios,” tesis de grado, Universidad de Piura, 2026. https://pirhua.udep.edu.pe/backend/api/core/bitstreams/1dc4bbf2-dc5d-48c1-ae19-fbe01fa07027/content

F. Guerra, K. Monti y J. M. Fernández, “Sistema de generación aumentada por recuperación (RAG) para el acceso a información académica,” en Libro de actas del XXXI Congreso Argentino de Ciencias de la Computación, 2025, pp. 1165–1169. https://sedici.unlp.edu.ar/handle/10915/191535

G. V. Cormack, C. L. A. Clarke y S. Büttcher, “Reciprocal rank fusion outperforms condorcet and individual rank learning methods,” en SIGIR ’09, 2009, pp. 758–759. https://doi.org/10.1145/1571941.1572114 DOI: https://doi.org/10.1145/1571941.1572114

R. Nogueira y K. Cho, “Passage re-ranking with BERT,” arXiv:1901.04085, 2019. https://arxiv.org/abs/1901.04085

S. Es, J. James, L. Espinosa-Anke y S. Schockaert, “RAGAs: Automated evaluation of retrieval augmented generation,” en Proceedings of EACL 2024: System Demonstrations, 2024, pp. 150–158. https://doi.org/10.18653/v1/2024.eacl-demo.16 DOI: https://doi.org/10.18653/v1/2024.eacl-demo.16

A. R. Hevner, S. T. March, J. Park y S. Ram, “Design science in information systems research,” MIS Quarterly, vol. 28, no. 1, pp. 75–105, 2004. https://doi.org/10.2307/25148625 DOI: https://doi.org/10.2307/25148625

pypdf, “Extract text from a PDF,” documentación técnica. Consulta: 23 oct. 2026. https://pypdf.readthedocs.io/en/stable/user/extract-text.html

Google, “Embeddings,” Gemini API, documentación técnica. Consulta: 23 oct. 2026. https://ai.google.dev/gemini-api/docs/embeddings

pgvector, “Open-source vector similarity search for Postgres,” repositorio y documentación técnica. Consulta: 23 oct. 2026. https://github.com/pgvector/pgvector

Y. A. Malkov y D. A. Yashunin, “Efficient and robust approximate nearest neighbor search using hierarchical navigable small world graphs,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 42, no. 4, pp. 824–836, 2020. https://doi.org/10.1109/TPAMI.2018.2889473 DOI: https://doi.org/10.1109/TPAMI.2018.2889473

PostgreSQL Global Development Group, “Controlling text search,” PostgreSQL 16 Documentation, secc. 12.3. Consulta: 23 oct. 2026. https://www.postgresql.org/docs/16/textsearch-controls.html

Google, “Google Gen AI SDK,” documentación técnica. Consulta: 23 oct. 2026. https://googleapis.github.io/python-genai/

FastAPI, “Testing,” documentación técnica. Consulta: 23 oct. 2026. https://fastapi.tiangolo.com/tutorial/testing/

pytest, “How to monkeypatch/mock modules and environments,” documentación de pytest 8.3. Consulta: 23 oct. 2026. https://docs.pytest.org/en/8.3.x/how-to/monkeypatch.html

Ragas, “Context Recall,” documentación técnica. Consulta: 23 oct. 2026. https://docs.ragas.io/en/stable/concepts/metrics/available_metrics/context_recall/

Contribution of this article to the SDG.

Received: 2026-08-26
Accepted: 2026-09-18
Published: 2026-09-30
Contributor Roles
Moises Alexander Felix Romero:
How to Cite
[1]
M. A. Felix Romero, “Design and functional verification of a hybrid RAG prototype for technical document consultation”, Innov. softw., vol. 7, no. 2, pp. 75-87, Sep. 2026.
Section
Journal papers