Skip to content

feat(ai): ImageConfig and FinishReasons#18180

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

feat(ai): ImageConfig and FinishReasons#18180
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.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

@paulb777 paulb777 changed the title [AI] ImageConfig and FinishReasons feat(ai): ImageConfig and FinishReasons Apr 7, 2026
@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 in the Gemini API, including new FinishReason enum values for image-related stop conditions and the addition of the ImageConfig class with its associated ImageAspectRatio and ImageSize enums. The GenerationConfig has been updated to include an imageConfig field, and corresponding unit tests have been added to verify serialization and parsing. The feedback focuses on adhering to the project's style guide by using const constructors for the new immutable configuration classes and their instances in tests.

@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 in the Gemini API, including new ImageConfig, ImageAspectRatio, and ImageSize types, as well as several new FinishReason enum values. The changes include necessary JSON serialization logic and updated unit tests. Feedback was provided regarding a minor typo in a documentation comment and a recommendation to use package:checks for new test assertions to align with the repository's style guide.

Comment on lines +488 to +508
group('ImageConfig', () {
test('toJson with all fields', () {
const config = ImageConfig(
aspectRatio: ImageAspectRatio.portrait9x16,
imageSize: ImageSize.size2K,
);
expect(config.toJson(), {
'aspectRatio': '9:16',
'imageSize': '2K',
});
});

test('toJson with some fields null', () {
const config = ImageConfig(
aspectRatio: ImageAspectRatio.landscape16x9,
);
expect(config.toJson(), {
'aspectRatio': '16:9',
});
});
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

low

The repository style guide (line 69) recommends using package:checks for assertions instead of package:test's expect. While the existing tests use expect, new tests should ideally follow the updated guidelines.

References
  1. Use package:checks for assertions. (link)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Keeping expect to be consistent with rest of file.

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