← all repositories
danny-avila/rag_api

RAG by the file, not the haystack

A FastAPI service that keeps embeddings organized by file ID so retrieval targets specific documents instead of searching an undifferentiated vector soup.

866 stars Python RAG · SearchData Tooling
rag_api
Not currently ranked — collecting fresh signals.
star history

What it does This project is an async FastAPI backend that uses LangChain to chunk, embed, and store documents in PostgreSQL/pgvector, keyed by file_id. Instead of dumping every document into one anonymous vector bucket, it maintains file boundaries, letting downstream apps query specific documents or sets of files. It was built primarily to power LibreChat’s retrieval, but works as a standalone ID-based RAG service.

The interesting bit Most RAG stores blur file boundaries together; this one treats the file ID as a first-class partition, which makes targeted queries and metadata filtering almost free. It also ships with a broad menagerie of embedding provider options—OpenAI, Azure, Ollama, Bedrock, Hugging Face, Google—so you can swap models without swapping architectures.

Key highlights

  • File-level embedding organization via file_id for precise, targeted retrieval
  • Async batch processing to cap memory use during large document ingestion
  • Pluggable embedding backends including OpenAI, Azure, Ollama, Bedrock, and Hugging Face
  • Optional JWT verification and pgvector distance-threshold filtering to cut low-quality matches
  • Extensive environment-variable configuration, Docker-ready for quick deployment

Caveats

  • The README reads like a configuration manifest; architectural depth and API contract details are thin
  • MongoDB Atlas support exists but feels secondary to the PostgreSQL/pgvector path
  • Several environment variables carry RAG_ prefixes specifically to avoid collisions with LibreChat, implying tight coupling to that ecosystem

Verdict A solid choice if you need a pre-built RAG microservice with document-level scoping for a chatbot or CMS. Look elsewhere if your retrieval pipeline needs custom re-ranking or fine-grained access control beyond file IDs.

Frequently asked

What is danny-avila/rag_api?
A FastAPI service that keeps embeddings organized by file ID so retrieval targets specific documents instead of searching an undifferentiated vector soup.
Is rag_api open source?
Yes — danny-avila/rag_api is open source, released under the MIT license.
What language is rag_api written in?
danny-avila/rag_api is primarily written in Python.
How popular is rag_api?
danny-avila/rag_api has 866 stars on GitHub.
Where can I find rag_api?
danny-avila/rag_api is on GitHub at https://github.com/danny-avila/rag_api.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.