Skip to content

Add mock-responses with finish message#61

Merged
milaGGL merged 1 commit into
mainfrom
mila-finish-message
Apr 27, 2026
Merged

Add mock-responses with finish message#61
milaGGL merged 1 commit into
mainfrom
mila-finish-message

Conversation

@milaGGL
Copy link
Copy Markdown
Collaborator

@milaGGL milaGGL commented Apr 27, 2026

No description provided.

@github-actions
Copy link
Copy Markdown

Coverage Diff

Coverage is identical

Copy link
Copy Markdown

@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 new mock response files for the Google AI (Gemini) API, covering both streaming success and unary failure scenarios. The review feedback highlights that the finishMessage field is non-standard for the Gemini API and should be removed to ensure the mocks accurately reflect the actual API schema. Additionally, it is recommended to include standard fields such as modelVersion and usageMetadata for consistency.

@@ -0,0 +1,3 @@
data: {"candidates": [{"content": {"parts": [{"text": "Hello"}],"role": "model"}}],"modelVersion": "gemini-2.0-flash"}

data: {"candidates": [{"content": {"parts": [{"text": " world!"}],"role": "model"},"finishReason": "STOP","finishMessage": "Finished successfully"}],"modelVersion": "gemini-2.0-flash"}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The finishMessage field is not a standard part of the Google AI (Gemini) API response schema for a Candidate. Standard fields include content, finishReason, safetyRatings, etc. If this mock is intended to represent the raw API response, consider removing this field to maintain accuracy.

data: {"candidates": [{"content": {"parts": [{"text": " world!"}],"role": "model"},"finishReason": "STOP"}],"modelVersion": "gemini-2.0-flash"}

Comment on lines +1 to +8
{
"candidates": [
{
"finishReason": "OTHER",
"finishMessage": "Model failed to generate content due to internal error."
}
]
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Similar to the streaming mock, finishMessage is not a standard field in the Gemini API. Additionally, for consistency with other mock responses in this repository (such as the Vertex AI examples), it is recommended to include the modelVersion and usageMetadata fields while removing the non-standard finishMessage.

Suggested change
{
"candidates": [
{
"finishReason": "OTHER",
"finishMessage": "Model failed to generate content due to internal error."
}
]
}
{
"candidates": [
{
"finishReason": "OTHER"
}
],
"usageMetadata": {
"promptTokenCount": 0,
"totalTokenCount": 0
},
"modelVersion": "gemini-2.0-flash"
}

Copy link
Copy Markdown
Collaborator

@rlazo rlazo left a comment

Choose a reason for hiding this comment

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

Feel free to submit, ignore Android test

@milaGGL milaGGL merged commit 2d6adfd into main Apr 27, 2026
9 of 10 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.

2 participants