AIChatMessage class

Type of message that is spoken by the AI.

Inheritance
Annotations
  • @immutable

Constructors

AIChatMessage({required List<AIChatMessageContentBlock> content})
Type of message that is spoken by the AI.
const
AIChatMessage.fromMap(Map<String, dynamic> map)
Converts a map to a AIChatMessage.
factory
AIChatMessage.text(String text, {List<AIChatMessageToolCall> toolCalls = const []})
Creates an AI message containing visible text and optional tool calls.
factory

Properties

content List<AIChatMessageContentBlock>
The canonical ordered content blocks.
final
contentAsString String
Returns to content of the message as a string.
no setterinherited
hashCode int
The hash code for this object.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
toolCalls List<AIChatMessageToolCall>
The list of tool that the model wants to call. If the model does not want to call any tool, this list will be empty.
no setter

Methods

concat(ChatMessage other) AIChatMessage
Merges this message with another by concatenating the content.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() Map<String, dynamic>
Converts this ChatMessage to a map along with a type hint for deserialization.
override
toString() String
A string representation of this object.
override

Operators

operator ==(covariant AIChatMessage other) bool
The equality operator.
override

Constants

defaultPrefix → const String
Default prefix for AIChatMessage.