Skip to content

fauzanishtiaq1/PDF-Chat-with-LangChainRAG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PDF-Chat-with-LangChainRAG

https://python.langchain.com/docs/expression_language/cookbook/retrieval

Program Description:

The program is designed to process text from a PDF file, generate embeddings for the text chunks using OpenAI's embedding service, and then produce responses to prompts based on the embeddings. It consists of two main parts: the core functionality implemented in the rag.py module and a test script (rag_test.py) that demonstrates the usage of the core functionality.

Core Functionality (rag.py):

PDF Processing: The program extracts text from a PDF file, splits it into smaller chunks, and prepares the text for further processing.
Embedding Generation: It utilizes OpenAI's embedding service to generate embeddings for the text chunks, allowing for semantic analysis and similarity comparison.
Response Generation: Based on the generated embeddings, the program generates responses to prompts provided by the user, leveraging the semantic context embedded in the text chunks.

Test Script (rag_test.py):

File Input: The user is prompted to provide the filepath of the PDF file they want to process.
PDF Processing: The program invokes functions from rag.py to process the PDF file and generate embeddings for the text chunks.
Response Generation: It prompts the user for input and generates responses based on the provided prompts and the embeddings generated earlier.
Output Display: The generated responses are displayed to the user in the terminal or command prompt.

Usage:

The program can be used for various purposes such as generating responses to questions, summarizing content, or providing insights based on the text within PDF files.
It offers a versatile approach to extracting meaning from text data, enabling applications in natural language processing and understanding.

Dependencies:

Requires you to install dependencies in the 'requirements.txt' file ("pip install -r requirements.txt")
It also requires an OpenAI API key for accessing the embedding service.

Note:

Users need to ensure they have the necessary dependencies installed and an OpenAI API key configured to run the program successfully.
The program's flexibility and modular design allow for easy integration into various projects and workflows involving text analysis and response generation.

Contact: Please feel free to reach out if you have any questions.

Email: ishtiaq.fauzan@gmail.com

LinkedIn: https://www.linkedin.com/in/fauzan-ishtiaq-3b2356250/

Releases

No releases published

Packages

No packages published

Languages