Skip to content

Rabbid76/langchain-pdf-openai-chat-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LangChain PDF OpenAI Chat Boilerplate

The application consists of two scripts. The first generates a Chroma database from a given set of PDFs. The database is created in the subfolder "chroma_db". The second implements a Streamlit web chat bot, based on the database, which can be used to ask questions related to the content of the PDFs.

An OpenAI key is required for this application (see Create an OpenAI API key). The OpenAI key must either be set in the environment variable OPENAI_API_KEY or must be passed as an argument to the scripts.

Required python packages

chromadb, langchain, langchain-community, openai, pypdf, streamlit, tiktoken

Create the database

To create the database, the "create_db.py" script must be executed and a file path to the PDFs must be passed as the first argument. The second argument is optional and can be the OpenAI key.

python3 create_db.py <path_to_pdfs> [<openai_key>]

Run the chat bot

The OpenAI key must be set in the environment variable OPENAI_API_KEY or set in the "app.py" script. To run the chat bot, the "app.py" script must be executed.

streamlit run app.py

Resources

Releases

No releases published

Packages

No packages published

Languages