Skip to content
Oussama EL HADJI edited this page Aug 21, 2026 · 2 revisions

RAG Project Wiki

RAG Project is a FastAPI service for building a searchable, project-scoped knowledge base from uploaded text and PDF documents. The service stores uploaded-file metadata and processed chunks in MongoDB, converts chunks into embeddings, persists vectors in the configured vector database, and uses retrieved context to generate answers through the selected language-model provider.

Core workflow: upload → process → index → search → answer.

What this project provides

Capability Description
Project-scoped ingestion Files and processed chunks are grouped under a project_id.
Text and PDF processing The current upload validation allows text/plain and application/pdf; document loading is performed lazily so optional ML dependencies are not required for lightweight tests.
Chunking and persistence Extracted document content is split into validated chunks and stored in MongoDB.
Vector indexing Processed chunks are embedded and written to a Qdrant-backed vector collection.
Semantic search A text query is embedded and matched against the project’s vector collection.
RAG answer generation Retrieved context is rendered through the localized prompt template and sent to the configured generation provider.
Health probing GET /api/v1/health provides a lightweight process liveness response.

Quick navigation

Page Use it when you need to…
Getting Started Install dependencies, start MongoDB, configure the environment, and run the API.
Configuration Reference Look up every supported environment variable and provider setting.
Architecture and Data Flow Understand startup wiring, ingestion, indexing, retrieval, and answer generation.
API Reference Use the HTTP endpoints, request bodies, validation rules, and response signals.
Data Model and Storage Understand MongoDB collections, file paths, chunk pagination, and vector collections.
Security and Troubleshooting Review path-safety controls, secret handling, operational failures, and diagnostics.
Testing and Contributing Run the test suite, make focused changes, and prepare a pull request.
Provider Extensions Understand the provider factories and how to add a backend safely.

Supported runtime shape

The repository currently targets Python 3.12.2 or later. A local deployment requires a reachable MongoDB instance and a configured generation backend, embedding backend, and vector database. The default vector database implementation is Qdrant. Provider-specific dependencies and credentials depend on the selected backend.

The service is intentionally small and modular. HTTP routing lives under src/routes, persistence wrappers under src/models, filesystem and RAG orchestration under src/controllers, configuration under src/helpers, and provider integrations under src/stores.

Source of truth

This wiki describes the implementation in the repository. When behavior changes, update the relevant wiki page together with the code, tests, and main README.

Topic Repository source
Installation and API examples README.md
Runtime settings src/helpers/config.py and src/.env.exemple
Application startup src/main.py
HTTP routes src/routes
Persistence models src/models
Security and contributions SECURITY.md and CONTRIBUTING.md

Clone this wiki locally