Skip to content

fix: response_format is ignored in Azure OpenAI models with API version >= 2025#9244

Closed
shionhonda wants to merge 1 commit intoBerriAI:mainfrom
shionhonda:shionhonda/fix-response-format
Closed

fix: response_format is ignored in Azure OpenAI models with API version >= 2025#9244
shionhonda wants to merge 1 commit intoBerriAI:mainfrom
shionhonda:shionhonda/fix-response-format

Conversation

@shionhonda
Copy link

@shionhonda shionhonda commented Mar 14, 2025

Title

This PR fixes a bug in the function _is_response_format_supported_api_version.
Due to this bug, we are not passing the argument response_format in API version >= 2025.

def _is_response_format_supported_api_version(
self, api_version_year: str, api_version_month: str
) -> bool:
"""
- check if api_version is supported for response_format
"""
is_supported = int(api_version_year) <= 2024 and int(api_version_month) >= 8

I believe it should evaluate true if it is >= "2024-08"

Relevant issues

Pre-Submission checklist

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

I followed the guideline but couldn't make the existing tests pass on the fresh main branch (Failed: Error occurred: litellm.APIError: AzureException APIError - argument of type 'NoneType' is not iterable)

Type

🐛 Bug Fix

Changes

  • _is_response_format_supported_api_version should be true when the API version >= 2025
  • Added test cases

@vercel
Copy link

vercel bot commented Mar 14, 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 Mar 14, 2025 1:22pm

@shionhonda shionhonda changed the title fix response format fix: response_format is ignored in API version >= 2025 Mar 14, 2025
@shionhonda shionhonda marked this pull request as ready for review March 14, 2025 16:37
@shionhonda shionhonda changed the title fix: response_format is ignored in API version >= 2025 fix: response_format is ignored in Azure OpenAI models with API version >= 2025 Mar 17, 2025
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@shionhonda
Copy link
Author

Bug fixed in #9705

@shionhonda shionhonda closed this Jun 2, 2025
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.

2 participants