Skip to content

This application allows you to have a dialogue with your questions and answers by simply uploading a PDF file, etc.

Notifications You must be signed in to change notification settings

IT-five/langchain-chat-PDF

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Langchain Chat PDF

This is a Python application that allows you to upload a PDF and ask questions about it using natural language. The application uses an LLM (which you can define yourself) to generate answers about your PDF.

How it works

The application first needs to pick the temperature coefficient which determines the randomness of the answers generated by the LLM (the closer to 0 the more certain). Next, the PDF is read and the text is split into smaller blocks for Embedding and then passed into a vector database. Finally, find matching answers in the database for the questions you enter and send these as prompts to LLM to generate responses.

The application uses Streamlit to create the GUI and Langchain to handle the LLM.

Installation

To install the repository, please clone this repository and install the requirements:

pip install -r requirements.txt

You will also need to add your OpenAI API key in app.py os.environ["OPENAI_API_KEY"] = '这里换成你的OpenAI API key'

Usage

To use the application, After entering the project's directory file,execute the following command:

streamlit run app.py

Contributing

This repository is for educational use only, so that you can learn to use langchain to implement Q&A with your PDF, and is not intended for further contribution.

About

This application allows you to have a dialogue with your questions and answers by simply uploading a PDF file, etc.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages