Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

chore: merge latest staging into RAG retrieval filter

milan5fe2b41bb465
diff --cc litellm/rag/main.py
index 628680e8a62,2dcaa200cc6..eacfffba9ec
--- a/litellm/rag/main.py
+++ b/litellm/rag/main.py
@@@ -233,13 -223,10 +223,13 @@@ async def _execute_query_pipeline
raise ValueError("No query found in messages for RAG query")
# 2. Search vector store
- kwargs_filters = kwargs.pop("filters", None)
- filters = retrieval_config.get("retrieval_filter") or retrieval_config.get("filters") or kwargs_filters
++ kwargs_filters: Final = kwargs.pop("filters", None)
++ filters: Final = retrieval_config.get("retrieval_filter") or retrieval_config.get("filters") or kwargs_filters
with _suppressed_sub_call_billing():
- search_response = await litellm.vector_stores.asearch(
+ search_response: Final = await litellm.vector_stores.asearch(
vector_store_id=retrieval_config["vector_store_id"],
query=query_text,
+ filters=filters,
max_num_results=retrieval_config.get("top_k", 10),
custom_llm_provider=retrieval_config.get("custom_llm_provider", "openai"),
**kwargs,
diff --cc litellm/types/rag.py
index 216c5a611ca,d1b411d8c04..bed3fdfa7e9
--- a/litellm/types/rag.py
+++ b/litellm/types/rag.py
@@@ -243,8 -240,7 +240,8 @@@ class RAGRetrievalConfig(TypedDict, tot
vector_store_id: str
custom_llm_provider: str
top_k: int # max results from vector store
- filters: Optional[Dict[str, Any]] # optional - vector store filters
- retrieval_filter: Optional[Dict[str, Any]] # optional - alias forwarded as vector store filters
+ filters: dict[str, Any] | None # optional - vector store filters
++ retrieval_filter: dict[str, Any] | None # optional - alias forwarded as vector store filters
class RAGRerankConfig(TypedDict, total=False):