Conversation
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Using Gemini Code AssistThe 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
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 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. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request adds several new FinishReason cases, primarily related to image generation and tool usage, and includes corresponding integration tests. The changes are generally good, but I've identified a minor grammatical error in a documentation comment and a more significant issue in one of the new integration tests. The test for Imagen safety filtering is incorrectly structured and will fail as it doesn't account for an expected error being thrown. I've provided a corrected implementation for the test.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request adds several new FinishReason cases to the SDK, along with corresponding unit and integration tests. The changes to the FinishReason enum and the new integration test for Gemini models are well-implemented. However, I've identified a logical issue in the new Imagen integration test and an opportunity to improve maintainability in the new unit test for decoding finish reasons. My detailed feedback is in the comments below.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request adds several new FinishReason cases to handle more scenarios, particularly around image generation and tool calls. The changes include updating the FinishReason enum and its corresponding static properties. New unit tests are added to verify the decoding of these new reasons, and a new integration test is introduced to check the imageSafety finish reason. The changes are well-implemented and tested. I have one minor suggestion to improve the new unit test's maintainability.
1a6b378 to
c6df95a
Compare
c6df95a to
ed81ec3
Compare
ed81ec3 to
7573ed6
Compare
|
Integration test failures look like flakes |
andrewheard
left a comment
There was a problem hiding this comment.
I did a super quick pass and LGTM. Just noticed the one changelog entry issue.
Co-authored-by: Andrew Heard <andrewheard@google.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Daymon <17409137+daymxn@users.noreply.github.com> Co-authored-by: Daymon <daymxn@google.com>
PR Review: [AI] Finish Reasons #15931
This pull request, [AI] Finish Reasons #15931, introduces support for expanded
FinishReasonvalues and a newfinishMessageproperty within theFirebaseAISDK. These changes aim to provide more granular feedback when the model stops generating content, particularly for image generation and tool-use scenarios.Key Changes
1. Enhanced Model Response Metadata
New Property: Added
finishMessageto theCandidatestruct. This is a human-readable string explaining why the model stopped generating.Expanded Enums: The
FinishReasonenum now includes several new cases:imageSafety,imageProhibitedContent,imageOther,noImage, andimageRecitation.unexpectedToolCall,tooManyToolCalls,missingThoughtSignature, andmalformedResponse.language(for unsupported languages).2. Testing and Validation
Integration Tests: Added a new test
generateContent_finishReason_imageSafetyto verify that prompts triggering safety violations (e.g., "A graphic image of violence") correctly return the expectedimageSafetyornoImagereasons.Unit Tests: * Added decoding tests to ensure all new
FinishReasonstrings from the API are mapped correctly.isEmptylogic to ensure a candidate is not considered empty if it contains afinishMessage.3. Documentation
CHANGELOG.mdto reflect these new features, noting the added support for image generation safety reasons and tool-use feedback.