feat(sdk-js): pass the client instead of apiKey/apiUrl

This commit is contained in:
Tat Dat Duong
2025-04-29 15:17:55 +02:00
parent b7482a6f6a
commit cc62a9fa33
+8 -1
View File
@@ -414,10 +414,15 @@ export interface UseStreamOptions<
*/
assistantId: string;
/**
* Client used to send requests.
*/
client?: Client;
/**
* The URL of the API to use.
*/
apiUrl: ClientConfig["apiUrl"];
apiUrl?: ClientConfig["apiUrl"];
/**
* The API key to use.
@@ -629,6 +634,7 @@ export function useStream<
const client = useMemo(
() =>
options.client ??
new Client({
apiUrl: options.apiUrl,
apiKey: options.apiKey,
@@ -636,6 +642,7 @@ export function useStream<
defaultHeaders: options.defaultHeaders,
}),
[
options.client,
options.apiKey,
options.apiUrl,
options.callerOptions,