Message class
A message in a thread.
Messages contain the content of a conversation between the user and an assistant.
- Annotations
-
- @immutable
Constructors
-
Message({required String id, required String object, required int createdAt, required String threadId, MessageStatus? status, IncompleteDetails? incompleteDetails, int? completedAt, int? incompleteAt, required String role, required List<
MessageContent> content, String? assistantId, String? runId, required List<MessageAttachment> attachments, required Map<String, String> metadata}) -
Creates a Message.
const
-
Message.fromJson(Map<
String, dynamic> json) -
Creates a Message from JSON.
factory
Properties
- assistantId → String?
-
The assistant ID if this is an assistant message.
final
-
attachments
→ List<
MessageAttachment> -
File attachments.
final
- completedAt → int?
-
The Unix timestamp when the message was completed.
final
-
content
→ List<
MessageContent> -
The content of the message.
final
- createdAt → int
-
The Unix timestamp when the message was created.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- id → String
-
The message identifier.
final
- incompleteAt → int?
-
The Unix timestamp when the message became incomplete.
final
- incompleteDetails → IncompleteDetails?
-
Details about why the message is incomplete.
final
- isAssistant → bool
-
Whether this is an assistant message.
no setter
- isComplete → bool
-
Whether the message is complete.
no setter
- isUser → bool
-
Whether this is a user message.
no setter
-
metadata
→ Map<
String, String> -
Custom metadata.
final
- object → String
-
The object type (always "thread.message").
final
- role → String
-
The role of the message author ("user" or "assistant").
final
- runId → String?
-
The run ID that generated this message.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- status → MessageStatus?
-
The status of the message.
final
- text → String
-
Gets the text content of the message.
no setter
- threadId → String
-
The thread ID this message belongs to.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts to JSON.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override