Skip to content

yihong0618/ask-greenplum

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 

Repository files navigation

Ask Greenplum Q&A

2023-04-07.18.40.57.mov

Greenplum Q&A is a project that demonstrates how to use word embeddings and Postgres to build a chatbot. The chatbot is implemented using pgvector and relies on OpenAI's GPT-3.5 API to generate responses.

Getting started

To get started with this project, you'll need to have:

Once you have the prerequisites installed, follow these steps to get the project up and running:

Clone the repository:

git clone https://github.com/yihong0618/ask-greenplum.git
cd ask-greenplum

Prepare the data

docker run --name some-greenplum1 -e POSTGRES_PASSWORD=postgres -p 5432:5432  -d ankane/pgvector
cd data
python -m venv env
source env/bin/activate
pip install -r requirements.txt

Import the schema to your database:

psql <database-url> -f database.sql

Let’s now add DATABASE_URL and OPENAI_API_KEY to our environment variables:

export DATABASE_URL=<YOUR_PG_CONEECTION_STRING> 
OPENAI_API_KEY=<YOUR_OPENAI_API_KEY>

Run main.py to import the emebbeding to your pg database:

python main.py

Relax and grab a cup of coffee as this section might take 60mins to process!

Expcted result:

Saving to CSV...
Loading tokenizer...
Embedding text...
Connecting to database...
Done!

Set the following environment variables:

OPENAI_API_KEY= Your OpenAI API key.
DATABASE_URL= The connection URL for your docker postgres database.

Ask

pip install git+https://github.com/yihong0618/GPTerminator.git

then

gpterm # go ask

Contributing

We welcome contributions to this project! If you find a bug, have a suggestion, or want to contribute code, please open an issue or pull request on the GitHub repository.

License

This project is licensed under the MIT License. See the LICENSE file for more information.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • Python 100.0%