@@ -66,6 +66,8 @@ class RealtimeAudioOptions(typing.TypedDict, total=False):
6666 min_silence_duration_ms : int
6767 language_code : str
6868 include_timestamps : bool
69+ keyterms : typing .List [str ]
70+ no_verbatim : bool
6971
7072
7173class RealtimeUrlOptions (typing .TypedDict , total = False ):
@@ -92,6 +94,8 @@ class RealtimeUrlOptions(typing.TypedDict, total=False):
9294 min_silence_duration_ms : int
9395 language_code : str
9496 include_timestamps : bool
97+ keyterms : typing .List [str ]
98+ no_verbatim : bool
9599
96100
97101class ScribeRealtime :
@@ -196,6 +200,8 @@ async def _connect_audio(self, options: RealtimeAudioOptions) -> RealtimeConnect
196200 min_silence_duration_ms = options .get ("min_silence_duration_ms" )
197201 language_code = options .get ("language_code" )
198202 include_timestamps = options .get ("include_timestamps" , False )
203+ keyterms = options .get ("keyterms" )
204+ no_verbatim = options .get ("no_verbatim" )
199205
200206 if not audio_format or not sample_rate :
201207 raise ValueError ("audio_format and sample_rate are required for manual audio mode" )
@@ -211,6 +217,8 @@ async def _connect_audio(self, options: RealtimeAudioOptions) -> RealtimeConnect
211217 min_silence_duration_ms = min_silence_duration_ms ,
212218 language_code = language_code ,
213219 include_timestamps = include_timestamps ,
220+ keyterms = keyterms ,
221+ no_verbatim = no_verbatim ,
214222 )
215223
216224 # Connect to WebSocket
@@ -243,6 +251,8 @@ async def _connect_url(self, options: RealtimeUrlOptions) -> RealtimeConnection:
243251 min_silence_duration_ms = options .get ("min_silence_duration_ms" )
244252 language_code = options .get ("language_code" )
245253 include_timestamps = options .get ("include_timestamps" , False )
254+ keyterms = options .get ("keyterms" )
255+ no_verbatim = options .get ("no_verbatim" )
246256
247257 if not url :
248258 raise ValueError ("url is required for URL mode" )
@@ -262,6 +272,8 @@ async def _connect_url(self, options: RealtimeUrlOptions) -> RealtimeConnection:
262272 min_silence_duration_ms = min_silence_duration_ms ,
263273 language_code = language_code ,
264274 include_timestamps = include_timestamps ,
275+ keyterms = keyterms ,
276+ no_verbatim = no_verbatim ,
265277 )
266278
267279 # Connect to WebSocket
@@ -364,7 +376,9 @@ def _build_websocket_url(
364376 min_speech_duration_ms : typing .Optional [int ] = None ,
365377 min_silence_duration_ms : typing .Optional [int ] = None ,
366378 language_code : typing .Optional [str ] = None ,
367- include_timestamps : typing .Optional [bool ] = None
379+ include_timestamps : typing .Optional [bool ] = None ,
380+ keyterms : typing .Optional [typing .List [str ]] = None ,
381+ no_verbatim : typing .Optional [bool ] = None ,
368382 ) -> str :
369383 """Build the WebSocket URL with query parameters"""
370384 # Extract base domain
@@ -390,6 +404,11 @@ def _build_websocket_url(
390404 params .append (f"language_code={ language_code } " )
391405 if include_timestamps is not None :
392406 params .append (f"include_timestamps={ str (include_timestamps ).lower ()} " )
407+ if keyterms is not None :
408+ for term in keyterms :
409+ params .append (f"keyterms={ term } " )
410+ if no_verbatim is not None :
411+ params .append (f"no_verbatim={ str (no_verbatim ).lower ()} " )
393412
394413 query_string = "&" .join (params )
395414 return f"{ base } /v1/speech-to-text/realtime?{ query_string } "
0 commit comments