Skip to content

Commit

Permalink
sdk-js: add stream mode and stream subgraphs to runs.create
Browse files Browse the repository at this point in the history
  • Loading branch information
vbarda committed Jan 8, 2025
1 parent 9680e35 commit 9527885
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 2 additions & 0 deletions libs/sdk-js/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,8 @@ export class RunsClient extends BaseClient {
command: payload?.command,
config: payload?.config,
metadata: payload?.metadata,
stream_mode: payload?.streamMode,
stream_subgraphs: payload?.streamSubgraphs,
assistant_id: assistantId,
interrupt_before: payload?.interruptBefore,
interrupt_after: payload?.interruptAfter,
Expand Down
18 changes: 17 additions & 1 deletion libs/sdk-js/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,23 @@ export interface RunsStreamPayload extends RunsInvokePayload {
feedbackKeys?: string[];
}

export interface RunsCreatePayload extends RunsInvokePayload {}
export interface RunsCreatePayload extends RunsInvokePayload {
/**
* One of `"values"`, `"messages"`, `"updates"` or `"events"`.
* - `"values"`: Stream the thread state any time it changes.
* - `"messages"`: Stream chat messages from thread state and calls to chat models,
* token-by-token where possible.
* - `"updates"`: Stream the state updates returned by each node.
* - `"events"`: Stream all events produced by the run. You can also access these
* afterwards using the `client.runs.listEvents()` method.
*/
streamMode?: StreamMode | Array<StreamMode>;

/**
* Stream output from subgraphs. By default, streams only the top graph.
*/
streamSubgraphs?: boolean;
}

export interface CronsCreatePayload extends RunsCreatePayload {
/**
Expand Down

0 comments on commit 9527885

Please sign in to comment.