monkeyboiii / privateGPT-sqlcoder

0 stars 0 forks source link

privateGPT-sqlcoder

The source code is hosted on github. This is a work developed at ZOFUND under the supervision of Mr. Shoubo Sheng. It's a fork from privateGPT, which has sqlcoder integrated with the help of langchain, to enable text-to-sql generation.

Usage

Install dependencies:

# conda environment recommended
pip install -r requirements.txt

Define necessary environment variables:

# Copy `example.env` file to `.env`
cp example.env .env

Use example data

# enter misc directory
cd misc

# format questions
python format_question.py

# populate sqlite database
python insert.py

# return to project level
cd ..

Build embedding vector store:

python ingest.py [--help]

Run the app:

# Streamlit interface (recommended)
streamlit run app.py

# Text-to-sql model cli
python privateGPT.py [--help]

Stats

# .ipynb LoC
jq '.cells[] | select(.cell_type == "code") .source[]' **/*.ipynb | wc -l

# .py Loc
git ls-files | grep -i "\.py$" | xargs wc -l