Skip to content

Commit

Permalink
Merge pull request #1993 from langchain-ai/brace/after-seconds-js
Browse files Browse the repository at this point in the history
fix(js): Add afterSeconds run arg
  • Loading branch information
bracesproul authored Oct 3, 2024
2 parents ac7903b + 92e75aa commit f9afd3c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libs/sdk-js/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,7 @@ export class RunsClient extends BaseClient {
multitask_strategy: payload?.multitaskStrategy,
on_completion: payload?.onCompletion,
on_disconnect: payload?.onDisconnect,
after_seconds: payload?.afterSeconds,
};

const endpoint =
Expand Down Expand Up @@ -755,6 +756,7 @@ export class RunsClient extends BaseClient {
webhook: payload?.webhook,
checkpoint_id: payload?.checkpointId,
multitask_strategy: payload?.multitaskStrategy,
after_seconds: payload?.afterSeconds,
};
return this.fetch<Run>(`/threads/${threadId}/runs`, {
method: "POST",
Expand Down Expand Up @@ -823,6 +825,7 @@ export class RunsClient extends BaseClient {
multitask_strategy: payload?.multitaskStrategy,
on_completion: payload?.onCompletion,
on_disconnect: payload?.onDisconnect,
after_seconds: payload?.afterSeconds,
};
const endpoint =
threadId == null ? `/runs/wait` : `/threads/${threadId}/runs/wait`;
Expand Down
6 changes: 6 additions & 0 deletions libs/sdk-js/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ interface RunsInvokePayload {
* - "continue": Continue the run.
*/
onDisconnect?: DisconnectMode;

/**
* The number of seconds to wait before starting the run.
* Use to schedule future runs.
*/
afterSeconds?: number;
}

export interface RunsStreamPayload extends RunsInvokePayload {
Expand Down

0 comments on commit f9afd3c

Please sign in to comment.