🚀 [firebase_ai] Support system/context message turns in chat history for backend or memory updates
メンテナーはふだん 4 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 28/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 領域
- ai, api, mobile-dev
調査の方向性
package/firebase_ai/src/developer/api.dart、特に DeveloperSerialization.parseGenerateContentResponse から始め、issue で説明されている chat-history API を使って、報告された Content.system() エラーを再現してください。既存の user、model、system-instruction、FunctionResponse の処理を比較してください。完了条件は、backend または memory のイベントについて合意済みのサポート対象表現があり、その結果生じる history の動作がカバーされていることです。
索引モデルが issue の本文から書いたものです。
説明
What feature would you like to see?
Feature Summary
Add support for injecting backend- or system-originated events and memory updates into the chat history as their own distinct turn type. This would allow these messages to be properly recognized by the AI model—without being misattributed to the user or model—and ensure the model has the right context for generating accurate, helpful responses. This could be accomplished by supporting a new message role (such as system or context) in the chat history, or by providing an explicit API for adding non-user, non-model context turns.
Description:
I’m building a Flutter AI chat app with firebase_ai: ^2.3.0 and need to inject extra context—such as backend-triggered events or memory updates—into the chat history so the model can provide informed responses.
However, adding Content.system() as a turn in the chat history results in the following error:
I/flutter (22326): Please use a valid role: user, model.
I/flutter (22326): #0 DeveloperSerialization.parseGenerateContentResponse (package:firebase_ai/src/developer/api.dart:103:56)
System content is only allowed as a system instruction, not as a message turn.
Why this is a problem
While FunctionResponse works for tool call responses, many events—like backend updates ("Your booking was rescheduled")—are triggered asynchronously, not by a user or model prompt or a model-initiated function call. Injecting these as FunctionResponse technically seems possible, but it feels like a workaround, and I'm not even sure if this actually works as intended since there was no function invocation.
Using a role of user for these events doesn't make sense, because the update or context did not originate from the user.
Using a role of model also doesn't make sense, as these messages are not generated by the model.
Question
- Is it supported or recommended to use FunctionResponse for backend events that aren't the result of a function call?
- Or is there a better way (e.g., a dedicated system/context message type, or allowing Content.system() in the message history) to inject backend or app-originated events into the chat?
Why this matters
- Enables the app to push backend or memory updates into the conversation history in the correct order
- Cleanly distinguishes between user/model/tool and system-originated events
Version:
- firebase_ai: 2.3.0
- Flutter stable
- 主要言語
- Dart
- スター
- 9.3k
- フォーク
- 4.1k
- 平均マージ
- 4日 17時間
- マージ済み PR(30日)
- 49
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
firebase/flutterfire のほかの issue
-
[cloud_functions]: Apple platforms ignore custom domains passed as region対応中かも @ragavendranbala-TSL が今日担当しました。 オープンNeeds Attention platform: ios platform: macos plugin: functions type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
firebase/flutterfire#19015 · コメント 2 件 ·
メンテナーはふだん 4 日以内に返信
-
Needs Attention platform: android plugin: messaging type: bug
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
firebase/flutterfire#19017 ·
メンテナーはふだん 4 日以内に返信
-
Needs Attention platform: web plugin: crashlytics type: enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 34/100
firebase/flutterfire#19014 · コメント 1 件 ·
メンテナーはふだん 4 日以内に返信
-
[firebase_messaging]: Android getToken() errors lose their cause since firebase-messaging 25.1.0 ("FCM Registration failed!")対応中かも @SelaseKay が 3 日前に担当しました。 オープンNeeds Attention platform: android plugin: messaging reproduced type: bug
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
firebase/flutterfire#18997 · コメント 1 件 ·
メンテナーはふだん 4 日以内に返信
-
[firebase_storage]: Windows: getData() crashes with access violation (use-after-free of StorageReference in ReferenceGetData)対応中かも @SelaseKay が 4 日前に担当しました。 オープンblocked: customer-response platform: windows plugin: storage type: bug type: crash
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
firebase/flutterfire#18994 · コメント 2 件 ·
メンテナーはふだん 4 日以内に返信
firebase/flutterfire の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
Anxcye/anx-reader#1024 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
RevenueCat/purchases-flutter#2048 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
hajisensai/Fushi#4543 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
[video_player] _updatePosition sets isCompleted=true after 500ms when duration is Duration.zeroオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
laugustyniak/augustyniak-capture#477 ·
メンテナーはふだん 1 日以内に返信