Backport: fix(google): emit no-args streaming tool calls and preserve thoughtSignature#15136
Merged
Merged
Conversation
…gnature (#14968) ## Background Vertex emits a no-args function call as a single chunk shaped `{ functionCall: { name: 'X' } }` with no `args`, no `partialArgs`, and no `willContinue`. The streaming parser in `google-language-model.ts` classifies chunks into `isStreamingChunk` / `isTerminalChunk` / `isCompleteCall`, and a no-args call matches none of them — so it falls through and is silently dropped. The unary (`doGenerate`) path has the same drop because of an `args != null` guard. For Gemini 3 thinking models that one dropped chunk also carries the response's `thoughtSignature`. Vertex enforces a multi-turn rule: an assistant turn containing any function calls must contain at least one with a `thoughtSignature`. When the dropped call is the first call (the one with the sig), the next agent step 400s with `missing thought_signature`. ## Summary - Streaming path: add a fourth classifier `isNoArgsCompleteCall` that matches `{ name: X }` with no `args` / `partialArgs` / `willContinue !== true`, and emit `tool-input-start` → `tool-input-end` → `tool-call` with `'{}'` input, propagating `providerMetadata` (so `thoughtSignature` survives). - Unary path: stop requiring `args != null`. Use `JSON.stringify(args ?? {})` so a no-args complete call from `doGenerate` is also emitted instead of dropped. ## Manual Verification See #14968 description --- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Rayan Salhab <cyphercodes@users.noreply.github.com> Co-authored-by: Paul Elliot <paulelliotco@users.noreply.github.com>
5 tasks
gr2m
approved these changes
May 8, 2026
Fix CI failures on the backported #14968 test by: - Renaming GoogleLanguageModel → GoogleGenerativeAILanguageModel (the v6.0 class name). - Dropping the googleVertex providerMetadata key assertion. The dual-key (googleVertex + vertex) helper is a separate refactor that only exists on main; v6.0 emits a single vertex key. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Author
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 is an automated backport of #14968 to the release-v6.0 branch. FYI @gr2m