-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Enhance parameter filtering in get_optional_params_image_gen to prevent unsupported parameters from being added to extra_body for Azure GPT image generation #15077
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
base: main
Are you sure you want to change the base?
Conversation
…nt unsupported parameters from being added to extra_body for Azure GPT image generation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
hi @Dashing-Nelson, thank you for this PR! i think we already have a reusable function for this logic - why not use that? Also - your currently failing linting - if you can look into that, that'd be great! |
…arameters for improved handling of unsupported arguments
…for image generation by introducing helper functions for provider-specific logic
…rams variable and streamline argument validation logic
…arameters for improved handling of unsupported arguments
…image_gen function, streamlining parameter processing for image generation
…or_image_gen function, enhancing filtering of provider-specific parameters for image generation
@krrishdholakia I have made use of the function and modified I also noticed that linting and the test cases are failing for functions that are not related to mine. |
…ams with dropped_params for improved handling of unsupported parameters
Title
This pull request improves parameter handling for Azure GPT image generation models to prevent unsupported parameters from being included in API requests, which previously could cause errors. It also adds a new test to ensure this behavior is maintained.
Parameter filtering improvements:
_check_valid_arg
inlitellm/utils.py
to filter out unsupported parameters frompassed_params
whendrop_params
is enabled, ensuring only supported parameters are included in API requests. This prevents issues like sendingresponse_format
to Azure'sgpt-image-1
model, which can result in 400 Bad Request errors.Testing enhancements:
test_azure_gpt_image_1_no_extra_body_injection
intests/test_litellm/test_utils.py
to verify that unsupported parameters (such asresponse_format
) are dropped and not injected intoextra_body
when using provider config with Azure GPT image generation, and that supported parameters are preserved.Relevant issues
Fixes #15028
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
tests/litellm/
directory, Adding at least 1 test is a hard requirement - see detailsmake test-unit
Type
🐛 Bug Fix
Changes
Azure OpenAI Reject Image Generation Payload Due to extra_body Injection in LiteLLM v1.77.3 for gpt-image-1