Create a new thread.
create(
self,
*,
metadata: Json = None,
thread_id: str | None = None,
if_exists: OnConflictBehavior | None = None,
supersteps: Sequence[dict[str, Sequence[dict[str, Any]]]] | None = None,
graph_id: str | None = None,
ttl: int | Mapping[str, Any] | None = None,
headers: Mapping[str, str] | None = None,
params: QueryParamTypes | None = None
) -> Threadclient = get_client(url="http://localhost:2024")
thread = await client.threads.create(
metadata={"number":1},
thread_id="my-thread-id",
if_exists="raise"
)| 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: NoneHow to handle duplicate creation. Defaults to 'raise' under the hood. Must be either 'raise' (raise error if duplicate), or 'do_nothing' (return existing thread). |
supersteps | Sequence[dict[str, Sequence[dict[str, Any]]]] | None | Default: NoneApply a list of supersteps when creating a thread, each containing a sequence of updates.
Each update has |
graph_id | str | None | Default: NoneOptional graph ID to associate with the thread. |
ttl | int | Mapping[str, Any] | None | Default: NoneOptional time-to-live in minutes for the thread. You can pass an
integer (minutes) or a mapping with keys |
headers | Mapping[str, str] | None | Default: NoneOptional custom headers to include with the request. |
params | QueryParamTypes | None | Default: NoneOptional query parameters to include with the request. |