Skip to content

Latest commit

 

History

History
37 lines (19 loc) · 1.31 KB

readme.md

File metadata and controls

37 lines (19 loc) · 1.31 KB

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.