RAGOps is a backend platform for building, evaluating, and comparing Retrieval-Augmented Generation (RAG) systems. It provides document ingestion, vector search, LLM-powered question answering, automated evaluation, and experiment tracking through a REST API built with FastAPI.
- 📄 Upload and process PDF documents
- ✂️ Automatic document chunking
- 🧠 OpenAI embedding generation
- 🗄️ PostgreSQL + pgvector vector storage
- 🔍 Semantic similarity search
- 🤖 LLM-powered answer generation
- 🧪 Experiment management
- ❓ Evaluation question management
- 📊 Automated RAG evaluation
- 📈 Experiment run tracking
- 💾 Metrics persistence
- 🔄 Alembic database migrations
- 🌐 RESTful API with interactive Swagger documentation
- FastAPI
- SQLAlchemy 2.0
- PostgreSQL
- pgvector
- Alembic
- OpenAI
- LangChain
- PyPDF
- Recursive Character Text Splitter
- Tiktoken
- Docker
- Docker Compose
app/
│
├── api/
│ ├── chat.py
│ ├── documents.py
│ ├── experiments.py
│ └── questions.py
│
├── core/
│
├── models/
│
├── repositories/
│
├── schemas/
│
├── services/
│
├── migrations/
│
└── main.py
The project follows a layered architecture:
API
↓
Services
↓
Repositories
↓
Database
Upload PDF
↓
Extract Text
↓
Chunk Document
↓
Generate Embeddings
↓
Store in PostgreSQL + pgvector
↓
Retrieve Relevant Chunks
↓
Generate Answer
↓
Evaluate Response
↓
Store Question Results
↓
Aggregate Metrics
↓
Store Experiment Run
Each experiment is evaluated using the following metrics:
- Answer Relevancy
- Faithfulness
- Context Precision
- Context Recall
- Latency
Average metrics are calculated and stored for every experiment run.
| Method | Endpoint | Description |
|---|---|---|
| POST | /documents/upload |
Upload and index a PDF document |
| Method | Endpoint | Description |
|---|---|---|
| POST | /chat |
Ask questions using indexed documents |
| Method | Endpoint | Description |
|---|---|---|
| POST | /experiments |
Create an experiment |
| GET | /experiments |
List all experiments |
| POST | /experiments/{experiment_id}/run |
Execute an experiment |
| Method | Endpoint | Description |
|---|---|---|
| POST | /questions |
Create an evaluation question |
| GET | /questions/by-experiment/{experiment_id} |
Get questions for an experiment |
git clone https://github.com/<your-username>/ragops.git
cd ragopsCreate a .env file in the project root.
OPENAI_API_KEY=your_openai_api_key
DATABASE_URL=postgresql+psycopg://postgres:password@postgres:5432/ragops
OPENAI_EMBEDDING_MODEL=text-embedding-3-small
OPENAI_CHAT_MODEL=gpt-4.1-minidocker compose up --builddocker compose exec fastapi alembic upgrade headhttp://localhost:8000/docs
- Upload a PDF document.
- Ask questions using the chat endpoint.
- Create an experiment.
- Add evaluation questions.
- Execute the experiment.
- View stored evaluation metrics and experiment results.
- Document upload and indexing
- Semantic search using pgvector
- LLM-powered question answering
- Experiment management
- Evaluation question management
- Automated RAG evaluation
- Experiment run tracking
- Experiment history
- Run comparison
- Evaluation dashboard
- Background workers
- Authentication
- Frontend (React/Next.js)
- CI/CD pipeline
- Cloud deployment
Contributions, issues, and feature requests are welcome.
Feel free to fork the repository and submit a pull request.
This project is licensed under the MIT License.
Built with ❤️ using FastAPI, PostgreSQL, pgvector, LangChain, and OpenAI.