Skip to content

[Feat] Add new RAG API on LiteLLM AI Gateway - #17109

Merged
ishaan-jaff merged 26 commits into
mainfrom
litellm_rag_api
Nov 26, 2025
Merged

[Feat] Add new RAG API on LiteLLM AI Gateway #17109
ishaan-jaff merged 26 commits into
mainfrom
litellm_rag_api

Conversation

@ishaan-jaff

@ishaan-jaff ishaan-jaff commented Nov 26, 2025

Copy link
Copy Markdown
Contributor

[Feat] Add new RAG API on LiteLLM AI Gateway

This PR adds a new /v1/rag/ingest API endpoint for all-in-one document ingestion into vector stores. The pipeline handles: Upload -> Chunk -> Embed -> Vector Store.

The implementation uses a provider-specific class architecture where each vector store provider (OpenAI, Bedrock) can override ingestion behavior. For example, OpenAI handles embedding internally when files are attached to vector stores, while other providers may require explicit embedding calls.

Usage

curl -X POST "http://localhost:4000/v1/rag/ingest" \
    -H "Authorization: Bearer sk-1234" \
    -H "Content-Type: application/json" \
    -d "{
        \"file\": {
            \"filename\": \"test_document.txt\",
            \"content\": \"$(base64 -i test_document.txt)\",
            \"content_type\": \"text/plain\"
        },
        \"ingest_options\": {
            \"name\": \"test-basic-ingest\",
            \"vector_store\": {
                \"custom_llm_provider\": \"openai\"
            }
        }
    }

Response

{
  "id": "ingest_abc123",
  "status": "completed",
  "vector_store_id": "vs_xyz789",
  "file_id": "file_123"
}

Query the Ingested Data

curl -X POST "http://localhost:4000/v1/vector_stores/vs_xyz789/search" \
    -H "Authorization: Bearer sk-1234" \
    -H "Content-Type: application/json" \
    -d '{"query": "What is the main topic?"}'## Architecture

Relevant issues

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

🆕 New Feature
✅ Test

Changes

@vercel

vercel Bot commented Nov 26, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
litellm Ready Ready Preview Comment Nov 26, 2025 1:55am

@ishaan-jaff
ishaan-jaff merged commit 5c192a2 into main Nov 26, 2025
7 of 45 checks passed
@ishaan-berri
ishaan-berri deleted the litellm_rag_api branch March 26, 2026 21:55
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
* init RAG api types

* add RAG endpoints

* init main.py for RAG ingest API

* init RecursiveCharacterTextSplitter

* add BaseRAGIngestion

* fix OpenAIRAGIngestion

* fix img handler

* init OpenAIRAGIngestion

* init BedrockRAGIngestion

* init BedrockRAGIngestion

* init rag tests

* init BedrockVectorStoreOptions

* implement BedrockRAGIngestion

* add BaseRAGAPI

* add endpoint for RAG ingest

* add ingest RAG endpoints

* add test doc

* add parse_rag_ingest_request

* update endpoints

* docs add docs for new RAG API

* fix qa check

* fix linting

* docs ficx

* docs

* add max depth checks

* docs anthropic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant