[google gen ai, vertexai] Important fixes (GoogleGenAiChatModel thoughts, JsonSchemaConverter nullable types and defs)#5211
Closed
viacheslav-dobrynin wants to merge 8 commits into
Conversation
212fc92 to
6b05a21
Compare
|
Is there any chance or timeline to support thought_signatures in VertexAiGeminiChatModel.java ? |
Contributor
Author
|
@ilayaperumalg, I can break this PR into multiple smaller PRs if that would be more convenient for review and delivery. |
3f800cf to
260d3bc
Compare
Signed-off-by: Viacheslav Dobrynin <w.v.dobr@gmail.com> # Conflicts: # models/spring-ai-google-genai/src/main/java/org/springframework/ai/google/genai/schema/JsonSchemaConverter.java # models/spring-ai-vertex-ai-gemini/src/main/java/org/springframework/ai/vertexai/gemini/schema/JsonSchemaConverter.java
Signed-off-by: Viacheslav Dobrynin <w.v.dobr@gmail.com>
…ogle doesn't support it Details: https://ai.google.dev/gemini-api/docs/structured-output?example=recipe#type-specific_properties, https://docs.cloud.google.com/vertex-ai/generative-ai/docs/multimodal/control-generated-output#fields Signed-off-by: Viacheslav Dobrynin <w.v.dobr@gmail.com>
Signed-off-by: Viacheslav Dobrynin <w.v.dobr@gmail.com>
Signed-off-by: Viacheslav Dobrynin <w.v.dobr@gmail.com>
Signed-off-by: Viacheslav Dobrynin <w.v.dobr@gmail.com>
Signed-off-by: Viacheslav Dobrynin <w.v.dobr@gmail.com>
- Change switchMap to concatMap to prevent dropping streaming chunks - Ensure thought_signatures from all chunks are collected before building conversation history for subsequent tool calling steps Signed-off-by: Viacheslav Dobrynin <w.v.dobr@gmail.com>
9a6a8dc to
993e0d8
Compare
Contributor
|
I believe this PR resolves the following issue: To fix the |
ericbottard
pushed a commit
that referenced
this pull request
Mar 12, 2026
- filter thoughts from model output - validate that input json schema doesn't contain $defs since google doesn't support it Details: https://ai.google.dev/gemini-api/docs/structured-output?example=recipe#type-specific_properties, https://docs.cloud.google.com/vertex-ai/generative-ai/docs/multimodal/control-generated-output#fields - don't skip thought but mark with flag in metadata - prevent missing thought_signature errors in streaming tool calls - Change switchMap to concatMap to prevent dropping streaming chunks - Ensure thought_signatures from all chunks are collected before building conversation history for subsequent tool calling steps Signed-off-by: Viacheslav Dobrynin <w.v.dobr@gmail.com> Original PR: #5211
Member
|
Thanks for your contribution @viacheslav-dobrynin ! Merged on main as f7ccb10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR includes several fixes:
include-thoughtstotrueto enablethought_signatures, but the model also return them in the visible output.JsonSchemaConverter: Disallow
$defs/$ref. Google’s supported OpenAPI schema subset does not support definitions and references, so forbidding them avoids unexpected behavior.JsonSchemaConverter: Handle nullable types via
nullable: true. Google’s OpenAPI schema (3.0.3) does not support nullable union types (e.g.,["null", T]), so we convert them tonullable: true.vertexai.JsonSchemaConverterTests: Add missing tests by porting them from
genai.JsonSchemaConverterTests.MessageAggregator: Add separated thoughts and output metadata to the aggregated message.