@@ -189,7 +189,6 @@ public void testOpen()
189189 .encoding ("audio/raw;rate=16000" )
190190 .stabilizePartialResults (RealtimeParameters .StabilizePartialResults .None )
191191 .shouldIgnoreInvalidCustomizations (false )
192- .shouldIgnoreInvalidCustomizations (false )
193192 .partialSilenceThresholdInMs (501 )
194193 .finalSilenceThresholdInMs (2005 )
195194 .languageCode ("en-US" )
@@ -239,7 +238,6 @@ public void testOpenPunctuationAuto()
239238 .encoding ("audio/raw;rate=16000" )
240239 .stabilizePartialResults (RealtimeParameters .StabilizePartialResults .None )
241240 .shouldIgnoreInvalidCustomizations (false )
242- .shouldIgnoreInvalidCustomizations (false )
243241 .partialSilenceThresholdInMs (501 )
244242 .finalSilenceThresholdInMs (2005 )
245243 .languageCode ("en-US" )
@@ -290,11 +288,61 @@ public void testSpoken()
290288 .encoding ("audio/raw;rate=16000" )
291289 .stabilizePartialResults (RealtimeParameters .StabilizePartialResults .None )
292290 .shouldIgnoreInvalidCustomizations (false )
291+ .partialSilenceThresholdInMs (501 )
292+ .finalSilenceThresholdInMs (2005 )
293+ .languageCode ("en-US" )
294+ .modelDomain (RealtimeParameters .ModelDomain .Generic )
295+ .punctuation (RealtimeParameters .Punctuation .Spoken )
296+ .customizations (Arrays .asList (cm1 ))
297+ .build ();
298+
299+ realtimeSpeechClient .open ("wss://test-endpoint.com" , realtimeParameters );
300+
301+ ArgumentCaptor <URI > uriArgumentCaptor = ArgumentCaptor .forClass (URI .class );
302+ ArgumentCaptor <ClientUpgradeRequest > upgradeRequestArgCaptor =
303+ ArgumentCaptor .forClass (ClientUpgradeRequest .class );
304+ Mockito .verify (mockWebsocketClient , times (1 ))
305+ .connect (any (), uriArgumentCaptor .capture (), upgradeRequestArgCaptor .capture ());
306+
307+ final String expectedURIString =
308+ "wss://test-endpoint.com/ws/transcribe/stream?isAckEnabled=true&encoding=audio%2Fraw%3Brate%3D16000&shouldIgnoreInvalidCustomizations=false"
309+ + "&partialSilenceThresholdInMs=501&finalSilenceThresholdInMs=2005&stabilizePartialResults=NONE&languageCode=en-US&modelDomain=GENERIC"
310+ + "&punctuation=SPOKEN"
311+ + "&customizations=%5B%7B%22customizationId%22%3A%22testCustomizationId%22%2C%22customizationAlias%22%3Anull%2C%22"
312+ + "compartmentId%22%3A%22testCompartmentId%22%2C%22entities%22%3Anull%7D%5D" ;
313+
314+ Assert .assertEquals (expectedURIString , uriArgumentCaptor .getValue ().toString ());
315+ }
316+
317+ @ Test
318+ public void testModelTypeOracle ()
319+ throws IOException , RealtimeSpeechConnectException , ExecutionException ,
320+ InterruptedException , TimeoutException {
321+ RealtimeSpeechClient realtimeSpeechClientSpy = Mockito .spy (realtimeSpeechClient );
322+
323+ Mockito .doReturn (true ).when (mockWebsocketClient ).isStarted ();
324+
325+ Future <Session > futureMock = mock (Future .class );
326+ when (mockWebsocketClient .connect (any (), any (), any ())).thenReturn (futureMock );
327+ doReturn (mockSession ).when (futureMock ).get (eq (10 ), eq (TimeUnit .SECONDS ));
328+
329+ CustomizationInference cm1 =
330+ CustomizationInference .builder ()
331+ .customizationId ("testCustomizationId" )
332+ .compartmentId ("testCompartmentId" )
333+ .build ();
334+
335+ final RealtimeParameters realtimeParameters =
336+ RealtimeParameters .builder ()
337+ .isAckEnabled (true )
338+ .encoding ("audio/raw;rate=16000" )
339+ .stabilizePartialResults (RealtimeParameters .StabilizePartialResults .None )
293340 .shouldIgnoreInvalidCustomizations (false )
294341 .partialSilenceThresholdInMs (501 )
295342 .finalSilenceThresholdInMs (2005 )
296343 .languageCode ("en-US" )
297344 .modelDomain (RealtimeParameters .ModelDomain .Generic )
345+ .modelType ("ORACLE" )
298346 .punctuation (RealtimeParameters .Punctuation .Spoken )
299347 .customizations (Arrays .asList (cm1 ))
300348 .build ();
@@ -317,6 +365,49 @@ public void testSpoken()
317365 Assert .assertEquals (expectedURIString , uriArgumentCaptor .getValue ().toString ());
318366 }
319367
368+ @ Test
369+ public void testModelTypeWhisper ()
370+ throws IOException , RealtimeSpeechConnectException , ExecutionException ,
371+ InterruptedException , TimeoutException {
372+ RealtimeSpeechClient realtimeSpeechClientSpy = Mockito .spy (realtimeSpeechClient );
373+
374+ Mockito .doReturn (true ).when (mockWebsocketClient ).isStarted ();
375+
376+ Future <Session > futureMock = mock (Future .class );
377+ when (mockWebsocketClient .connect (any (), any (), any ())).thenReturn (futureMock );
378+ doReturn (mockSession ).when (futureMock ).get (eq (10 ), eq (TimeUnit .SECONDS ));
379+
380+ CustomizationInference cm1 =
381+ CustomizationInference .builder ()
382+ .customizationId ("testCustomizationId" )
383+ .compartmentId ("testCompartmentId" )
384+ .build ();
385+
386+ final RealtimeParameters realtimeParameters =
387+ RealtimeParameters .builder ()
388+ .isAckEnabled (true )
389+ .encoding ("audio/raw;rate=16000" )
390+ .languageCode ("en" )
391+ .modelDomain (RealtimeParameters .ModelDomain .Generic )
392+ .modelType ("WHISPER" )
393+ .punctuation (RealtimeParameters .Punctuation .Auto )
394+ .build ();
395+
396+ realtimeSpeechClient .open ("wss://test-endpoint.com" , realtimeParameters );
397+
398+ ArgumentCaptor <URI > uriArgumentCaptor = ArgumentCaptor .forClass (URI .class );
399+ ArgumentCaptor <ClientUpgradeRequest > upgradeRequestArgCaptor =
400+ ArgumentCaptor .forClass (ClientUpgradeRequest .class );
401+ Mockito .verify (mockWebsocketClient , times (1 ))
402+ .connect (any (), uriArgumentCaptor .capture (), upgradeRequestArgCaptor .capture ());
403+
404+ final String expectedURIString =
405+ "wss://test-endpoint.com/ws/transcribe/stream?isAckEnabled=true&encoding=audio%2Fraw%3Brate%3D16000"
406+ + "&languageCode=en&modelDomain=GENERIC&modelType=WHISPER&punctuation=AUTO" ;
407+
408+ Assert .assertEquals (expectedURIString , uriArgumentCaptor .getValue ().toString ());
409+ }
410+
320411 @ Test
321412 public void testOnOpenWithSingleParameters ()
322413 throws IOException , RealtimeSpeechConnectException , InvocationTargetException ,
@@ -340,6 +431,8 @@ public void testOnOpenWithSingleParameters()
340431 "modelDomain" , RealtimeParameters .ModelDomain .Generic , "?modelDomain=GENERIC" );
341432 runSingleTest ("punctuation" , RealtimeParameters .Punctuation .None , "" );
342433 runSingleTest ("punctuation" , RealtimeParameters .Punctuation .Auto , "?punctuation=AUTO" );
434+ runSingleTest ("modelType" , "ORACLE" , "" );
435+ runSingleTest ("modelType" , "WHISPER" , "?modelType=WHISPER" );
343436 }
344437
345438 private void runSingleTest (String paramName , Object paramValue , String queryParamValue )
0 commit comments