Message class
Represents a message in the conversation.
Constructors
-
Message({required Role role, Contents contents = Contents.empty, List<
ToolCall> toolCalls = const [], Map<String, String> channels = const {}}) -
Creates a message.
const
-
Message.fromJson(Map<
String, Object?> json) -
Creates a message from JSON-compatible values.
factory
- Message.fromJsonString(String jsonString)
-
Creates a message from a JSON string.
factory
-
Message.model({Contents contents = Contents.empty, List<
ToolCall> toolCalls = const [], Map<String, String> channels = const {}}) -
Creates a model message.
factory
- Message.modelText(String text)
-
Creates a model message from the given text.
factory
- Message.system(String text)
-
Creates a system message from the given text.
factory
- Message.systemContents(Contents contents)
-
Creates a system message from the given contents.
factory
- Message.tool(Contents contents)
-
Creates a tool message from the given contents.
factory
- Message.user(String text)
-
Creates a user message from the given text.
factory
- Message.userContents(Contents contents)
-
Creates a user message from the given contents.
factory
Properties
-
channels
→ Map<
String, String> -
The channels of the message.
final
- contents → Contents
-
The contents of the message.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- role → Role
-
The role of the message.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- text → String
-
The text content of the message.
no setter
-
toolCalls
→ List<
ToolCall> -
Tool calls returned by the model.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, Object?> - Converts this message to JSON-compatible values.
-
toJsonString(
) → String - Converts this message to a JSON string.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited