From be6c850df93ab9a8f9339e11a6cfab8c36268a87 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Wed, 5 Feb 2025 15:35:32 -0800 Subject: [PATCH] fix(o_series_transformation.py): support o3 mini native streaming Fixes https://github.com/BerriAI/litellm/issues/8274 --- litellm/llms/azure/chat/o_series_transformation.py | 7 ++++++- tests/llm_translation/test_azure_o_series.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/litellm/llms/azure/chat/o_series_transformation.py b/litellm/llms/azure/chat/o_series_transformation.py index 2cae4c7cbb1..0ca3a28d23e 100644 --- a/litellm/llms/azure/chat/o_series_transformation.py +++ b/litellm/llms/azure/chat/o_series_transformation.py @@ -35,11 +35,16 @@ class AzureOpenAIO1Config(OpenAIOSeriesConfig): if stream is not True: return False + if ( + model and "o3" in model + ): # o3 models support streaming - https://github.com/BerriAI/litellm/issues/8274 + return False + if model is not None: try: model_info = get_model_info( model=model, custom_llm_provider=custom_llm_provider - ) + ) # allow user to override default with model_info={"supports_native_streaming": true} if ( model_info.get("supports_native_streaming") is True diff --git a/tests/llm_translation/test_azure_o_series.py b/tests/llm_translation/test_azure_o_series.py index 52a5fbd96df..21c4f4e04af 100644 --- a/tests/llm_translation/test_azure_o_series.py +++ b/tests/llm_translation/test_azure_o_series.py @@ -120,7 +120,7 @@ def test_azure_o3_streaming(): ) as e: # expect output translation error as mock response doesn't return a json print(e) assert mock_create.call_count == 1 - assert "stream" not in mock_create.call_args.kwargs + assert "stream" in mock_create.call_args.kwargs def test_azure_o_series_routing():