Skip to content

Comments

fix(issue): DallEAPIWrapper passes unsupported 'quality' param to OpenAI API#179

Merged
Mason Daugherty (mdrxy) merged 1 commit intolangchain-ai:mainfrom
siddarthreddygsr:main
Jul 24, 2025
Merged

fix(issue): DallEAPIWrapper passes unsupported 'quality' param to OpenAI API#179
Mason Daugherty (mdrxy) merged 1 commit intolangchain-ai:mainfrom
siddarthreddygsr:main

Conversation

@siddarthreddygsr
Copy link
Contributor

This PR fixes #177 , quality parameter will now only be sent if specifically mentioned.

@siddarthreddygsr
Copy link
Contributor Author

Mason Daugherty (@mdrxy) Can you please review this and suggest any changes if required

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes issue #177 by modifying the DALL-E image generator to only include the quality parameter in API calls when it's explicitly set by the user, rather than always sending a default "standard" value.

  • Changed the default quality parameter from "standard" to None
  • Updated the API call logic to conditionally include the quality parameter only when it has a value
Comments suppressed due to low confidence (2)

libs/community/langchain_community/utilities/dalle_image_generator.py:144

  • [nitpick] The variable name 'kwargs' is generic and doesn't clearly describe its purpose. Consider renaming it to 'api_params' or 'generation_params' to better indicate it contains parameters for the image generation API call.
            kwargs = {

libs/community/langchain_community/utilities/dalle_image_generator.py:152

  • The new conditional logic for including the quality parameter should be covered by unit tests. Tests should verify that: 1) when quality is None, the parameter is not sent to the API, and 2) when quality has a value, it is properly included in the API call.
            response = self.client.generate(**kwargs)

@mdrxy Mason Daugherty (mdrxy) changed the title fix(issue): Fixing issue #177 fix(issue): DallEAPIWrapper passes unsupported 'quality' param to OpenAI API Jul 24, 2025
@mdrxy Mason Daugherty (mdrxy) enabled auto-merge (squash) July 24, 2025 13:59
@mdrxy Mason Daugherty (mdrxy) merged commit 22e4798 into langchain-ai:main Jul 24, 2025
13 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.

DallEAPIWrapper passes unsupported 'quality' param to OpenAI API

2 participants