Skip to content

🚀 [firebase_ai] Public way to set thoughtSignature on request parts #18917

Open

Description

@adesinah

What feature would you like to see?

A public way to set thoughtSignature on the parts of a request.

Gemini 3 models return a thoughtSignature on response parts, and the API expects it back on those parts in later turns, otherwise multi-turn function calling with thinking fails. ChatSession handles this internally, but code that builds Content itself (for example a framework keeping its own message history) has no supported way to do it in firebase_ai 5.1.0:

  • Part keeps the signature in a private _thoughtSignature. It can be read back through toJson(), but not set.
  • The public TextPart, InlineDataPart, FileData and FunctionCall constructors pass thoughtSignature: null.
  • Only the @visibleForTesting .forTest constructors accept it, and parsePart isn't exported.

We use the .forTest constructors in the Genkit plugin for Firebase AI Logic (genkit_firebase_ai) to round-trip signatures, which works but relies on test-only API that could change in any release.

Any of these would solve it:

  1. A thoughtSignature named parameter on the public part constructors (and ideally a public thoughtSignature getter on Part).
  2. Exporting parsePart, so a part can be rebuilt from the JSON the API returned.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs AttentionThis issue needs maintainer attention.plugin: ailabel issues for firebase_ai plugintype: enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions