Read the tutorial Query your database with AI using LangChain and Gradio that explains how this repo works
- Download Python and PIP in your local machine (see this article )
- Install virtual environment
pip install virtualenv
- Navigate to the folder where you want to create the VM and run the below NOTE: Run the command below from one level up where you installed the repo - e.g. if you downloaded the repo to C:\repo\langchain_sql_gradio, you need to run the command below from C:\repo
virtualenv langchain_sql_gradio
- Activate the environment by using
.\langchain_sql_gradio\Scripts\activate
- Inside the Virtual environment, install all required components
pip install -r requirements.txt
-
Install SQLLite from their website, this is needed to run the engine so that the Python script has access to the DB.
-
Create a the following environment variables (see this example )
- OPENAI_API_KEY -> used for connecting to OpenAI
- After doing all the previous steps, you might need to restart your machine, I have noticed that the environment variables are not picked up by Python until a restart or the PIP install doesn't quite work
- Install any new pip package inside the virtual environment command line
- Run the command below to update the requirements.txt file that contains the packages needed to run the repo
pip freeze > requirements.txt
The Northwind SQLlite used in this repo was taken from the repo https://github.com/jpwhite3/northwind-SQLite3/tree/main/dist