Text-to-Insight: Um Sistema Multi-Agente para Consulta a Bancos de Dados Relacionais via Linguagem Natural
Resumo
O TextToInsight é uma biblioteca Python de código aberto que converte perguntas em linguagem natural em consultas SQL seguras para bancos de dados relacionais. Utilizando uma arquitetura de grafos de agentes via LangGraph, o sistema orquestra módulos especializados: Planejador, Agente de Código, Executor e Crítico. O fluxo conta com um ciclo de autocorreção iterativa, onde o Crítico fornece feedback estruturado ao Planejador em caso de erros. Além da execução automatizada, a biblioteca oferece visualizações de dados e suporte a Human-in-the-Loop para a resolução de ambiguidades complexas.
Referências
Lei, F. et al. (2024). Spider 2.0: Evaluating Language Models on Real-World Enterprise Text-to-SQL Workflows. arXiv preprint arXiv:2411.07763.
Gao, D. et al. (2024). DAIL-SQL: Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation. Proceedings of the VLDB Endowment, 17(5), 1132–1145.
Dong, X. et al. (2023). C3: Zero-shot Text-to-SQL with ChatGPT. arXiv preprint arXiv:2307.07306.
Pourreza, M. e Rafiei, D. (2024). DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction. Advances in Neural Information Processing Systems, 36.
Wang, B. et al. (2025). MAC-SQL: A Multi-Agent Collaborative Framework for Text-to-SQL. Proceedings of the 31st International Conference on Computational Linguistics (COLING 2025), 540–557.
Olist (2018). Brazilian E-Commerce Public Dataset by Olist. Disponível em: [link].
LangGraph Documentation (2024). LangGraph: Build Stateful Multi-Actor Applications. Disponível em: [link].
Talaei, S., Pourreza, M., Chang, Y.-C., Mirhoseini, A., and Saberi, A. (2024). CHESS: Contextual Harnessing for Efficient SQL Synthesis. arXiv preprint arXiv:2405.16755.
Li, H., Zhang, J., Liu, H., Fan, J., Zhang, X., Zhu, J., Wei, R., Pan, H., Li, C. e Chen, H. (2024). CodeS: Towards Building Open-Source Language Models for Text-to-SQL. Proceedings of the ACM on Management of Data, 2(3), 1–28.
