Optional
apiOptional
apiThe URL of the API to use.
The ID of the assistant to use.
Optional
callerCustom call options, such as custom fetch implementation.
Optional
clientClient used to send requests.
Optional
defaultDefault headers to send with requests.
Optional
fetchWhether to fetch the history of the thread. If true, the history will be fetched from the server. Defaults to 1000 entries. If false, only the last state will be fetched from the server.
true
Optional
initialInitial values to display immediately when loading a thread. Useful for displaying cached thread data while official history loads. These values will be replaced when official thread data is fetched.
Note: UI components from initialValues will render immediately if they're predefined in LoadExternalComponent's components prop, providing instant cached UI display without server fetches.
Optional
messagesSpecify the key within the state that contains messages. Defaults to "messages".
"messages"
Optional
onCallback that is called when a new stream is created.
Optional
onCallback that is called when a custom event is received.
Optional
onCallback that is called when an error occurs.
Optional
onCallback that is called when the stream is finished.
Optional
onCallback that is called when a LangChain event is received.
Optional
onCallback that is called when a metadata event is received.
Optional
onCallback that is called when the stream is stopped by the user. Provides a mutate function to update the stream state immediately without requiring a server roundtrip.
onStop: ({ mutate }) => {
mutate((prev) => ({
...prev,
ui: prev.ui?.map(component =>
component.props.isLoading
? { ...component, props: { ...component.props, stopped: true, isLoading: false }}
: component
)
}));
}
Optional
onCallback that is called when the thread ID is updated (ie when a new thread is created).
Optional
onCallback that is called when an update event is received.
Optional
reconnectWill reconnect the stream on mount
Optional
threadThe ID of the thread to fetch history and current values from.
The API key to use.