mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-11 20:27:54 +02:00
feat(sdk-js): useStream expose callerOptions and defaultHeaders
This commit is contained in:
@@ -424,6 +424,16 @@ interface UseStreamOptions<
|
||||
*/
|
||||
apiKey?: ClientConfig["apiKey"];
|
||||
|
||||
/**
|
||||
* Custom call options, such as custom fetch implementation.
|
||||
*/
|
||||
callerOptions?: ClientConfig["callerOptions"];
|
||||
|
||||
/**
|
||||
* Default headers to send with requests.
|
||||
*/
|
||||
defaultHeaders?: ClientConfig["defaultHeaders"];
|
||||
|
||||
/**
|
||||
* Specify the key within the state that contains messages.
|
||||
* Defaults to "messages".
|
||||
@@ -603,8 +613,19 @@ export function useStream<
|
||||
messagesKey ??= "messages";
|
||||
|
||||
const client = useMemo(
|
||||
() => new Client({ apiUrl: options.apiUrl, apiKey: options.apiKey }),
|
||||
[options.apiKey, options.apiUrl],
|
||||
() =>
|
||||
new Client({
|
||||
apiUrl: options.apiUrl,
|
||||
apiKey: options.apiKey,
|
||||
callerOptions: options.callerOptions,
|
||||
defaultHeaders: options.defaultHeaders,
|
||||
}),
|
||||
[
|
||||
options.apiKey,
|
||||
options.apiUrl,
|
||||
options.callerOptions,
|
||||
options.defaultHeaders,
|
||||
],
|
||||
);
|
||||
const [threadId, onThreadId] = useControllableThreadId(options);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user