RAGGuide_ is a powerful Retrieval-Augmented Generation (RAG) system designed for:
- Question Answering (Q&A) β providing accurate, context-aware responses to user queries.
- Rule Compliance Evaluation (Judge Mode) β analyzing reports or documents against specified rules and offering structured feedback.
It combines FastAPI, PostgreSQL/pgvector, and Streamlit to create a smart, document-aware conversational system that bridges reasoning and data-driven understanding.
-
π¬ Q&A Mode β Ask natural-language questions and get accurate, polite, and concise answers.
-
βοΈ Judge Mode β Verify if uploaded reports or ideas comply with specific rules or policies and receive improvement suggestions.
-
π§© RAG Architecture β Combines vector retrieval with generative reasoning.
-
π FastAPI Backend β High-performance and modular REST API.
-
π¨ Streamlit Frontend β User-friendly web interface for uploading, processing, and querying documents.
-
π³ Docker Ready β Fully containerized for easy deployment.
-
π Monitoring β Integrated Prometheus and Grafana dashboards for performance insights.
- Python 3.9+
- PostgreSQL (with pgvector extension) or Qdrant
- Docker
- Conda (recommended for local development)
- VS Code (for editing and debugging)
sudo apt update
sudo apt install libpq-dev gcc python3-dev-
Download Miniconda from here
-
Create New Environment using :
$ conda create -n mini-rag-app-2 python=3.9
-
Activate New Environment using :
$ conda activate mini-rag-app-2
-
Install packages in requirements.txt:
$ pip install -r requirements.txt
$ cp .env.example .env
- Then open docker/env/.env.app and configure your keys:
COHERE_API_KEY="your_cohere_key" OPEN_API_KEY="your_openai_key" POSTGRES_USERNAME="postgres" POSTGRES_PASSWORD="postgres_password"
$ cd docker
$ sudo docker compose up
- update .env with your credentials.
$ uvicorn main:app --reload --host 0.0.0.0 --port 5000
Access the API documentation here: http://localhost:8000/docs
$ streamlit run app.py
π Open in your browser: http://localhost:8501
- You can monitor application metrics, performance, and API usage using the integrated Grafana dashboard.
(Example view of RAGGuideβs system performance using Grafana and Prometheus integration.)
RAGGuide_/
βββ app.py # Streamlit frontend entrypoint
β
βββ src/ # Backend (FastAPI + RAG core logic)
β βββ main.py # FastAPI app entrypoint
β βββ .env # Environment variables for backend
β βββ .env.example # Example environment file
β βββ requirements.txt # Backend dependencies
β βββ .gitignore # Ignore rules specific to backend development
β β
β βββ assets/ # Static assets or processed data
β β
β βββ controllers/ # Core application controllers (business logic)
β β βββ __pycache__/
β β βββ __init__.py
β β βββ BaseController.py # Common controller base class
β β βββ DataController.py # Handles document ingestion and management
β β βββ NLPController.py # Handles text processing, embeddings, and NLP tasks
β β βββ ProcessController.py # Document preprocessing and cleaning
β β βββ ProjectController.py # Manages project-level configurations and workflows
β β
β βββ helpers/ # General-purpose helpers and configurations
β β βββ __pycache__/
β β βββ __init__.py
β β βββ config.py # Global configuration and environment loader
β β
β βββ models/ # Database and Pydantic models
β β βββ __pycache__/
β β βββ db_schemes/ # Alembic schemas and DB structure
β β βββ enum/ # Enum definitions for model constants
β β βββ __init__.py
β β βββ AssetModel.py
β β βββ BaseDataModel.py
β β βββ ChunkModel.py
β β βββ ProjectModel.py
β β
β βββ routes/ # FastAPI routes (API endpoints)
β β βββ __pycache__/
β β βββ schemes/ # Request/response schemas for routes
β β β βββ __init__.py
β β β βββ base.py
β β β βββ data.py
β β β βββ nlp.py
β β
β βββ stores/ # Data and model storage layer
β β βββ llm/ # Large Language Model integration layer
β β β βββ __pycache__/
β β β βββ providers/ # Specific LLM providers (OpenAI, Cohere, etc.)
β β β β βββ __pycache__/
β β β β βββ __init__.py
β β β β βββ ColHereProvider.py
β β β β βββ OpenAllProvider.py
β β β βββ templates/ # Prompt templates and LLM configuration files
β β β βββ __init__.py
β β β βββ LLMinums.py # Enum for LLM provider types
β β β βββ LLMInterface.py # Abstract interface for all LLMs
β β β βββ LLMProviderFactory.py # Factory pattern for dynamic provider selection
β β β
β β βββ vectordb/ # Vector database layer (for retrieval)
β β βββ __pycache__/
β β βββ providers/ # Specific vector DB providers
β β β βββ __pycache__/
β β β βββ __init__.py
β β β βββ PGVectorProvider.py
β β β βββ OdrantDBProvider.py
β β βββ __init__.py
β β βββ VectorDBEnumspy # Enum definitions for vector DB backends
β β βββ VectorDBInterface.py # Interface for all vector DB integrations
β β βββ VectorDBProviderFactory.py # Factory for vector DB providers
β β
β βββ utils/ # Utility functions and performance metrics
β β βββ __pycache__/
β β βββ __init__.py
β β βββ metrics.py # App-level metrics and monitoring logic
β
βββ docker/ # Docker deployment and orchestration
β βββ env/ # Environment configuration files
β β βββ .env.app
β β βββ .env.example.app
β β βββ .env.example.grafana
β β βββ .env.example.postgres
β β βββ .env.example.postgres-exporter
β β βββ .env.grafana
β β βββ .env.postgres
β β βββ .env.postgres-exporter
β β
β βββ minirag/ # FastAPI build context and Alembic migrations
β β βββ alembic.ini
β β βββ alembic.ini.example
β β βββ Dockerfile
β β βββ entrypoint.sh
β β
β βββ nginx/ # Reverse proxy configuration
β β βββ default.conf
β β
β βββ prometheus/ # Prometheus configuration for metrics
β β βββ prometheus.yml
β β
β βββ docker-compose.yml # Multi-container setup (FastAPI, Streamlit, Postgres, Grafana)
β βββ .gitignore
β βββ README.md
β
βββ assets/ # Data assets or sample files
β
βββ Images/ # Screenshots and monitoring visuals
β βββ fastapi-grafana.jpg # Grafana dashboard showing API metrics
β βββ streamlit_interface.jpg # Streamlit user interface screenshot
β
βββ .gitignore # Root-level ignore configuration
βββ LICENSE # MIT License
βββ README.md # Project documentation
- You can test all API endpoints using the included Postman collection: Download the Postman collection from ./assets/mini-rag-app.postman_collection.json
Contributions are always welcome..
To contribute to RAGGuide_:
- Fork the repository.
- Create a new branch for your feature or fix:
git checkout -b feature/your-feature-name
- Commit your changes:
git commit -m "Add new feature or fix issue" - Push to your branch:
git push origin feature/your-feature-name
- Open a Pull Request with a clear description of your changes.
This project is licensed under the MIT License.
See the LICENSE file for details.
RAGGuide_ was created to serve as both an educational and deployable Retrieval-Augmented Generation (RAG) system.
It provides a flexible foundation for building intelligent, retrieval-augmented applications that combine reasoning, context awareness, and document understanding.
For questions, collaborations, or contribution opportunities, feel free to reach out:
- Email: ahmdeltoky4@gmail.com
- LinkedIn: www.linkedin.com/in/ahmed-eltokhy-7a7901383

