It works with any openAI compatible LLM.
- Openrouter: For online Third Party Provider
- 100% local Private GPT using - Ollama/LMStudio
rag-pdf-pipeline/
āāā README.md
āāā STEPS.md
āāā pyproject.toml
āāā requirements.txt
āāā .env.example
āāā .gitignore
āāā src/
ā āāā __init__.py
ā āāā config.py
ā āāā models/
ā ā āāā __init__.py
ā ā āāā llm_handler.py
ā ā āāā embedding_handler.py
ā āāā storage/
ā ā āāā __init__.py
ā ā āāā vector_store.py
ā ā āāā document_store.py
ā āāā processing/
ā ā āāā __init__.py
ā ā āāā pdf_processor.py
ā ā āāā text_chunker.py
ā āāā rag/
ā ā āāā __init__.py
ā ā āāā retriever.py
ā ā āāā generator.py
ā āāā utils/
ā āāā __init__.py
ā āāā logger.py
āāā ui/
ā āāā __init__.py
ā āāā streamlit_app.py
ā āāā components/
ā ā āāā __init__.py
ā ā āāā file_upload.py
ā ā āāā chat_interface.py
ā ā āāā settings.py
ā āāā styles/
ā āāā main.css
āāā data/
ā āāā uploads/
ā āāā vector_db/
ā āāā chat_history/
āāā tests/
ā āāā __init__.py
ā āāā test_pdf_processor.py
ā āāā test_vector_store.py
ā āāā test_rag_pipeline.py
āāā scripts/
āāā setup.bat
āāā run.bat
-
Install dependencies:
This project uses
uvfor dependency management. If you don't haveuvinstalled, you can install it via pip:pip install uv
Then, install the project dependencies:
uv sync
This RAG pipeline project provides the following key features:
- PDF Document Processing: Utilizes
pdf_processor.pyto extract text from PDF documents. - Text Chunking: Efficiently breaks down large texts into manageable chunks for processing.
- Embedding Generation: Generates vector embeddings for text chunks using a dedicated
embedding_handler.py. - Vector Storage and Retrieval: Stores and retrieves document embeddings using a
vector_store.pyfor efficient similarity search. - LLM Integration: Integrates with Large Language Models via
llm_handler.pyfor generating responses based on retrieved information. - Streamlit User Interface: Provides an interactive web interface for uploading PDFs, chatting with the RAG model, and configuring settings.
The project is organized into several modules, each responsible for a specific part of the RAG pipeline:
src/: Contains the core logic of the RAG pipeline.src/models/: Handles interactions with LLMs and embedding models.src/processing/: Manages document processing, such as PDF parsing and text chunking.src/rag/: Implements the retriever and generator components of the RAG system.src/storage/: Deals with document storage and vector database operations.src/utils/: Provides utility functions like logging.
ui/: Contains the Streamlit web application and its components.static/: Stores static assets like images and example documents.scripts/: Holds various utility scripts for setup and running the application.logs/: Directory for application logs.
To use the RAG pipeline, follow these steps:
-
Start the Streamlit Application:
uv run streamlit run ui/app.py
-
Interact with the UI:
- Upload PDF: Use the file uploader to select a PDF document. The application will process the document, extract text, chunk it, and generate embeddings.
- Chat: Once the document is processed, you can type your questions into the chat input field. The RAG model will retrieve relevant information from the document and generate a response.
- Settings: Adjust various parameters like the chunk size, overlap, and model settings through the sidebar.



