Skip to content

feat: Add MALFORMED_RESPONSE to FinishReason - #3286

Merged
copybara-service[bot] merged 1 commit into
mainfrom
copybara/1003216252
Nov 5, 2026
Merged

copybara-service[bot] merged 1 commit into
mainfrom
copybara/1003216252

Conversation

@copybara-service

Copy link
Copy Markdown

feat: Add MALFORMED_RESPONSE to FinishReason

Java: GenerateContentResponse.text(), parts() and the other helpers that call checkFinishReason() now throw IllegalArgumentException for MALFORMED_RESPONSE, as they already do for MALFORMED_FUNCTION_CALL. Previously the value mapped to FINISH_REASON_UNSPECIFIED and did not throw.

fixes #2937

@copybara-service
copybara-service Bot force-pushed the copybara/1003216252 branch 3 times, most recently from 5fc7241 to 8e7d990 Compare November 5, 2026 20:17
Java: GenerateContentResponse.text(), parts() and the other helpers that call checkFinishReason() now throw IllegalArgumentException for MALFORMED_RESPONSE, as they already do for MALFORMED_FUNCTION_CALL. Previously the value mapped to FINISH_REASON_UNSPECIFIED and did not throw.

fixes #2937

PiperOrigin-RevId: 1014922475
@copybara-service
copybara-service Bot merged commit 6eb8523 into main Nov 5, 2026
1 check passed
@copybara-service
copybara-service Bot deleted the copybara/1003216252 branch November 5, 2026 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FinishReason enum is missing MALFORMED_RESPONSE, which the API actually returns

1 participant