-
Notifications
You must be signed in to change notification settings - Fork 98
Description
From discussion #599
Is your feature request related to a problem? Please describe.
The current ContentGenerator interface returns Stream<String> for AI responses, which discards rich typed data provided by the AI SDK. This means consumers cannot access message parts like MessagePart, TextPart, ToolCallPart, ThinkingPart, images or multimodal parts, finish reasons, token usage, safety ratings, citations, etc.
Describe the solution you'd like
Provide a new API that exposes the full typed AI response to consumers. This could be achieved by converting the existing Stream<String> to a Stream<Part> or by adding an alternate method that returns a stream of typed parts. This would allow applications to access thinking blocks, tool calls, results, and other metadata.
Describe alternatives you've considered
Currently, we can only see tool calls in logs and lose other important information. There isn't a clean way to access this data through the existing interface.
Additional context
The flutter/ai package also recreates these parts; there may be overlap between the implementations in flutter/ai and genui. Consolidating the primitives into a separate shared package could be considered.