| Name | Type | Description |
|---|---|---|
metadata | Json | Default: NoneMetadata to add to thread. |
thread_id | str | None | Default: NoneID of thread.
If |
if_exists | OnConflictBehavior | None | Default: None |
supersteps | Sequence[dict[str, Sequence[dict[str, Any]]]] | None | Default: None |
graph_id | str | None | Default: None |
ttl | int | Mapping[str, Any] | None | Default: None |
headers | Mapping[str, str] | None | Default: None |
Create a new thread.
client = get_sync_client(url="http://localhost:2024")
thread = client.threads.create(
metadata={"number":1},
thread_id="my-thread-id",
if_exists="raise"
)
)
How to handle duplicate creation. Defaults to 'raise' under the hood. Must be either 'raise' (raise error if duplicate), or 'do_nothing' (return existing thread).
Apply a list of supersteps when creating a thread, each containing a sequence of updates.
Each update has values or command and as_node. Used for copying a thread between deployments.
Optional graph ID to associate with the thread.
Optional time-to-live in minutes for the thread. You can pass an
integer (minutes) or a mapping with keys ttl and optional
strategy (defaults to "delete").
Optional custom headers to include with the request.