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
Fix pytest event loop warning (#10512)
Marc Abramowitz2f3f07607953
diff --git a/litellm/caching/llm_caching_handler.py b/litellm/caching/llm_caching_handler.pyindex 3bf1f80d088..16eb824f4c9 100644--- a/litellm/caching/llm_caching_handler.py+++ b/litellm/caching/llm_caching_handler.py@@ -14,10 +14,10 @@ class LLMClientCache(InMemoryCache):If none, use the key as is."""try:- event_loop = asyncio.get_event_loop()+ event_loop = asyncio.get_running_loop()stringified_event_loop = str(id(event_loop))return f"{key}-{stringified_event_loop}"- except Exception: # handle no current event loop+ except RuntimeError: # handle no current running event loopreturn keydef set_cache(self, key, value, **kwargs):