@@ -67,6 +67,8 @@ class RealtimeAudioOptions(typing.TypedDict, total=False):
6767 min_silence_duration_ms : int
6868 language_code : str
6969 include_timestamps : bool
70+ keyterms : typing .List [str ]
71+ no_verbatim : bool
7072
7173
7274class RealtimeUrlOptions (typing .TypedDict , total = False ):
@@ -93,6 +95,8 @@ class RealtimeUrlOptions(typing.TypedDict, total=False):
9395 min_silence_duration_ms : int
9496 language_code : str
9597 include_timestamps : bool
98+ keyterms : typing .List [str ]
99+ no_verbatim : bool
96100
97101
98102class ScribeRealtime :
@@ -197,6 +201,8 @@ async def _connect_audio(self, options: RealtimeAudioOptions) -> RealtimeConnect
197201 min_silence_duration_ms = options .get ("min_silence_duration_ms" )
198202 language_code = options .get ("language_code" )
199203 include_timestamps = options .get ("include_timestamps" , False )
204+ keyterms = options .get ("keyterms" )
205+ no_verbatim = options .get ("no_verbatim" )
200206
201207 if not audio_format or not sample_rate :
202208 raise ValueError ("audio_format and sample_rate are required for manual audio mode" )
@@ -212,6 +218,8 @@ async def _connect_audio(self, options: RealtimeAudioOptions) -> RealtimeConnect
212218 min_silence_duration_ms = min_silence_duration_ms ,
213219 language_code = language_code ,
214220 include_timestamps = include_timestamps ,
221+ keyterms = keyterms ,
222+ no_verbatim = no_verbatim ,
215223 )
216224
217225 # Connect to WebSocket
@@ -244,6 +252,8 @@ async def _connect_url(self, options: RealtimeUrlOptions) -> RealtimeConnection:
244252 min_silence_duration_ms = options .get ("min_silence_duration_ms" )
245253 language_code = options .get ("language_code" )
246254 include_timestamps = options .get ("include_timestamps" , False )
255+ keyterms = options .get ("keyterms" )
256+ no_verbatim = options .get ("no_verbatim" )
247257
248258 if not url :
249259 raise ValueError ("url is required for URL mode" )
@@ -263,6 +273,8 @@ async def _connect_url(self, options: RealtimeUrlOptions) -> RealtimeConnection:
263273 min_silence_duration_ms = min_silence_duration_ms ,
264274 language_code = language_code ,
265275 include_timestamps = include_timestamps ,
276+ keyterms = keyterms ,
277+ no_verbatim = no_verbatim ,
266278 )
267279
268280 # Connect to WebSocket
@@ -365,7 +377,9 @@ def _build_websocket_url(
365377 min_speech_duration_ms : typing .Optional [int ] = None ,
366378 min_silence_duration_ms : typing .Optional [int ] = None ,
367379 language_code : typing .Optional [str ] = None ,
368- include_timestamps : typing .Optional [bool ] = None
380+ include_timestamps : typing .Optional [bool ] = None ,
381+ keyterms : typing .Optional [typing .List [str ]] = None ,
382+ no_verbatim : typing .Optional [bool ] = None ,
369383 ) -> str :
370384 """Build the WebSocket URL with query parameters"""
371385 params = [
@@ -384,6 +398,11 @@ def _build_websocket_url(
384398 params .append ((key , str (value )))
385399 if include_timestamps is not None :
386400 params .append (("include_timestamps" , str (include_timestamps ).lower ()))
401+ if keyterms is not None :
402+ for term in keyterms :
403+ params .append (("keyterms" , term ))
404+ if no_verbatim is not None :
405+ params .append (("no_verbatim" , str (no_verbatim ).lower ()))
387406
388407 return build_ws_url (self .base_url , ["v1" , "speech-to-text" , "realtime" ], params )
389408
0 commit comments