Skip to content

fix(test): update Azure pass-through test after Responses API routing change#22334

Merged
jquinter merged 1 commit intomainfrom
fix/anthropic-passthrough-azure-test
Feb 28, 2026
Merged

fix(test): update Azure pass-through test after Responses API routing change#22334
jquinter merged 1 commit intomainfrom
fix/anthropic-passthrough-azure-test

Conversation

@jquinter
Copy link
Contributor

Summary

  • Commit 99c62ca40e removed "azure" from _RESPONSES_API_PROVIDERS, routing Azure models through litellm.completion instead of litellm.responses
  • The test test_anthropic_experimental_pass_through_messages_handler_dynamic_api_key_and_api_base_and_custom_values was still patching litellm.responses, causing it to fail since the mock was never called
  • Updated the test to patch litellm.completion to match the current routing behavior

Test plan

  • All 7 tests in the file pass locally
  • Verified the failure is pre-existing on main

🤖 Generated with Claude Code

Commit 99c62ca removed "azure" from _RESPONSES_API_PROVIDERS,
routing Azure models through litellm.completion instead of
litellm.responses. The test was not updated to match, causing it
to assert against the wrong mock.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Building Building Preview, Comment Feb 28, 2026 1:59am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 28, 2026

Greptile Summary

Fixes a broken test caused by commit 99c62ca40e, which removed "azure" from _RESPONSES_API_PROVIDERS so that Azure models are routed through litellm.completion (chat/completions path) instead of litellm.responses (Responses API path).

  • Updated test_anthropic_experimental_pass_through_messages_handler_dynamic_api_key_and_api_base_and_custom_values to mock litellm.completion instead of litellm.responses, matching the new routing behavior
  • Updated docstring to reflect that Azure now goes through chat/completions
  • All assertions (api_key, api_base, custom_key forwarding) remain intact and correctly verify the same behavior on the new code path
  • Minor nit: the first test's docstring (line 20) still references "OpenAI and Azure" for the Responses API path, though Azure is no longer routed there

Confidence Score: 5/5

  • This PR is safe to merge — it's a test-only fix that correctly aligns mocking with the current routing behavior.
  • The change is minimal and scoped entirely to a single test file. The mock target change from litellm.responses to litellm.completion is verified correct by inspecting the handler code: Azure falls through to LiteLLMMessagesToCompletionTransformationHandler, which calls litellm.completion. No production code is modified.
  • No files require special attention.

Important Files Changed

Filename Overview
tests/test_litellm/llms/anthropic/experimental_pass_through/messages/test_anthropic_experimental_pass_through_messages_handler.py Updated test to patch litellm.completion instead of litellm.responses for Azure models, correctly reflecting the routing change in _RESPONSES_API_PROVIDERS. Minor stale docstring in an adjacent test.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[anthropic_messages_handler] --> B{_should_route_to_responses_api?}
    B -->|"provider == 'openai'"| C[LiteLLMMessagesToResponsesAPIHandler]
    C --> D["litellm.responses()"]
    B -->|"provider == 'azure' or other"| E[LiteLLMMessagesToCompletionTransformationHandler]
    E --> F["litellm.completion()"]
    
    style B fill:#f9f,stroke:#333,stroke-width:2px
    style F fill:#bbf,stroke:#333,stroke-width:2px,color:#000
    style D fill:#bfb,stroke:#333,stroke-width:2px,color:#000
Loading

Last reviewed commit: 273994b

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 28, 2026

Additional Comments (1)

tests/test_litellm/llms/anthropic/experimental_pass_through/messages/test_anthropic_experimental_pass_through_messages_handler.py
Stale docstring references Azure

The docstring on line 20 still says "OpenAI and Azure models are routed directly to the Responses API", but since commit 99c62ca40e Azure is no longer in _RESPONSES_API_PROVIDERS and routes through litellm.completion instead. Consider updating this to match:

    Test that api key is passed to litellm.responses for OpenAI models.
    OpenAI models are routed directly to the Responses API.

@jquinter
Copy link
Contributor Author

@shin-bot-litellm evaluate this PR

@jquinter jquinter merged commit 332dc32 into main Feb 28, 2026
30 of 35 checks passed
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.

1 participant