$ account RustyRAG
RustyRAG is a production-grade RAG (Retrieval-Augmented Generation) API server written in Rust, designed for sub-200ms time-to-first-token. It provides a complete pipeline: document ingestion (PDF, DOCX, PPTX, XLSX, HTML, TXT, ZIP) via Docling with layout-aware extraction, OCR, table recognition, and optional vision-model image descriptions; hybrid search using Milvus (dense HNSW vectors + BM25 sparse with Reciprocal Rank Fusion); cross-encoder reranking via Jina Reranker v3; and streaming LLM responses from Groq or Cerebras. The server exposes REST endpoints for document upload, semantic search, RAG chat (both full response and SSE streaming), collection backup, and an evaluation benchmark runner. The architecture follows a clean layered pattern: Actix-web handlers in `src/handlers/` orchestrate business logic, services in `src/services/` encapsulate external API clients (Milvus, embeddings, reranker, Docling, LLM), and schemas in `src/schemas/` define request/response types with OpenAPI annotations via utoipa. The Rust binary is a single self-contained server; GPU-accelerated sidecars (embeddings, reranker, Docling) run as Docker containers. Configuration is environment-driven with sensible defaults. Key entry points are the HTTP API at `/api/v1/` (Swagger UI at `/swagger-ui/`) and a built-in chat UI at `/static/chat.html`. The primary data flow for a RAG query is: embed user query → fire concurrent dense and BM25 searches in Milvus → merge via RRF → rerank top candidates → build context prompt → stream LLM response with source citations and timing metadata. The system is designed for low latency and high accuracy, with benchmark results showing 94.5% pass rate with reranker at ~279ms TTFT.