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]

refactor(cache-qdrant-semantic): reuse immutable indexing params

Yujong Leea4fda8f0d807
diff --git a/litellm/caching/qdrant_semantic_cache.py b/litellm/caching/qdrant_semantic_cache.py
index 64764ce402c..b99023c07fd 100644
--- a/litellm/caching/qdrant_semantic_cache.py
+++ b/litellm/caching/qdrant_semantic_cache.py
@@ -12,6 +12,7 @@ import ast
import asyncio
import json
import os
+from types import MappingProxyType
from typing import TYPE_CHECKING, Any, Final, Protocol, cast
import litellm
@@ -36,6 +37,8 @@ from ._embedding_router import (
)
from .base_cache import BaseCache
+_WAIT_FOR_INDEXING: Final = MappingProxyType({"wait": "true"})
+
if TYPE_CHECKING:
from litellm.router import Router
@@ -313,7 +316,7 @@ class QdrantSemanticCache(BaseCache):
self.sync_client.put(
url=f"{self.qdrant_api_base}/collections/{self.collection_name}/points",
headers=self.headers,
- params={"wait": "true"}, # mutable-ok: Qdrant requires an explicit indexing wait
+ params=_WAIT_FOR_INDEXING,
json=data,
)
@@ -423,7 +426,7 @@ class QdrantSemanticCache(BaseCache):
await self.async_client.put(
url=f"{self.qdrant_api_base}/collections/{self.collection_name}/points",
headers=self.headers,
- params={"wait": "true"}, # mutable-ok: Qdrant requires an explicit indexing wait
+ params=_WAIT_FOR_INDEXING,
json=data,
)