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_streaming_response
Ishaan Jaffer6e46824939da
diff --git a/tests/llm_translation/test_openai.py b/tests/llm_translation/test_openai.pyindex 716a679f484..55d2d3953c6 100644--- a/tests/llm_translation/test_openai.py+++ b/tests/llm_translation/test_openai.py@@ -337,7 +337,7 @@ def test_openai_max_retries_0(mock_get_openai_client):assert mock_get_openai_client.call_args.kwargs["max_retries"] == 0[email protected]("model", ["o1", "o1-mini", "o3-mini"])[email protected]("model", ["o1", "o3-mini"])def test_o1_parallel_tool_calls(model):litellm.completion(model=model,diff --git a/tests/llm_translation/test_openai_o1.py b/tests/llm_translation/test_openai_o1.pyindex 76e3cde8b72..47fd145317f 100644--- a/tests/llm_translation/test_openai_o1.py+++ b/tests/llm_translation/test_openai_o1.py@@ -210,7 +210,7 @@ def test_o3_reasoning_effort():assert resp.choices[0].message.content is not None[email protected]("model", ["o1-mini", "o1", "o3-mini"])[email protected]("model", ["o1", "o3-mini"])def test_streaming_response(model):"""Test that streaming response is returned correctly"""from litellm import completiondiff --git a/tests/local_testing/test_openai_moderations_hook.py b/tests/local_testing/test_openai_moderations_hook.pyindex c63ce342b25..5d2cab38b33 100644--- a/tests/local_testing/test_openai_moderations_hook.py+++ b/tests/local_testing/test_openai_moderations_hook.py@@ -28,13 +28,15 @@ from litellm.caching.caching import DualCache@pytest.mark.asyncio-async def test_openai_moderation_error_raising():+async def test_openai_moderation_error_raising(monkeypatch):"""Tests to see OpenAI Moderation raises an error for a flagged response"""-+ from unittest.mock import AsyncMock, MagicMock+ from litellm.types.llms.openai import OpenAIModerationResponse++ litellm.openai_moderations_model_name = "text-moderation-latest"openai_mod = _ENTERPRISE_OpenAI_Moderation()- litellm.openai_moderations_model_name = "omni-moderation-latest"_api_key = "sk-12345"_api_key = hash_token("sk-12345")user_api_key_dict = UserAPIKeyAuth(api_key=_api_key)@@ -45,15 +47,24 @@ async def test_openai_moderation_error_raising():llm_router = litellm.Router(model_list=[{- "model_name": "omni-moderation-latest",+ "model_name": "text-moderation-latest","litellm_params": {- "model": "omni-moderation-latest",- "api_key": os.environ["OPENAI_API_KEY"],+ "model": "text-moderation-latest",+ "api_key": os.environ.get("OPENAI_API_KEY", "fake-key"),},}])+ # Mock the amoderation call to return a flagged response+ mock_response = MagicMock(spec=OpenAIModerationResponse)+ mock_response.results = [MagicMock(flagged=True)]++ async def mock_amoderation(*args, **kwargs):+ return mock_response++ llm_router.amoderation = mock_amoderation+setattr(litellm.proxy.proxy_server, "llm_router", llm_router)try: