Skip to content

About

FastAPI RAG microservice for document ingestion and contextual content generation using ChromaDB and LLMs.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Document RAG Service

A production-ready Retrieval-Augmented Generation (RAG) microservice built with FastAPI, Next.js, and ChromaDB.

Upload PDF/TXT documents and chat with them using a local LLM (Ollama).

License Python TypeScript Docker

Features

  • Multi-Format Support: Ingest PDF and TXT files with automatic text extraction and chunking.
  • Semantic Search: Powered by SentenceTransformers and ChromaDB for accurate context retrieval.
  • Local LLM Integration: Uses Ollama for privacy-focused, offline inference.
  • Modern UI: Built with Next.js, Tailwind CSS, and Framer Motion for a smooth chat experience.
  • Dockerized: One-command setup with docker-compose.
  • Robust Testing: Comprehensive Unit, Integration, and E2E tests with 90%+ coverage.

Tech Stack

Backend

  • Framework: FastAPI
  • Vector DB: ChromaDB
  • Embeddings: all-MiniLM-L6-v2
  • PDF Processing: pdfminer.six
  • Testing: Pytest, Pytest-Asyncio

Frontend

  • Framework: Next.js (React)
  • Styling: Tailwind CSS
  • State: React Hooks
  • PDF Viewer: react-pdf

Getting Started

Prerequisites

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/document-rag-service.git
    cd document-rag-service
  2. Start the services

    docker-compose up --build
  3. Access the application

    • Frontend: http://localhost:3000
    • Backend API: http://localhost:8000/docs

Running Tests

The project includes a robust test suite running inside Docker.

# Run all tests
docker-compose exec backend pytest app/tests

# Run specific test category
docker-compose exec backend pytest app/tests/unit
docker-compose exec backend pytest app/tests/integration
docker-compose exec backend pytest app/tests/e2e

Project Structure

├── backend/             # FastAPI application
│   ├── app/
│   │   ├── api/         # API Routes
│   │   ├── core/        # Config & Settings
│   │   ├── services/    # Business Logic (Ingestion, Retrieval, LLM)
│   │   └── tests/       # Pytest Suite
│   └── Dockerfile
├── frontend/            # Next.js application
│   ├── src/
│   │   ├── components/  # React Components
│   │   └── app/         # Pages & Layouts
│   └── Dockerfile
├── docs/                # Documentation
└── docker-compose.yml   # Orchestration

License

Distributed under the MIT License.

About

FastAPI RAG microservice for document ingestion and contextual content generation using ChromaDB and LLMs.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages