Build scalable, secure, and intelligent RAG (Retrieval-Augmented Generation) systems without reinventing the wheel.
π Official Website & Documentation
π https://theultimaterag.vercel.app/
Key Features β’ Architecture β’ Getting Started β’ Visualizer β’ API β’ Contributing
TUG (TheUltimateRAG) is a real-world, production-grade RAG framework, not just another tutorial or demo project.
It is designed to solve common problems developers face when moving from simple prototypes to scalable AI systems, such as:
- Multi-user data separation
- Long-term memory handling
- Organizational knowledge sharing
- Clean, modular architecture
Whether youβre building:
- A corporate knowledge assistant
- A legal or research AI
- A personal second-brain
- Or a multi-tenant SaaS AI platform
π TUG (TheUltimateRAG) gives you a strong, extensible backend foundation.
For a complete walkthrough, architecture deep-dives, and usage examples,
π visit the official documentation:
https://theultimaterag.vercel.app/
| Feature | What It Means for You |
|---|---|
| β‘ High-Performance API | Built with FastAPI for fast, async, and scalable AI services |
| π‘οΈ True Multi-Tenant Isolation | Each userβs data is fully isolated and secure |
| π’ Organization-Level Knowledge | Share documents across teams without duplicating data |
| π§ Session-Aware Memory | Conversations retain context naturally across turns |
| π Hybrid Semantic Search | Metadata-aware vector search with logical filters |
| ποΈ RAG Visualizer GUI | Real-time visualization of retrieval, context, and generation |
The system follows a plug-and-play architecture.
You can replace or extend any core component without breaking the rest of the system.
- Swap vector databases
- Change LLM providers
- Add custom memory logic
- Introduce agent workflows
graph TD
Client[Client / Frontend] -->|HTTP / JSON| API[FastAPI Gateway]
subgraph "Core RAG Engine"
API --> Logic[Orchestrator]
Logic -->|Retrieve Context| Vector[Vector Store Manager]
Logic -->|Conversation State| Memory[Session Memory]
Logic -->|Generate Response| LLM[LLM Service]
end
subgraph "Data Layer"
Vector <-->|Embeddings| Chroma[(ChromaDB)]
Memory <-->|Chat Logs| Cache[(In-Memory / Redis)]
end
π Detailed architecture explanation available at: π https://theultimaterag.vercel.app/
- Python 3.10+
- Node.js & npm (for the Visualizer UI)
- API keys (OpenAI, Anthropic, etc.)
pip install ultimateragIf you cloned the repository, install dependencies first:
pip install -e .To run TheUltimateRAG correctly, you must create and configure a .env file.
This file stores environment-specific settings such as API keys, database configs, and runtime options.
The project uses Pydantic Settings + python-dotenv, so all variables defined in .env are automatically loaded at startup.
At the root of the project, create a file named:
.envBelow is a complete reference of supported environment variables, grouped by purpose.
You only need to configure the parts relevant to your setup.
APP_NAME=TheUltimateRAG
APP_ENV=development # development | production
DEBUG=true| Variable | Description |
|---|---|
APP_NAME |
Application name |
APP_ENV |
Runtime environment |
DEBUG |
Enable/disable debug logs |
LLM_PROVIDER=openai # openai | ollama | anthropic
EMBEDDING_PROVIDER=openai # openai | ollama | huggingface
MODEL_NAME=gpt-3.5-turbo| Variable | Description |
|---|---|
LLM_PROVIDER |
LLM backend to use |
EMBEDDING_PROVIDER |
Embedding model provider |
MODEL_NAME |
Chat model name |
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxANTHROPIC_API_KEY=sk-ant-xxxxxxxxxxxx
β οΈ Note: IfLLM_PROVIDERorEMBEDDING_PROVIDERis set toopenai,OPENAI_API_KEYmust be provided, otherwise a warning will be shown.
OLLAMA_BASE_URL=http://localhost:11434Use this only if you are running Ollama locally.
VECTOR_DB_TYPE=chroma
VECTOR_DB_PATH=./chroma_db_data
EMBEDDING_DIMENSION=1536VECTOR_DB_TYPE=postgres
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=vector_db
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres| Variable | Description |
|---|---|
VECTOR_DB_TYPE |
chroma or postgres |
VECTOR_DB_PATH |
Local ChromaDB storage path |
EMBEDDING_DIMENSION |
Vector embedding size |
MEMORY_WINDOW_SIZE=10
MEMORY_WINDOW_LIMIT=10
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_DB=0
REDIS_USER=default
REDIS_PASSWORD=The system automatically builds the Redis connection URL internally.
The project uses:
python-dotenvpydantic-settings
load_dotenv()
settings = Settings()So no manual loading is required.
If you want to get started quickly, this is enough:
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxx
LLM_PROVIDER=openai
EMBEDDING_PROVIDER=openai
VECTOR_DB_TYPE=chromaπ Refer to the full configuration guide here: π https://theultimaterag.vercel.app/
3οΈβ£ Run the Platform (CLI)
You can use the installed ultimaterag CLI to control the system.
Start the Server:
ultimaterag start
# Options: --host 0.0.0.0 --port 8000 --reloador via python:
python app.pyOther CLI Commands:
ultimaterag version: Show current versionultimaterag about: Show project informationultimaterag license: usage licenseultimaterag help: Show full help guide
We provide a standalone example example.py in the root directory to demonstrate how to build a custom application using ultimaterag as a library.
# Ensure you are in the project root
python example.pyThis starts a custom FastAPI server on port 8001 with a specific /ask endpoint that uses the RAG engine directly.
Test the Custom Endpoint:
curl -X POST "http://localhost:8001/ask" \
-H "Content-Type: application/json" \
-d '{"query": "What is UltimateRAG?"}'A dedicated React-based GUI lets you:
- Inspect retrieved documents
- Understand context flow
- Debug hallucinations
- Optimize retrieval strategies
cd rag_visualizer
npm install
npm run devAccess live API documentation at:
π http://localhost:8000/docs
- POST
/api/v1/chatβ Chat with your knowledge base - POST
/api/v1/ingestβ Secure document ingestion
- GET
/api/v1/agent/tools - POST
/api/v1/agent/search - POST
/api/v1/agent/workflowβ Self-correcting RAG pipelines
π Full API reference: π https://theultimaterag.vercel.app/
Contributions are welcome and encouraged π
- Fork the repository
- Create a feature branch
- Commit your changes
- Open a Pull Request
See CONTRIBUTING.md for guidelines.
- π Official Docs: https://theultimaterag.vercel.app/
- π User Manual:
USER_MANUAL.md - π± Git Learning Guide:
LEARN.md