ThreadItem class

A thread item in a ChatKit thread.

Thread items represent messages, tool calls, and other content within a conversation thread.

Example

final items = await client.chatkit.threads.items.list('thread-abc123');
for (final item in items.data) {
  print('${item.type}: ${item.id}');
}
Annotations
  • @immutable

Constructors

ThreadItem({required String id, required String type, required Map<String, dynamic> json})
Creates a ThreadItem.
const
ThreadItem.fromJson(Map<String, dynamic> json)
Creates a ThreadItem from JSON.
factory

Properties

hashCode int
The hash code for this object.
no setteroverride
id String
The item identifier.
final
isAssistantMessage bool
Whether this is an assistant message.
no setter
isClientToolCall bool
Whether this is a client tool call.
no setter
isTask bool
Whether this is a task.
no setter
isTaskGroup bool
Whether this is a task group.
no setter
isUserMessage bool
Whether this is a user message.
no setter
isWidgetMessage bool
Whether this is a widget message.
no setter
json Map<String, dynamic>
The raw JSON data for the item.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type String
The type of item (user_message, assistant_message, widget_message, client_tool_call, task, task_group).
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