mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
fix(image_gen): keep the provider's echoed size, quality, and output_format on gpt-image responses
This commit is contained in:
parent
4d3c1998af
commit
ec2e35b679
2 changed files with 5 additions and 4 deletions
|
|
@ -82,8 +82,8 @@ class GPTImageGenerationConfig(BaseImageGenerationConfig):
|
|||
)
|
||||
|
||||
# set optional params
|
||||
image_response.size = optional_params.get("size", "1024x1024") # default is always 1024x1024
|
||||
image_response.quality = optional_params.get("quality", "high") # always hd for dall-e-3
|
||||
image_response.output_format = optional_params.get("output_format", "png")
|
||||
image_response.size = image_response.size or optional_params.get("size", "1024x1024")
|
||||
image_response.quality = image_response.quality or optional_params.get("quality", "high")
|
||||
image_response.output_format = image_response.output_format or optional_params.get("output_format", "png")
|
||||
|
||||
return image_response
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ from litellm.types.utils import ImageResponse
|
|||
|
||||
|
||||
@pytest.mark.parametrize("config", [GPTImageGenerationConfig(), AzureGPTImageGenerationConfig()])
|
||||
def test_transform_image_generation_response_reports_requested_output_format(config):
|
||||
def test_transform_image_generation_response_keeps_provider_echo(config):
|
||||
raw_response = httpx.Response(
|
||||
status_code=200,
|
||||
json={
|
||||
|
|
@ -35,4 +35,5 @@ def test_transform_image_generation_response_reports_requested_output_format(con
|
|||
)
|
||||
|
||||
assert image_response.output_format == "jpeg"
|
||||
assert image_response.quality == "low"
|
||||
assert image_response.background == "opaque"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue