Skip to content

This Streamlit app enables users to query a MySQL database using natural language. It translates questions into SQL, executes them, and returns the results in plain language. Powered by LangChain and Groq, the app makes database querying simple for non-technical users.

Notifications You must be signed in to change notification settings

SURESHBEEKHANI/Chat-with-MySQL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

title emoji colorFrom colorTo sdk sdk_version app_file pinned
Chat with MySQL
💬
purple
blue
streamlit
1.38.0
src/app.py
false

Chat with MySQL

This is a Streamlit application that allows users to interact with a MySQL database via natural language queries. The app uses LangChain, Groq, and Streamlit to generate SQL queries and respond with database results in natural language.

Features

  • Connect to your MySQL database and chat with it using natural language.
  • Automatically generate SQL queries based on your questions.
  • Receive responses both in SQL and human-readable formats.

Libraries and Tools Used

  • dotenv: Loads environment variables from a .env file.
  • LangChain: Handles the prompt templates and chains for generating SQL queries and responses.
  • Groq: Utilized as the model for chat-based interactions and SQL generation.
  • Streamlit: Provides the interface for interacting with the database and handling the conversation.
  • SQLDatabase: LangChain's utility to manage SQL database connections and queries.

Setup Instructions

  1. Clone the repository:
    git clone https://github.com/your-repo/chat-with-mysql.git
    cd chat-with-mysql

Install the required Python libraries:

bash Copy code pip install -r requirements.txt Create a .env file in the root directory of the project and add your database credentials:

bash Copy code DB_USER=root DB_PASSWORD=admin DB_HOST=localhost DB_PORT=3306 DB_NAME=Chinook Run the application:

bash Copy code streamlit run app.py Open your browser and go to the Streamlit web app, typically at http://localhost:8501.

How It Works The app connects to a MySQL database using credentials from environment variables. It uses a LangChain model to process user queries, convert them into SQL statements, and return the results. You can view the SQL query generated from your questions and the corresponding response. Configuration Check out the configuration reference at Hugging Face Spaces Config Reference.

About

This Streamlit app enables users to query a MySQL database using natural language. It translates questions into SQL, executes them, and returns the results in plain language. Powered by LangChain and Groq, the app makes database querying simple for non-technical users.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages