fix: drop effort parameter for Haiku with azure_ai provider - #31188
fix: drop effort parameter for Haiku with azure_ai provider#31188dsteeley wants to merge 8 commits into
Conversation
Greptile SummaryThis PR fixes a 400 error from Azure AI Foundry when
Confidence Score: 5/5Safe to merge — the change is narrowly scoped to stripping an unsupported request parameter for Azure AI Anthropic models and leaves all other request paths untouched. The sanitization logic reads capability flags from the model map rather than hardcoding model names, so it will automatically handle future models without code changes. Both affected transformation paths are covered, tests exercise all branches, and the proof-of-fix curl output confirms the 400 is resolved. No logic regressions or backwards-incompatible changes. No files require special attention.
|
| Filename | Overview |
|---|---|
| litellm/llms/azure_ai/anthropic/output_params_utils.py | New shared utility that strips output_config.effort for models that don't support it; delegates to AnthropicConfig._model_supports_effort_param which reads from the model map — correctly follows the no-hardcoded-model-flags rule. |
| litellm/llms/azure_ai/anthropic/transformation.py | Calls sanitize_azure_anthropic_output_params after the parent transform_request to drop unsupported effort params; straightforward and correctly placed. |
| litellm/llms/azure_ai/anthropic/messages_transformation.py | Same sanitization applied to the Anthropic Messages pass-through path; correctly placed after _remove_scope_from_cache_control. |
| tests/test_litellm/llms/azure_ai/claude/test_azure_anthropic_output_params_utils.py | New unit tests covering all branches of sanitize_azure_anthropic_output_params: drops effort for unsupported models, preserves for supported, handles non-dict and missing output_config. All mock-only, no real network calls. |
| tests/test_litellm/llms/azure_ai/claude/test_azure_anthropic_transformation.py | Adds regression tests for transform_request, verifying effort is stripped for Haiku 4.5 and preserved for Sonnet 4.6. |
| tests/test_litellm/llms/azure_ai/claude/test_azure_anthropic_messages_transformation.py | Adds similar regression tests for the Messages pass-through path; no real network calls. |
Reviews (3): Last reviewed commit: "chore: further markups" | Re-trigger Greptile
…aging' into haiku-azure
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Thanks for the fix, @dsteeley! A couple of things to help move this along:\n- Proof of working — could you share some evidence the fix works? Even a quick before/after snippet showing the 400 error disappearing, a test run output, or a curl example against an Azure AI Haiku model would be great.\n- Triggering a fresh Greptile review against the current head to get an up-to-date score.\n\n@greptileai |
@Sameerlite Here's me running a direct curl against azure_ai before and after my proposed fix. Before: |
Fixes TypeError from the PR BerriAI#31188 test failures and clears the LIT001/LIT011 lint budget violations flagged in output_params_utils.py.
|
Thanks! The messages path is already fixed upstream by #32867, translating effort to legacy thinking. Residual chat-only case is non-standard, so closing. Appreciate the contribution |
Relevant issues
Fixes !31187
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
make test-unit@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer reviewDelays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
CI (LiteLLM team)
Branch creation CI run
Link:
CI run for the last commit
Link:
Merge / cherry-pick CI run
Links:
Screenshots / Proof of Fix
Type
🐛 Bug Fix
Changes
Following the vertex provider fix. Drop
effortwhen sending requests to Azure AI hosted Haiku models.