From cc62a9fa3338b8ab3ee40a8b89395c186fd1e903 Mon Sep 17 00:00:00 2001 From: Tat Dat Duong Date: Tue, 29 Apr 2025 15:17:55 +0200 Subject: [PATCH] feat(sdk-js): pass the client instead of apiKey/apiUrl --- libs/sdk-js/src/react/stream.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libs/sdk-js/src/react/stream.tsx b/libs/sdk-js/src/react/stream.tsx index 06ac8b4f9..081300d94 100644 --- a/libs/sdk-js/src/react/stream.tsx +++ b/libs/sdk-js/src/react/stream.tsx @@ -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,