A Retrieval-Augmented Generation (RAG) application for semantic question answering over PDF documents using a local Large Language Model (LLM).
Note: The demonstration uses a fictional company document created exclusively for showcasing the RAG pipeline. NovaTech Solutions is a fictitious company, and all names, policies, contact information, products, and other details are entirely fictional and do not represent any real organization.
RAG Studio allows users to upload PDF documents, index their contents into a vector database and ask natural language questions about the uploaded documents.
Instead of relying on the model's internal knowledge, answers are generated using the information retrieved from the indexed documents, reducing hallucinations and improving factual accuracy.
- Upload one or multiple PDF documents.
- Automatic document ingestion and indexing.
- Document chunking for semantic retrieval.
- Embedding generation using Hugging Face embedding models.
- Vector storage with ChromaDB.
- Semantic search over indexed documents.
- Context-aware answer generation using a local LLM.
- Conversational interface with chat history.
- Display of retrieved document chunks used to generate each answer.
Document Indexing
┌─────────────────────────────────────────────────────┐
│ │
│ PDF Documents │
│ │ │
│ ▼ │
│ Document Loader │
│ │ │
│ ▼ │
│ Chunking │
│ │ │
│ ▼ │
│ Embedding Model │
│ │ │
│ ▼ │
│ Vector Database (ChromaDB) │
│ │
└─────────────────────────────────────────────────────┘
Question Answering
┌─────────────────────────────────────────────────────┐
│ │
│ User Question │
│ │ │
│ ▼ │
│ Embedding Model │
│ │ │
│ ▼ │
│ Semantic Retrieval (ChromaDB) │
│ │ │
│ ▼ │
│ Retrieved Context │
│ │ │
│ ▼ │
│ Local LLM (Llama 3.2) │
│ │ │
│ ▼ │
│ Final Answer │
│ │
└─────────────────────────────────────────────────────┘
- Python
- LangChain
- Ollama
- Llama 3.2
- ChromaDB
- Hugging Face Embeddings
- Gradio
rag_studio/
│
├── app.py
├── pyproject.toml
├── uv.lock
├── .python-version
├── README.md
│
├── data/
│ ├── uploaded_documents/
│ └── vector_store/
│
└── src/
├── answer.py
├── chunking.py
├── embeddings.py
├── file_manager.py
├── ingestion.py
├── loaders.py
├── prompts.py
├── retrieval.py
└── utils.py
Clone the repository:
git clone https://github.com/andref218/rag_studio.git
cd rag_studioInstall the dependencies:
uv syncInstall Ollama:
Download the language model:
ollama pull llama3.2Run the application:
uv run app.pyOptionally, create a .env file based on .env.example and set your Hugging Face access token to avoid download rate limits when retrieving embedding models.
HF_TOKEN=your_huggingface_token- Upload one or more PDF documents.
- Click Index Documents.
- Wait until indexing is complete.
- Ask questions about the uploaded documents.
- Inspect the retrieved document chunks used to generate the answer.
The project currently implements the complete Retrieval-Augmented Generation (RAG) pipeline, including document ingestion, semantic retrieval and context-aware answer generation.
Future work includes evaluating the retrieval component using standard Information Retrieval metrics to measure and improve the effectiveness of the semantic search process.
