Skip to content

fix: enable native streaming for Azure o4 models #12167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

colesmcintosh
Copy link
Collaborator

Title

Enable native streaming for Azure o4 models

Relevant issues

Fixes #12150

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

🐛 Bug Fix

Changes

  • Updated should_fake_stream method in litellm/llms/azure/chat/o_series_transformation.py to return False for o4 models (including o4-mini)
  • Azure o4 models now support native streaming per Microsoft documentation
  • Added tests to verify o4 streaming behavior in tests/llm_translation/test_azure_o_series.py

Test Results

Tests pass successfully:

tests/llm_translation/test_azure_o_series.py::test_should_fake_stream_for_o4_models PASSED
tests/llm_translation/test_azure_o_series.py::test_azure_o3_streaming PASSED
tests/llm_translation/test_azure_o_series.py::test_azure_o4_streaming PASSED

Changes Summary

  1. Modified should_fake_stream to check for both "o3" and "o4" in model names
  2. Updated docstring to reflect that both O3 and O4 support native streaming
  3. Added comprehensive tests for o4 streaming behavior

- Update should_fake_stream to return False for o4 models (o4-mini, o4)
- Azure o4 models now support native streaming per Microsoft documentation
- Add tests to verify o4 streaming behavior

Fixes BerriAI#12150
Copy link

vercel bot commented Jun 30, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 30, 2025 3:33pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Azure Uses Fake Streaming for o4-mini and o3, Which Support True Streaming
1 participant