Skip to content

jstoppa/langchain_sql_gradio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Query your database with AI using LangChain and Gradio

Read the tutorial Query your database with AI using LangChain and Gradio that explains how this repo works

Setup

  1. Download Python and PIP in your local machine (see this article )
  2. Install virtual environment
pip install virtualenv
  1. 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
  1. Activate the environment by using
.\langchain_sql_gradio\Scripts\activate
  1. Inside the Virtual environment, install all required components
pip install -r requirements.txt
  1. Install SQLLite from their website, this is needed to run the engine so that the Python script has access to the DB.

  2. Create a the following environment variables (see this example )

  • OPENAI_API_KEY -> used for connecting to OpenAI
  1. 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

Notes for using the repo

  • 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

References

The Northwind SQLlite used in this repo was taken from the repo https://github.com/jpwhite3/northwind-SQLite3/tree/main/dist

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages