Skip to content

[AI] ImageConfig and FinishReasons#1422

Draft
paulb777 wants to merge 5 commits intomainfrom
pb-nanobanana-image-config
Draft

[AI] ImageConfig and FinishReasons#1422
paulb777 wants to merge 5 commits intomainfrom
pb-nanobanana-image-config

Conversation

@paulb777
Copy link
Copy Markdown
Member

@paulb777 paulb777 commented Apr 7, 2026

Replicating changes from iOS SDK for ImageConfig and expanded FinishReasons.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for image generation configuration and expands the FinishReason enum to include image-related and other new termination reasons. Key changes include the addition of an ImageConfig struct to manage aspect ratios and image sizes, the integration of this configuration into GenerationConfig, and updates to the response parsing logic to handle the expanded set of finish reasons. Feedback focuses on improving the robustness of enum-to-string conversions in ImageConfig.cs by explicitly handling all cases or throwing exceptions for unknown values instead of relying on default string representations which might be incompatible with the backend API.

@paulb777
Copy link
Copy Markdown
Member Author

paulb777 commented Apr 8, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for image generation configuration and expands the FinishReason enum to include image-related statuses. It introduces the ImageConfig struct, allowing users to specify aspect ratios and image sizes, and integrates this into GenerationConfig. Automated tests were also added to verify the new functionality. Review feedback recommends implementing IEquatable for the new structs to optimize equality checks and adding null validation during JSON serialization to ensure robust API requests.

@paulb777
Copy link
Copy Markdown
Member Author

paulb777 commented Apr 8, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for image generation configuration and expanded finish reasons within the Firebase AI SDK. Key changes include the addition of the ImageConfig struct for defining aspect ratios and image sizes, the integration of this configuration into GenerationConfig, and the expansion of the FinishReason enum to handle new model response statuses such as image safety violations and malformed responses. Automated tests were also added to verify the serialization and parsing of these new components. The review feedback suggests minor refactorings to improve the clarity and efficiency of null-handling and property access during JSON serialization.

@paulb777
Copy link
Copy Markdown
Member Author

paulb777 commented Apr 8, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for image generation configuration and expands the set of finish reasons in the Firebase AI SDK. Key changes include the addition of the ImageConfig struct for specifying aspect ratios and image sizes, updates to GenerationConfig to include these settings, and the inclusion of several new FinishReason enum values related to image generation and tool calls. Corresponding unit tests were added to verify the serialization of the new configuration and the parsing of the expanded finish reasons. I have no feedback to provide.

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.

1 participant