ChatVector is an open-source Retrieval-Augmented Generation (RAG) engine for ingesting, indexing, and querying unstructured documents such as PDFs and text files.
Think of it as an engine developers can use to build document-aware applications β such as research assistants, contract analysis tools, or internal knowledge systems β without having to reinvent the RAG pipeline.
β Star the repo to follow progress and support the project!
- What is ChatVector?
- ChatVector vs Frameworks
- Who is this for?
- Current Status
- Architecture Overview
- Quick Start
- Contributing
- License
ChatVector provides a clean, extensible backend foundation for RAG-based document intelligence. It handles the full lifecycle of document Q&A:
- Document ingestion (PDF, text) with configurable chunking strategies
- Text extraction, cleaning, and semantic chunking
- Vector embedding and storage via pgvector
- Semantic retrieval with optional query transformations
- LLM-powered answer generation with cited responses
- Background processing queue with rate limiting and retry logic
The goal is to offer a developer-focused RAG engine you can deploy as a service and integrate via HTTP β not a polished end-user SaaS, and not a framework you have to assemble yourself.
ChatVector is designed as a production-ready backend service, not a general-purpose framework. Here's how it compares:
| Aspect | ChatVector (This Project) | General AI Framework (e.g., LangChain) |
|---|---|---|
| Primary Goal | Deliver a deployable backend service for document intelligence. | Provide modular components to build a wide variety of AI applications. |
| Out-of-the-Box Experience | A fully functional FastAPI service with logging, testing, rate limiting, and a clean API. | A collection of tools and abstractions you must wire together and productionize. |
| Architecture | Batteries-included, opinionated engine. Get a working system for one use case. | Modular building blocks. Assemble and customize components for many use cases. |
| Best For | Developers, startups, or teams who need a document Q&A API now and want to focus on their application layer. | Developers and researchers building novel, complex AI agents or exploring multiple LLM patterns from the ground up. |
| Path to Production | Short. Configure, deploy, and integrate via API. Built-in observability, rate limiting, and scaling patterns. | Long. Requires significant additional work on API layers, monitoring, deployment, and performance tuning. |
ChatVector is designed for:
- Developers building document intelligence tools or internal knowledge systems
- Backend engineers who want a solid RAG foundation without heavy abstractions
- AI/ML practitioners experimenting with chunking, retrieval, and prompt strategies
- Open-source contributors interested in retrieval systems, embeddings, and LLM orchestration
Phases 1, 2, and 2.5 are complete. Phase 3 is actively underway β most backend quality and provider work has shipped, but production API-key enforcement is still in progress. See ROADMAP.md for the full breakdown.
What's working today:
Backend
- β PDF and text document ingestion
- β Configurable chunking strategies (fixed, paragraph, semantic)
- β Vector embeddings + semantic search via pgvector
- β Hybrid retrieval (PostgreSQL full-text + vector, RRF fusion)
- β Baseline retrieval reranking (similarity + lexical overlap)
- β Session-scoped and tenant-wide retrieval modes
- β LLM-powered answers with source citations and relevance scores
- β Query transformations (rewrite, expand, stepback)
- β Configurable response personas and system prompt
- β Session-based chat with persisted conversation history
- β
SSE streaming chat (
/chat/stream) - β Background ingestion queue with rate limiting, retry, and DLQ
- β Redis-backed ingestion queue (production default; in-memory fallback for local dev)
- β Structured logging with request ID tracing
- β
Health checks with TTL caching on
/status - β Per-tenant rate limiting on all authenticated API routes
- β Security headers, CORS hardening, input validation
- β Production Compose config + GitHub Actions CI
- β Pluggable LLM providers (Gemini, OpenAI, Ollama, Anthropic Claude)
- β Pluggable embedding providers (Gemini, OpenAI, Ollama, Voyage AI)
- β Mixed-provider configurations (e.g. Claude + Voyage)
- β
Response metadata:
latency_msandmodelon chat responses - β Python client SDK (core synchronous workflows)
Frontend Demo
- β Document upload with live pipeline stage display and SSE progress
- β Real-time ingestion status polling
- β Full RAG chat with source citations and session sidebar
- β SSE streaming chat, batch query demo, and live system status page
- β Responsive design with dark developer aesthetic
Active Phase 3 work:
- π§ Production API-key authentication and strict tenant enforcement (plumbing scaffolded; validation not yet active)
- π§ Redis-backed distributed rate limiting
- π§ Python SDK parity (sessions, streaming, retrieval scopes)
- π§ Node.js/TypeScript SDK (planned)
- π§ Query transformation debug metadata and retrieval inspection tooling
- FastAPI β modern Python API framework
- Uvicorn β high-performance ASGI server
- slowapi β per-tenant rate limiting
- Design goals: clarity, extensibility, resilience, and security by default
- Pluggable providers β Gemini, OpenAI, Ollama, Anthropic Claude (LLM), and Voyage AI (embeddings); mix and match independently
- Hybrid retrieval β vector similarity + PostgreSQL full-text search with RRF fusion
- Baseline reranking β deterministic similarity + lexical overlap reranker
- Retrieval scopes β session-scoped (default) or tenant-wide search
- Configurable chunking β fixed, paragraph, or semantic strategies
- Query transformations β rewrite, expand, or stepback before retrieval
- Response personas β
default,concise,conversational,academic,technical
- PostgreSQL + pgvector β vector similarity search
- SQLAlchemy (development) / Supabase (production)
- Strategy pattern β swap backends without touching business logic
- Next.js + TypeScript
- Full end-to-end demo β upload, ingest, chat, citations
- Not production-ready β exists to demonstrate and test backend capabilities
See ARCHITECTURE.md for full system design details.
After installing Docker and Node.js, start the complete ChatVector development environment with one command.
- Docker with Docker Compose (
docker compose) - Node.js and npm
- Either:
- an API key for a supported hosted provider (Gemini or OpenAI), or
- a local Ollama installation
Gemini is the recommended default and the simplest guided setup.
make quickstartThe command creates the env file, pauses while you add provider credentials, then continues after you press Enter. It installs frontend dependencies, builds the backend Docker image, starts backend services and the non-containerized frontend demo, waits for both to become ready, and opens the frontend and API docs when supported.
Setup is safe to rerun β existing backend/.env and frontend-demo/.env.local files are never overwritten.
If provider configuration is already complete, make quickstart continues immediately without pausing.
Edit backend/.env to choose providers and set credentials. Gemini is the recommended default:
LLM_PROVIDER=gemini
EMBEDDING_PROVIDER=gemini
GEN_AI_KEY=your_google_ai_studio_api_keySupported combinations include Gemini, OpenAI, Ollama, Anthropic Claude (generation), and Voyage AI (embeddings), including mixed setups (for example Claude + Voyage). See backend/.env.example for all variables.
- Frontend demo (non-core reference UI): http://localhost:3000
- Swagger UI: http://localhost:8000/docs
make setup
# edit backend/.env
makemake setupβ create env files, install dependencies, and build Docker images (prints editing instructions if configuration is incomplete; does not wait)makeβ start backend and frontend, then open browser tabs
Returning contributors normally use:
makemake devUseful for SSH sessions, CI, or when you prefer to open URLs yourself.
| Command | Purpose |
|---|---|
make quickstart |
Create env, pause for credentials, then start everything |
make setup |
Create env files, install dependencies, and build Docker images |
make |
Start backend + frontend, open browser tabs (default) |
make dev |
Start backend + frontend without opening tabs |
make backend |
Start only the backend Docker stack |
make frontend |
Start only the frontend demo |
make open |
Open the frontend and API docs URLs |
make stop |
Stop this repo's frontend process and Docker services |
make help |
Show all Make commands |
Notes:
- Setup is safe to rerun and preserves existing env files.
- Provider credentials are edited in
backend/.envβ the setup scripts do not prompt for or read API keys in the terminal. - Press Ctrl+C while
make,make dev, ormake quickstartis running to stop the frontend; backend containers keep running until you runmake stop. - The frontend demo is a non-core, non-containerized reference UI for testing the backend.
POST /uploadβ upload a PDF, get adocument_idandstatus_endpointGET /documents/{document_id}/statusβ poll ingestion stage and progressPOST /chatβ ask questions using thedocument_id
| Command | Purpose |
|---|---|
docker compose up |
Start containers without rebuilding |
docker compose down |
Stop containers, preserve data |
docker compose down -v |
Stop containers and delete all DB data |
docker compose up --build |
Rebuild containers after code changes |
docker compose logs -f api |
Follow API logs in real time |
docker compose exec db psql -U postgres |
Connect to Postgres directly |
Or use the Makefile shortcuts above β run make help for the full list.
If you prefer not to use Make, copy backend/.env.example to backend/.env and configure your providers. Gemini is the simplest default:
LLM_PROVIDER=gemini
EMBEDDING_PROVIDER=gemini
GEN_AI_KEY=your_key_hereSee backend/.env.example for OpenAI, Ollama, Anthropic Claude, Voyage AI, and mixed-provider configurations. Then:
docker compose up --build
cd frontend-demo
npm ci
echo "NEXT_PUBLIC_API_URL=http://localhost:8000" > .env.local
npm run devFrontend runs at http://localhost:3000
A synchronous Python client is available today. A Node.js/TypeScript SDK is planned for Phase 3.
pip install ./sdk/pythonfrom chatvector import ChatVectorClient
with ChatVectorClient("http://localhost:8000") as client:
doc = client.upload_document("report.pdf")
client.wait_for_ready(doc.document_id, timeout=90)
answer = client.chat("What are the key findings?", doc.document_id)
print(answer.answer, answer.latency_ms, answer.model)
for source in answer.sources:
print(source.file_name, source.page_number, source.score)Session management, streaming chat, and retrieval scope options are not yet exposed in the SDK. See sdk/python/README.md for details.
High-impact contribution areas:
- Ingestion & indexing pipelines
- Retrieval quality & evaluation
- Chunking and query transformation strategies
- API design & refactoring
- Performance & scaling
- Security hardening
- SDK development
- Documentation & examples
Frontend contributions are welcome but considered non-core.
See CONTRIBUTING.md for details and Good First Issues to get started.