Skip to content

Repository files navigation

🧠 CorpusAI Backend

FastAPI · RAG · Multimodal AI

FastAPI Python PostgreSQL Qdrant Redis


🎥 Demo 1 · 🎥 Demo 2 · 📝 Kaggle Writeup · 🔗 DOI


📸 Preview

CorpusAI Landing Page
🏠 Landing Page · Watch Demo
CorpusAI Chat Interface
💬 Chat Interface · Watch Demo

The core API for CorpusAI — an AI-powered document intelligence platform. It handles ingestion, vector search, authentication, and chat so users can upload documents and get grounded, multimodal answers.

Works with the CorpusAI Frontend for the full experience.


🔗 Related Repository

Repo Description
CorpusAI Frontend React client — chat UI, document management, Creative Space
CorpusAI Backend (this repo) FastAPI API — RAG pipeline, auth, storage, LLM routing

✨ Features

  • 🎛️ Dynamic Chat Modes — Hybrid · AI-Only · Document-Only
  • 📚 Advanced RAG — Intent routing with vector search & hierarchical summaries
  • Summary Caching — Instant repeat retrievals
  • 👁️ Vision & Multimodal — Images from docs passed to vision LLMs
  • 🌐 Web Search — Real-time context augmentation
  • 🤖 Multi-LLM — Groq · GitHub Models · Azure AI · Hugging Face
  • 🎨 Creative Space — AI text & image generation
  • 📄 Multi-format Docs — PDF · DOCX · PPTX · OCR
  • 🔐 Secure Auth — Appwrite + JWT · OAuth (Google · GitHub)
  • 🚦 Rate Limiting — Redis-backed protection
  • Background Tasks — APScheduler

🛠️ Tech Stack

FastAPI · Uvicorn · Pydantic
🐘 PostgreSQL · SQLAlchemy
🔍 Qdrant — vector search
🚀 Redis — cache & rate limits
🔐 Appwrite · Python-JOSE
🤖 Groq · Azure AI · Hugging Face
📄 PyPDF · python-docx · python-pptx · Tesseract

📋 Prerequisites

  • Python 3.11+
  • PostgreSQL database
  • Qdrant Cloud (or local instance)
  • Redis instance
  • Appwrite project with storage bucket
  • API keys for at least one LLM provider (Groq recommended)

🚀 Quick Start

python -m venv .venv
.venv\Scripts\activate          # Windows
# source .venv/bin/activate     # macOS / Linux

pip install -r requirements.txt

Create a .env file in the project root with your credentials, then start the server:

uvicorn api.main:app --reload

🌐 API → http://localhost:8000
📖 Docs → /docs · /redoc

Run the frontend on http://localhost:8080 and set FRONTEND_URL=http://localhost:8080 in your .env.


⚙️ Environment Variables

Variable Description
ENV development or production
DATABASE_* PostgreSQL connection (host, port, name, user, password)
QDRANT_URL · QDRANT_API_KEY Qdrant vector store
REDIS_* Redis host, port, credentials
APPWRITE_* Appwrite endpoint, project, API key, bucket
GROQ_API_KEY Groq LLM provider
JWT_SECRET Secret for access & refresh tokens
FRONTEND_URL · BACKEND_URL URLs for CORS and OAuth redirects
GOOGLE_* · GITHUB_* OAuth client credentials (optional)

Never commit .env files or API keys to version control.


🌟 Support

If you find this project useful or interesting, please consider giving it a ⭐ on GitHub! Your support helps make the project more visible and encourages further development.


📜 License

License: AGPL-3.0

Licensed under the GNU Affero General Public License v3.0 (AGPL-3.0).
Copyright © 2026 Ameya Sanjay Chopade · See LICENSE for details.

About

FastAPI backend for CorpusAI — document ingestion, embeddings (Qdrant), summarization/RAG, and streaming chat with Appwrite storage and Postgres persistence.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages