Skip to content

test(provider/google): add thoughtSignature cross-namespace regression tests#12576

Open
dancer wants to merge 3 commits intomainfrom
josh/thoughtsignature-tests
Open

test(provider/google): add thoughtSignature cross-namespace regression tests#12576
dancer wants to merge 3 commits intomainfrom
josh/thoughtsignature-tests

Conversation

@dancer
Copy link
Collaborator

@dancer dancer commented Feb 13, 2026

background

follow-up to #12403 - customers reported issues with gemini models on ai gateway when switching between google and vertex providers. the thoughtSignature metadata was stored under different namespace keys (google vs vertex), causing failures on multi-turn tool call conversations. adding regression tests and examples to prevent future breakage

summary

  • add unit tests verifying thoughtSignature is correctly included in the API request body for multi-turn tool call conversations
  • cover both google and vertex (cross-namespace) providers in doGenerate and doStream
  • add cross-namespace multi-turn test in conversion layer (vertex providerOptionsName resolving google-namespaced thoughtSignature through full tool call flow)
  • add 4 example scripts exercising thinking roundtrip with gemini-3-flash-preview:
    • generate-text/google-thinking-roundtrip.ts (direct google)
    • generate-text/gateway-google-thinking-roundtrip.ts (via gateway)
    • stream-text/google-thinking-roundtrip.ts (direct google)
    • stream-text/gateway-google-thinking-roundtrip.ts (via gateway)

verification

all google package tests pass (260 tests)
 ✓ src/convert-to-google-generative-ai-messages.test.ts  (19 tests) 9ms
 ✓ src/google-generative-ai-language-model.test.ts  (117 tests) 127ms
 ...
 Test Files  10 passed (10)
      Tests  260 passed (260)
all 4 examples complete multi-step tool calls with thoughtSignature
# direct google generateText
Text: The current temperature in San Francisco is 72°F.
Steps: 2
Provider metadata: {"google":{"thoughtSignature":"ErwDCrkDAb4+9v..."}}

# gateway generateText (routes to vertex)
Text: The weather in San Francisco is 72°F.
Steps: 2
Provider metadata: {"vertex":{"thoughtSignature":"CvMBAY89a1+ttw..."}}

# direct google streamText
Tool call: weather { location: 'San Francisco, CA' }
Steps: 2
Provider metadata: {"google":{"thoughtSignature":"EjQKMgG+Pvb7MP..."}}

# gateway streamText (routes to vertex)
Tool call: weather { location: 'San Francisco, CA' }
Steps: 2
Provider metadata: {"vertex":{"thoughtSignature":"CiQBjz1rX23pak..."}}

checklist

  • tests have been added / updated (for bug fixes / features)
  • documentation has been added / updated (for bug fixes / features)
  • a patch changeset for relevant packages has been added (run pnpm changeset in root)
  • i have reviewed this pull request (self-review)

related issues

follow-up to #12403

…ests

add tests verifying thoughtSignature is correctly included in API
request body for multi-turn tool call conversations, covering both
google and vertex (cross-namespace) providers in doGenerate and doStream
add generateText and streamText examples that exercise multi-step
tool calls with thoughtSignature on gemini-3-flash-preview, both
direct google provider and via ai gateway
only: ['google'],
},
vertex: {
safetySettings: [
Copy link
Contributor

Choose a reason for hiding this comment

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

the combination of passing vertex providerOptions to the google provider fails passing those options. when you run this example, you will notice that no safety ratings are set.

however passing google providerOptions to vertex provider will work, and the safety ratings will be observed.

Solution:
the conversion of the key from vertex to google needs to happen when gateway falls back to google provider from vertex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/provider provider/amazon-bedrock Issues related to the @ai-sdk/amazon-bedrock provider provider/anthropic

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants