From 9527885a231ad498729e39387a4cee713d11aadb Mon Sep 17 00:00:00 2001 From: vbarda Date: Wed, 8 Jan 2025 10:22:09 -0500 Subject: [PATCH] sdk-js: add stream mode and stream subgraphs to runs.create --- libs/sdk-js/src/client.ts | 2 ++ libs/sdk-js/src/types.ts | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/libs/sdk-js/src/client.ts b/libs/sdk-js/src/client.ts index 581145229..b340274ca 100644 --- a/libs/sdk-js/src/client.ts +++ b/libs/sdk-js/src/client.ts @@ -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, diff --git a/libs/sdk-js/src/types.ts b/libs/sdk-js/src/types.ts index 116a1d244..1f66b61a2 100644 --- a/libs/sdk-js/src/types.ts +++ b/libs/sdk-js/src/types.ts @@ -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; + + /** + * Stream output from subgraphs. By default, streams only the top graph. + */ + streamSubgraphs?: boolean; +} export interface CronsCreatePayload extends RunsCreatePayload { /**