latestOpenAPI 3.1.02026-08-236994571.1 MB
79928a3d37d3
rag
Rag Query
RAG Query endpoint - search vector store, optionally rerank, and generate LLM response.
This endpoint:
- Extracts the query from the last user message
- Searches the vector store for relevant context
- Optionally reranks the results
- Generates an LLM response with the retrieved context
Example Request:
curl -X POST "http://localhost:4000/v1/rag/query" \
-H "Authorization: Bearer sk-1234" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "What is LiteLLM?"}],
"retrieval_config": {
"vector_store_id": "vs_abc123",
"custom_llm_provider": "openai",
"top_k": 5
}
}'
With Reranking:
curl -X POST "http://localhost:4000/v1/rag/query" \
-H "Authorization: Bearer sk-1234" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "What is LiteLLM?"}],
"retrieval_config": {
"vector_store_id": "vs_abc123",
"custom_llm_provider": "openai",
"top_k": 10
},
"rerank": {
"enabled": true,
"model": "cohere/rerank-english-v3.0",
"top_n": 3
}
}'
post/rag/query
Response
Successful Response
{"stackTrail":"paths:/rag/query:post:responses:200:content:application/json:schema","oasType":"schema","type":"unknown"}