mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-17 21:25:46 +02:00
sdk-js: add stream mode and stream subgraphs to runs.create (#2958)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
import { Checkpoint, Config, Metadata } from "./schema.js";
|
||||
|
||||
/**
|
||||
* Stream modes
|
||||
* - "values": Stream only the state values.
|
||||
* - "messages": Stream complete messages.
|
||||
* - "messages-tuple": Stream (message chunk, metadata) tuples.
|
||||
* - "updates": Stream updates to the state.
|
||||
* - "events": Stream events occurring during execution.
|
||||
* - "debug": Stream detailed debug information.
|
||||
* - "custom": Stream custom events.
|
||||
*/
|
||||
export type StreamMode =
|
||||
| "values"
|
||||
| "messages"
|
||||
@@ -140,13 +150,7 @@ interface RunsInvokePayload {
|
||||
|
||||
export interface RunsStreamPayload 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.
|
||||
* One of `"values"`, `"messages"`, `"messages-tuple"`, `"updates"`, `"events"`, `"debug"`, `"custom"`.
|
||||
*/
|
||||
streamMode?: StreamMode | Array<StreamMode>;
|
||||
|
||||
@@ -162,7 +166,17 @@ export interface RunsStreamPayload extends RunsInvokePayload {
|
||||
feedbackKeys?: string[];
|
||||
}
|
||||
|
||||
export interface RunsCreatePayload extends RunsInvokePayload {}
|
||||
export interface RunsCreatePayload extends RunsInvokePayload {
|
||||
/**
|
||||
* One of `"values"`, `"messages"`, `"messages-tuple"`, `"updates"`, `"events"`, `"debug"`, `"custom"`.
|
||||
*/
|
||||
streamMode?: StreamMode | Array<StreamMode>;
|
||||
|
||||
/**
|
||||
* Stream output from subgraphs. By default, streams only the top graph.
|
||||
*/
|
||||
streamSubgraphs?: boolean;
|
||||
}
|
||||
|
||||
export interface CronsCreatePayload extends RunsCreatePayload {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user