diff --git a/src/deepgram/listen/v1/client.py b/src/deepgram/listen/v1/client.py index c6cba2d8..070273ac 100644 --- a/src/deepgram/listen/v1/client.py +++ b/src/deepgram/listen/v1/client.py @@ -53,8 +53,8 @@ def connect( endpointing: typing.Optional[str] = None, extra: typing.Optional[str] = None, interim_results: typing.Optional[str] = None, - keyterm: typing.Optional[str] = None, - keywords: typing.Optional[str] = None, + keyterm: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + keywords: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, language: typing.Optional[str] = None, mip_opt_out: typing.Optional[str] = None, model: str, @@ -63,9 +63,9 @@ def connect( profanity_filter: typing.Optional[str] = None, punctuate: typing.Optional[str] = None, redact: typing.Optional[str] = None, - replace: typing.Optional[str] = None, + replace: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, sample_rate: typing.Optional[str] = None, - search: typing.Optional[str] = None, + search: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, smart_format: typing.Optional[str] = None, tag: typing.Optional[str] = None, utterance_end_ms: typing.Optional[str] = None, @@ -167,9 +167,17 @@ def connect( if interim_results is not None: query_params = query_params.add("interim_results", interim_results) if keyterm is not None: - query_params = query_params.add("keyterm", keyterm) + if isinstance(keyterm, str): + query_params = query_params.add("keyterm", keyterm) + else: + for term in keyterm: + query_params = query_params.add("keyterm", term) if keywords is not None: - query_params = query_params.add("keywords", keywords) + if isinstance(keywords, str): + query_params = query_params.add("keywords", keywords) + else: + for keyword in keywords: + query_params = query_params.add("keywords", keyword) if language is not None: query_params = query_params.add("language", language) if mip_opt_out is not None: @@ -187,11 +195,19 @@ def connect( if redact is not None: query_params = query_params.add("redact", redact) if replace is not None: - query_params = query_params.add("replace", replace) + if isinstance(replace, str): + query_params = query_params.add("replace", replace) + else: + for replacement in replace: + query_params = query_params.add("replace", replacement) if sample_rate is not None: query_params = query_params.add("sample_rate", sample_rate) if search is not None: - query_params = query_params.add("search", search) + if isinstance(search, str): + query_params = query_params.add("search", search) + else: + for term in search: + query_params = query_params.add("search", term) if smart_format is not None: query_params = query_params.add("smart_format", smart_format) if tag is not None: @@ -264,8 +280,8 @@ async def connect( endpointing: typing.Optional[str] = None, extra: typing.Optional[str] = None, interim_results: typing.Optional[str] = None, - keyterm: typing.Optional[str] = None, - keywords: typing.Optional[str] = None, + keyterm: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + keywords: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, language: typing.Optional[str] = None, mip_opt_out: typing.Optional[str] = None, model: str, @@ -274,9 +290,9 @@ async def connect( profanity_filter: typing.Optional[str] = None, punctuate: typing.Optional[str] = None, redact: typing.Optional[str] = None, - replace: typing.Optional[str] = None, + replace: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, sample_rate: typing.Optional[str] = None, - search: typing.Optional[str] = None, + search: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, smart_format: typing.Optional[str] = None, tag: typing.Optional[str] = None, utterance_end_ms: typing.Optional[str] = None, @@ -378,9 +394,17 @@ async def connect( if interim_results is not None: query_params = query_params.add("interim_results", interim_results) if keyterm is not None: - query_params = query_params.add("keyterm", keyterm) + if isinstance(keyterm, str): + query_params = query_params.add("keyterm", keyterm) + else: + for term in keyterm: + query_params = query_params.add("keyterm", term) if keywords is not None: - query_params = query_params.add("keywords", keywords) + if isinstance(keywords, str): + query_params = query_params.add("keywords", keywords) + else: + for keyword in keywords: + query_params = query_params.add("keywords", keyword) if language is not None: query_params = query_params.add("language", language) if mip_opt_out is not None: @@ -398,11 +422,19 @@ async def connect( if redact is not None: query_params = query_params.add("redact", redact) if replace is not None: - query_params = query_params.add("replace", replace) + if isinstance(replace, str): + query_params = query_params.add("replace", replace) + else: + for replacement in replace: + query_params = query_params.add("replace", replacement) if sample_rate is not None: query_params = query_params.add("sample_rate", sample_rate) if search is not None: - query_params = query_params.add("search", search) + if isinstance(search, str): + query_params = query_params.add("search", search) + else: + for term in search: + query_params = query_params.add("search", term) if smart_format is not None: query_params = query_params.add("smart_format", smart_format) if tag is not None: diff --git a/src/deepgram/listen/v1/raw_client.py b/src/deepgram/listen/v1/raw_client.py index 81311319..6daeb45b 100644 --- a/src/deepgram/listen/v1/raw_client.py +++ b/src/deepgram/listen/v1/raw_client.py @@ -34,8 +34,8 @@ def connect( endpointing: typing.Optional[str] = None, extra: typing.Optional[str] = None, interim_results: typing.Optional[str] = None, - keyterm: typing.Optional[str] = None, - keywords: typing.Optional[str] = None, + keyterm: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + keywords: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, language: typing.Optional[str] = None, mip_opt_out: typing.Optional[str] = None, model: str, @@ -44,9 +44,9 @@ def connect( profanity_filter: typing.Optional[str] = None, punctuate: typing.Optional[str] = None, redact: typing.Optional[str] = None, - replace: typing.Optional[str] = None, + replace: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, sample_rate: typing.Optional[str] = None, - search: typing.Optional[str] = None, + search: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, smart_format: typing.Optional[str] = None, tag: typing.Optional[str] = None, utterance_end_ms: typing.Optional[str] = None, @@ -148,9 +148,17 @@ def connect( if interim_results is not None: query_params = query_params.add("interim_results", interim_results) if keyterm is not None: - query_params = query_params.add("keyterm", keyterm) + if isinstance(keyterm, str): + query_params = query_params.add("keyterm", keyterm) + else: + for term in keyterm: + query_params = query_params.add("keyterm", term) if keywords is not None: - query_params = query_params.add("keywords", keywords) + if isinstance(keywords, str): + query_params = query_params.add("keywords", keywords) + else: + for keyword in keywords: + query_params = query_params.add("keywords", keyword) if language is not None: query_params = query_params.add("language", language) if mip_opt_out is not None: @@ -168,11 +176,19 @@ def connect( if redact is not None: query_params = query_params.add("redact", redact) if replace is not None: - query_params = query_params.add("replace", replace) + if isinstance(replace, str): + query_params = query_params.add("replace", replace) + else: + for replacement in replace: + query_params = query_params.add("replace", replacement) if sample_rate is not None: query_params = query_params.add("sample_rate", sample_rate) if search is not None: - query_params = query_params.add("search", search) + if isinstance(search, str): + query_params = query_params.add("search", search) + else: + for term in search: + query_params = query_params.add("search", term) if smart_format is not None: query_params = query_params.add("smart_format", smart_format) if tag is not None: @@ -224,8 +240,8 @@ async def connect( endpointing: typing.Optional[str] = None, extra: typing.Optional[str] = None, interim_results: typing.Optional[str] = None, - keyterm: typing.Optional[str] = None, - keywords: typing.Optional[str] = None, + keyterm: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + keywords: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, language: typing.Optional[str] = None, mip_opt_out: typing.Optional[str] = None, model: str, @@ -234,9 +250,9 @@ async def connect( profanity_filter: typing.Optional[str] = None, punctuate: typing.Optional[str] = None, redact: typing.Optional[str] = None, - replace: typing.Optional[str] = None, + replace: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, sample_rate: typing.Optional[str] = None, - search: typing.Optional[str] = None, + search: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, smart_format: typing.Optional[str] = None, tag: typing.Optional[str] = None, utterance_end_ms: typing.Optional[str] = None, @@ -338,9 +354,17 @@ async def connect( if interim_results is not None: query_params = query_params.add("interim_results", interim_results) if keyterm is not None: - query_params = query_params.add("keyterm", keyterm) + if isinstance(keyterm, str): + query_params = query_params.add("keyterm", keyterm) + else: + for term in keyterm: + query_params = query_params.add("keyterm", term) if keywords is not None: - query_params = query_params.add("keywords", keywords) + if isinstance(keywords, str): + query_params = query_params.add("keywords", keywords) + else: + for keyword in keywords: + query_params = query_params.add("keywords", keyword) if language is not None: query_params = query_params.add("language", language) if mip_opt_out is not None: @@ -358,11 +382,19 @@ async def connect( if redact is not None: query_params = query_params.add("redact", redact) if replace is not None: - query_params = query_params.add("replace", replace) + if isinstance(replace, str): + query_params = query_params.add("replace", replace) + else: + for replacement in replace: + query_params = query_params.add("replace", replacement) if sample_rate is not None: query_params = query_params.add("sample_rate", sample_rate) if search is not None: - query_params = query_params.add("search", search) + if isinstance(search, str): + query_params = query_params.add("search", search) + else: + for term in search: + query_params = query_params.add("search", term) if smart_format is not None: query_params = query_params.add("smart_format", smart_format) if tag is not None: diff --git a/src/deepgram/listen/v2/client.py b/src/deepgram/listen/v2/client.py index ff78c81d..2491edb4 100644 --- a/src/deepgram/listen/v2/client.py +++ b/src/deepgram/listen/v2/client.py @@ -43,7 +43,7 @@ def connect( eager_eot_threshold: typing.Optional[str] = None, eot_threshold: typing.Optional[str] = None, eot_timeout_ms: typing.Optional[str] = None, - keyterm: typing.Optional[str] = None, + keyterm: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, mip_opt_out: typing.Optional[str] = None, tag: typing.Optional[str] = None, authorization: typing.Optional[str] = None, @@ -100,7 +100,11 @@ def connect( if eot_timeout_ms is not None: query_params = query_params.add("eot_timeout_ms", eot_timeout_ms) if keyterm is not None: - query_params = query_params.add("keyterm", keyterm) + if isinstance(keyterm, str): + query_params = query_params.add("keyterm", keyterm) + else: + for term in keyterm: + query_params = query_params.add("keyterm", term) if mip_opt_out is not None: query_params = query_params.add("mip_opt_out", mip_opt_out) if tag is not None: @@ -154,7 +158,7 @@ async def connect( eager_eot_threshold: typing.Optional[str] = None, eot_threshold: typing.Optional[str] = None, eot_timeout_ms: typing.Optional[str] = None, - keyterm: typing.Optional[str] = None, + keyterm: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, mip_opt_out: typing.Optional[str] = None, tag: typing.Optional[str] = None, authorization: typing.Optional[str] = None, @@ -211,7 +215,11 @@ async def connect( if eot_timeout_ms is not None: query_params = query_params.add("eot_timeout_ms", eot_timeout_ms) if keyterm is not None: - query_params = query_params.add("keyterm", keyterm) + if isinstance(keyterm, str): + query_params = query_params.add("keyterm", keyterm) + else: + for term in keyterm: + query_params = query_params.add("keyterm", term) if mip_opt_out is not None: query_params = query_params.add("mip_opt_out", mip_opt_out) if tag is not None: diff --git a/src/deepgram/listen/v2/raw_client.py b/src/deepgram/listen/v2/raw_client.py index 818a88e4..3b8db207 100644 --- a/src/deepgram/listen/v2/raw_client.py +++ b/src/deepgram/listen/v2/raw_client.py @@ -31,7 +31,7 @@ def connect( eager_eot_threshold: typing.Optional[str] = None, eot_threshold: typing.Optional[str] = None, eot_timeout_ms: typing.Optional[str] = None, - keyterm: typing.Optional[str] = None, + keyterm: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, mip_opt_out: typing.Optional[str] = None, tag: typing.Optional[str] = None, authorization: typing.Optional[str] = None, @@ -88,7 +88,11 @@ def connect( if eot_timeout_ms is not None: query_params = query_params.add("eot_timeout_ms", eot_timeout_ms) if keyterm is not None: - query_params = query_params.add("keyterm", keyterm) + if isinstance(keyterm, str): + query_params = query_params.add("keyterm", keyterm) + else: + for term in keyterm: + query_params = query_params.add("keyterm", term) if mip_opt_out is not None: query_params = query_params.add("mip_opt_out", mip_opt_out) if tag is not None: @@ -131,7 +135,7 @@ async def connect( eager_eot_threshold: typing.Optional[str] = None, eot_threshold: typing.Optional[str] = None, eot_timeout_ms: typing.Optional[str] = None, - keyterm: typing.Optional[str] = None, + keyterm: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, mip_opt_out: typing.Optional[str] = None, tag: typing.Optional[str] = None, authorization: typing.Optional[str] = None, @@ -188,7 +192,11 @@ async def connect( if eot_timeout_ms is not None: query_params = query_params.add("eot_timeout_ms", eot_timeout_ms) if keyterm is not None: - query_params = query_params.add("keyterm", keyterm) + if isinstance(keyterm, str): + query_params = query_params.add("keyterm", keyterm) + else: + for term in keyterm: + query_params = query_params.add("keyterm", term) if mip_opt_out is not None: query_params = query_params.add("mip_opt_out", mip_opt_out) if tag is not None: