Skip to content

Lightweight RAG system using OpenAI embeddings and ChromaDB for local document search and retrieval.

Notifications You must be signed in to change notification settings

KoolDrip/RAG-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔍 OpenAI-Powered RAG (Retrieval-Augmented Generation)

A production-ready RAG system built with:

  • 💡 OpenAI for embeddings and completions
  • 📦 ChromaDB as the local vector store
  • FastAPI for serving as an API
  • 🧱 Modular code structure with utilities, configs, and logging

📁 Project Structure

rag-gemini-app/
├── app/                  # Core logic: ingestion, retrieval, generation
│   ├── ingest.py
│   ├── retriever.py
│   ├── generator.py
│   ├── rag_pipeline.py
│   ├── utils.py
│   └── __init__.py
├── api/                  # FastAPI server
│   ├── main.py
│   ├── routes.py
│   └── schemas.py
├── data/                 # Your input text files
│   └── documents/
├── vector_store/         # Chroma persistence
├── .env                  # API keys and environment variables
├── .gitignore
├── requirements.txt
├── run.py                # CLI interface for RAG
└── README.md

🚀 Quick Start

1. 🔧 Setup Environment

git clone https://github.com/yourusername/rag-gemini-app.git
cd rag-gemini-app

python -m venv venv
source venv/bin/activate        # or venv\Scripts\activate on Windows

pip install -r requirements.txt

2. 📄 Configure .env

OPENAI_API_KEY=your-openai-key-here

3. 📥 Ingest Documents

Place your .txt files into data/documents/, then run:

python app/ingest.py

4. 🧠 Ask via CLI

python run.py

5. 🌐 Run the API Server

uvicorn api.main:app --reload

Then open: http://localhost:8000/docs


🧠 How It Works

  1. Ingestion:

    • Text files → Chunked → Embedded using OpenAI
    • Stored in ChromaDB with metadata
  2. Retrieval:

    • Query embedded → Similarity search via Chroma
  3. Generation:

    • Top-k chunks + Query → Prompt sent to OpenAI ChatCompletion

📦 Requirements

  • Python 3.9+
  • OpenAI API Key
  • Internet access for embedding & LLM

📌 TODOs

  • Improve chunking with NLP (spaCy, LangChain)
  • Add document upload via API
  • Add /ingest and /health endpoints
  • Optional: Swap ChromaDB for FAISS or Qdrant in production

🛡 License

MIT


🙋‍♂️ Maintainer

Made with ❤️ by Jenish Thapa

About

Lightweight RAG system using OpenAI embeddings and ChromaDB for local document search and retrieval.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages