rag_api  by danny-avila

Async API for ID-based RAG using Langchain

created 1 year ago
594 stars

Top 55.6% on sourcepulse

GitHubView on GitHub
Project Summary

This project provides an ID-based RAG (Retrieval-Augmented Generation) API using FastAPI, Langchain, and PostgreSQL/pgvector. It's designed for scalable document indexing and retrieval, particularly for use cases requiring file-level embedding management, such as integration with LibreChat. The API enables targeted queries by leveraging file metadata stored in a database.

How It Works

The core approach is to organize document embeddings by file_id, enabling granular control and targeted retrieval. It utilizes Langchain's vector store capabilities for efficient searching and supports asynchronous operations for enhanced performance. The architecture is built with FastAPI, offering a modern and scalable web framework.

Quick Start & Requirements

  • Install: pip install -r requirements.txt
  • Prerequisites: PostgreSQL with pgvector extension (v0.5.0+ recommended), Python 3.x. OpenAI API key is required for default embeddings.
  • Run: Use docker compose up for a combined RAG API and PostgreSQL/pgvector setup, or run the API separately with docker compose -f ./api-compose.yaml up. Local setup requires configuring a .env file and running uvicorn main:app.
  • Docs: README

Highlighted Details

  • Supports multiple embedding providers including OpenAI, Azure OpenAI, Hugging Face (via sentence-transformers or TEI), and Ollama.
  • Offers optional authentication via JWT verification.
  • Allows configuration of chunking strategy, including chunk size and overlap.
  • Can utilize Atlas MongoDB as an alternative vector database.

Maintenance & Community

The project is maintained by danny-avila. Further community or roadmap information is not detailed in the README.

Licensing & Compatibility

The README does not explicitly state a license. Compatibility for commercial use or closed-source linking is not specified.

Limitations & Caveats

The project is described as a "simple API" and may evolve, suggesting it might be in early development. Specific limitations regarding supported document types beyond PDFs or advanced RAG techniques are not detailed.

Health Check
Last commit

3 weeks ago

Responsiveness

1 day

Pull Requests (30d)
11
Issues (30d)
7
Star History
106 stars in the last 90 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems).

super-rag by superagent-ai

0.3%
380
RAG pipeline for AI apps
created 1 year ago
updated 1 year ago
Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems) and Elie Bursztein Elie Bursztein(Cybersecurity Lead at Google DeepMind).

LightRAG by HKUDS

1.0%
19k
RAG framework for fast, simple retrieval-augmented generation
created 10 months ago
updated 20 hours ago
Feedback? Help us improve.