Merge pull request #2237 from langchain-ai/jacob/sdk

feat(sdk-js): Support if_not_exists in SDK runs
This commit is contained in:
David Duong
2024-10-30 19:16:22 +01:00
committed by GitHub
3 changed files with 11 additions and 1 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@langchain/langgraph-sdk",
"version": "0.0.19",
"version": "0.0.20",
"description": "Client library for interacting with the LangGraph API",
"type": "module",
"packageManager": "yarn@1.22.19",
+5
View File
@@ -160,6 +160,7 @@ export class CronsClient extends BaseClient {
interrupt_after: payload?.interruptAfter,
webhook: payload?.webhook,
multitask_strategy: payload?.multitaskStrategy,
if_not_exists: payload?.ifNotExists,
};
return this.fetch<Run>(`/threads/${threadId}/runs/crons`, {
method: "POST",
@@ -187,6 +188,7 @@ export class CronsClient extends BaseClient {
interrupt_after: payload?.interruptAfter,
webhook: payload?.webhook,
multitask_strategy: payload?.multitaskStrategy,
if_not_exists: payload?.ifNotExists,
};
return this.fetch<Run>(`/runs/crons`, {
method: "POST",
@@ -698,6 +700,7 @@ export class RunsClient extends BaseClient {
on_completion: payload?.onCompletion,
on_disconnect: payload?.onDisconnect,
after_seconds: payload?.afterSeconds,
if_not_exists: payload?.ifNotExists,
};
const endpoint =
@@ -779,6 +782,7 @@ export class RunsClient extends BaseClient {
checkpoint_id: payload?.checkpointId,
multitask_strategy: payload?.multitaskStrategy,
after_seconds: payload?.afterSeconds,
if_not_exists: payload?.ifNotExists,
};
return this.fetch<Run>(`/threads/${threadId}/runs`, {
method: "POST",
@@ -849,6 +853,7 @@ export class RunsClient extends BaseClient {
on_completion: payload?.onCompletion,
on_disconnect: payload?.onDisconnect,
after_seconds: payload?.afterSeconds,
if_not_exists: payload?.ifNotExists,
};
const endpoint =
threadId == null ? `/runs/wait` : `/threads/${threadId}/runs/wait`;
+5
View File
@@ -95,6 +95,11 @@ interface RunsInvokePayload {
* Use to schedule future runs.
*/
afterSeconds?: number;
/**
* Behavior if the specified run doesn't exist. Defaults to "reject".
*/
ifNotExists?: "create" | "reject";
}
export interface RunsStreamPayload extends RunsInvokePayload {