DEV.co
Vector Databases · danny-avila

rag_api

RAG API is a FastAPI-based service that integrates Langchain with PostgreSQL/pgvector to enable document indexing and retrieval organized by file ID. It provides asynchronous, scalable endpoints for managing embeddings and vector-based search, with support for multiple embedding providers (OpenAI, Bedrock, Azure, HuggingFace, and others).

Source: GitHub — github.com/danny-avila/rag_api
860
GitHub stars
375
Forks
Python
Primary language
MIT
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositorydanny-avila/rag_api
Ownerdanny-avila
Primary languagePython
LicenseMIT — OSI-approved
Stars860
Forks375
Open issues44
Latest releasev0.8.0 (2026-04-21)
Last updated2026-06-18
Sourcehttps://github.com/danny-avila/rag_api

What rag_api is

Python FastAPI application built on Langchain that uses PostgreSQL with pgvector extension for vector storage and similarity search. Supports configurable embedding providers, async operations, JWT authentication, batch processing, and query optimization via distance thresholding. Deployable via Docker or local Python environment.

Quickstart

Get the rag_api source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/danny-avila/rag_api.gitcd rag_api# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Document Retrieval at File Granularity

Ideal for systems needing RAG with file-level metadata tracking and targeted queries. Primary integration point is LibreChat, but applicable to any multi-tenant or multi-project document management system requiring embeddings organized by file ID.

Scalable Vector Search Infrastructure

Supports high-throughput async operations with configurable batch sizes and queue management for embedding processing. Suitable for applications requiring tunable performance characteristics and async-first architecture.

Multi-Provider Embedding Flexibility

Abstracts embedding provider selection (OpenAI, Bedrock, Azure, HuggingFace, Ollama, Google, VertexAI) via configuration. Enables cost optimization or vendor lock-in avoidance by switching providers without code changes.

Implementation considerations

  • PostgreSQL/pgvector setup is mandatory; Docker Compose simplifies local development but production deployments need managed database configuration (schema, connection pooling settings, extension handling).
  • Embedding provider credentials (RAG_OPENAI_API_KEY, Bedrock, Azure, etc.) must be securely managed; multiple environment variable options exist to avoid conflicts with parent systems like LibreChat.
  • Chunk size, overlap, batch size, and distance threshold tuning directly impact search quality and cost; defaults provided but require inspection and adjustment based on embedding model and use case.
  • Async operations and connection pooling require careful configuration for remote PostgreSQL (PG_POOL_PRE_PING, PG_POOL_RECYCLE settings) to handle idle timeouts and network latency.
  • JWT authentication is optional but strongly recommended for production; requires upstream token generation and is verification-only (no issuance mechanism included).

When to avoid it — and what to weigh

  • Requiring Out-of-Box UI — This is API-only with no built-in frontend. Integration requires separate client application development or embedding into an existing system like LibreChat.
  • Simple Single-File Use Cases — The ID-based organizational model adds complexity suited for multi-file, multi-project scenarios. Simpler document search needs may be overengineered by this architecture.
  • No PostgreSQL/pgvector Infrastructure — Requires PostgreSQL with pgvector extension pre-configured. While Docker Compose is provided, managed Postgres adoption requires additional configuration (e.g., schema setup, superuser constraints noted in docs).
  • Production Security Without External Validation — JWT authentication is basic (verification-only, no token issuance). Requires secure token generation from external system. Not suitable for standalone secure deployments without upstream auth infrastructure.

License & commercial use

MIT License. Permissive, OSI-compliant license allowing commercial use, modification, and distribution with attribution.

MIT license permits commercial use without restriction. However, ensure that any external dependencies (Langchain, FastAPI, embedding provider SDKs) comply with your commercial requirements. No warranty implied; review dependency licenses before production deployment.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityModerate
DEV.co fitGood
Assessment confidenceHigh
Security considerations

No claims made regarding security posture. JWT authentication is optional and verification-only (requires external token issuance). Credential handling for embedding providers must be managed via environment variables (no secrets management built-in). Database credentials similarly environment-based. No encryption at rest, TLS, or audit logging mentioned. Requires review of secret management strategy for production use.

Alternatives to consider

LangChain Community Vector Store (direct)

Use LangChain's built-in vector store integrations directly in your application if you don't need a separate microservice. Reduces deployment complexity but couples logic to your main application.

Weaviate or Pinecone (managed vector DB)

Fully managed vector databases with hosted infrastructure, automatic scaling, and built-in API. Avoid self-hosted PostgreSQL/pgvector complexity but increases cost and vendor lock-in.

Vespa or Milvus (open-source vector engines)

Alternative open-source vector databases with their own APIs and scaling characteristics. Similar deployment overhead to pgvector but different operational and performance trade-offs.

Software development agency

Build on rag_api with DEV.co software developers

Explore RAG API for scalable document retrieval, or let our team help you evaluate integration complexity and embedding strategy for your specific use case.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

rag_api FAQ

Can I use this without PostgreSQL?
Default is pgvector on PostgreSQL. VECTOR_DB_TYPE env var allows Atlas Mongo as alternative (mentioned in distance threshold docs), but this requires review and is not fully documented in the README excerpt.
How do I integrate this with an existing LLM system?
Provide HTTP client calls to RAG API endpoints for document management and retrieval, then pass results to your LLM. Designed to integrate with LibreChat but works standalone. JWT authentication optional for endpoint protection.
What embedding models are recommended?
Defaults: OpenAI's text-embedding-3-small, HuggingFace all-MiniLM-L6-v2, etc. Docs suggest EMBEDDING_BATCH_SIZE of 750 for text-embedding-3-small. Choice depends on cost, quality, and latency trade-offs; requires testing with your data.
Is this production-ready?
Functionally yes, but requires careful configuration of PostgreSQL, secrets management, JWT validation upstream, and optional features like distance thresholding and query logging. No warranty; review all dependencies and security considerations before deploying.

Software developers & web developers for hire

From first prototype to production, DEV.co delivers software development services around tools like rag_api. Our software development agency staffs experienced software developers and web developers for custom software development, web development, integrations, and ongoing support across vector databases and beyond.

Ready to Implement RAG Search in Your Application?

Explore RAG API for scalable document retrieval, or let our team help you evaluate integration complexity and embedding strategy for your specific use case.