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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
chore(caching): align qdrant scoped miss metadata
user74e93444cf0b
diff --git a/litellm/caching/qdrant_semantic_cache.py b/litellm/caching/qdrant_semantic_cache.pyindex e6e8e255228..e7436e2ca6b 100644--- a/litellm/caching/qdrant_semantic_cache.py+++ b/litellm/caching/qdrant_semantic_cache.py@@ -349,6 +349,7 @@ class QdrantSemanticCache(BaseCache):payload = results[0]["payload"]if not self._payload_matches_cache_key(payload=payload, key=key):print_verbose("Qdrant semantic-cache hit did not match cache key scope")+ kwargs.setdefault("metadata", {})["semantic-similarity"] = 0.0return Nonecached_prompt = payload["text"]diff --git a/tests/test_litellm/caching/test_qdrant_semantic_cache.py b/tests/test_litellm/caching/test_qdrant_semantic_cache.pyindex aa46d180234..71dbd24063e 100644--- a/tests/test_litellm/caching/test_qdrant_semantic_cache.py+++ b/tests/test_litellm/caching/test_qdrant_semantic_cache.py@@ -197,11 +197,15 @@ def test_qdrant_semantic_cache_rejects_unscoped_cache_hit():with patch("litellm.embedding", return_value={"data": [{"embedding": [0.1, 0.2, 0.3]}]}):+ metadata = {}result = qdrant_cache.get_cache(- key="test_key", messages=[{"content": "What is the capital of France?"}]+ key="test_key",+ messages=[{"content": "What is the capital of France?"}],+ metadata=metadata,)assert result is None+ assert metadata["semantic-similarity"] == 0.0def test_qdrant_semantic_cache_payload_index_failure_is_non_blocking():