AiMessage class

A single message in the conversation.

Most messages carry text. An assistant turn that calls tools carries toolCalls; a AiRole.tool message carries a single toolResult answering one earlier call.

Constructors

AiMessage({required AiRole role, String? text, List<AiToolCall> toolCalls = const [], AiToolResult? toolResult})
const
AiMessage.assistant({String? text, List<AiToolCall> toolCalls = const []})
An assistant message, optionally with text and/or toolCalls.
const
AiMessage.system(String text)
A plain system-prompt message.
const
AiMessage.tool(AiToolResult result)
A tool-result message answering the call with result's id.
const
AiMessage.user(String text)
A plain user message.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
role AiRole
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
text String?
final
toolCalls List<AiToolCall>
final
toolResult AiToolResult?
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