# Agentic RAG

A FastAPI starter for an authenticated, document-scoped retrieval-augmented generation system with built-in evaluation, rather than a bare upload-and-ask demo.

This project goes beyond a basic upload-text-ask-question RAG demo by adding authenticated users and owned documents, document-scoped retrieval to prevent cross-document leakage, pluggable embeddings and reranking, a semantic answer cache, an evaluation pipeline with run history and rerun support, and a simple built-in UI for asking questions and running evaluations.

It supports an agent loop with tool calling and a retriever tool, a Chroma vector store with persistent local storage, OpenAI or Hugging Face embedding providers with an optional Cohere reranker, query refinement before retrieval, and a semantic cache backed by Postgres with pgvector. Text and PDF ingestion produce page-aware citations in answers, and users get JWT-based authentication with document ownership, listing and soft delete.

The evaluation pipeline reports retrieval metrics and LLM-judge answer metrics, with a Jinja-based UI for asking questions and reviewing evaluation runs, and a Dockerized development stack with Postgres and pgAdmin.

Website: https://github.com/mahmoudsamy7729/agentic-rag
