Thread class

A thread representing a conversation with an assistant.

Threads store the message history and can be used across multiple runs.

Example

final thread = await client.threads.create(
  CreateThreadRequest(
    messages: [
      ThreadMessage.user('Hello!'),
    ],
  ),
);
Annotations
  • @immutable

Constructors

Thread({required String id, required String object, required int createdAt, ToolResources? toolResources, required Map<String, String> metadata})
Creates a Thread.
const
Thread.fromJson(Map<String, dynamic> json)
Creates a Thread from JSON.
factory

Properties

createdAt int
The Unix timestamp when the thread was created.
final
createdAtDateTime DateTime
The creation time as a DateTime.
no setter
hashCode int
The hash code for this object.
no setteroverride
id String
The thread identifier.
final
metadata Map<String, String>
Custom metadata for the thread.
final
object String
The object type (always "thread").
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
toolResources ToolResources?
Tool resources available to the thread.
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