GenerationResult class
Text, tool calls, and metrics from one generation.
Constructors
-
GenerationResult({required String text, String? thinkingText, List<
ToolCall> toolCalls = const <ToolCall>[], List<ToolResult> toolResults = const <ToolResult>[], FinishReason finishReason = FinishReason.stop, int inputTokens = 0, int outputTokens = 0, int timeToFirstTokenMs = 0, double tokensPerSecond = 0, String requestId = '', String model = ''}) -
Build a generation result directly. Prefer the named factories.
const
- GenerationResult.fromLlm(LLMGenerationResult proto, {String requestId = ''})
-
Build from the generated unary LLM result.
factory
- GenerationResult.fromToolCalling(ToolCallingResult proto, {String requestId = '', String model = ''})
-
Build from the generated tool-calling loop result.
factory
- GenerationResult.fromVlm(VLMResult proto, {String requestId = '', String model = ''})
-
Build from the generated VLM result.
factory
Properties
- finishReason → FinishReason
-
Why generation stopped.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- inputTokens → int
-
Prompt tokens consumed.
final
- model → String
-
Model that produced the text.
final
- outputTokens → int
-
Completion tokens produced.
final
- requestId → String
-
Correlation id for this request.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- text → String
-
Generated text with thinking content removed.
final
- thinkingText → String?
-
Thinking content, when the model produced it and the caller asked for it.
final
- timeToFirstTokenMs → int
-
Latency to the first emitted token.
final
- tokensPerSecond → double
-
Decode throughput.
final
-
toolCalls
→ List<
ToolCall> -
Tool calls the model requested.
final
-
toolResults
→ List<
ToolResult> -
Results of the tool calls the SDK executed during the loop. Beyond the v3
spec, but commons returns them and callers need them to show what ran.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited