Skip to content

feat(google): add thought_signature support for Gemini 2.0+#112

Open
Gabbosaur wants to merge 1 commit intodatapizza-labs:mainfrom
Gabbosaur:feature/thought-signature-support
Open

feat(google): add thought_signature support for Gemini 2.0+#112
Gabbosaur wants to merge 1 commit intodatapizza-labs:mainfrom
Gabbosaur:feature/thought-signature-support

Conversation

@Gabbosaur
Copy link

@Gabbosaur Gabbosaur commented Feb 19, 2026

Summary

Add support for thought_signature in Google/Gemini client to enable function calling with Gemini 2.0+ models.

Problem

Gemini 2.0 and newer models (including gemini-2.0-flash) require thought_signature to be preserved and returned during multi-turn function calling conversations. Without this, the API returns:

400 INVALID_ARGUMENT: Function call is missing a thought_signature in functionCall parts.

Solution

  1. FunctionCallBlock - Added optional thought_signature field
  2. GoogleClient._response_to_client_response - Extract thought_signature from response parts
  3. GoogleMemoryAdapter._turn_to_message - Include thought_signature when converting back to API format

Changes

  • datapizza-ai-core/datapizza/type/type.py
  • datapizza-ai-clients-google/datapizza/clients/google/google_client.py
  • datapizza-ai-clients-google/datapizza/clients/google/memory_adapter.py

References

Testing

Tested with gemini-2.0-flash model using multi-turn function calling.

Copy link
Contributor

@Federaffo Federaffo left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution. The PR currently fails CI due to formatting only: (blank line contains whitespace) in

Can you run the repo pre-commit pipeline locally and push the formatting fix?

Suggested commands:

  • uvx ruff check . --fix
  • pre-commit run --all-files

Copy link
Contributor

@Federaffo Federaffo left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution. The PR currently fails CI due to formatting only:\n\n- W293 (blank line contains whitespace) in datapizza-ai-clients/datapizza-ai-clients-google/datapizza/clients/google/google_client.py:620\n\nCan you run the repo pre-commit pipeline locally and push the formatting fix?\nSuggested commands:\n- uvx ruff check . --fix\n- pre-commit run --all-files

@Federaffo Federaffo dismissed their stale review February 23, 2026 11:09

Dismissing accidental duplicate review caused by command formatting.

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.

2 participants