RAG SQL Agent is a Retrieval-Augmented Generation (RAG) application designed to interact with SQL databases using natural language queries. It leverages advanced language models to generate SQL queries, retrieve relevant data, and provide human-readable answers.
- Natural Language to SQL: Converts user questions into SQL queries.
- Database Interaction: Supports querying SQLite databases.
- Vector Database Integration: Uses ChromaDB for vectorized document storage and retrieval.
- Streamlit UI: Provides an intuitive interface for user interaction.
- Local and Remote LLM Support: Supports both local and remote Ollama servers for language model inference.
- Code/: Contains the core application logic, including database interaction, LLM integration, and utility functions.
- DB/: Stores the SQLite database (
sakila.db). - Test_Files/: Includes unit and integration tests for the application.
- Vector_DB/: Stores vectorized representations of database tables for retrieval.
-
Clone the repository:
git clone https://github.com/beckerfelipee/Rag-SQL-Gen-Agent.git cd Rag-SQL-Gen-Agent -
Install dependencies:
pip install -r requirements.txt
-
Set up the environment variables:
- Create a .env file in the root directory.
- Add the required variables (OLLAMA_SERVER, OLLAMA_LOCAL_SERVER).
- Ensure the SQLite database is in the DB/ directory.
Run the Streamlit UI:
streamlit run Code/UI.pyAsk questions about the database and get answers in natural language.
This project is licensed under the MIT License.