7.2 KiB
@langchain/langgraph-sdk / UseStreamOptions
Interface: UseStreamOptions<StateType, Bag>
Defined in: react/stream.tsx:413
Type Parameters
• StateType extends Record<string, unknown> = Record<string, unknown>
• Bag extends BagTemplate = BagTemplate
Properties
apiKey?
optionalapiKey:string
Defined in: react/stream.tsx:435
The API key to use.
apiUrl?
optionalapiUrl:string
Defined in: react/stream.tsx:430
The URL of the API to use.
assistantId
assistantId:
string
Defined in: react/stream.tsx:420
The ID of the assistant to use.
callerOptions?
optionalcallerOptions:AsyncCallerParams
Defined in: react/stream.tsx:440
Custom call options, such as custom fetch implementation.
client?
optionalclient:Client<DefaultValues,DefaultValues,unknown>
Defined in: react/stream.tsx:425
Client used to send requests.
defaultHeaders?
optionaldefaultHeaders:Record<string,HeaderValue>
Defined in: react/stream.tsx:445
Default headers to send with requests.
messagesKey?
optionalmessagesKey:string
Defined in: react/stream.tsx:453
Specify the key within the state that contains messages. Defaults to "messages".
Default
"messages"
onCreated()?
optionalonCreated: (run) =>void
Defined in: react/stream.tsx:471
Callback that is called when a new stream is created.
Parameters
run
RunCallbackMeta
Returns
void
onCustomEvent()?
optionalonCustomEvent: (data,options) =>void
Defined in: react/stream.tsx:483
Callback that is called when a custom event is received.
Parameters
data
GetCustomEventType<Bag>
options
mutate
(update) => void
Returns
void
onDebugEvent()?
optionalonDebugEvent: (data) =>void
Defined in: react/stream.tsx:507
Internal
Callback that is called when a debug event is received. This API is experimental and subject to change.
Parameters
data
unknown
Returns
void
onError()?
optionalonError: (error,run) =>void
Defined in: react/stream.tsx:458
Callback that is called when an error occurs.
Parameters
error
unknown
run
undefined | RunCallbackMeta
Returns
void
onFinish()?
optionalonFinish: (state,run) =>void
Defined in: react/stream.tsx:463
Callback that is called when the stream is finished.
Parameters
state
ThreadState<StateType>
run
undefined | RunCallbackMeta
Returns
void
onLangChainEvent()?
optionalonLangChainEvent: (data) =>void
Defined in: react/stream.tsx:501
Callback that is called when a LangChain event is received.
Parameters
data
data
unknown
event
string & object | "on_tool_start" | "on_tool_stream" | "on_tool_end" | "on_chat_model_start" | "on_chat_model_stream" | "on_chat_model_end" | "on_llm_start" | "on_llm_stream" | "on_llm_end" | "on_chain_start" | "on_chain_stream" | "on_chain_end" | "on_retriever_start" | "on_retriever_stream" | "on_retriever_end" | "on_prompt_start" | "on_prompt_stream" | "on_prompt_end"
metadata
Record<string, unknown>
name
string
parent_ids
string[]
run_id
string
tags
string[]
Returns
void
See
https://langchain-ai.github.io/langgraph/cloud/how-tos/stream_events/#stream-graph-in-events-mode for more details.
onMetadataEvent()?
optionalonMetadataEvent: (data) =>void
Defined in: react/stream.tsx:495
Callback that is called when a metadata event is received.
Parameters
data
run_id
string
thread_id
string
Returns
void
onThreadId()?
optionalonThreadId: (threadId) =>void
Defined in: react/stream.tsx:517
Callback that is called when the thread ID is updated (ie when a new thread is created).
Parameters
threadId
string
Returns
void
onUpdateEvent()?
optionalonUpdateEvent: (data) =>void
Defined in: react/stream.tsx:476
Callback that is called when an update event is received.
Parameters
data
Returns
void
reconnectOnMount?
optionalreconnectOnMount:boolean| () =>RunMetadataStorage
Defined in: react/stream.tsx:520
Will reconnect the stream on mount
threadId?
optionalthreadId:null|string
Defined in: react/stream.tsx:512
The ID of the thread to fetch history and current values from.