ChatMessage class sealed

A message that is part of a chat conversation.

Implementers
Annotations
  • @immutable

Constructors

ChatMessage.ai(String content, {List<AIChatMessageToolCall> toolCalls = const []})
Type of message that is spoken by the AI.
factory
ChatMessage.custom(String content, {required String role})
Chat message with custom role.
factory
ChatMessage.human(ChatMessageContent content)
Type of message that is spoken by the human.
factory
ChatMessage.humanText(String text)
This is a convenience method for ChatMessage.human with ChatMessageContent.text.
factory
ChatMessage.system(String content)
Type of message that is a system message.
factory
ChatMessage.tool({required String toolCallId, required String content})
Type of message that is the response of calling a tool.
factory

Properties

contentAsString String
Returns to content of the message as a string.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

concat(ChatMessage other) ChatMessage
Merges this message with another by concatenating the content.
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