mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-10-01 22:15:11 +02:00
sdk-js: add thread_id and if_exists to ThreadsClient.create (#1032)
This commit is contained in:
@@ -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,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user