This is a simple CLI Q&A tool that uses LangChain to generate document embeddings using HuggingFace embeddings, store them in a vector store (PGVector hosted on Supabase), retrieve them based on input similarity, and augment the LLM prompt with the knowledge base context.
The knowledge base documents are stored in the /documents
directory.
- Create a new virtual environment and launch it.
- Install dependencies with
pip install -r requirements.txt
. - Create a vector database on Supabase by enabling the PGVector extension.
- Add your OpenAI API key and PGVector database information into an
.env
file (refer to.env.example
as reference). - If running for the first time, set the
INITIALIZE
variable toTrue
. - Run the program with
python qna.py
.
Simply replace the .txt
files in the /documents
directory with your own documents and run the program.
Follow the recommendations from this GitHub Issue thread.