sdk-js: add thread_id and if_exists to ThreadsClient.create (#1032)

This commit is contained in:
Vadym Barda
2024-07-16 09:18:22 -04:00
committed by GitHub
parent 449b42717c
commit 3713ba66a8
2 changed files with 9 additions and 1 deletions
+8 -1
View File
@@ -19,6 +19,7 @@ import {
RunsWaitPayload,
StreamEvent,
CronsCreatePayload,
OnConflictBehavior,
} from "./types.mjs";
interface ClientConfig {
@@ -323,10 +324,16 @@ class ThreadsClient extends BaseClient {
* Metadata for the thread.
*/
metadata?: Metadata;
threadId?: string;
ifExists?: OnConflictBehavior;
}): Promise<Thread> {
return this.fetch<Thread>(`/threads`, {
method: "POST",
json: { metadata: payload?.metadata },
json: {
metadata: payload?.metadata,
thread_id: payload?.threadId,
if_exists: payload?.ifExists,
},
});
}
+1
View File
@@ -2,6 +2,7 @@ import { Config, Metadata } from "./schema.js";
export type StreamMode = "values" | "messages" | "updates" | "events" | "debug";
export type MultitaskStrategy = "reject" | "interrupt" | "rollback" | "enqueue";
export type OnConflictBehavior = "raise" | "do_nothing";
export type StreamEvent =
| "events"
| "metadata"