Skip to content

Conversation

@tomc98
Copy link
Contributor

@tomc98 tomc98 commented Dec 18, 2025

Summary

Gemini 3+ models require thought signatures to be preserved and returned when using function calling with thinking mode enabled. Without this fix, the API returns a 400 error:

Function call is missing a thought_signature in functionCall parts. 
This is required for tools to work correctly, and missing thought_signature may lead to degraded model performance.

Changes

  • Add thoughtSignature optional field to FunctionCall class
  • Capture thoughtSignature from Gemini API response in Google plugin's #parsePart method
  • Include thoughtSignature when converting chat context back to Google format
  • Update isEquivalent to compare thoughtSignature for function calls

Models affected

This fix enables compatibility with:

  • gemini-3-flash-preview
  • gemini-3-flash-lite-preview
  • gemini-3-pro-preview

References

Test plan

  • Build passes
  • Existing tests pass (failures are due to missing API keys, not code changes)
  • Lint passes

@changeset-bot
Copy link

changeset-bot bot commented Dec 18, 2025

⚠️ No Changeset found

Latest commit: 80138a6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@tomc98
Copy link
Contributor Author

tomc98 commented Dec 18, 2025

I also made an issue here #920

@tomc98
Copy link
Contributor Author

tomc98 commented Dec 18, 2025

Wait, I've got a few issues, do not merge

- Add thoughtSignature field to FunctionCall class in chat_context.ts
- Capture thoughtSignature from API response in google plugin llm.ts
- Include thoughtSignature when converting back to Google format
- Preserve thoughtSignature in voice/generation.ts when recreating FunctionCall
- Update @google/genai to v1.34.0 for thoughtSignature support
@tomc98 tomc98 force-pushed the fix/thought-signature-function-calling branch from b99fa73 to 80138a6 Compare December 18, 2025 03:51
@tomc98
Copy link
Contributor Author

tomc98 commented Dec 18, 2025

Ok ready for review :D

@tomc98 tomc98 marked this pull request as draft December 22, 2025 00:17
@tomc98 tomc98 marked this pull request as ready for review December 22, 2025 00:17
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.

1 participant