Skip to content

Commit

Permalink
Merge pull request #2420 from langchain-ai/nc/14nov/js-sdk-command
Browse files Browse the repository at this point in the history
Nc/14nov/js sdk command
  • Loading branch information
nfcampos authored Nov 15, 2024
2 parents 970e68e + 84ef939 commit 3c4ce3f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libs/sdk-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@langchain/langgraph-sdk",
"version": "0.0.23",
"version": "0.0.24",
"description": "Client library for interacting with the LangGraph API",
"type": "module",
"packageManager": "[email protected]",
Expand Down
3 changes: 3 additions & 0 deletions libs/sdk-js/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ export class RunsClient extends BaseClient {
}> {
const json: Record<string, any> = {
input: payload?.input,
command: payload?.command,
config: payload?.config,
metadata: payload?.metadata,
stream_mode: payload?.streamMode,
Expand Down Expand Up @@ -780,6 +781,7 @@ export class RunsClient extends BaseClient {
): Promise<Run> {
const json: Record<string, any> = {
input: payload?.input,
command: payload?.command,
config: payload?.config,
metadata: payload?.metadata,
assistant_id: assistantId,
Expand Down Expand Up @@ -849,6 +851,7 @@ export class RunsClient extends BaseClient {
): Promise<ThreadState["values"]> {
const json: Record<string, any> = {
input: payload?.input,
command: payload?.command,
config: payload?.config,
metadata: payload?.metadata,
assistant_id: assistantId,
Expand Down
18 changes: 18 additions & 0 deletions libs/sdk-js/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ export type StreamEvent =
| "messages/complete"
| (string & {});

export interface Send {
node: string;
input: Record<string, unknown> | null;
}

export interface Command {
update?: Record<string, unknown>;

resume?: unknown;

send?: Send | Send[];
}

interface RunsInvokePayload {
/**
* Input to the run. Pass `null` to resume from the current state of the thread.
Expand Down Expand Up @@ -107,6 +120,11 @@ interface RunsInvokePayload {
* Behavior if the specified run doesn't exist. Defaults to "reject".
*/
ifNotExists?: "create" | "reject";

/**
* One or more commands to invoke the graph with.
*/
command?: Command;
}

export interface RunsStreamPayload extends RunsInvokePayload {
Expand Down

0 comments on commit 3c4ce3f

Please sign in to comment.