Skip to content

Knowledge base Q&A program using LangChain for retrieval-augmented prompting and PGVector as vector store.

License

Notifications You must be signed in to change notification settings

mshumayl/langchain-pgvector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is this?

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.

How to run the program?

  1. Create a new virtual environment and launch it.
  2. Install dependencies with pip install -r requirements.txt.
  3. Create a vector database on Supabase by enabling the PGVector extension.
  4. Add your OpenAI API key and PGVector database information into an .env file (refer to .env.example as reference).
  5. If running for the first time, set the INITIALIZE variable to True.
  6. Run the program with python qna.py.

How to 'fine-tune' it on my own documents?

Simply replace the .txt files in the /documents directory with your own documents and run the program.

I am encountering an error about token dimension mismatch (1536 vs 768)

Follow the recommendations from this GitHub Issue thread.

About

Knowledge base Q&A program using LangChain for retrieval-augmented prompting and PGVector as vector store.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages