Skip to content

ashutro/Query-gpt-ollama

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔍 QueryGPT — Chat with Your SQLite Database using LLMs

QueryGPT is a Streamlit-based AI assistant that allows you to interact with your SQLite database using natural language. It leverages LLMs like Ollama (Mistral) or OpenAI GPT-4 via LangChain to translate your questions into SQL queries and display meaningful answers.


📦 Features

  • 🔗 Connects to a local SQLite database (products.db)
  • 🤖 Uses either:
    • Ollama (default) — lightweight LLM via local inference
    • OpenAI GPT-4 — via API key
  • 🧠 Translates natural language into SQL using LangChain's SQL agent
  • 📊 Automatically renders query results in table format (if applicable)
  • 🧾 Handles plain-text responses and extracts structured data when possible

🚀 How It Works

  1. You ask a question (e.g., "Show me the top 5 most expensive products").
  2. The app uses a selected LLM to generate a SQL query.
  3. If it's a SELECT query:
    • Executes it on products.db
    • Displays results in a table
  4. If not, it tries to parse and display the response cleanly.

🧰 Tech Stack

  • Python
  • Streamlit
  • LangChain
  • Ollama / OpenAI
  • SQLite
  • Pandas

⚙️ Setup Instructions

  1. Clone the Repository
git clone https://github.com/your-username/query-gpt.git
cd query-gpt

About

QueryGPT is a Streamlit-based AI assistant that allows you to interact with your SQLite database using natural language. It leverages LLMs like **Ollama (Mistral)** or **OpenAI GPT-4** via LangChain to translate your questions into SQL queries and display meaningful answers.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages