@@ -54,8 +54,8 @@ export class OpenAIRealtimeWebSocket extends OpenAIRealtimeEmitter {
5454 throw new Error (
5555 [
5656 'Cannot open Realtime WebSocket with a function-based apiKey.' ,
57- 'Use the factory so the key is resolved before connecting:' ,
58- '- OpenAIRealtimeWebSocket.create(client, { model })' ,
57+ 'Use the .create() method so that the key is resolved before connecting:' ,
58+ 'await OpenAIRealtimeWebSocket.create(client, { model })' ,
5959 ] . join ( '\n' ) ,
6060 ) ;
6161 }
@@ -116,9 +116,9 @@ export class OpenAIRealtimeWebSocket extends OpenAIRealtimeEmitter {
116116 client : Pick < AzureOpenAI , '_callApiKey' | 'apiVersion' | 'apiKey' | 'baseURL' | 'deploymentName' > ,
117117 options : { deploymentName ?: string ; dangerouslyAllowBrowser ?: boolean } = { } ,
118118 ) : Promise < OpenAIRealtimeWebSocket > {
119- const isToken = await client . _callApiKey ( ) ;
119+ const isApiKeyProvider = await client . _callApiKey ( ) ;
120120 function onURL ( url : URL ) {
121- if ( isToken ) {
121+ if ( isApiKeyProvider ) {
122122 url . searchParams . set ( 'Authorization' , `Bearer ${ client . apiKey } ` ) ;
123123 } else {
124124 url . searchParams . set ( 'api-key' , client . apiKey ) ;
@@ -134,7 +134,7 @@ export class OpenAIRealtimeWebSocket extends OpenAIRealtimeEmitter {
134134 model : deploymentName ,
135135 onURL,
136136 ...( dangerouslyAllowBrowser ? { dangerouslyAllowBrowser } : { } ) ,
137- __resolvedApiKey : isToken ,
137+ __resolvedApiKey : isApiKeyProvider ,
138138 } ,
139139 client ,
140140 ) ;
0 commit comments