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

Open
#18,917 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
67/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
dart, firebase, flutter
Domain
api, mobile

Research direction

Start by reading the public part constructors and Part in the firebase_ai package, then check how ChatSession preserves thoughtSignature and how parsePart is exported. Confirm which proposed public API fits the package conventions and add or update focused tests for setting and round-tripping the signature. Done means callers can preserve it across turns without using test-only constructors.

Written by the indexing model from the issue text.

Description

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.
Dominant language
Dart
Stars
9.3k
Forks
4.1k
Avg merge
1d 9h
Merged PRs (30d)
69

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from firebase/flutterfire

All issues in firebase/flutterfire

Similar issues

More Dart issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.