KBchat: Uma abordagem para consulta inteligente de bases de conhecimento

Authors

DOI:

https://doi.org/10.5753/reic.2026.6742

Keywords:

RAG, LLM, Embeddings, Chatbot, Base de conhecimento

Abstract

Com o avanço das tecnologias de linguagem natural, este trabalho propõe o desenvolvimento de um sistema de chat com base na abordagem de Geração Aumentada por Recuperação (RAG), voltado à consulta em bases de conhecimento criadas a partir de documentos em PDF. O sistema opera com dois fluxos principais. O primeiro fluxo é responsável pela inserção de documentos na base de conhecimento: os arquivos PDF são processados com a biblioteca Markitdown, convertidos para markdown, segmentados em trechos e transformados em embeddings utilizando o modelo all-mpnet-base-v2. Esses vetores são então armazenados em um banco vetorial PostgreSQL com a extensão pgvector. O segundo fluxo representa o chat em que o usuário interage com a base: ao receber uma pergunta, o sistema gera seu embedding, passa essa pergunta por um pré-processamento, realiza uma busca vetorial pelos trechos mais relevantes e constrói um prompt contextualizado, enviado ao modelo Gemini-2.0-Flash-001, que gera a resposta. A aplicação foi desenvolvida com Python e Flask para o backend e React no frontend, integrando técnicas contemporâneas de NLP e IA generativa. Os resultados demonstram a viabilidade do sistema para consultas eficientes e contextualizadas em grandes volumes de texto, com potencial aplicação em contextos corporativos, educacionais, jurídicos, entre outros.

Downloads

Não há dados estatísticos.

Referências

Aquino, I. V. d., dos Santos, M. M., Dorneles, C. F., and Carvalho, J. T. (2024). Extracting information from brazilian legal documents with retrieval augmented generation. In Proceedings of the 39th Workshop on Data Science Against Corruption in the Public Sector (DS-COPS) - Simpósio Brasileiro de Banco de Dados (SBBD), pages 280–287, Florianópolis, SC, Brazil. Sociedade Brasileira de Computação. DOI: 10.5753/sbbd_estendido.2024.244241.

Brown, T., Mann, B., Ryder, N., Subbiah, M., Kaplan, J. D., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., et al. (2020). Language models are few-shot learners. In Advances in neural information processing systems, volume 33, pages 1877–1901. Disponível em: [link]. Acesso em: 22 jul. 2026.

Chan, C., Xu, C., Yuan, R., Luo, H., Xue, W., Guo, Y., and Fu, J. (2024). RQ-RAG: Learning to refine queries for retrieval-augmented generation. In Conference on Language Modeling (COLM 2024). Disponível em: [link]. Acesso em: 22 jul. 2026.

Datalab-to (2025). Marker: Convert pdf to markdown json quickly with high accuracy. Disponível em: [link]. Acesso em: 22 jul. 2026.

Es, S., James, J., Anke, L. E., and Schockaert, S. (2024). Ragas: Automated evaluation of retrieval augmented generation. In Proceedings of the 18th Conference of the European Chapter of the Association for Computational Linguistics: System Demonstrations (EACL), pages 150–158. DOI: 10.18653/v1/2024.eacl-demo.16.

Evans, M. (2025). Vite: A next generation frontend tooling. Disponível em: [link]. Acesso em: 22 jul. 2026.

Flask Project (2025). Flask. Disponível em: [link]. Acesso em: 22 jul. 2026.

Google (2025). Gemini 2.0 flash. Disponível em: [link]. Acesso em: 22 jul. 2026.

Karpukhin, V., Oguz, B., Min, S., Lewis, P., Wu, L., Edunov, S., Chen, D., and Yih, W.-t. (2020). Dense passage retrieval for open-domain question answering. In Webber, B., Cohn, T., He, Y., and Liu, Y., editors, Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 6769–6781, Online. Association for Computational Linguistics. DOI: 10.18653/v1/2020.emnlp-main.550.

Khattab, O. and Zaharia, M. (2020). Colbert: Efficient and effective passage search via contextualized late interaction over bert. In Proceedings of the 43rd International ACM SIGIR Conference on Research and Development in Information Retrieval, SIGIR ’20, page 39–48, New York, NY, USA. Association for Computing Machinery. DOI: 10.1145/3397271.3401075.

Kuratomi, G., Pirozelli, P., Cozman, F. G., and Peres, S. M. (2024). A rag-based institutional assistant. In Proceedings of the 21st Encontro Nacional de Inteligência Artificial e Computacional (ENIAC), pages 755–766, Belém, PA, Brazil. Sociedade Brasileira de Computação. DOI: 10.5753/eniac.2024.245243.

Lewis, P., Perez, E., Piktus, A., Petroni, F., Karpukhin, V., Goyal, N., Küttler, H., Lewis, M., Yih, W.-t., Rocktäschel, T., Riedel, S., and Kiela, D. (2020). Retrieval-augmented generation for knowledge-intensive nlp tasks. In Proceedings of the 34th International Conference on Neural Information Processing Systems, NIPS ’20, Red Hook, NY, USA. Curran Associates Inc. Disponível em: [link]. Acesso em: 22 jul. 2026.

Martins, A. (2025). Tailwindcss: Estilos utilitários para um design eficiente. Disponível em: [link]. Acesso em: 22 jul. 2026.

Microsoft (2025). Markitdown. Disponível em: [link]. Acesso em: 22 jul. 2026.

pgvector (2025). pgvector. Disponível em: [link]. Acesso em: 22 jul. 2026.

React (2025). Aprenda react. Disponível em: [link]. Acesso em: 22 jul. 2026.

Robertson, S. E. and Zaragoza, H. (2009). The Probabilistic Relevance Framework: BM25 and Beyond, volume 3, pages 333–389. Now Publishers. DOI: 10.1561/1500000019.

Song, K., Tan, X., Qin, T., Lu, J., and Liu, T.-Y. (2020). Mpnet: Masked and permuted pre-training for language understanding. Advances in neural information processing systems, 33:16857–16867. Disponível em: [link]. Acesso em: 22 jul. 2026.

Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., and Polosukhin, I. (2017). Attention is all you need. In Proceedings of the 31st International Conference on Neural Information Processing Systems, NIPS’17, page 6000–6010, Red Hook, NY, USA. Curran Associates Inc. Disponível em: [link]. Acesso em: 22 jul. 2026.

Downloads

Published

2026-08-07

Como Citar

Tavares, D. S., & Feitosa, R. G. F. (2026). KBchat: Uma abordagem para consulta inteligente de bases de conhecimento. Revista Eletrônica De Iniciação Científica Em Computação, 24(1), 565–573. https://doi.org/10.5753/reic.2026.6742

Issue

Section

Artigos