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
test_custom_callback_router.py
Ishaan Jaffer9790451ccecf
diff --git a/tests/logging_callback_tests/test_custom_callback_router.py b/tests/logging_callback_tests/test_custom_callback_router.pyindex 91d79619196..27d9e17edf0 100644--- a/tests/logging_callback_tests/test_custom_callback_router.py+++ b/tests/logging_callback_tests/test_custom_callback_router.py@@ -605,9 +605,9 @@ async def test_async_completion_azure_caching():unique_time = time.time()model_list = [{- "model_name": "gpt-3.5-turbo", # openai model name+ "model_name": "gpt-4.1-nano", # openai model name"litellm_params": { # params for litellm completion/embedding call- "model": "azure/chatgpt-v-3",+ "model": "azure/gpt-4.1-nano","api_key": os.getenv("AZURE_API_KEY"),"api_version": os.getenv("AZURE_API_VERSION"),"api_base": os.getenv("AZURE_API_BASE"),@@ -626,7 +626,7 @@ async def test_async_completion_azure_caching():]router = Router(model_list=model_list) # type: ignoreresponse1 = await router.acompletion(- model="gpt-3.5-turbo",+ model="gpt-4.1-nano",messages=[{"role": "user", "content": f"Hi 👋 - i'm async azure {unique_time}"}],@@ -635,7 +635,7 @@ async def test_async_completion_azure_caching():await asyncio.sleep(1)print(f"customHandler_caching.states pre-cache hit: {customHandler_caching.states}")response2 = await router.acompletion(- model="gpt-3.5-turbo",+ model="gpt-4.1-nano",messages=[{"role": "user", "content": f"Hi 👋 - i'm async azure {unique_time}"}],@@ -652,6 +652,7 @@ async def test_async_completion_azure_caching():@pytest.mark.asyncioasync def test_async_completion_azure_caching_streaming():import copy+ import uuidlitellm.set_verbose = TruecustomHandler_caching = CompletionCustomHandler()@@ -664,7 +665,7 @@ async def test_async_completion_azure_caching_streaming():litellm.callbacks = [customHandler_caching]unique_time = uuid.uuid4()response1 = await litellm.acompletion(- model="azure/chatgpt-v-3",+ model="azure/gpt-4.1-nano",messages=[{"role": "user", "content": f"Hi 👋 - i'm async azure {unique_time}"}],@@ -677,7 +678,7 @@ async def test_async_completion_azure_caching_streaming():initial_customhandler_caching_states = len(customHandler_caching.states)print(f"customHandler_caching.states pre-cache hit: {customHandler_caching.states}")response2 = await litellm.acompletion(- model="azure/chatgpt-v-3",+ model="azure/gpt-4.1-nano",messages=[{"role": "user", "content": f"Hi 👋 - i'm async azure {unique_time}"}],@@ -710,13 +711,13 @@ async def test_async_embedding_azure_caching():litellm.callbacks = [customHandler_caching]unique_time = time.time()response1 = await litellm.aembedding(- model="azure/azure-embedding-model",+ model="azure/text-embedding-ada-002",input=[f"good morning from litellm1 {unique_time}"],caching=True,)await asyncio.sleep(1) # set cache is async for aembedding()response2 = await litellm.aembedding(- model="azure/azure-embedding-model",+ model="azure/text-embedding-ada-002",input=[f"good morning from litellm1 {unique_time}"],caching=True,)