fix(issue): DallEAPIWrapper passes unsupported 'quality' param to OpenAI API#179
Merged
Mason Daugherty (mdrxy) merged 1 commit intolangchain-ai:mainfrom Jul 24, 2025
Merged
Conversation
Signed-off-by: Siddarthreddygsr <[email protected]>
Contributor
Author
|
Mason Daugherty (@mdrxy) Can you please review this and suggest any changes if required |
Contributor
There was a problem hiding this comment.
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes #177 , quality parameter will now only be sent if specifically mentioned.