Skip to content

Repository files navigation

RAG Architecture

RAG Book Assistant

A simple Retrieval-Augmented Generation (RAG) project that lets you upload a PDF, create a vector database, and ask questions using the document content.

Features

  • Upload a PDF through a Streamlit interface
  • Split the document into chunks and store embeddings in Chroma
  • Retrieve relevant context with MMR search
  • Ask questions and get AI-powered answers based on the uploaded document

Project Structure

  • app.py - Main Streamlit application for uploading PDFs and asking questions
  • main.py - Command-line RAG demo using the existing Chroma database
  • create_database.py - Script to generate the vector database from a PDF
  • documents/ - Sample document files and loaders
  • retrievers/ - Example retriever implementations
  • vector store/ - Additional Chroma-related experiments

Tech Stack

  • Python 3.12
  • Streamlit
  • LangChain
  • Chroma DB
  • Mistral AI and Google Gemini embeddings
  • PyPDF / LangChain PDF loader

Prerequisites

  1. Python 3.10+
  2. A virtual environment
  3. API keys for the AI providers used in your setup

Setup

  1. Create and activate a virtual environment bash python -m venv .venv .\.venv\Scripts\Activate.ps1
  2. Install dependencies bash pip install -r requirements.txt
  3. Create a .env file using .env.example and add your API keys.

Run the App

Start the Streamlit interface:

bash python -m streamlit run app.py

Generate a Vector Database

If you want to create or refresh the Chroma database from a PDF:

bash python create_database.py

Notes

  • The app uses the chroma_db/ directory to persist embeddings.
  • Make sure your environment variables are available before running the app.
  • The current setup is intended for local development and experimentation.

About

Learning RAG

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages