Skip to content

anivenk25/Cervello

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

66 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Cerevello : AI-Powered Real-Time RAG System with Ticketing and Multimodal Support

This project is a real-time Retrieval-Augmented Generation (RAG) system, powered by OpenAI's LLMs, integrated with a FastAPI backend and a multimodal ingestion pipeline. It enables users to interact with enterprise knowledge through document upload, querying, and support ticketing, all while leveraging vector search via Qdrant.


🧠 Key Features

  • RAG (Retrieval-Augmented Generation) using OpenAI and Qdrant
  • Multimodal ingestion pipeline: Supports .pdf, .docx, .png
  • OpenAI Agent + Tool integration to dynamically call backend services
  • FastAPI microservices for RAG & ticketing
  • Support ticketing system with MongoDB
  • Semantic vector search using OpenAI embeddings
  • Client endpoints for interacting with the system in real-time

🧱 Architecture Overview

This system is composed of several interconnected services:

1. πŸ“¦ RAG API (FastAPI Server)

Endpoints to:

  • /query: Search and retrieve knowledge with OpenAI + Qdrant
  • /upload: Bulk upload documents
  • /update: Update existing vector entries
  • /delete: Delete documents
  • /llm-query: Basic LLM RAG
  • /mcp/query: OpenAI Agent-based query routing with tools

2. 🧾 Ticketing API (FastAPI Microservice)

Endpoints to:

  • /create-ticket: Submit a new support request
  • /tickets: View all tickets
  • /tickets/{userId}: View user-specific tickets

3. 🧰 OpenAI Agent & Tools

Uses:

  • search_docs: Queries knowledge base
  • add_docs: Uploads new documents
  • update_doc: Updates vectorized entries
  • delete_doc: Removes documents from the vector DB

4. πŸ”— Multimodal Ingestion Pipeline

Handles file ingestion and embedding:

  • Text extraction (pytesseract, python-docx)
  • Embedding with text-embedding-3-small
  • Insertion into Qdrant
  • Result logging to JSON

5. 🧠 Databases

  • Qdrant Cloud: Vector database for storing embeddings
  • MongoDB Atlas: Stores tickets and user interactions

πŸš€ Getting Started

1. πŸ“₯ Clone the Repo

git clone https://github.com/anivenk25/Cervello.git
cd Cervello_server

2. πŸ“¦ Install Dependencies

We use uv for virtual env management.

Ensure Python >= 3.10 is installed.

  • For macOs/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
  • For windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
  • Using pip
pip install uv

3. πŸ” Setup Environment Variables

Create a .env file in the root and configure: (refer to env.local

OPENAI_API_KEY=your_openai_key
QDRANT_API_KEY=your_qdrant_key
QDRANT_URL=https://your-qdrant-url
MONGO_URI=mongodb+srv://...

4. πŸ” Activate virtual env

  • For windows
.venv\Scripts\activate
  • For Linux
source .venv/bin/activate

5. Install dependencies

uv pip install -r requirements.txt

5. Run the venv

  1. To run the server for queries and db updation/deletion
uvicorn mcp_server:app --reload --log-level debug
  1. To run the server for ticketing
uvicorn tickets:app --reload --log-level debug

πŸ“‚ Directory Structure

.
β”œβ”€β”€ main_app/
β”‚   β”œβ”€β”€ app.py                 # FastAPI RAG endpoints
β”‚   β”œβ”€β”€ ingestion/             # File parsing and embedding
β”‚   └── agents/                # OpenAI agent tools
|   └── tickets.py
|   └── mcp_server.py 
β”œβ”€β”€ tickets/
β”‚   └── tickets.py             # Ticketing FastAPI service
β”œβ”€β”€ examples/
β”‚   └── gpt_4o_multimodal_rag/ # Demo apps and workflows
β”œβ”€β”€ .env                       # Environment variables
β”œβ”€β”€ pyproject.toml             # Poetry config
└── README.md

πŸ§ͺ How to Use

βž• Upload Documents

  • Send .pdf, .docx, or .png files to the /upload endpoint.
  • Text will be extracted and embedded via OpenAI.
  • Stored in Qdrant for semantic retrieval.

πŸ” Search with RAG

  • Hit /query with a natural language question.
  • Top-k relevant documents retrieved from Qdrant.
  • OpenAI responds with a generated answer.

🧠 Agent Mode

  • Use /mcp/query for enhanced query with tool calling.
  • OpenAI auto-selects appropriate tool like upload/search/update.

🎫 Create Tickets

  • The system may suggest creating a ticket.
  • User can edit and submit via /create-ticket.
  • Stored in MongoDB and retrievable anytime.

πŸ“Œ Requirements

  • Python β‰₯ 3.10
  • Poetry
  • MongoDB Atlas account
  • Qdrant Cloud account
  • OpenAI API Key

πŸ› οΈ Tech Stack

Component Technology
API Backend FastAPI
Vector Store Qdrant
Embeddings OpenAI text-embedding-3-small
Agent LLM OpenAI GPT-3.5/GPT-4o
Database MongoDB Atlas
Text Parsing Pathway, pytesseract, python-docx
Frontend Client (Optional) Chat interface or Postman

πŸ‘₯ Contributing

We welcome PRs, feedback, and issues. Please:

  1. Fork this repo
  2. Create a new branch
  3. Push your changes
  4. Open a Pull Request

πŸ“„ License

MIT License


πŸ“« Contact

Feel free to reach out with questions or collaboration requests:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors