From 9934a859b21ae1f1426bfce5a751ac6c2da18ef7 Mon Sep 17 00:00:00 2001 From: Conduit Date: Fri, 4 Dec 2026 13:41:01 +0000 Subject: [PATCH 1/2] chore: initialize SDK regeneration branch From af2e2f5ecfea1f3b703f6c7bc50f04ae3ad5107d Mon Sep 17 00:00:00 2001 From: Conduit Date: Fri, 4 Dec 2026 13:41:01 +0000 Subject: [PATCH 2/2] chore: unfreeze files pending regen --- .fernignore | 114 +- .gitignore.bak | 8 + src/deepgram/__init__.py.bak | 1435 +++++++++++++++++ src/deepgram/agent/__init__.py.bak | 528 ++++++ src/deepgram/agent/v1/__init__.py.bak | 530 ++++++ .../agent/v1/requests/__init__.py.bak | 279 ++++ .../requests/agent_v1conversation_text.py.bak | 39 + ...gent_v1inject_dynamic_agent_message.py.bak | 27 + .../agent/v1/requests/agent_v1settings.py.bak | 31 + .../v1/requests/agent_v1settings_agent.py.bak | 18 + .../agent_v1settings_agent_context.py.bak | 37 + src/deepgram/agent/v1/socket_client.py.bak | 447 +++++ src/deepgram/agent/v1/types/__init__.py.bak | 305 ++++ .../v1/types/agent_v1conversation_text.py.bak | 50 + ...gent_v1inject_dynamic_agent_message.py.bak | 38 + .../agent/v1/types/agent_v1settings.py.bak | 42 + .../v1/types/agent_v1settings_agent.py.bak | 58 + .../agent_v1settings_agent_context.py.bak | 67 + ...tings_agent_context_listen_provider.py.bak | 77 + ...nt_v1settings_agent_listen_provider.py.bak | 77 + .../types/agent_v1update_listen_listen.py.bak | 61 + src/deepgram/core/api_error.py.bak | 25 + src/deepgram/core/client_wrapper.py.bak | 146 ++ src/deepgram/core/parse_error.py.bak | 38 + src/deepgram/core/query_encoder.py.bak | 65 + src/deepgram/listen/__init__.py.bak | 246 +++ .../listen_v1configure_failure.py.bak | 34 + src/deepgram/listen/v1/socket_client.py.bak | 262 +++ .../types/listen_v1configure_failure.py.bak | 45 + src/deepgram/listen/v2/__init__.py.bak | 118 ++ src/deepgram/listen/v2/socket_client.py.bak | 251 +++ src/deepgram/listen/v2/types/__init__.py.bak | 78 + .../types/listen_v2configure_failure.py.bak | 45 + .../types/listen_v2configure_success.py.bak | 60 + ...sten_v2configure_success_thresholds.py.bak | 30 + .../listen/v2/types/listen_v2connected.py.bak | 35 + .../v2/types/listen_v2fatal_error.py.bak | 40 + .../listen/v2/types/listen_v2turn_info.py.bak | 102 ++ .../listen_v2turn_info_words_item.py.bak | 38 + .../listen/v2/types/listen_v2warning.py.bak | 45 + .../manage/v1/projects/keys/client.py.bak | 449 ++++++ .../manage/v1/projects/keys/raw_client.py.bak | 624 +++++++ src/deepgram/requests/__init__.py.bak | 624 +++++++ src/deepgram/requests/shared_intents.py.bak | 16 + src/deepgram/requests/shared_topics.py.bak | 16 + src/deepgram/speak/v1/socket_client.py.bak | 237 +++ .../speak/v2/requests/speak_v2warning.py.bak | 30 + src/deepgram/speak/v2/socket_client.py.bak | 269 +++ .../speak/v2/types/speak_v2warning.py.bak | 41 + src/deepgram/types/__init__.py.bak | 892 ++++++++++ src/deepgram/types/deepgram.py.bak | 44 + .../types/deepgram_listen_provider_v2.py.bak | 86 + src/deepgram/types/shared_intents.py.bak | 62 + src/deepgram/types/shared_topics.py.bak | 62 + .../types/speak_settings_v1provider.py.bak | 117 ++ tests/wire/test_listen_v1_media.py.bak | 105 ++ .../wire/test_manage_v1_projects_keys.py.bak | 66 + .../test_manage_v1_projects_requests.py.bak | 66 + 58 files changed, 9720 insertions(+), 57 deletions(-) create mode 100644 .gitignore.bak create mode 100644 src/deepgram/__init__.py.bak create mode 100644 src/deepgram/agent/__init__.py.bak create mode 100644 src/deepgram/agent/v1/__init__.py.bak create mode 100644 src/deepgram/agent/v1/requests/__init__.py.bak create mode 100644 src/deepgram/agent/v1/requests/agent_v1conversation_text.py.bak create mode 100644 src/deepgram/agent/v1/requests/agent_v1inject_dynamic_agent_message.py.bak create mode 100644 src/deepgram/agent/v1/requests/agent_v1settings.py.bak create mode 100644 src/deepgram/agent/v1/requests/agent_v1settings_agent.py.bak create mode 100644 src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py.bak create mode 100644 src/deepgram/agent/v1/socket_client.py.bak create mode 100644 src/deepgram/agent/v1/types/__init__.py.bak create mode 100644 src/deepgram/agent/v1/types/agent_v1conversation_text.py.bak create mode 100644 src/deepgram/agent/v1/types/agent_v1inject_dynamic_agent_message.py.bak create mode 100644 src/deepgram/agent/v1/types/agent_v1settings.py.bak create mode 100644 src/deepgram/agent/v1/types/agent_v1settings_agent.py.bak create mode 100644 src/deepgram/agent/v1/types/agent_v1settings_agent_context.py.bak create mode 100644 src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py.bak create mode 100644 src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py.bak create mode 100644 src/deepgram/agent/v1/types/agent_v1update_listen_listen.py.bak create mode 100644 src/deepgram/core/api_error.py.bak create mode 100644 src/deepgram/core/client_wrapper.py.bak create mode 100644 src/deepgram/core/parse_error.py.bak create mode 100644 src/deepgram/core/query_encoder.py.bak create mode 100644 src/deepgram/listen/__init__.py.bak create mode 100644 src/deepgram/listen/v1/requests/listen_v1configure_failure.py.bak create mode 100644 src/deepgram/listen/v1/socket_client.py.bak create mode 100644 src/deepgram/listen/v1/types/listen_v1configure_failure.py.bak create mode 100644 src/deepgram/listen/v2/__init__.py.bak create mode 100644 src/deepgram/listen/v2/socket_client.py.bak create mode 100644 src/deepgram/listen/v2/types/__init__.py.bak create mode 100644 src/deepgram/listen/v2/types/listen_v2configure_failure.py.bak create mode 100644 src/deepgram/listen/v2/types/listen_v2configure_success.py.bak create mode 100644 src/deepgram/listen/v2/types/listen_v2configure_success_thresholds.py.bak create mode 100644 src/deepgram/listen/v2/types/listen_v2connected.py.bak create mode 100644 src/deepgram/listen/v2/types/listen_v2fatal_error.py.bak create mode 100644 src/deepgram/listen/v2/types/listen_v2turn_info.py.bak create mode 100644 src/deepgram/listen/v2/types/listen_v2turn_info_words_item.py.bak create mode 100644 src/deepgram/listen/v2/types/listen_v2warning.py.bak create mode 100644 src/deepgram/manage/v1/projects/keys/client.py.bak create mode 100644 src/deepgram/manage/v1/projects/keys/raw_client.py.bak create mode 100644 src/deepgram/requests/__init__.py.bak create mode 100644 src/deepgram/requests/shared_intents.py.bak create mode 100644 src/deepgram/requests/shared_topics.py.bak create mode 100644 src/deepgram/speak/v1/socket_client.py.bak create mode 100644 src/deepgram/speak/v2/requests/speak_v2warning.py.bak create mode 100644 src/deepgram/speak/v2/socket_client.py.bak create mode 100644 src/deepgram/speak/v2/types/speak_v2warning.py.bak create mode 100644 src/deepgram/types/__init__.py.bak create mode 100644 src/deepgram/types/deepgram.py.bak create mode 100644 src/deepgram/types/deepgram_listen_provider_v2.py.bak create mode 100644 src/deepgram/types/shared_intents.py.bak create mode 100644 src/deepgram/types/shared_topics.py.bak create mode 100644 src/deepgram/types/speak_settings_v1provider.py.bak create mode 100644 tests/wire/test_listen_v1_media.py.bak create mode 100644 tests/wire/test_manage_v1_projects_keys.py.bak create mode 100644 tests/wire/test_manage_v1_projects_requests.py.bak diff --git a/.fernignore b/.fernignore index f9d1a292..7f9e96df 100644 --- a/.fernignore +++ b/.fernignore @@ -45,18 +45,18 @@ src/deepgram/requests/shared_intents_results_intents_segments_item_intents_item. # and Params retain the deprecated ``results`` construction shape and normalize # it to generated ``segments`` while preserving the permanent wrappers above. # [temporarily frozen — remove in the next major after retiring ``results``] -src/deepgram/types/shared_topics.py -src/deepgram/types/shared_intents.py -src/deepgram/requests/shared_topics.py -src/deepgram/requests/shared_intents.py +src/deepgram/types/shared_topics.py.bak +src/deepgram/types/shared_intents.py.bak +src/deepgram/requests/shared_topics.py.bak +src/deepgram/requests/shared_intents.py.bak # Agent Think Live ConversationText gained a required wire field in 2026-10. # The runtime model defaults missing legacy response payloads to `default`, while # the request TypedDict accepts the pre-2026-10 shape for existing typed callers. # SDK-created runtime models still serialize the current wire-required field. # [temporarily frozen — remove after legacy server payloads are retired] -src/deepgram/agent/v1/types/agent_v1conversation_text.py -src/deepgram/agent/v1/requests/agent_v1conversation_text.py +src/deepgram/agent/v1/types/agent_v1conversation_text.py.bak +src/deepgram/agent/v1/requests/agent_v1conversation_text.py.bak # WebSocket socket clients: # - except Exception broad catch (supports custom transports, generator narrows to WebSocketException) @@ -71,17 +71,17 @@ src/deepgram/agent/v1/requests/agent_v1conversation_text.py # - listen response unions include bytes because their iterators and recv methods # already return binary frames # [temporarily frozen — manual patches listed above] -src/deepgram/agent/v1/socket_client.py -src/deepgram/listen/v1/socket_client.py -src/deepgram/listen/v2/socket_client.py -src/deepgram/speak/v1/socket_client.py -src/deepgram/speak/v2/socket_client.py +src/deepgram/agent/v1/socket_client.py.bak +src/deepgram/listen/v1/socket_client.py.bak +src/deepgram/listen/v2/socket_client.py.bak +src/deepgram/speak/v1/socket_client.py.bak +src/deepgram/speak/v2/socket_client.py.bak # Agent TTS provider expressivity must reject fractional values rather than # allowing Pydantic v1 to truncate them before the API sees the request. # [temporarily frozen — remove when Pydantic v1 support is dropped] -src/deepgram/types/speak_settings_v1provider.py -src/deepgram/types/deepgram.py +src/deepgram/types/speak_settings_v1provider.py.bak +src/deepgram/types/deepgram.py.bak # Backward-compat patch: AgentV1SettingsAgentContext schema restructure as of # 2026-05-05. The new schema nests messages under .context.messages; this file @@ -89,12 +89,12 @@ src/deepgram/types/deepgram.py # kwarg and remaps it to `context={"messages": ...}` so existing callers keep # producing the correct wire payload, plus a read-side `.messages` property so # existing attribute access keeps working. -src/deepgram/agent/v1/types/agent_v1settings_agent_context.py -src/deepgram/agent/v1/types/agent_v1settings_agent.py -src/deepgram/agent/v1/types/agent_v1settings.py -src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py -src/deepgram/agent/v1/requests/agent_v1settings_agent.py -src/deepgram/agent/v1/requests/agent_v1settings.py +src/deepgram/agent/v1/types/agent_v1settings_agent_context.py.bak +src/deepgram/agent/v1/types/agent_v1settings_agent.py.bak +src/deepgram/agent/v1/types/agent_v1settings.py.bak +src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py.bak +src/deepgram/agent/v1/requests/agent_v1settings_agent.py.bak +src/deepgram/agent/v1/requests/agent_v1settings.py.bak # Backward-compatibility alias shims for renamed generated public types/params. # These are hand-written wrappers around the current generated names and must not be regenerated. @@ -133,8 +133,8 @@ src/deepgram/requests/create_key_v1request.py # the wire test only counts requests. Remove and unfreeze when the legacy call shape is retired in a # future major. # [temporarily frozen -- manual patch described above] -src/deepgram/manage/v1/projects/keys/client.py -src/deepgram/manage/v1/projects/keys/raw_client.py +src/deepgram/manage/v1/projects/keys/client.py.bak +src/deepgram/manage/v1/projects/keys/raw_client.py.bak # Backward-compatibility alias shims for the 2026-08-18 regen renames. The generator # dropped the *ThinkProvider*/*SpeakProvider* prefixes from these public model/voice/ @@ -191,9 +191,9 @@ src/deepgram/requests/deepgram_listen_provider_v2language_hint.py # remaps a legacy `language_hint=` kwarg to `language_hints` and drops the dead singular # key. Remove and unfreeze these shims when the singular alias is intentionally retired in a # future major release. -src/deepgram/types/deepgram_listen_provider_v2.py -src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py -src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py +src/deepgram/types/deepgram_listen_provider_v2.py.bak +src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py.bak +src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py.bak # Backward-compat patch for the 2026-07-31 AgentV1UpdateListen provider retype. The # generated `provider` field is now the required discriminated union @@ -202,7 +202,7 @@ src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py # that coerces a legacy DeepgramListenProviderV1/V2 (or a dict lacking the version # discriminant) into the new shape so existing callers keep working. Remove and unfreeze # when the old provider payloads are retired in a future major. -src/deepgram/agent/v1/types/agent_v1update_listen_listen.py +src/deepgram/agent/v1/types/agent_v1update_listen_listen.py.bak # Hand-written compat shim recreating ListenV2CloseStreamType, which Fern removed in the # 2026-06-15 regen (docs #946). The original generated type wrongly allowed @@ -215,17 +215,17 @@ src/deepgram/listen/v2/types/listen_v2close_stream_type.py # Temporarily frozen generated package barrels that carry hand-applied legacy alias # re-exports. Before each regen, swap these originals to .bak paths so Fern can add new # exports; then restore the aliases alongside every genuine generated addition. -src/deepgram/__init__.py -src/deepgram/agent/__init__.py -src/deepgram/agent/v1/__init__.py -src/deepgram/agent/v1/types/__init__.py -src/deepgram/agent/v1/requests/__init__.py -src/deepgram/types/__init__.py -src/deepgram/requests/__init__.py +src/deepgram/__init__.py.bak +src/deepgram/agent/__init__.py.bak +src/deepgram/agent/v1/__init__.py.bak +src/deepgram/agent/v1/types/__init__.py.bak +src/deepgram/agent/v1/requests/__init__.py.bak +src/deepgram/types/__init__.py.bak +src/deepgram/requests/__init__.py.bak # listen __init__.py files re-export the ListenV2CloseStreamType shim above. -src/deepgram/listen/__init__.py -src/deepgram/listen/v2/__init__.py -src/deepgram/listen/v2/types/__init__.py +src/deepgram/listen/__init__.py.bak +src/deepgram/listen/v2/__init__.py.bak +src/deepgram/listen/v2/types/__init__.py.bak # Coerces Python bools to lowercase "true"/"false" before urlencode, which # otherwise stringifies via str() and produces "True"/"False" — rejected by @@ -242,40 +242,40 @@ src/deepgram/listen/v2/types/__init__.py # the websockets DEBUG handshake logs; this is the other path to it. Unfreeze if the # generator starts redacting credentials itself. -src/deepgram/core/api_error.py -src/deepgram/core/parse_error.py +src/deepgram/core/api_error.py.bak +src/deepgram/core/parse_error.py.bak # Pydantic 2.14+ adapter annotations are now generated natively. -src/deepgram/core/query_encoder.py +src/deepgram/core/query_encoder.py.bak # The generated metadata fallback must match the published SDK version in source # checkouts and carries a release-please marker so it is updated on release. # [temporarily frozen — remove when Fern emits a release-managed fallback] -src/deepgram/core/client_wrapper.py +src/deepgram/core/client_wrapper.py.bak # Generated docstrings have a local whitespace cleanup. # [temporarily frozen — remove when Fern emits whitespace-clean docstrings] -src/deepgram/speak/v2/types/speak_v2warning.py -src/deepgram/speak/v2/requests/speak_v2warning.py -src/deepgram/agent/v1/types/agent_v1inject_dynamic_agent_message.py -src/deepgram/agent/v1/requests/agent_v1inject_dynamic_agent_message.py -src/deepgram/listen/v1/types/listen_v1configure_failure.py -src/deepgram/listen/v1/requests/listen_v1configure_failure.py +src/deepgram/speak/v2/types/speak_v2warning.py.bak +src/deepgram/speak/v2/requests/speak_v2warning.py.bak +src/deepgram/agent/v1/types/agent_v1inject_dynamic_agent_message.py.bak +src/deepgram/agent/v1/requests/agent_v1inject_dynamic_agent_message.py.bak +src/deepgram/listen/v1/types/listen_v1configure_failure.py.bak +src/deepgram/listen/v1/requests/listen_v1configure_failure.py.bak # Read-side compatibility for the SDK 7.7 Listen V2 response retype. These # generated response models inherit the hand-written base above so callers can # temporarily use both attribute and read-only subscript access. Remove the custom # inheritance and unfreeze these files in the next major release. # [temporarily frozen -- manual patch described above] -src/deepgram/listen/v2/types/listen_v2connected.py -src/deepgram/listen/v2/types/listen_v2turn_info.py -src/deepgram/listen/v2/types/listen_v2turn_info_words_item.py -src/deepgram/listen/v2/types/listen_v2configure_success.py -src/deepgram/listen/v2/types/listen_v2configure_success_thresholds.py -src/deepgram/listen/v2/types/listen_v2configure_failure.py -src/deepgram/listen/v2/types/listen_v2fatal_error.py -src/deepgram/listen/v2/types/listen_v2warning.py +src/deepgram/listen/v2/types/listen_v2connected.py.bak +src/deepgram/listen/v2/types/listen_v2turn_info.py.bak +src/deepgram/listen/v2/types/listen_v2turn_info_words_item.py.bak +src/deepgram/listen/v2/types/listen_v2configure_success.py.bak +src/deepgram/listen/v2/types/listen_v2configure_success_thresholds.py.bak +src/deepgram/listen/v2/types/listen_v2configure_failure.py.bak +src/deepgram/listen/v2/types/listen_v2fatal_error.py.bak +src/deepgram/listen/v2/types/listen_v2warning.py.bak # Hand-written custom tests tests/custom/test_agent_custom_think_provider.py @@ -321,14 +321,14 @@ tests/custom/test_voice_agent_force_end_turn_example.py tests/typecheck/compat_aliases.py # Wire test with restored compatibility coverage for legacy create-key request alias -tests/wire/test_manage_v1_projects_keys.py +tests/wire/test_manage_v1_projects_keys.py.bak # Wire test with restored query-parameter coverage for manage.v1.projects.requests.list. # The 2026-08-11 regen simplified the upstream spec *example* for this endpoint, and Fern # derives the wire test from the example, so the generated test dropped all ten optional # query params (including the datetime -> ISO-8601 Z encoding) while the client signature # still forwards them. Frozen so future regens do not silently drop that check again. -tests/wire/test_manage_v1_projects_requests.py +tests/wire/test_manage_v1_projects_requests.py.bak # Wire test with restored query-parameter coverage for listen.v1.media.transcribe_url. # Third instance of the same mechanism as the two entries above: the 2026-08-18 regen @@ -337,7 +337,7 @@ tests/wire/test_manage_v1_projects_requests.py # dropped all 37 optional query params -- including the bool -> lowercase "true"/"false" # assertions -- while the client signature still forwards every one of them. Frozen so # future regens cannot silently drop that check again. -tests/wire/test_listen_v1_media.py +tests/wire/test_listen_v1_media.py.bak # Manual standalone tests tests/manual @@ -387,7 +387,7 @@ AGENTS.md # file before (fdcce88, ad93815, 4bee463) and would strip them. # [temporarily frozen — unfreeze + re-diff before each regen, then re-apply the # three coverage lines] -.gitignore +.gitignore.bak # Folders to ignore .github diff --git a/.gitignore.bak b/.gitignore.bak new file mode 100644 index 00000000..765eb109 --- /dev/null +++ b/.gitignore.bak @@ -0,0 +1,8 @@ +.mypy_cache/ +.ruff_cache/ +__pycache__/ +dist/ +poetry.toml +.coverage +htmlcov/ +coverage.xml diff --git a/src/deepgram/__init__.py.bak b/src/deepgram/__init__.py.bak new file mode 100644 index 00000000..ed946a84 --- /dev/null +++ b/src/deepgram/__init__.py.bak @@ -0,0 +1,1435 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + AgentConfigurationV1, + AgentThinkModelsV1Response, + AgentThinkModelsV1ResponseModelsItem, + AgentThinkModelsV1ResponseModelsItemId, + AgentThinkModelsV1ResponseModelsItemOne, + AgentThinkModelsV1ResponseModelsItemOneId, + AgentThinkModelsV1ResponseModelsItemThree, + AgentThinkModelsV1ResponseModelsItemTwo, + AgentThinkModelsV1ResponseModelsItemTwoId, + AgentThinkModelsV1ResponseModelsItemZero, + AgentThinkModelsV1ResponseModelsItemZeroId, + AgentVariableV1, + Anthropic, + AnthropicModel, + AwsBedrockThinkProvider, + AwsBedrockThinkProviderCredentials, + AwsBedrockThinkProviderCredentialsType, + AwsBedrockThinkProviderModel, + AwsPollySpeakProvider, + AwsPollySpeakProviderCredentials, + AwsPollySpeakProviderCredentialsType, + AwsPollySpeakProviderEngine, + AwsPollySpeakProviderVoice, + BillingBreakdownV1Response, + BillingBreakdownV1ResponseResolution, + BillingBreakdownV1ResponseResultsItem, + BillingBreakdownV1ResponseResultsItemGrouping, + Cartesia, + CartesiaModelId, + CartesiaVoice, + CreateAgentConfigurationV1Response, + CreateKeyV1Request, + CreateKeyV1Response, + CreateProjectDistributionCredentialsV1Response, + CreateProjectDistributionCredentialsV1ResponseDistributionCredentials, + CreateProjectDistributionCredentialsV1ResponseMember, + CreateProjectInviteV1Response, + Deepgram, + DeepgramListenProviderV1, + DeepgramListenProviderV2, + DeepgramModel, + DeepgramThinkLiveProviderV1, + DeepgramThinkProvider, + DeepgramThinkProviderModel, + DeepgramThinkProviderReasoningMode, + DeleteAgentConfigurationV1Response, + DeleteAgentVariableV1Response, + DeleteProjectInviteV1Response, + DeleteProjectKeyV1Response, + DeleteProjectMemberV1Response, + DeleteProjectV1Response, + ElevenLabsSpeakProvider, + ElevenLabsSpeakProviderModelId, + ErrorResponse, + ErrorResponseLegacyError, + ErrorResponseModernError, + ErrorResponseTextError, + GetModelV1Response, + GetModelV1ResponseBatch, + GetModelV1ResponseMetadata, + GetModelV1ResponseMetadataMetadata, + GetProjectBalanceV1Response, + GetProjectDistributionCredentialsV1Response, + GetProjectDistributionCredentialsV1ResponseDistributionCredentials, + GetProjectDistributionCredentialsV1ResponseMember, + GetProjectKeyV1Response, + GetProjectKeyV1ResponseItem, + GetProjectKeyV1ResponseItemMember, + GetProjectKeyV1ResponseItemMemberApiKey, + GetProjectRequestV1Response, + GetProjectV1Response, + Google, + GoogleModel, + GoogleVersion, + GrantV1Response, + Groq, + GroqReasoningMode, + LeaveProjectV1Response, + ListAgentConfigurationsV1Response, + ListAgentVariablesV1Response, + ListBillingFieldsV1Response, + ListBillingFieldsV1ResponseDeploymentsItem, + ListModelsV1Response, + ListModelsV1ResponseSttModels, + ListModelsV1ResponseTtsModels, + ListModelsV1ResponseTtsModelsMetadata, + ListProjectBalancesV1Response, + ListProjectBalancesV1ResponseBalancesItem, + ListProjectDistributionCredentialsV1Response, + ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem, + ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials, + ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember, + ListProjectInvitesV1Response, + ListProjectInvitesV1ResponseInvitesItem, + ListProjectKeysV1Response, + ListProjectKeysV1ResponseApiKeysItem, + ListProjectKeysV1ResponseApiKeysItemApiKey, + ListProjectKeysV1ResponseApiKeysItemMember, + ListProjectMemberScopesV1Response, + ListProjectMembersV1Response, + ListProjectMembersV1ResponseMembersItem, + ListProjectPurchasesV1Response, + ListProjectPurchasesV1ResponseOrdersItem, + ListProjectRequestsV1Response, + ListProjectsV1Response, + ListProjectsV1ResponseProjectsItem, + ListenV1AcceptedResponse, + ListenV1Callback, + ListenV1CallbackMethod, + ListenV1Channels, + ListenV1DetectEntities, + ListenV1Diarize, + ListenV1Dictation, + ListenV1Encoding, + ListenV1Endpointing, + ListenV1Extra, + ListenV1InterimResults, + ListenV1Keyterm, + ListenV1Keywords, + ListenV1Language, + ListenV1LanguageHint, + ListenV1MipOptOut, + ListenV1Model, + ListenV1Multichannel, + ListenV1Numerals, + ListenV1ProfanityFilter, + ListenV1Punctuate, + ListenV1Redact, + ListenV1RedactUsage, + ListenV1Replace, + ListenV1RequestFile, + ListenV1Response, + ListenV1ResponseMetadata, + ListenV1ResponseMetadataDiarizeInfo, + ListenV1ResponseMetadataIntentsInfo, + ListenV1ResponseMetadataSentimentInfo, + ListenV1ResponseMetadataSummaryInfo, + ListenV1ResponseMetadataTopicsInfo, + ListenV1ResponseResults, + ListenV1ResponseResultsChannels, + ListenV1ResponseResultsChannelsItem, + ListenV1ResponseResultsChannelsItemAlternativesItem, + ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem, + ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs, + ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem, + ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem, + ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem, + ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem, + ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem, + ListenV1ResponseResultsChannelsItemSearchItem, + ListenV1ResponseResultsChannelsItemSearchItemHitsItem, + ListenV1ResponseResultsSummary, + ListenV1ResponseResultsUtterances, + ListenV1ResponseResultsUtterancesItem, + ListenV1ResponseResultsUtterancesItemWordsItem, + ListenV1SampleRate, + ListenV1Search, + ListenV1SmartFormat, + ListenV1Tag, + ListenV1UtteranceEndMs, + ListenV1VadEvents, + ListenV1Version, + ListenV2ConfigureNumerals, + ListenV2ConfigureRedactUsage, + ListenV2EagerEotThreshold, + ListenV2Encoding, + ListenV2EotThreshold, + ListenV2EotTimeoutMs, + ListenV2Keyterm, + ListenV2LanguageHint, + ListenV2MipOptOut, + ListenV2Model, + ListenV2Numerals, + ListenV2ProfanityFilter, + ListenV2Redact, + ListenV2RedactUsage, + ListenV2SampleRate, + ListenV2Tag, + Nvidia, + NvidiaReasoningMode, + OpenAiSpeakProvider, + OpenAiSpeakProviderModel, + OpenAiSpeakProviderVoice, + OpenAiThinkProvider, + OpenAiThinkProviderModel, + OpenAiThinkProviderReasoningMode, + ProjectRequestResponse, + ReadV1Request, + ReadV1RequestText, + ReadV1RequestUrl, + ReadV1Response, + ReadV1ResponseMetadata, + ReadV1ResponseMetadataMetadata, + ReadV1ResponseMetadataMetadataIntentsInfo, + ReadV1ResponseMetadataMetadataSentimentInfo, + ReadV1ResponseMetadataMetadataSummaryInfo, + ReadV1ResponseMetadataMetadataTopicsInfo, + ReadV1ResponseResults, + ReadV1ResponseResultsSummary, + ReadV1ResponseResultsSummaryResults, + ReadV1ResponseResultsSummaryResultsSummary, + SharedIntents, + SharedIntentsSegmentsItem, + SharedIntentsSegmentsItemIntentsItem, + SharedSentiments, + SharedSentimentsAverage, + SharedSentimentsSegmentsItem, + SharedTopics, + SharedTopicsSegmentsItem, + SharedTopicsSegmentsItemTopicsItem, + SpeakSettingsV1, + SpeakSettingsV1Endpoint, + SpeakSettingsV1Provider, + SpeakSettingsV1Provider_AwsPolly, + SpeakSettingsV1Provider_Cartesia, + SpeakSettingsV1Provider_Deepgram, + SpeakSettingsV1Provider_ElevenLabs, + SpeakSettingsV1Provider_OpenAi, + SpeakV1Encoding, + SpeakV1MipOptOut, + SpeakV1Model, + SpeakV1Response, + SpeakV1SampleRate, + SpeakV1Speed, + SpeakV2AcceptedResponse, + SpeakV2Encoding, + SpeakV2Expressivity, + SpeakV2MipOptOut, + SpeakV2Model, + SpeakV2NormalizeVolume, + SpeakV2Response, + SpeakV2SampleRate, + SpeakV2Speed, + SpeakV2SpeedValue, + SpeakV2Tag, + ThinkLiveSettingsV1, + ThinkSettingsV1, + ThinkSettingsV1ContextLength, + ThinkSettingsV1Endpoint, + ThinkSettingsV1FunctionsItem, + ThinkSettingsV1FunctionsItemEndpoint, + ThinkSettingsV1Provider, + ThinkSettingsV1Provider_Anthropic, + ThinkSettingsV1Provider_AwsBedrock, + ThinkSettingsV1Provider_Deepgram, + ThinkSettingsV1Provider_Google, + ThinkSettingsV1Provider_Groq, + ThinkSettingsV1Provider_Nvidia, + ThinkSettingsV1Provider_OpenAi, + UpdateProjectMemberScopesV1Response, + UpdateProjectV1Response, + UsageBreakdownV1Response, + UsageBreakdownV1ResponseResolution, + UsageBreakdownV1ResponseResultsItem, + UsageBreakdownV1ResponseResultsItemGrouping, + UsageFieldsV1Response, + UsageFieldsV1ResponseModelsItem, + UsageV1Response, + UsageV1ResponseResolution, + ) + from .errors import BadRequestError + from . import agent, auth, listen, manage, read, self_hosted, speak, voice_agent + from ._default_clients import DefaultAioHttpClient, DefaultAsyncHttpxClient + from .client import AsyncDeepgramClient, DeepgramClient + from .environment import DeepgramClientEnvironment + from .requests import ( + AgentConfigurationV1Params, + AgentThinkModelsV1ResponseModelsItemIdParams, + AgentThinkModelsV1ResponseModelsItemOneParams, + AgentThinkModelsV1ResponseModelsItemParams, + AgentThinkModelsV1ResponseModelsItemThreeParams, + AgentThinkModelsV1ResponseModelsItemTwoParams, + AgentThinkModelsV1ResponseModelsItemZeroParams, + AgentThinkModelsV1ResponseParams, + AgentVariableV1Params, + AnthropicParams, + AwsBedrockThinkProviderCredentialsParams, + AwsBedrockThinkProviderParams, + AwsPollySpeakProviderCredentialsParams, + AwsPollySpeakProviderParams, + BillingBreakdownV1ResponseParams, + BillingBreakdownV1ResponseResolutionParams, + BillingBreakdownV1ResponseResultsItemGroupingParams, + BillingBreakdownV1ResponseResultsItemParams, + CartesiaParams, + CartesiaVoiceParams, + CreateAgentConfigurationV1ResponseParams, + CreateKeyV1RequestParams, + CreateKeyV1ResponseParams, + CreateProjectDistributionCredentialsV1ResponseDistributionCredentialsParams, + CreateProjectDistributionCredentialsV1ResponseMemberParams, + CreateProjectDistributionCredentialsV1ResponseParams, + CreateProjectInviteV1ResponseParams, + DeepgramListenProviderV1Params, + DeepgramListenProviderV2Params, + DeepgramParams, + DeepgramThinkLiveProviderV1Params, + DeepgramThinkProviderParams, + DeleteProjectInviteV1ResponseParams, + DeleteProjectKeyV1ResponseParams, + DeleteProjectMemberV1ResponseParams, + DeleteProjectV1ResponseParams, + ElevenLabsSpeakProviderParams, + ErrorResponseLegacyErrorParams, + ErrorResponseModernErrorParams, + ErrorResponseParams, + GetModelV1ResponseBatchParams, + GetModelV1ResponseMetadataMetadataParams, + GetModelV1ResponseMetadataParams, + GetModelV1ResponseParams, + GetProjectBalanceV1ResponseParams, + GetProjectDistributionCredentialsV1ResponseDistributionCredentialsParams, + GetProjectDistributionCredentialsV1ResponseMemberParams, + GetProjectDistributionCredentialsV1ResponseParams, + GetProjectKeyV1ResponseItemMemberApiKeyParams, + GetProjectKeyV1ResponseItemMemberParams, + GetProjectKeyV1ResponseItemParams, + GetProjectKeyV1ResponseParams, + GetProjectRequestV1ResponseParams, + GetProjectV1ResponseParams, + GoogleParams, + GrantV1ResponseParams, + GroqParams, + LeaveProjectV1ResponseParams, + ListAgentConfigurationsV1ResponseParams, + ListAgentVariablesV1ResponseParams, + ListBillingFieldsV1ResponseParams, + ListModelsV1ResponseParams, + ListModelsV1ResponseSttModelsParams, + ListModelsV1ResponseTtsModelsMetadataParams, + ListModelsV1ResponseTtsModelsParams, + ListProjectBalancesV1ResponseBalancesItemParams, + ListProjectBalancesV1ResponseParams, + ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentialsParams, + ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMemberParams, + ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemParams, + ListProjectDistributionCredentialsV1ResponseParams, + ListProjectInvitesV1ResponseInvitesItemParams, + ListProjectInvitesV1ResponseParams, + ListProjectKeysV1ResponseApiKeysItemApiKeyParams, + ListProjectKeysV1ResponseApiKeysItemMemberParams, + ListProjectKeysV1ResponseApiKeysItemParams, + ListProjectKeysV1ResponseParams, + ListProjectMemberScopesV1ResponseParams, + ListProjectMembersV1ResponseMembersItemParams, + ListProjectMembersV1ResponseParams, + ListProjectPurchasesV1ResponseOrdersItemParams, + ListProjectPurchasesV1ResponseParams, + ListProjectRequestsV1ResponseParams, + ListProjectsV1ResponseParams, + ListProjectsV1ResponseProjectsItemParams, + ListenV1AcceptedResponseParams, + ListenV1LanguageHintParams, + ListenV1ResponseMetadataDiarizeInfoParams, + ListenV1ResponseMetadataIntentsInfoParams, + ListenV1ResponseMetadataParams, + ListenV1ResponseMetadataSentimentInfoParams, + ListenV1ResponseMetadataSummaryInfoParams, + ListenV1ResponseMetadataTopicsInfoParams, + ListenV1ResponseParams, + ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItemParams, + ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemParams, + ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItemParams, + ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParams, + ListenV1ResponseResultsChannelsItemAlternativesItemParams, + ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItemParams, + ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItemParams, + ListenV1ResponseResultsChannelsItemAlternativesItemWordsItemParams, + ListenV1ResponseResultsChannelsItemParams, + ListenV1ResponseResultsChannelsItemSearchItemHitsItemParams, + ListenV1ResponseResultsChannelsItemSearchItemParams, + ListenV1ResponseResultsChannelsParams, + ListenV1ResponseResultsParams, + ListenV1ResponseResultsSummaryParams, + ListenV1ResponseResultsUtterancesItemParams, + ListenV1ResponseResultsUtterancesItemWordsItemParams, + ListenV1ResponseResultsUtterancesParams, + ListenV2KeytermParams, + ListenV2LanguageHintParams, + NvidiaParams, + OpenAiSpeakProviderParams, + OpenAiThinkProviderParams, + ProjectRequestResponseParams, + ReadV1RequestParams, + ReadV1RequestTextParams, + ReadV1RequestUrlParams, + ReadV1ResponseMetadataMetadataIntentsInfoParams, + ReadV1ResponseMetadataMetadataParams, + ReadV1ResponseMetadataMetadataSentimentInfoParams, + ReadV1ResponseMetadataMetadataSummaryInfoParams, + ReadV1ResponseMetadataMetadataTopicsInfoParams, + ReadV1ResponseMetadataParams, + ReadV1ResponseParams, + ReadV1ResponseResultsParams, + ReadV1ResponseResultsSummaryParams, + ReadV1ResponseResultsSummaryResultsParams, + ReadV1ResponseResultsSummaryResultsSummaryParams, + SharedIntentsParams, + SharedIntentsSegmentsItemIntentsItemParams, + SharedIntentsSegmentsItemParams, + SharedSentimentsAverageParams, + SharedSentimentsParams, + SharedSentimentsSegmentsItemParams, + SharedTopicsParams, + SharedTopicsSegmentsItemParams, + SharedTopicsSegmentsItemTopicsItemParams, + SpeakSettingsV1EndpointParams, + SpeakSettingsV1Params, + SpeakSettingsV1ProviderParams, + SpeakSettingsV1Provider_AwsPollyParams, + SpeakSettingsV1Provider_CartesiaParams, + SpeakSettingsV1Provider_DeepgramParams, + SpeakSettingsV1Provider_ElevenLabsParams, + SpeakSettingsV1Provider_OpenAiParams, + SpeakV2AcceptedResponseParams, + ThinkLiveSettingsV1Params, + ThinkSettingsV1ContextLengthParams, + ThinkSettingsV1EndpointParams, + ThinkSettingsV1FunctionsItemEndpointParams, + ThinkSettingsV1FunctionsItemParams, + ThinkSettingsV1Params, + ThinkSettingsV1ProviderParams, + ThinkSettingsV1Provider_AnthropicParams, + ThinkSettingsV1Provider_AwsBedrockParams, + ThinkSettingsV1Provider_DeepgramParams, + ThinkSettingsV1Provider_GoogleParams, + ThinkSettingsV1Provider_GroqParams, + ThinkSettingsV1Provider_NvidiaParams, + ThinkSettingsV1Provider_OpenAiParams, + UpdateProjectMemberScopesV1ResponseParams, + UpdateProjectV1ResponseParams, + UsageBreakdownV1ResponseParams, + UsageBreakdownV1ResponseResolutionParams, + UsageBreakdownV1ResponseResultsItemGroupingParams, + UsageBreakdownV1ResponseResultsItemParams, + UsageFieldsV1ResponseModelsItemParams, + UsageFieldsV1ResponseParams, + UsageV1ResponseParams, + UsageV1ResponseResolutionParams, + ) + from .version import __version__ +_dynamic_imports: typing.Dict[str, str] = { + "AgentConfigurationV1": ".types", + "AgentConfigurationV1Params": ".requests", + "AgentThinkModelsV1Response": ".types", + "AgentThinkModelsV1ResponseModelsItem": ".types", + "AgentThinkModelsV1ResponseModelsItemId": ".types", + "AgentThinkModelsV1ResponseModelsItemIdParams": ".requests", + "AgentThinkModelsV1ResponseModelsItemOne": ".types", + "AgentThinkModelsV1ResponseModelsItemOneId": ".types", + "AgentThinkModelsV1ResponseModelsItemOneParams": ".requests", + "AgentThinkModelsV1ResponseModelsItemParams": ".requests", + "AgentThinkModelsV1ResponseModelsItemThree": ".types", + "AgentThinkModelsV1ResponseModelsItemThreeParams": ".requests", + "AgentThinkModelsV1ResponseModelsItemTwo": ".types", + "AgentThinkModelsV1ResponseModelsItemTwoId": ".types", + "AgentThinkModelsV1ResponseModelsItemTwoParams": ".requests", + "AgentThinkModelsV1ResponseModelsItemZero": ".types", + "AgentThinkModelsV1ResponseModelsItemZeroId": ".types", + "AgentThinkModelsV1ResponseModelsItemZeroParams": ".requests", + "AgentThinkModelsV1ResponseParams": ".requests", + "AgentVariableV1": ".types", + "AgentVariableV1Params": ".requests", + "Anthropic": ".types", + "AnthropicModel": ".types", + "AnthropicParams": ".requests", + "AsyncDeepgramClient": ".client", + "AwsBedrockThinkProvider": ".types", + "AwsBedrockThinkProviderCredentials": ".types", + "AwsBedrockThinkProviderCredentialsParams": ".requests", + "AwsBedrockThinkProviderCredentialsType": ".types", + "AwsBedrockThinkProviderModel": ".types", + "AwsBedrockThinkProviderParams": ".requests", + "AwsPollySpeakProvider": ".types", + "AwsPollySpeakProviderCredentials": ".types", + "AwsPollySpeakProviderCredentialsParams": ".requests", + "AwsPollySpeakProviderCredentialsType": ".types", + "AwsPollySpeakProviderEngine": ".types", + "AwsPollySpeakProviderParams": ".requests", + "AwsPollySpeakProviderVoice": ".types", + "BadRequestError": ".errors", + "BillingBreakdownV1Response": ".types", + "BillingBreakdownV1ResponseParams": ".requests", + "BillingBreakdownV1ResponseResolution": ".types", + "BillingBreakdownV1ResponseResolutionParams": ".requests", + "BillingBreakdownV1ResponseResultsItem": ".types", + "BillingBreakdownV1ResponseResultsItemGrouping": ".types", + "BillingBreakdownV1ResponseResultsItemGroupingParams": ".requests", + "BillingBreakdownV1ResponseResultsItemParams": ".requests", + "Cartesia": ".types", + "CartesiaModelId": ".types", + "CartesiaParams": ".requests", + "CartesiaVoice": ".types", + "CartesiaVoiceParams": ".requests", + "CreateAgentConfigurationV1Response": ".types", + "CreateAgentConfigurationV1ResponseParams": ".requests", + "CreateKeyV1Request": ".types", + "CreateKeyV1RequestParams": ".requests", + "CreateKeyV1Response": ".types", + "CreateKeyV1ResponseParams": ".requests", + "CreateProjectDistributionCredentialsV1Response": ".types", + "CreateProjectDistributionCredentialsV1ResponseDistributionCredentials": ".types", + "CreateProjectDistributionCredentialsV1ResponseDistributionCredentialsParams": ".requests", + "CreateProjectDistributionCredentialsV1ResponseMember": ".types", + "CreateProjectDistributionCredentialsV1ResponseMemberParams": ".requests", + "CreateProjectDistributionCredentialsV1ResponseParams": ".requests", + "CreateProjectInviteV1Response": ".types", + "CreateProjectInviteV1ResponseParams": ".requests", + "Deepgram": ".types", + "DeepgramClient": ".client", + "DeepgramClientEnvironment": ".environment", + "DeepgramListenProviderV1": ".types", + "DeepgramListenProviderV1Params": ".requests", + "DeepgramListenProviderV2": ".types", + "DeepgramListenProviderV2Params": ".requests", + "DeepgramModel": ".types", + "DeepgramParams": ".requests", + "DeepgramThinkLiveProviderV1": ".types", + "DeepgramThinkLiveProviderV1Params": ".requests", + "DeepgramThinkProvider": ".types", + "DeepgramThinkProviderModel": ".types", + "DeepgramThinkProviderParams": ".requests", + "DeepgramThinkProviderReasoningMode": ".types", + "DefaultAioHttpClient": "._default_clients", + "DefaultAsyncHttpxClient": "._default_clients", + "DeleteAgentConfigurationV1Response": ".types", + "DeleteAgentVariableV1Response": ".types", + "DeleteProjectInviteV1Response": ".types", + "DeleteProjectInviteV1ResponseParams": ".requests", + "DeleteProjectKeyV1Response": ".types", + "DeleteProjectKeyV1ResponseParams": ".requests", + "DeleteProjectMemberV1Response": ".types", + "DeleteProjectMemberV1ResponseParams": ".requests", + "DeleteProjectV1Response": ".types", + "DeleteProjectV1ResponseParams": ".requests", + "ElevenLabsSpeakProvider": ".types", + "ElevenLabsSpeakProviderModelId": ".types", + "ElevenLabsSpeakProviderParams": ".requests", + "ErrorResponse": ".types", + "ErrorResponseLegacyError": ".types", + "ErrorResponseLegacyErrorParams": ".requests", + "ErrorResponseModernError": ".types", + "ErrorResponseModernErrorParams": ".requests", + "ErrorResponseParams": ".requests", + "ErrorResponseTextError": ".types", + "GetModelV1Response": ".types", + "GetModelV1ResponseBatch": ".types", + "GetModelV1ResponseBatchParams": ".requests", + "GetModelV1ResponseMetadata": ".types", + "GetModelV1ResponseMetadataMetadata": ".types", + "GetModelV1ResponseMetadataMetadataParams": ".requests", + "GetModelV1ResponseMetadataParams": ".requests", + "GetModelV1ResponseParams": ".requests", + "GetProjectBalanceV1Response": ".types", + "GetProjectBalanceV1ResponseParams": ".requests", + "GetProjectDistributionCredentialsV1Response": ".types", + "GetProjectDistributionCredentialsV1ResponseDistributionCredentials": ".types", + "GetProjectDistributionCredentialsV1ResponseDistributionCredentialsParams": ".requests", + "GetProjectDistributionCredentialsV1ResponseMember": ".types", + "GetProjectDistributionCredentialsV1ResponseMemberParams": ".requests", + "GetProjectDistributionCredentialsV1ResponseParams": ".requests", + "GetProjectKeyV1Response": ".types", + "GetProjectKeyV1ResponseItem": ".types", + "GetProjectKeyV1ResponseItemMember": ".types", + "GetProjectKeyV1ResponseItemMemberApiKey": ".types", + "GetProjectKeyV1ResponseItemMemberApiKeyParams": ".requests", + "GetProjectKeyV1ResponseItemMemberParams": ".requests", + "GetProjectKeyV1ResponseItemParams": ".requests", + "GetProjectKeyV1ResponseParams": ".requests", + "GetProjectRequestV1Response": ".types", + "GetProjectRequestV1ResponseParams": ".requests", + "GetProjectV1Response": ".types", + "GetProjectV1ResponseParams": ".requests", + "Google": ".types", + "GoogleModel": ".types", + "GoogleParams": ".requests", + "GoogleVersion": ".types", + "GrantV1Response": ".types", + "GrantV1ResponseParams": ".requests", + "Groq": ".types", + "GroqParams": ".requests", + "GroqReasoningMode": ".types", + "LeaveProjectV1Response": ".types", + "LeaveProjectV1ResponseParams": ".requests", + "ListAgentConfigurationsV1Response": ".types", + "ListAgentConfigurationsV1ResponseParams": ".requests", + "ListAgentVariablesV1Response": ".types", + "ListAgentVariablesV1ResponseParams": ".requests", + "ListBillingFieldsV1Response": ".types", + "ListBillingFieldsV1ResponseDeploymentsItem": ".types", + "ListBillingFieldsV1ResponseParams": ".requests", + "ListModelsV1Response": ".types", + "ListModelsV1ResponseParams": ".requests", + "ListModelsV1ResponseSttModels": ".types", + "ListModelsV1ResponseSttModelsParams": ".requests", + "ListModelsV1ResponseTtsModels": ".types", + "ListModelsV1ResponseTtsModelsMetadata": ".types", + "ListModelsV1ResponseTtsModelsMetadataParams": ".requests", + "ListModelsV1ResponseTtsModelsParams": ".requests", + "ListProjectBalancesV1Response": ".types", + "ListProjectBalancesV1ResponseBalancesItem": ".types", + "ListProjectBalancesV1ResponseBalancesItemParams": ".requests", + "ListProjectBalancesV1ResponseParams": ".requests", + "ListProjectDistributionCredentialsV1Response": ".types", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem": ".types", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials": ".types", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentialsParams": ".requests", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember": ".types", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMemberParams": ".requests", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemParams": ".requests", + "ListProjectDistributionCredentialsV1ResponseParams": ".requests", + "ListProjectInvitesV1Response": ".types", + "ListProjectInvitesV1ResponseInvitesItem": ".types", + "ListProjectInvitesV1ResponseInvitesItemParams": ".requests", + "ListProjectInvitesV1ResponseParams": ".requests", + "ListProjectKeysV1Response": ".types", + "ListProjectKeysV1ResponseApiKeysItem": ".types", + "ListProjectKeysV1ResponseApiKeysItemApiKey": ".types", + "ListProjectKeysV1ResponseApiKeysItemApiKeyParams": ".requests", + "ListProjectKeysV1ResponseApiKeysItemMember": ".types", + "ListProjectKeysV1ResponseApiKeysItemMemberParams": ".requests", + "ListProjectKeysV1ResponseApiKeysItemParams": ".requests", + "ListProjectKeysV1ResponseParams": ".requests", + "ListProjectMemberScopesV1Response": ".types", + "ListProjectMemberScopesV1ResponseParams": ".requests", + "ListProjectMembersV1Response": ".types", + "ListProjectMembersV1ResponseMembersItem": ".types", + "ListProjectMembersV1ResponseMembersItemParams": ".requests", + "ListProjectMembersV1ResponseParams": ".requests", + "ListProjectPurchasesV1Response": ".types", + "ListProjectPurchasesV1ResponseOrdersItem": ".types", + "ListProjectPurchasesV1ResponseOrdersItemParams": ".requests", + "ListProjectPurchasesV1ResponseParams": ".requests", + "ListProjectRequestsV1Response": ".types", + "ListProjectRequestsV1ResponseParams": ".requests", + "ListProjectsV1Response": ".types", + "ListProjectsV1ResponseParams": ".requests", + "ListProjectsV1ResponseProjectsItem": ".types", + "ListProjectsV1ResponseProjectsItemParams": ".requests", + "ListenV1AcceptedResponse": ".types", + "ListenV1AcceptedResponseParams": ".requests", + "ListenV1Callback": ".types", + "ListenV1CallbackMethod": ".types", + "ListenV1Channels": ".types", + "ListenV1DetectEntities": ".types", + "ListenV1Diarize": ".types", + "ListenV1Dictation": ".types", + "ListenV1Encoding": ".types", + "ListenV1Endpointing": ".types", + "ListenV1Extra": ".types", + "ListenV1InterimResults": ".types", + "ListenV1Keyterm": ".types", + "ListenV1Keywords": ".types", + "ListenV1Language": ".types", + "ListenV1LanguageHint": ".types", + "ListenV1LanguageHintParams": ".requests", + "ListenV1MipOptOut": ".types", + "ListenV1Model": ".types", + "ListenV1Multichannel": ".types", + "ListenV1Numerals": ".types", + "ListenV1ProfanityFilter": ".types", + "ListenV1Punctuate": ".types", + "ListenV1Redact": ".types", + "ListenV1RedactUsage": ".types", + "ListenV1Replace": ".types", + "ListenV1RequestFile": ".types", + "ListenV1Response": ".types", + "ListenV1ResponseMetadata": ".types", + "ListenV1ResponseMetadataDiarizeInfo": ".types", + "ListenV1ResponseMetadataDiarizeInfoParams": ".requests", + "ListenV1ResponseMetadataIntentsInfo": ".types", + "ListenV1ResponseMetadataIntentsInfoParams": ".requests", + "ListenV1ResponseMetadataParams": ".requests", + "ListenV1ResponseMetadataSentimentInfo": ".types", + "ListenV1ResponseMetadataSentimentInfoParams": ".requests", + "ListenV1ResponseMetadataSummaryInfo": ".types", + "ListenV1ResponseMetadataSummaryInfoParams": ".requests", + "ListenV1ResponseMetadataTopicsInfo": ".types", + "ListenV1ResponseMetadataTopicsInfoParams": ".requests", + "ListenV1ResponseParams": ".requests", + "ListenV1ResponseResults": ".types", + "ListenV1ResponseResultsChannels": ".types", + "ListenV1ResponseResultsChannelsItem": ".types", + "ListenV1ResponseResultsChannelsItemAlternativesItem": ".types", + "ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem": ".types", + "ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItemParams": ".requests", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs": ".types", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem": ".types", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemParams": ".requests", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem": ".types", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItemParams": ".requests", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParams": ".requests", + "ListenV1ResponseResultsChannelsItemAlternativesItemParams": ".requests", + "ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem": ".types", + "ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItemParams": ".requests", + "ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem": ".types", + "ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItemParams": ".requests", + "ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem": ".types", + "ListenV1ResponseResultsChannelsItemAlternativesItemWordsItemParams": ".requests", + "ListenV1ResponseResultsChannelsItemParams": ".requests", + "ListenV1ResponseResultsChannelsItemSearchItem": ".types", + "ListenV1ResponseResultsChannelsItemSearchItemHitsItem": ".types", + "ListenV1ResponseResultsChannelsItemSearchItemHitsItemParams": ".requests", + "ListenV1ResponseResultsChannelsItemSearchItemParams": ".requests", + "ListenV1ResponseResultsChannelsParams": ".requests", + "ListenV1ResponseResultsParams": ".requests", + "ListenV1ResponseResultsSummary": ".types", + "ListenV1ResponseResultsSummaryParams": ".requests", + "ListenV1ResponseResultsUtterances": ".types", + "ListenV1ResponseResultsUtterancesItem": ".types", + "ListenV1ResponseResultsUtterancesItemParams": ".requests", + "ListenV1ResponseResultsUtterancesItemWordsItem": ".types", + "ListenV1ResponseResultsUtterancesItemWordsItemParams": ".requests", + "ListenV1ResponseResultsUtterancesParams": ".requests", + "ListenV1SampleRate": ".types", + "ListenV1Search": ".types", + "ListenV1SmartFormat": ".types", + "ListenV1Tag": ".types", + "ListenV1UtteranceEndMs": ".types", + "ListenV1VadEvents": ".types", + "ListenV1Version": ".types", + "ListenV2ConfigureNumerals": ".types", + "ListenV2ConfigureRedactUsage": ".types", + "ListenV2EagerEotThreshold": ".types", + "ListenV2Encoding": ".types", + "ListenV2EotThreshold": ".types", + "ListenV2EotTimeoutMs": ".types", + "ListenV2Keyterm": ".types", + "ListenV2KeytermParams": ".requests", + "ListenV2LanguageHint": ".types", + "ListenV2LanguageHintParams": ".requests", + "ListenV2MipOptOut": ".types", + "ListenV2Model": ".types", + "ListenV2Numerals": ".types", + "ListenV2ProfanityFilter": ".types", + "ListenV2Redact": ".types", + "ListenV2RedactUsage": ".types", + "ListenV2SampleRate": ".types", + "ListenV2Tag": ".types", + "Nvidia": ".types", + "NvidiaParams": ".requests", + "NvidiaReasoningMode": ".types", + "OpenAiSpeakProvider": ".types", + "OpenAiSpeakProviderModel": ".types", + "OpenAiSpeakProviderParams": ".requests", + "OpenAiSpeakProviderVoice": ".types", + "OpenAiThinkProvider": ".types", + "OpenAiThinkProviderModel": ".types", + "OpenAiThinkProviderParams": ".requests", + "OpenAiThinkProviderReasoningMode": ".types", + "ProjectRequestResponse": ".types", + "ProjectRequestResponseParams": ".requests", + "ReadV1Request": ".types", + "ReadV1RequestParams": ".requests", + "ReadV1RequestText": ".types", + "ReadV1RequestTextParams": ".requests", + "ReadV1RequestUrl": ".types", + "ReadV1RequestUrlParams": ".requests", + "ReadV1Response": ".types", + "ReadV1ResponseMetadata": ".types", + "ReadV1ResponseMetadataMetadata": ".types", + "ReadV1ResponseMetadataMetadataIntentsInfo": ".types", + "ReadV1ResponseMetadataMetadataIntentsInfoParams": ".requests", + "ReadV1ResponseMetadataMetadataParams": ".requests", + "ReadV1ResponseMetadataMetadataSentimentInfo": ".types", + "ReadV1ResponseMetadataMetadataSentimentInfoParams": ".requests", + "ReadV1ResponseMetadataMetadataSummaryInfo": ".types", + "ReadV1ResponseMetadataMetadataSummaryInfoParams": ".requests", + "ReadV1ResponseMetadataMetadataTopicsInfo": ".types", + "ReadV1ResponseMetadataMetadataTopicsInfoParams": ".requests", + "ReadV1ResponseMetadataParams": ".requests", + "ReadV1ResponseParams": ".requests", + "ReadV1ResponseResults": ".types", + "ReadV1ResponseResultsParams": ".requests", + "ReadV1ResponseResultsSummary": ".types", + "ReadV1ResponseResultsSummaryParams": ".requests", + "ReadV1ResponseResultsSummaryResults": ".types", + "ReadV1ResponseResultsSummaryResultsParams": ".requests", + "ReadV1ResponseResultsSummaryResultsSummary": ".types", + "ReadV1ResponseResultsSummaryResultsSummaryParams": ".requests", + "SharedIntents": ".types", + "SharedIntentsParams": ".requests", + "SharedIntentsSegmentsItem": ".types", + "SharedIntentsSegmentsItemIntentsItem": ".types", + "SharedIntentsSegmentsItemIntentsItemParams": ".requests", + "SharedIntentsSegmentsItemParams": ".requests", + "SharedSentiments": ".types", + "SharedSentimentsAverage": ".types", + "SharedSentimentsAverageParams": ".requests", + "SharedSentimentsParams": ".requests", + "SharedSentimentsSegmentsItem": ".types", + "SharedSentimentsSegmentsItemParams": ".requests", + "SharedTopics": ".types", + "SharedTopicsParams": ".requests", + "SharedTopicsSegmentsItem": ".types", + "SharedTopicsSegmentsItemParams": ".requests", + "SharedTopicsSegmentsItemTopicsItem": ".types", + "SharedTopicsSegmentsItemTopicsItemParams": ".requests", + "SpeakSettingsV1": ".types", + "SpeakSettingsV1Endpoint": ".types", + "SpeakSettingsV1EndpointParams": ".requests", + "SpeakSettingsV1Params": ".requests", + "SpeakSettingsV1Provider": ".types", + "SpeakSettingsV1ProviderParams": ".requests", + "SpeakSettingsV1Provider_AwsPolly": ".types", + "SpeakSettingsV1Provider_AwsPollyParams": ".requests", + "SpeakSettingsV1Provider_Cartesia": ".types", + "SpeakSettingsV1Provider_CartesiaParams": ".requests", + "SpeakSettingsV1Provider_Deepgram": ".types", + "SpeakSettingsV1Provider_DeepgramParams": ".requests", + "SpeakSettingsV1Provider_ElevenLabs": ".types", + "SpeakSettingsV1Provider_ElevenLabsParams": ".requests", + "SpeakSettingsV1Provider_OpenAi": ".types", + "SpeakSettingsV1Provider_OpenAiParams": ".requests", + "SpeakV1Encoding": ".types", + "SpeakV1MipOptOut": ".types", + "SpeakV1Model": ".types", + "SpeakV1Response": ".types", + "SpeakV1SampleRate": ".types", + "SpeakV1Speed": ".types", + "SpeakV2AcceptedResponse": ".types", + "SpeakV2AcceptedResponseParams": ".requests", + "SpeakV2Encoding": ".types", + "SpeakV2Expressivity": ".types", + "SpeakV2MipOptOut": ".types", + "SpeakV2Model": ".types", + "SpeakV2NormalizeVolume": ".types", + "SpeakV2Response": ".types", + "SpeakV2SampleRate": ".types", + "SpeakV2Speed": ".types", + "SpeakV2SpeedValue": ".types", + "SpeakV2Tag": ".types", + "ThinkLiveSettingsV1": ".types", + "ThinkLiveSettingsV1Params": ".requests", + "ThinkSettingsV1": ".types", + "ThinkSettingsV1ContextLength": ".types", + "ThinkSettingsV1ContextLengthParams": ".requests", + "ThinkSettingsV1Endpoint": ".types", + "ThinkSettingsV1EndpointParams": ".requests", + "ThinkSettingsV1FunctionsItem": ".types", + "ThinkSettingsV1FunctionsItemEndpoint": ".types", + "ThinkSettingsV1FunctionsItemEndpointParams": ".requests", + "ThinkSettingsV1FunctionsItemParams": ".requests", + "ThinkSettingsV1Params": ".requests", + "ThinkSettingsV1Provider": ".types", + "ThinkSettingsV1ProviderParams": ".requests", + "ThinkSettingsV1Provider_Anthropic": ".types", + "ThinkSettingsV1Provider_AnthropicParams": ".requests", + "ThinkSettingsV1Provider_AwsBedrock": ".types", + "ThinkSettingsV1Provider_AwsBedrockParams": ".requests", + "ThinkSettingsV1Provider_Deepgram": ".types", + "ThinkSettingsV1Provider_DeepgramParams": ".requests", + "ThinkSettingsV1Provider_Google": ".types", + "ThinkSettingsV1Provider_GoogleParams": ".requests", + "ThinkSettingsV1Provider_Groq": ".types", + "ThinkSettingsV1Provider_GroqParams": ".requests", + "ThinkSettingsV1Provider_Nvidia": ".types", + "ThinkSettingsV1Provider_NvidiaParams": ".requests", + "ThinkSettingsV1Provider_OpenAi": ".types", + "ThinkSettingsV1Provider_OpenAiParams": ".requests", + "UpdateProjectMemberScopesV1Response": ".types", + "UpdateProjectMemberScopesV1ResponseParams": ".requests", + "UpdateProjectV1Response": ".types", + "UpdateProjectV1ResponseParams": ".requests", + "UsageBreakdownV1Response": ".types", + "UsageBreakdownV1ResponseParams": ".requests", + "UsageBreakdownV1ResponseResolution": ".types", + "UsageBreakdownV1ResponseResolutionParams": ".requests", + "UsageBreakdownV1ResponseResultsItem": ".types", + "UsageBreakdownV1ResponseResultsItemGrouping": ".types", + "UsageBreakdownV1ResponseResultsItemGroupingParams": ".requests", + "UsageBreakdownV1ResponseResultsItemParams": ".requests", + "UsageFieldsV1Response": ".types", + "UsageFieldsV1ResponseModelsItem": ".types", + "UsageFieldsV1ResponseModelsItemParams": ".requests", + "UsageFieldsV1ResponseParams": ".requests", + "UsageV1Response": ".types", + "UsageV1ResponseParams": ".requests", + "UsageV1ResponseResolution": ".types", + "UsageV1ResponseResolutionParams": ".requests", + "__version__": ".version", + "agent": ".agent", + "auth": ".auth", + "listen": ".listen", + "manage": ".manage", + "read": ".read", + "self_hosted": ".self_hosted", + "speak": ".speak", + "voice_agent": ".voice_agent", +} + +_dynamic_imports.update( + { + "SharedIntentsResults": ".types", + "SharedIntentsResultsIntents": ".types", + "SharedIntentsResultsIntentsParams": ".requests", + "SharedIntentsResultsIntentsSegmentsItem": ".types", + "SharedIntentsResultsIntentsSegmentsItemIntentsItem": ".types", + "SharedIntentsResultsIntentsSegmentsItemIntentsItemParams": ".requests", + "SharedIntentsResultsIntentsSegmentsItemParams": ".requests", + "SharedIntentsResultsParams": ".requests", + "SharedTopicsResults": ".types", + "SharedTopicsResultsParams": ".requests", + "SharedTopicsResultsTopics": ".types", + "SharedTopicsResultsTopicsParams": ".requests", + "SharedTopicsResultsTopicsSegmentsItem": ".types", + "SharedTopicsResultsTopicsSegmentsItemParams": ".requests", + "SharedTopicsResultsTopicsSegmentsItemTopicsItem": ".types", + "SharedTopicsResultsTopicsSegmentsItemTopicsItemParams": ".requests", + "AnthropicThinkProviderModel": ".types", + "CartesiaSpeakProviderModelId": ".types", + "CartesiaSpeakProviderVoice": ".types", + "CartesiaSpeakProviderVoiceParams": ".requests", + "CreateKeyV1RequestOne": ".types", + "DeepgramListenProviderV2LanguageHint": ".types", + "DeepgramListenProviderV2LanguageHintParams": ".requests", + "DeepgramSpeakProviderModel": ".types", + "GoogleThinkProviderModel": ".types", + "GoogleThinkProviderVersion": ".types", + "GroqThinkProviderReasoningMode": ".types", + } +) + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "AgentConfigurationV1", + "AgentConfigurationV1Params", + "AgentThinkModelsV1Response", + "AgentThinkModelsV1ResponseModelsItem", + "AgentThinkModelsV1ResponseModelsItemId", + "AgentThinkModelsV1ResponseModelsItemIdParams", + "AgentThinkModelsV1ResponseModelsItemOne", + "AgentThinkModelsV1ResponseModelsItemOneId", + "AgentThinkModelsV1ResponseModelsItemOneParams", + "AgentThinkModelsV1ResponseModelsItemParams", + "AgentThinkModelsV1ResponseModelsItemThree", + "AgentThinkModelsV1ResponseModelsItemThreeParams", + "AgentThinkModelsV1ResponseModelsItemTwo", + "AgentThinkModelsV1ResponseModelsItemTwoId", + "AgentThinkModelsV1ResponseModelsItemTwoParams", + "AgentThinkModelsV1ResponseModelsItemZero", + "AgentThinkModelsV1ResponseModelsItemZeroId", + "AgentThinkModelsV1ResponseModelsItemZeroParams", + "AgentThinkModelsV1ResponseParams", + "AgentVariableV1", + "AgentVariableV1Params", + "Anthropic", + "AnthropicModel", + "AnthropicParams", + "AsyncDeepgramClient", + "AwsBedrockThinkProvider", + "AwsBedrockThinkProviderCredentials", + "AwsBedrockThinkProviderCredentialsParams", + "AwsBedrockThinkProviderCredentialsType", + "AwsBedrockThinkProviderModel", + "AwsBedrockThinkProviderParams", + "AwsPollySpeakProvider", + "AwsPollySpeakProviderCredentials", + "AwsPollySpeakProviderCredentialsParams", + "AwsPollySpeakProviderCredentialsType", + "AwsPollySpeakProviderEngine", + "AwsPollySpeakProviderParams", + "AwsPollySpeakProviderVoice", + "BadRequestError", + "BillingBreakdownV1Response", + "BillingBreakdownV1ResponseParams", + "BillingBreakdownV1ResponseResolution", + "BillingBreakdownV1ResponseResolutionParams", + "BillingBreakdownV1ResponseResultsItem", + "BillingBreakdownV1ResponseResultsItemGrouping", + "BillingBreakdownV1ResponseResultsItemGroupingParams", + "BillingBreakdownV1ResponseResultsItemParams", + "Cartesia", + "CartesiaModelId", + "CartesiaParams", + "CartesiaVoice", + "CartesiaVoiceParams", + "CreateAgentConfigurationV1Response", + "CreateAgentConfigurationV1ResponseParams", + "CreateKeyV1Request", + "CreateKeyV1RequestParams", + "CreateKeyV1Response", + "CreateKeyV1ResponseParams", + "CreateProjectDistributionCredentialsV1Response", + "CreateProjectDistributionCredentialsV1ResponseDistributionCredentials", + "CreateProjectDistributionCredentialsV1ResponseDistributionCredentialsParams", + "CreateProjectDistributionCredentialsV1ResponseMember", + "CreateProjectDistributionCredentialsV1ResponseMemberParams", + "CreateProjectDistributionCredentialsV1ResponseParams", + "CreateProjectInviteV1Response", + "CreateProjectInviteV1ResponseParams", + "Deepgram", + "DeepgramClient", + "DeepgramClientEnvironment", + "DeepgramListenProviderV1", + "DeepgramListenProviderV1Params", + "DeepgramListenProviderV2", + "DeepgramListenProviderV2Params", + "DeepgramModel", + "DeepgramParams", + "DeepgramThinkLiveProviderV1", + "DeepgramThinkLiveProviderV1Params", + "DeepgramThinkProvider", + "DeepgramThinkProviderModel", + "DeepgramThinkProviderParams", + "DeepgramThinkProviderReasoningMode", + "DefaultAioHttpClient", + "DefaultAsyncHttpxClient", + "DeleteAgentConfigurationV1Response", + "DeleteAgentVariableV1Response", + "DeleteProjectInviteV1Response", + "DeleteProjectInviteV1ResponseParams", + "DeleteProjectKeyV1Response", + "DeleteProjectKeyV1ResponseParams", + "DeleteProjectMemberV1Response", + "DeleteProjectMemberV1ResponseParams", + "DeleteProjectV1Response", + "DeleteProjectV1ResponseParams", + "ElevenLabsSpeakProvider", + "ElevenLabsSpeakProviderModelId", + "ElevenLabsSpeakProviderParams", + "ErrorResponse", + "ErrorResponseLegacyError", + "ErrorResponseLegacyErrorParams", + "ErrorResponseModernError", + "ErrorResponseModernErrorParams", + "ErrorResponseParams", + "ErrorResponseTextError", + "GetModelV1Response", + "GetModelV1ResponseBatch", + "GetModelV1ResponseBatchParams", + "GetModelV1ResponseMetadata", + "GetModelV1ResponseMetadataMetadata", + "GetModelV1ResponseMetadataMetadataParams", + "GetModelV1ResponseMetadataParams", + "GetModelV1ResponseParams", + "GetProjectBalanceV1Response", + "GetProjectBalanceV1ResponseParams", + "GetProjectDistributionCredentialsV1Response", + "GetProjectDistributionCredentialsV1ResponseDistributionCredentials", + "GetProjectDistributionCredentialsV1ResponseDistributionCredentialsParams", + "GetProjectDistributionCredentialsV1ResponseMember", + "GetProjectDistributionCredentialsV1ResponseMemberParams", + "GetProjectDistributionCredentialsV1ResponseParams", + "GetProjectKeyV1Response", + "GetProjectKeyV1ResponseItem", + "GetProjectKeyV1ResponseItemMember", + "GetProjectKeyV1ResponseItemMemberApiKey", + "GetProjectKeyV1ResponseItemMemberApiKeyParams", + "GetProjectKeyV1ResponseItemMemberParams", + "GetProjectKeyV1ResponseItemParams", + "GetProjectKeyV1ResponseParams", + "GetProjectRequestV1Response", + "GetProjectRequestV1ResponseParams", + "GetProjectV1Response", + "GetProjectV1ResponseParams", + "Google", + "GoogleModel", + "GoogleParams", + "GoogleVersion", + "GrantV1Response", + "GrantV1ResponseParams", + "Groq", + "GroqParams", + "GroqReasoningMode", + "LeaveProjectV1Response", + "LeaveProjectV1ResponseParams", + "ListAgentConfigurationsV1Response", + "ListAgentConfigurationsV1ResponseParams", + "ListAgentVariablesV1Response", + "ListAgentVariablesV1ResponseParams", + "ListBillingFieldsV1Response", + "ListBillingFieldsV1ResponseDeploymentsItem", + "ListBillingFieldsV1ResponseParams", + "ListModelsV1Response", + "ListModelsV1ResponseParams", + "ListModelsV1ResponseSttModels", + "ListModelsV1ResponseSttModelsParams", + "ListModelsV1ResponseTtsModels", + "ListModelsV1ResponseTtsModelsMetadata", + "ListModelsV1ResponseTtsModelsMetadataParams", + "ListModelsV1ResponseTtsModelsParams", + "ListProjectBalancesV1Response", + "ListProjectBalancesV1ResponseBalancesItem", + "ListProjectBalancesV1ResponseBalancesItemParams", + "ListProjectBalancesV1ResponseParams", + "ListProjectDistributionCredentialsV1Response", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentialsParams", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMemberParams", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemParams", + "ListProjectDistributionCredentialsV1ResponseParams", + "ListProjectInvitesV1Response", + "ListProjectInvitesV1ResponseInvitesItem", + "ListProjectInvitesV1ResponseInvitesItemParams", + "ListProjectInvitesV1ResponseParams", + "ListProjectKeysV1Response", + "ListProjectKeysV1ResponseApiKeysItem", + "ListProjectKeysV1ResponseApiKeysItemApiKey", + "ListProjectKeysV1ResponseApiKeysItemApiKeyParams", + "ListProjectKeysV1ResponseApiKeysItemMember", + "ListProjectKeysV1ResponseApiKeysItemMemberParams", + "ListProjectKeysV1ResponseApiKeysItemParams", + "ListProjectKeysV1ResponseParams", + "ListProjectMemberScopesV1Response", + "ListProjectMemberScopesV1ResponseParams", + "ListProjectMembersV1Response", + "ListProjectMembersV1ResponseMembersItem", + "ListProjectMembersV1ResponseMembersItemParams", + "ListProjectMembersV1ResponseParams", + "ListProjectPurchasesV1Response", + "ListProjectPurchasesV1ResponseOrdersItem", + "ListProjectPurchasesV1ResponseOrdersItemParams", + "ListProjectPurchasesV1ResponseParams", + "ListProjectRequestsV1Response", + "ListProjectRequestsV1ResponseParams", + "ListProjectsV1Response", + "ListProjectsV1ResponseParams", + "ListProjectsV1ResponseProjectsItem", + "ListProjectsV1ResponseProjectsItemParams", + "ListenV1AcceptedResponse", + "ListenV1AcceptedResponseParams", + "ListenV1Callback", + "ListenV1CallbackMethod", + "ListenV1Channels", + "ListenV1DetectEntities", + "ListenV1Diarize", + "ListenV1Dictation", + "ListenV1Encoding", + "ListenV1Endpointing", + "ListenV1Extra", + "ListenV1InterimResults", + "ListenV1Keyterm", + "ListenV1Keywords", + "ListenV1Language", + "ListenV1LanguageHint", + "ListenV1LanguageHintParams", + "ListenV1MipOptOut", + "ListenV1Model", + "ListenV1Multichannel", + "ListenV1Numerals", + "ListenV1ProfanityFilter", + "ListenV1Punctuate", + "ListenV1Redact", + "ListenV1RedactUsage", + "ListenV1Replace", + "ListenV1RequestFile", + "ListenV1Response", + "ListenV1ResponseMetadata", + "ListenV1ResponseMetadataDiarizeInfo", + "ListenV1ResponseMetadataDiarizeInfoParams", + "ListenV1ResponseMetadataIntentsInfo", + "ListenV1ResponseMetadataIntentsInfoParams", + "ListenV1ResponseMetadataParams", + "ListenV1ResponseMetadataSentimentInfo", + "ListenV1ResponseMetadataSentimentInfoParams", + "ListenV1ResponseMetadataSummaryInfo", + "ListenV1ResponseMetadataSummaryInfoParams", + "ListenV1ResponseMetadataTopicsInfo", + "ListenV1ResponseMetadataTopicsInfoParams", + "ListenV1ResponseParams", + "ListenV1ResponseResults", + "ListenV1ResponseResultsChannels", + "ListenV1ResponseResultsChannelsItem", + "ListenV1ResponseResultsChannelsItemAlternativesItem", + "ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem", + "ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItemParams", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemParams", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItemParams", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParams", + "ListenV1ResponseResultsChannelsItemAlternativesItemParams", + "ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem", + "ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItemParams", + "ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem", + "ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItemParams", + "ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem", + "ListenV1ResponseResultsChannelsItemAlternativesItemWordsItemParams", + "ListenV1ResponseResultsChannelsItemParams", + "ListenV1ResponseResultsChannelsItemSearchItem", + "ListenV1ResponseResultsChannelsItemSearchItemHitsItem", + "ListenV1ResponseResultsChannelsItemSearchItemHitsItemParams", + "ListenV1ResponseResultsChannelsItemSearchItemParams", + "ListenV1ResponseResultsChannelsParams", + "ListenV1ResponseResultsParams", + "ListenV1ResponseResultsSummary", + "ListenV1ResponseResultsSummaryParams", + "ListenV1ResponseResultsUtterances", + "ListenV1ResponseResultsUtterancesItem", + "ListenV1ResponseResultsUtterancesItemParams", + "ListenV1ResponseResultsUtterancesItemWordsItem", + "ListenV1ResponseResultsUtterancesItemWordsItemParams", + "ListenV1ResponseResultsUtterancesParams", + "ListenV1SampleRate", + "ListenV1Search", + "ListenV1SmartFormat", + "ListenV1Tag", + "ListenV1UtteranceEndMs", + "ListenV1VadEvents", + "ListenV1Version", + "ListenV2ConfigureNumerals", + "ListenV2ConfigureRedactUsage", + "ListenV2EagerEotThreshold", + "ListenV2Encoding", + "ListenV2EotThreshold", + "ListenV2EotTimeoutMs", + "ListenV2Keyterm", + "ListenV2KeytermParams", + "ListenV2LanguageHint", + "ListenV2LanguageHintParams", + "ListenV2MipOptOut", + "ListenV2Model", + "ListenV2Numerals", + "ListenV2ProfanityFilter", + "ListenV2Redact", + "ListenV2RedactUsage", + "ListenV2SampleRate", + "ListenV2Tag", + "Nvidia", + "NvidiaParams", + "NvidiaReasoningMode", + "OpenAiSpeakProvider", + "OpenAiSpeakProviderModel", + "OpenAiSpeakProviderParams", + "OpenAiSpeakProviderVoice", + "OpenAiThinkProvider", + "OpenAiThinkProviderModel", + "OpenAiThinkProviderParams", + "OpenAiThinkProviderReasoningMode", + "ProjectRequestResponse", + "ProjectRequestResponseParams", + "ReadV1Request", + "ReadV1RequestParams", + "ReadV1RequestText", + "ReadV1RequestTextParams", + "ReadV1RequestUrl", + "ReadV1RequestUrlParams", + "ReadV1Response", + "ReadV1ResponseMetadata", + "ReadV1ResponseMetadataMetadata", + "ReadV1ResponseMetadataMetadataIntentsInfo", + "ReadV1ResponseMetadataMetadataIntentsInfoParams", + "ReadV1ResponseMetadataMetadataParams", + "ReadV1ResponseMetadataMetadataSentimentInfo", + "ReadV1ResponseMetadataMetadataSentimentInfoParams", + "ReadV1ResponseMetadataMetadataSummaryInfo", + "ReadV1ResponseMetadataMetadataSummaryInfoParams", + "ReadV1ResponseMetadataMetadataTopicsInfo", + "ReadV1ResponseMetadataMetadataTopicsInfoParams", + "ReadV1ResponseMetadataParams", + "ReadV1ResponseParams", + "ReadV1ResponseResults", + "ReadV1ResponseResultsParams", + "ReadV1ResponseResultsSummary", + "ReadV1ResponseResultsSummaryParams", + "ReadV1ResponseResultsSummaryResults", + "ReadV1ResponseResultsSummaryResultsParams", + "ReadV1ResponseResultsSummaryResultsSummary", + "ReadV1ResponseResultsSummaryResultsSummaryParams", + "SharedIntents", + "SharedIntentsParams", + "SharedIntentsSegmentsItem", + "SharedIntentsSegmentsItemIntentsItem", + "SharedIntentsSegmentsItemIntentsItemParams", + "SharedIntentsSegmentsItemParams", + "SharedSentiments", + "SharedSentimentsAverage", + "SharedSentimentsAverageParams", + "SharedSentimentsParams", + "SharedSentimentsSegmentsItem", + "SharedSentimentsSegmentsItemParams", + "SharedTopics", + "SharedTopicsParams", + "SharedTopicsSegmentsItem", + "SharedTopicsSegmentsItemParams", + "SharedTopicsSegmentsItemTopicsItem", + "SharedTopicsSegmentsItemTopicsItemParams", + "SpeakSettingsV1", + "SpeakSettingsV1Endpoint", + "SpeakSettingsV1EndpointParams", + "SpeakSettingsV1Params", + "SpeakSettingsV1Provider", + "SpeakSettingsV1ProviderParams", + "SpeakSettingsV1Provider_AwsPolly", + "SpeakSettingsV1Provider_AwsPollyParams", + "SpeakSettingsV1Provider_Cartesia", + "SpeakSettingsV1Provider_CartesiaParams", + "SpeakSettingsV1Provider_Deepgram", + "SpeakSettingsV1Provider_DeepgramParams", + "SpeakSettingsV1Provider_ElevenLabs", + "SpeakSettingsV1Provider_ElevenLabsParams", + "SpeakSettingsV1Provider_OpenAi", + "SpeakSettingsV1Provider_OpenAiParams", + "SpeakV1Encoding", + "SpeakV1MipOptOut", + "SpeakV1Model", + "SpeakV1Response", + "SpeakV1SampleRate", + "SpeakV1Speed", + "SpeakV2AcceptedResponse", + "SpeakV2AcceptedResponseParams", + "SpeakV2Encoding", + "SpeakV2Expressivity", + "SpeakV2MipOptOut", + "SpeakV2Model", + "SpeakV2NormalizeVolume", + "SpeakV2Response", + "SpeakV2SampleRate", + "SpeakV2Speed", + "SpeakV2SpeedValue", + "SpeakV2Tag", + "ThinkLiveSettingsV1", + "ThinkLiveSettingsV1Params", + "ThinkSettingsV1", + "ThinkSettingsV1ContextLength", + "ThinkSettingsV1ContextLengthParams", + "ThinkSettingsV1Endpoint", + "ThinkSettingsV1EndpointParams", + "ThinkSettingsV1FunctionsItem", + "ThinkSettingsV1FunctionsItemEndpoint", + "ThinkSettingsV1FunctionsItemEndpointParams", + "ThinkSettingsV1FunctionsItemParams", + "ThinkSettingsV1Params", + "ThinkSettingsV1Provider", + "ThinkSettingsV1ProviderParams", + "ThinkSettingsV1Provider_Anthropic", + "ThinkSettingsV1Provider_AnthropicParams", + "ThinkSettingsV1Provider_AwsBedrock", + "ThinkSettingsV1Provider_AwsBedrockParams", + "ThinkSettingsV1Provider_Deepgram", + "ThinkSettingsV1Provider_DeepgramParams", + "ThinkSettingsV1Provider_Google", + "ThinkSettingsV1Provider_GoogleParams", + "ThinkSettingsV1Provider_Groq", + "ThinkSettingsV1Provider_GroqParams", + "ThinkSettingsV1Provider_Nvidia", + "ThinkSettingsV1Provider_NvidiaParams", + "ThinkSettingsV1Provider_OpenAi", + "ThinkSettingsV1Provider_OpenAiParams", + "UpdateProjectMemberScopesV1Response", + "UpdateProjectMemberScopesV1ResponseParams", + "UpdateProjectV1Response", + "UpdateProjectV1ResponseParams", + "UsageBreakdownV1Response", + "UsageBreakdownV1ResponseParams", + "UsageBreakdownV1ResponseResolution", + "UsageBreakdownV1ResponseResolutionParams", + "UsageBreakdownV1ResponseResultsItem", + "UsageBreakdownV1ResponseResultsItemGrouping", + "UsageBreakdownV1ResponseResultsItemGroupingParams", + "UsageBreakdownV1ResponseResultsItemParams", + "UsageFieldsV1Response", + "UsageFieldsV1ResponseModelsItem", + "UsageFieldsV1ResponseModelsItemParams", + "UsageFieldsV1ResponseParams", + "UsageV1Response", + "UsageV1ResponseParams", + "UsageV1ResponseResolution", + "UsageV1ResponseResolutionParams", + "__version__", + "agent", + "auth", + "listen", + "manage", + "read", + "self_hosted", + "speak", + "voice_agent", +] + +__all__.extend( + [ + "SharedIntentsResults", + "SharedIntentsResultsIntents", + "SharedIntentsResultsIntentsParams", + "SharedIntentsResultsIntentsSegmentsItem", + "SharedIntentsResultsIntentsSegmentsItemIntentsItem", + "SharedIntentsResultsIntentsSegmentsItemIntentsItemParams", + "SharedIntentsResultsIntentsSegmentsItemParams", + "SharedIntentsResultsParams", + "SharedTopicsResults", + "SharedTopicsResultsParams", + "SharedTopicsResultsTopics", + "SharedTopicsResultsTopicsParams", + "SharedTopicsResultsTopicsSegmentsItem", + "SharedTopicsResultsTopicsSegmentsItemParams", + "SharedTopicsResultsTopicsSegmentsItemTopicsItem", + "SharedTopicsResultsTopicsSegmentsItemTopicsItemParams", + "AnthropicThinkProviderModel", + "CartesiaSpeakProviderModelId", + "CartesiaSpeakProviderVoice", + "CartesiaSpeakProviderVoiceParams", + "CreateKeyV1RequestOne", + "DeepgramListenProviderV2LanguageHint", + "DeepgramListenProviderV2LanguageHintParams", + "DeepgramSpeakProviderModel", + "GoogleThinkProviderModel", + "GoogleThinkProviderVersion", + "GroqThinkProviderReasoningMode", + ] +) diff --git a/src/deepgram/agent/__init__.py.bak b/src/deepgram/agent/__init__.py.bak new file mode 100644 index 00000000..23f670de --- /dev/null +++ b/src/deepgram/agent/__init__.py.bak @@ -0,0 +1,528 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import v1 + from .v1 import ( + AgentV1AgentAudioDone, + AgentV1AgentAudioDoneParams, + AgentV1AgentStartedSpeaking, + AgentV1AgentStartedSpeakingParams, + AgentV1AgentThinking, + AgentV1AgentThinkingParams, + AgentV1ConversationText, + AgentV1ConversationTextConversationalBehavior, + AgentV1ConversationTextParams, + AgentV1ConversationTextRole, + AgentV1CustomFromThinkProvider, + AgentV1CustomFromThinkProviderParams, + AgentV1CustomToThinkProvider, + AgentV1CustomToThinkProviderParams, + AgentV1Error, + AgentV1ErrorParams, + AgentV1ForceEndTurn, + AgentV1ForceEndTurnParams, + AgentV1FrustrationDetected, + AgentV1FrustrationDetectedParams, + AgentV1FunctionCallCancelled, + AgentV1FunctionCallCancelledFunctionsItem, + AgentV1FunctionCallCancelledFunctionsItemParams, + AgentV1FunctionCallCancelledParams, + AgentV1FunctionCallRequest, + AgentV1FunctionCallRequestFunctionsItem, + AgentV1FunctionCallRequestFunctionsItemParams, + AgentV1FunctionCallRequestParams, + AgentV1History, + AgentV1HistoryParams, + AgentV1InjectAgentMessage, + AgentV1InjectAgentMessageBehavior, + AgentV1InjectAgentMessageParams, + AgentV1InjectDynamicAgentMessage, + AgentV1InjectDynamicAgentMessageBehavior, + AgentV1InjectDynamicAgentMessageParams, + AgentV1InjectUserMessage, + AgentV1InjectUserMessageParams, + AgentV1InjectionRefused, + AgentV1InjectionRefusedParams, + AgentV1KeepAlive, + AgentV1KeepAliveParams, + AgentV1LatencyReport, + AgentV1LatencyReportParams, + AgentV1ListenUpdated, + AgentV1ListenUpdatedParams, + AgentV1PromptUpdated, + AgentV1PromptUpdatedParams, + AgentV1ReceiveFunctionCallResponse, + AgentV1ReceiveFunctionCallResponseParams, + AgentV1SendFunctionCallResponse, + AgentV1SendFunctionCallResponseParams, + AgentV1Settings, + AgentV1SettingsAgent, + AgentV1SettingsAgentContext, + AgentV1SettingsAgentContextContext, + AgentV1SettingsAgentContextContextMessagesItem, + AgentV1SettingsAgentContextContextMessagesItemParams, + AgentV1SettingsAgentContextContextParams, + AgentV1SettingsAgentContextListen, + AgentV1SettingsAgentContextListenParams, + AgentV1SettingsAgentContextListenProvider, + AgentV1SettingsAgentContextListenProviderParams, + AgentV1SettingsAgentContextListenProvider_V1, + AgentV1SettingsAgentContextListenProvider_V1Params, + AgentV1SettingsAgentContextListenProvider_V2, + AgentV1SettingsAgentContextListenProvider_V2Params, + AgentV1SettingsAgentContextParams, + AgentV1SettingsAgentContextSpeak, + AgentV1SettingsAgentContextSpeakParams, + AgentV1SettingsAgentContextThink, + AgentV1SettingsAgentContextThinkParams, + AgentV1SettingsAgentListen, + AgentV1SettingsAgentListenParams, + AgentV1SettingsAgentListenProvider, + AgentV1SettingsAgentListenProviderParams, + AgentV1SettingsAgentListenProvider_V1, + AgentV1SettingsAgentListenProvider_V1Params, + AgentV1SettingsAgentListenProvider_V2, + AgentV1SettingsAgentListenProvider_V2Params, + AgentV1SettingsAgentParams, + AgentV1SettingsAgentSpeak, + AgentV1SettingsAgentSpeakParams, + AgentV1SettingsAgentThink, + AgentV1SettingsAgentThinkParams, + AgentV1SettingsApplied, + AgentV1SettingsAppliedParams, + AgentV1SettingsAudio, + AgentV1SettingsAudioInput, + AgentV1SettingsAudioInputEncoding, + AgentV1SettingsAudioInputParams, + AgentV1SettingsAudioOutput, + AgentV1SettingsAudioOutputContainer, + AgentV1SettingsAudioOutputEncoding, + AgentV1SettingsAudioOutputParams, + AgentV1SettingsAudioParams, + AgentV1SettingsFlags, + AgentV1SettingsFlagsParams, + AgentV1SettingsParams, + AgentV1SpeakUpdated, + AgentV1SpeakUpdatedParams, + AgentV1ThinkLiveUpdated, + AgentV1ThinkLiveUpdatedParams, + AgentV1ThinkUpdated, + AgentV1ThinkUpdatedParams, + AgentV1UpdateListen, + AgentV1UpdateListenListen, + AgentV1UpdateListenListenParams, + AgentV1UpdateListenListenProvider, + AgentV1UpdateListenListenProviderParams, + AgentV1UpdateListenListenProvider_V1, + AgentV1UpdateListenListenProvider_V1Params, + AgentV1UpdateListenListenProvider_V2, + AgentV1UpdateListenListenProvider_V2Params, + AgentV1UpdateListenParams, + AgentV1UpdatePrompt, + AgentV1UpdatePromptParams, + AgentV1UpdateSpeak, + AgentV1UpdateSpeakParams, + AgentV1UpdateSpeakSpeak, + AgentV1UpdateSpeakSpeakParams, + AgentV1UpdateThink, + AgentV1UpdateThinkLive, + AgentV1UpdateThinkLiveParams, + AgentV1UpdateThinkParams, + AgentV1UpdateThinkThink, + AgentV1UpdateThinkThinkParams, + AgentV1UserStartedSpeaking, + AgentV1UserStartedSpeakingParams, + AgentV1Warning, + AgentV1WarningParams, + AgentV1Welcome, + AgentV1WelcomeParams, + ConversationHistoryMessage, + ConversationHistoryMessageParams, + ConversationHistoryMessageRole, + FunctionCallHistoryMessage, + FunctionCallHistoryMessageFunctionCallsItem, + FunctionCallHistoryMessageFunctionCallsItemParams, + FunctionCallHistoryMessageParams, + ) +_dynamic_imports: typing.Dict[str, str] = { + "AgentV1AgentAudioDone": ".v1", + "AgentV1AgentAudioDoneParams": ".v1", + "AgentV1AgentStartedSpeaking": ".v1", + "AgentV1AgentStartedSpeakingParams": ".v1", + "AgentV1AgentThinking": ".v1", + "AgentV1AgentThinkingParams": ".v1", + "AgentV1ConversationText": ".v1", + "AgentV1ConversationTextConversationalBehavior": ".v1", + "AgentV1ConversationTextParams": ".v1", + "AgentV1ConversationTextRole": ".v1", + "AgentV1CustomFromThinkProvider": ".v1", + "AgentV1CustomFromThinkProviderParams": ".v1", + "AgentV1CustomToThinkProvider": ".v1", + "AgentV1CustomToThinkProviderParams": ".v1", + "AgentV1Error": ".v1", + "AgentV1ErrorParams": ".v1", + "AgentV1ForceEndTurn": ".v1", + "AgentV1ForceEndTurnParams": ".v1", + "AgentV1FrustrationDetected": ".v1", + "AgentV1FrustrationDetectedParams": ".v1", + "AgentV1FunctionCallCancelled": ".v1", + "AgentV1FunctionCallCancelledFunctionsItem": ".v1", + "AgentV1FunctionCallCancelledFunctionsItemParams": ".v1", + "AgentV1FunctionCallCancelledParams": ".v1", + "AgentV1FunctionCallRequest": ".v1", + "AgentV1FunctionCallRequestFunctionsItem": ".v1", + "AgentV1FunctionCallRequestFunctionsItemParams": ".v1", + "AgentV1FunctionCallRequestParams": ".v1", + "AgentV1History": ".v1", + "AgentV1HistoryParams": ".v1", + "AgentV1InjectAgentMessage": ".v1", + "AgentV1InjectAgentMessageBehavior": ".v1", + "AgentV1InjectAgentMessageParams": ".v1", + "AgentV1InjectDynamicAgentMessage": ".v1", + "AgentV1InjectDynamicAgentMessageBehavior": ".v1", + "AgentV1InjectDynamicAgentMessageParams": ".v1", + "AgentV1InjectUserMessage": ".v1", + "AgentV1InjectUserMessageParams": ".v1", + "AgentV1InjectionRefused": ".v1", + "AgentV1InjectionRefusedParams": ".v1", + "AgentV1KeepAlive": ".v1", + "AgentV1KeepAliveParams": ".v1", + "AgentV1LatencyReport": ".v1", + "AgentV1LatencyReportParams": ".v1", + "AgentV1ListenUpdated": ".v1", + "AgentV1ListenUpdatedParams": ".v1", + "AgentV1PromptUpdated": ".v1", + "AgentV1PromptUpdatedParams": ".v1", + "AgentV1ReceiveFunctionCallResponse": ".v1", + "AgentV1ReceiveFunctionCallResponseParams": ".v1", + "AgentV1SendFunctionCallResponse": ".v1", + "AgentV1SendFunctionCallResponseParams": ".v1", + "AgentV1Settings": ".v1", + "AgentV1SettingsAgent": ".v1", + "AgentV1SettingsAgentContext": ".v1", + "AgentV1SettingsAgentContextContext": ".v1", + "AgentV1SettingsAgentContextContextMessagesItem": ".v1", + "AgentV1SettingsAgentContextContextMessagesItemParams": ".v1", + "AgentV1SettingsAgentContextContextParams": ".v1", + "AgentV1SettingsAgentContextListen": ".v1", + "AgentV1SettingsAgentContextListenParams": ".v1", + "AgentV1SettingsAgentContextListenProvider": ".v1", + "AgentV1SettingsAgentContextListenProviderParams": ".v1", + "AgentV1SettingsAgentContextListenProvider_V1": ".v1", + "AgentV1SettingsAgentContextListenProvider_V1Params": ".v1", + "AgentV1SettingsAgentContextListenProvider_V2": ".v1", + "AgentV1SettingsAgentContextListenProvider_V2Params": ".v1", + "AgentV1SettingsAgentContextParams": ".v1", + "AgentV1SettingsAgentContextSpeak": ".v1", + "AgentV1SettingsAgentContextSpeakParams": ".v1", + "AgentV1SettingsAgentContextThink": ".v1", + "AgentV1SettingsAgentContextThinkParams": ".v1", + "AgentV1SettingsAgentListen": ".v1", + "AgentV1SettingsAgentListenParams": ".v1", + "AgentV1SettingsAgentListenProvider": ".v1", + "AgentV1SettingsAgentListenProviderParams": ".v1", + "AgentV1SettingsAgentListenProvider_V1": ".v1", + "AgentV1SettingsAgentListenProvider_V1Params": ".v1", + "AgentV1SettingsAgentListenProvider_V2": ".v1", + "AgentV1SettingsAgentListenProvider_V2Params": ".v1", + "AgentV1SettingsAgentParams": ".v1", + "AgentV1SettingsAgentSpeak": ".v1", + "AgentV1SettingsAgentSpeakParams": ".v1", + "AgentV1SettingsAgentThink": ".v1", + "AgentV1SettingsAgentThinkParams": ".v1", + "AgentV1SettingsApplied": ".v1", + "AgentV1SettingsAppliedParams": ".v1", + "AgentV1SettingsAudio": ".v1", + "AgentV1SettingsAudioInput": ".v1", + "AgentV1SettingsAudioInputEncoding": ".v1", + "AgentV1SettingsAudioInputParams": ".v1", + "AgentV1SettingsAudioOutput": ".v1", + "AgentV1SettingsAudioOutputContainer": ".v1", + "AgentV1SettingsAudioOutputEncoding": ".v1", + "AgentV1SettingsAudioOutputParams": ".v1", + "AgentV1SettingsAudioParams": ".v1", + "AgentV1SettingsFlags": ".v1", + "AgentV1SettingsFlagsParams": ".v1", + "AgentV1SettingsParams": ".v1", + "AgentV1SpeakUpdated": ".v1", + "AgentV1SpeakUpdatedParams": ".v1", + "AgentV1ThinkLiveUpdated": ".v1", + "AgentV1ThinkLiveUpdatedParams": ".v1", + "AgentV1ThinkUpdated": ".v1", + "AgentV1ThinkUpdatedParams": ".v1", + "AgentV1UpdateListen": ".v1", + "AgentV1UpdateListenListen": ".v1", + "AgentV1UpdateListenListenParams": ".v1", + "AgentV1UpdateListenListenProvider": ".v1", + "AgentV1UpdateListenListenProviderParams": ".v1", + "AgentV1UpdateListenListenProvider_V1": ".v1", + "AgentV1UpdateListenListenProvider_V1Params": ".v1", + "AgentV1UpdateListenListenProvider_V2": ".v1", + "AgentV1UpdateListenListenProvider_V2Params": ".v1", + "AgentV1UpdateListenParams": ".v1", + "AgentV1UpdatePrompt": ".v1", + "AgentV1UpdatePromptParams": ".v1", + "AgentV1UpdateSpeak": ".v1", + "AgentV1UpdateSpeakParams": ".v1", + "AgentV1UpdateSpeakSpeak": ".v1", + "AgentV1UpdateSpeakSpeakParams": ".v1", + "AgentV1UpdateThink": ".v1", + "AgentV1UpdateThinkLive": ".v1", + "AgentV1UpdateThinkLiveParams": ".v1", + "AgentV1UpdateThinkParams": ".v1", + "AgentV1UpdateThinkThink": ".v1", + "AgentV1UpdateThinkThinkParams": ".v1", + "AgentV1UserStartedSpeaking": ".v1", + "AgentV1UserStartedSpeakingParams": ".v1", + "AgentV1Warning": ".v1", + "AgentV1WarningParams": ".v1", + "AgentV1Welcome": ".v1", + "AgentV1WelcomeParams": ".v1", + "ConversationHistoryMessage": ".v1", + "ConversationHistoryMessageParams": ".v1", + "ConversationHistoryMessageRole": ".v1", + "FunctionCallHistoryMessage": ".v1", + "FunctionCallHistoryMessageFunctionCallsItem": ".v1", + "FunctionCallHistoryMessageFunctionCallsItemParams": ".v1", + "FunctionCallHistoryMessageParams": ".v1", + "v1": ".v1", +} + +_dynamic_imports.update( + { + "AgentV1HistoryContent": ".v1", + "AgentV1HistoryContentParams": ".v1", + "AgentV1HistoryContentRole": ".v1", + "AgentV1HistoryFunctionCalls": ".v1", + "AgentV1HistoryFunctionCallsFunctionCallsItem": ".v1", + "AgentV1HistoryFunctionCallsFunctionCallsItemParams": ".v1", + "AgentV1HistoryFunctionCallsParams": ".v1", + "AgentV1SettingsAgentContextContextMessagesItemContentRole": ".v1", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem": ".v1", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams": ".v1", + "AgentV1SettingsAgentContextListenProviderV1": ".v1", + "AgentV1SettingsAgentContextListenProviderV1Params": ".v1", + "AgentV1SettingsAgentContextListenProviderV2": ".v1", + "AgentV1SettingsAgentContextListenProviderV2LanguageHint": ".v1", + "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams": ".v1", + "AgentV1SettingsAgentContextListenProviderV2Params": ".v1", + "AgentV1SettingsAgentContextMessagesItem": ".v1", + "AgentV1SettingsAgentContextMessagesItemContent": ".v1", + "AgentV1SettingsAgentContextMessagesItemContentParams": ".v1", + "AgentV1SettingsAgentContextMessagesItemContentRole": ".v1", + "AgentV1SettingsAgentContextMessagesItemFunctionCalls": ".v1", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem": ".v1", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams": ".v1", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams": ".v1", + "AgentV1SettingsAgentContextMessagesItemParams": ".v1", + "AgentV1SettingsAgentListenProviderV1": ".v1", + "AgentV1SettingsAgentListenProviderV1Params": ".v1", + "AgentV1SettingsAgentListenProviderV2": ".v1", + "AgentV1SettingsAgentListenProviderV2Params": ".v1", + } +) + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "AgentV1AgentAudioDone", + "AgentV1AgentAudioDoneParams", + "AgentV1AgentStartedSpeaking", + "AgentV1AgentStartedSpeakingParams", + "AgentV1AgentThinking", + "AgentV1AgentThinkingParams", + "AgentV1ConversationText", + "AgentV1ConversationTextConversationalBehavior", + "AgentV1ConversationTextParams", + "AgentV1ConversationTextRole", + "AgentV1CustomFromThinkProvider", + "AgentV1CustomFromThinkProviderParams", + "AgentV1CustomToThinkProvider", + "AgentV1CustomToThinkProviderParams", + "AgentV1Error", + "AgentV1ErrorParams", + "AgentV1ForceEndTurn", + "AgentV1ForceEndTurnParams", + "AgentV1FrustrationDetected", + "AgentV1FrustrationDetectedParams", + "AgentV1FunctionCallCancelled", + "AgentV1FunctionCallCancelledFunctionsItem", + "AgentV1FunctionCallCancelledFunctionsItemParams", + "AgentV1FunctionCallCancelledParams", + "AgentV1FunctionCallRequest", + "AgentV1FunctionCallRequestFunctionsItem", + "AgentV1FunctionCallRequestFunctionsItemParams", + "AgentV1FunctionCallRequestParams", + "AgentV1History", + "AgentV1HistoryParams", + "AgentV1InjectAgentMessage", + "AgentV1InjectAgentMessageBehavior", + "AgentV1InjectAgentMessageParams", + "AgentV1InjectDynamicAgentMessage", + "AgentV1InjectDynamicAgentMessageBehavior", + "AgentV1InjectDynamicAgentMessageParams", + "AgentV1InjectUserMessage", + "AgentV1InjectUserMessageParams", + "AgentV1InjectionRefused", + "AgentV1InjectionRefusedParams", + "AgentV1KeepAlive", + "AgentV1KeepAliveParams", + "AgentV1LatencyReport", + "AgentV1LatencyReportParams", + "AgentV1ListenUpdated", + "AgentV1ListenUpdatedParams", + "AgentV1PromptUpdated", + "AgentV1PromptUpdatedParams", + "AgentV1ReceiveFunctionCallResponse", + "AgentV1ReceiveFunctionCallResponseParams", + "AgentV1SendFunctionCallResponse", + "AgentV1SendFunctionCallResponseParams", + "AgentV1Settings", + "AgentV1SettingsAgent", + "AgentV1SettingsAgentContext", + "AgentV1SettingsAgentContextContext", + "AgentV1SettingsAgentContextContextMessagesItem", + "AgentV1SettingsAgentContextContextMessagesItemParams", + "AgentV1SettingsAgentContextContextParams", + "AgentV1SettingsAgentContextListen", + "AgentV1SettingsAgentContextListenParams", + "AgentV1SettingsAgentContextListenProvider", + "AgentV1SettingsAgentContextListenProviderParams", + "AgentV1SettingsAgentContextListenProvider_V1", + "AgentV1SettingsAgentContextListenProvider_V1Params", + "AgentV1SettingsAgentContextListenProvider_V2", + "AgentV1SettingsAgentContextListenProvider_V2Params", + "AgentV1SettingsAgentContextParams", + "AgentV1SettingsAgentContextSpeak", + "AgentV1SettingsAgentContextSpeakParams", + "AgentV1SettingsAgentContextThink", + "AgentV1SettingsAgentContextThinkParams", + "AgentV1SettingsAgentListen", + "AgentV1SettingsAgentListenParams", + "AgentV1SettingsAgentListenProvider", + "AgentV1SettingsAgentListenProviderParams", + "AgentV1SettingsAgentListenProvider_V1", + "AgentV1SettingsAgentListenProvider_V1Params", + "AgentV1SettingsAgentListenProvider_V2", + "AgentV1SettingsAgentListenProvider_V2Params", + "AgentV1SettingsAgentParams", + "AgentV1SettingsAgentSpeak", + "AgentV1SettingsAgentSpeakParams", + "AgentV1SettingsAgentThink", + "AgentV1SettingsAgentThinkParams", + "AgentV1SettingsApplied", + "AgentV1SettingsAppliedParams", + "AgentV1SettingsAudio", + "AgentV1SettingsAudioInput", + "AgentV1SettingsAudioInputEncoding", + "AgentV1SettingsAudioInputParams", + "AgentV1SettingsAudioOutput", + "AgentV1SettingsAudioOutputContainer", + "AgentV1SettingsAudioOutputEncoding", + "AgentV1SettingsAudioOutputParams", + "AgentV1SettingsAudioParams", + "AgentV1SettingsFlags", + "AgentV1SettingsFlagsParams", + "AgentV1SettingsParams", + "AgentV1SpeakUpdated", + "AgentV1SpeakUpdatedParams", + "AgentV1ThinkLiveUpdated", + "AgentV1ThinkLiveUpdatedParams", + "AgentV1ThinkUpdated", + "AgentV1ThinkUpdatedParams", + "AgentV1UpdateListen", + "AgentV1UpdateListenListen", + "AgentV1UpdateListenListenParams", + "AgentV1UpdateListenListenProvider", + "AgentV1UpdateListenListenProviderParams", + "AgentV1UpdateListenListenProvider_V1", + "AgentV1UpdateListenListenProvider_V1Params", + "AgentV1UpdateListenListenProvider_V2", + "AgentV1UpdateListenListenProvider_V2Params", + "AgentV1UpdateListenParams", + "AgentV1UpdatePrompt", + "AgentV1UpdatePromptParams", + "AgentV1UpdateSpeak", + "AgentV1UpdateSpeakParams", + "AgentV1UpdateSpeakSpeak", + "AgentV1UpdateSpeakSpeakParams", + "AgentV1UpdateThink", + "AgentV1UpdateThinkLive", + "AgentV1UpdateThinkLiveParams", + "AgentV1UpdateThinkParams", + "AgentV1UpdateThinkThink", + "AgentV1UpdateThinkThinkParams", + "AgentV1UserStartedSpeaking", + "AgentV1UserStartedSpeakingParams", + "AgentV1Warning", + "AgentV1WarningParams", + "AgentV1Welcome", + "AgentV1WelcomeParams", + "ConversationHistoryMessage", + "ConversationHistoryMessageParams", + "ConversationHistoryMessageRole", + "FunctionCallHistoryMessage", + "FunctionCallHistoryMessageFunctionCallsItem", + "FunctionCallHistoryMessageFunctionCallsItemParams", + "FunctionCallHistoryMessageParams", + "v1", +] + +__all__.extend( + [ + "AgentV1HistoryContent", + "AgentV1HistoryContentParams", + "AgentV1HistoryContentRole", + "AgentV1HistoryFunctionCalls", + "AgentV1HistoryFunctionCallsFunctionCallsItem", + "AgentV1HistoryFunctionCallsFunctionCallsItemParams", + "AgentV1HistoryFunctionCallsParams", + "AgentV1SettingsAgentContextContextMessagesItemContentRole", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams", + "AgentV1SettingsAgentContextListenProviderV1", + "AgentV1SettingsAgentContextListenProviderV1Params", + "AgentV1SettingsAgentContextListenProviderV2", + "AgentV1SettingsAgentContextListenProviderV2LanguageHint", + "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams", + "AgentV1SettingsAgentContextListenProviderV2Params", + "AgentV1SettingsAgentContextMessagesItem", + "AgentV1SettingsAgentContextMessagesItemContent", + "AgentV1SettingsAgentContextMessagesItemContentParams", + "AgentV1SettingsAgentContextMessagesItemContentRole", + "AgentV1SettingsAgentContextMessagesItemFunctionCalls", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams", + "AgentV1SettingsAgentContextMessagesItemParams", + "AgentV1SettingsAgentListenProviderV1", + "AgentV1SettingsAgentListenProviderV1Params", + "AgentV1SettingsAgentListenProviderV2", + "AgentV1SettingsAgentListenProviderV2Params", + ] +) diff --git a/src/deepgram/agent/v1/__init__.py.bak b/src/deepgram/agent/v1/__init__.py.bak new file mode 100644 index 00000000..205d398c --- /dev/null +++ b/src/deepgram/agent/v1/__init__.py.bak @@ -0,0 +1,530 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + AgentV1AgentAudioDone, + AgentV1AgentStartedSpeaking, + AgentV1AgentThinking, + AgentV1ConversationText, + AgentV1ConversationTextConversationalBehavior, + AgentV1ConversationTextRole, + AgentV1CustomFromThinkProvider, + AgentV1CustomToThinkProvider, + AgentV1Error, + AgentV1ForceEndTurn, + AgentV1FrustrationDetected, + AgentV1FunctionCallCancelled, + AgentV1FunctionCallCancelledFunctionsItem, + AgentV1FunctionCallRequest, + AgentV1FunctionCallRequestFunctionsItem, + AgentV1History, + AgentV1InjectAgentMessage, + AgentV1InjectAgentMessageBehavior, + AgentV1InjectDynamicAgentMessage, + AgentV1InjectDynamicAgentMessageBehavior, + AgentV1InjectUserMessage, + AgentV1InjectionRefused, + AgentV1KeepAlive, + AgentV1LatencyReport, + AgentV1ListenUpdated, + AgentV1PromptUpdated, + AgentV1ReceiveFunctionCallResponse, + AgentV1SendFunctionCallResponse, + AgentV1Settings, + AgentV1SettingsAgent, + AgentV1SettingsAgentContext, + AgentV1SettingsAgentContextContext, + AgentV1SettingsAgentContextContextMessagesItem, + AgentV1SettingsAgentContextListen, + AgentV1SettingsAgentContextListenProvider, + AgentV1SettingsAgentContextListenProvider_V1, + AgentV1SettingsAgentContextListenProvider_V2, + AgentV1SettingsAgentContextSpeak, + AgentV1SettingsAgentContextThink, + AgentV1SettingsAgentListen, + AgentV1SettingsAgentListenProvider, + AgentV1SettingsAgentListenProvider_V1, + AgentV1SettingsAgentListenProvider_V2, + AgentV1SettingsAgentSpeak, + AgentV1SettingsAgentThink, + AgentV1SettingsApplied, + AgentV1SettingsAudio, + AgentV1SettingsAudioInput, + AgentV1SettingsAudioInputEncoding, + AgentV1SettingsAudioOutput, + AgentV1SettingsAudioOutputContainer, + AgentV1SettingsAudioOutputEncoding, + AgentV1SettingsFlags, + AgentV1SpeakUpdated, + AgentV1ThinkLiveUpdated, + AgentV1ThinkUpdated, + AgentV1UpdateListen, + AgentV1UpdateListenListen, + AgentV1UpdateListenListenProvider, + AgentV1UpdateListenListenProvider_V1, + AgentV1UpdateListenListenProvider_V2, + AgentV1UpdatePrompt, + AgentV1UpdateSpeak, + AgentV1UpdateSpeakSpeak, + AgentV1UpdateThink, + AgentV1UpdateThinkLive, + AgentV1UpdateThinkThink, + AgentV1UserStartedSpeaking, + AgentV1Warning, + AgentV1Welcome, + ConversationHistoryMessage, + ConversationHistoryMessageRole, + FunctionCallHistoryMessage, + FunctionCallHistoryMessageFunctionCallsItem, + ) + from . import settings + from .requests import ( + AgentV1AgentAudioDoneParams, + AgentV1AgentStartedSpeakingParams, + AgentV1AgentThinkingParams, + AgentV1ConversationTextParams, + AgentV1CustomFromThinkProviderParams, + AgentV1CustomToThinkProviderParams, + AgentV1ErrorParams, + AgentV1ForceEndTurnParams, + AgentV1FrustrationDetectedParams, + AgentV1FunctionCallCancelledFunctionsItemParams, + AgentV1FunctionCallCancelledParams, + AgentV1FunctionCallRequestFunctionsItemParams, + AgentV1FunctionCallRequestParams, + AgentV1HistoryParams, + AgentV1InjectAgentMessageParams, + AgentV1InjectDynamicAgentMessageParams, + AgentV1InjectUserMessageParams, + AgentV1InjectionRefusedParams, + AgentV1KeepAliveParams, + AgentV1LatencyReportParams, + AgentV1ListenUpdatedParams, + AgentV1PromptUpdatedParams, + AgentV1ReceiveFunctionCallResponseParams, + AgentV1SendFunctionCallResponseParams, + AgentV1SettingsAgentContextContextMessagesItemParams, + AgentV1SettingsAgentContextContextParams, + AgentV1SettingsAgentContextListenParams, + AgentV1SettingsAgentContextListenProviderParams, + AgentV1SettingsAgentContextListenProvider_V1Params, + AgentV1SettingsAgentContextListenProvider_V2Params, + AgentV1SettingsAgentContextParams, + AgentV1SettingsAgentContextSpeakParams, + AgentV1SettingsAgentContextThinkParams, + AgentV1SettingsAgentListenParams, + AgentV1SettingsAgentListenProviderParams, + AgentV1SettingsAgentListenProvider_V1Params, + AgentV1SettingsAgentListenProvider_V2Params, + AgentV1SettingsAgentParams, + AgentV1SettingsAgentSpeakParams, + AgentV1SettingsAgentThinkParams, + AgentV1SettingsAppliedParams, + AgentV1SettingsAudioInputParams, + AgentV1SettingsAudioOutputParams, + AgentV1SettingsAudioParams, + AgentV1SettingsFlagsParams, + AgentV1SettingsParams, + AgentV1SpeakUpdatedParams, + AgentV1ThinkLiveUpdatedParams, + AgentV1ThinkUpdatedParams, + AgentV1UpdateListenListenParams, + AgentV1UpdateListenListenProviderParams, + AgentV1UpdateListenListenProvider_V1Params, + AgentV1UpdateListenListenProvider_V2Params, + AgentV1UpdateListenParams, + AgentV1UpdatePromptParams, + AgentV1UpdateSpeakParams, + AgentV1UpdateSpeakSpeakParams, + AgentV1UpdateThinkLiveParams, + AgentV1UpdateThinkParams, + AgentV1UpdateThinkThinkParams, + AgentV1UserStartedSpeakingParams, + AgentV1WarningParams, + AgentV1WelcomeParams, + ConversationHistoryMessageParams, + FunctionCallHistoryMessageFunctionCallsItemParams, + FunctionCallHistoryMessageParams, + ) +_dynamic_imports: typing.Dict[str, str] = { + "AgentV1AgentAudioDone": ".types", + "AgentV1AgentAudioDoneParams": ".requests", + "AgentV1AgentStartedSpeaking": ".types", + "AgentV1AgentStartedSpeakingParams": ".requests", + "AgentV1AgentThinking": ".types", + "AgentV1AgentThinkingParams": ".requests", + "AgentV1ConversationText": ".types", + "AgentV1ConversationTextConversationalBehavior": ".types", + "AgentV1ConversationTextParams": ".requests", + "AgentV1ConversationTextRole": ".types", + "AgentV1CustomFromThinkProvider": ".types", + "AgentV1CustomFromThinkProviderParams": ".requests", + "AgentV1CustomToThinkProvider": ".types", + "AgentV1CustomToThinkProviderParams": ".requests", + "AgentV1Error": ".types", + "AgentV1ErrorParams": ".requests", + "AgentV1ForceEndTurn": ".types", + "AgentV1ForceEndTurnParams": ".requests", + "AgentV1FrustrationDetected": ".types", + "AgentV1FrustrationDetectedParams": ".requests", + "AgentV1FunctionCallCancelled": ".types", + "AgentV1FunctionCallCancelledFunctionsItem": ".types", + "AgentV1FunctionCallCancelledFunctionsItemParams": ".requests", + "AgentV1FunctionCallCancelledParams": ".requests", + "AgentV1FunctionCallRequest": ".types", + "AgentV1FunctionCallRequestFunctionsItem": ".types", + "AgentV1FunctionCallRequestFunctionsItemParams": ".requests", + "AgentV1FunctionCallRequestParams": ".requests", + "AgentV1History": ".types", + "AgentV1HistoryParams": ".requests", + "AgentV1InjectAgentMessage": ".types", + "AgentV1InjectAgentMessageBehavior": ".types", + "AgentV1InjectAgentMessageParams": ".requests", + "AgentV1InjectDynamicAgentMessage": ".types", + "AgentV1InjectDynamicAgentMessageBehavior": ".types", + "AgentV1InjectDynamicAgentMessageParams": ".requests", + "AgentV1InjectUserMessage": ".types", + "AgentV1InjectUserMessageParams": ".requests", + "AgentV1InjectionRefused": ".types", + "AgentV1InjectionRefusedParams": ".requests", + "AgentV1KeepAlive": ".types", + "AgentV1KeepAliveParams": ".requests", + "AgentV1LatencyReport": ".types", + "AgentV1LatencyReportParams": ".requests", + "AgentV1ListenUpdated": ".types", + "AgentV1ListenUpdatedParams": ".requests", + "AgentV1PromptUpdated": ".types", + "AgentV1PromptUpdatedParams": ".requests", + "AgentV1ReceiveFunctionCallResponse": ".types", + "AgentV1ReceiveFunctionCallResponseParams": ".requests", + "AgentV1SendFunctionCallResponse": ".types", + "AgentV1SendFunctionCallResponseParams": ".requests", + "AgentV1Settings": ".types", + "AgentV1SettingsAgent": ".types", + "AgentV1SettingsAgentContext": ".types", + "AgentV1SettingsAgentContextContext": ".types", + "AgentV1SettingsAgentContextContextMessagesItem": ".types", + "AgentV1SettingsAgentContextContextMessagesItemParams": ".requests", + "AgentV1SettingsAgentContextContextParams": ".requests", + "AgentV1SettingsAgentContextListen": ".types", + "AgentV1SettingsAgentContextListenParams": ".requests", + "AgentV1SettingsAgentContextListenProvider": ".types", + "AgentV1SettingsAgentContextListenProviderParams": ".requests", + "AgentV1SettingsAgentContextListenProvider_V1": ".types", + "AgentV1SettingsAgentContextListenProvider_V1Params": ".requests", + "AgentV1SettingsAgentContextListenProvider_V2": ".types", + "AgentV1SettingsAgentContextListenProvider_V2Params": ".requests", + "AgentV1SettingsAgentContextParams": ".requests", + "AgentV1SettingsAgentContextSpeak": ".types", + "AgentV1SettingsAgentContextSpeakParams": ".requests", + "AgentV1SettingsAgentContextThink": ".types", + "AgentV1SettingsAgentContextThinkParams": ".requests", + "AgentV1SettingsAgentListen": ".types", + "AgentV1SettingsAgentListenParams": ".requests", + "AgentV1SettingsAgentListenProvider": ".types", + "AgentV1SettingsAgentListenProviderParams": ".requests", + "AgentV1SettingsAgentListenProvider_V1": ".types", + "AgentV1SettingsAgentListenProvider_V1Params": ".requests", + "AgentV1SettingsAgentListenProvider_V2": ".types", + "AgentV1SettingsAgentListenProvider_V2Params": ".requests", + "AgentV1SettingsAgentParams": ".requests", + "AgentV1SettingsAgentSpeak": ".types", + "AgentV1SettingsAgentSpeakParams": ".requests", + "AgentV1SettingsAgentThink": ".types", + "AgentV1SettingsAgentThinkParams": ".requests", + "AgentV1SettingsApplied": ".types", + "AgentV1SettingsAppliedParams": ".requests", + "AgentV1SettingsAudio": ".types", + "AgentV1SettingsAudioInput": ".types", + "AgentV1SettingsAudioInputEncoding": ".types", + "AgentV1SettingsAudioInputParams": ".requests", + "AgentV1SettingsAudioOutput": ".types", + "AgentV1SettingsAudioOutputContainer": ".types", + "AgentV1SettingsAudioOutputEncoding": ".types", + "AgentV1SettingsAudioOutputParams": ".requests", + "AgentV1SettingsAudioParams": ".requests", + "AgentV1SettingsFlags": ".types", + "AgentV1SettingsFlagsParams": ".requests", + "AgentV1SettingsParams": ".requests", + "AgentV1SpeakUpdated": ".types", + "AgentV1SpeakUpdatedParams": ".requests", + "AgentV1ThinkLiveUpdated": ".types", + "AgentV1ThinkLiveUpdatedParams": ".requests", + "AgentV1ThinkUpdated": ".types", + "AgentV1ThinkUpdatedParams": ".requests", + "AgentV1UpdateListen": ".types", + "AgentV1UpdateListenListen": ".types", + "AgentV1UpdateListenListenParams": ".requests", + "AgentV1UpdateListenListenProvider": ".types", + "AgentV1UpdateListenListenProviderParams": ".requests", + "AgentV1UpdateListenListenProvider_V1": ".types", + "AgentV1UpdateListenListenProvider_V1Params": ".requests", + "AgentV1UpdateListenListenProvider_V2": ".types", + "AgentV1UpdateListenListenProvider_V2Params": ".requests", + "AgentV1UpdateListenParams": ".requests", + "AgentV1UpdatePrompt": ".types", + "AgentV1UpdatePromptParams": ".requests", + "AgentV1UpdateSpeak": ".types", + "AgentV1UpdateSpeakParams": ".requests", + "AgentV1UpdateSpeakSpeak": ".types", + "AgentV1UpdateSpeakSpeakParams": ".requests", + "AgentV1UpdateThink": ".types", + "AgentV1UpdateThinkLive": ".types", + "AgentV1UpdateThinkLiveParams": ".requests", + "AgentV1UpdateThinkParams": ".requests", + "AgentV1UpdateThinkThink": ".types", + "AgentV1UpdateThinkThinkParams": ".requests", + "AgentV1UserStartedSpeaking": ".types", + "AgentV1UserStartedSpeakingParams": ".requests", + "AgentV1Warning": ".types", + "AgentV1WarningParams": ".requests", + "AgentV1Welcome": ".types", + "AgentV1WelcomeParams": ".requests", + "ConversationHistoryMessage": ".types", + "ConversationHistoryMessageParams": ".requests", + "ConversationHistoryMessageRole": ".types", + "FunctionCallHistoryMessage": ".types", + "FunctionCallHistoryMessageFunctionCallsItem": ".types", + "FunctionCallHistoryMessageFunctionCallsItemParams": ".requests", + "FunctionCallHistoryMessageParams": ".requests", + "settings": ".settings", +} + +_dynamic_imports.update( + { + "AgentV1HistoryContent": ".types", + "AgentV1HistoryContentParams": ".requests", + "AgentV1HistoryContentRole": ".types", + "AgentV1HistoryFunctionCalls": ".types", + "AgentV1HistoryFunctionCallsFunctionCallsItem": ".types", + "AgentV1HistoryFunctionCallsFunctionCallsItemParams": ".requests", + "AgentV1HistoryFunctionCallsParams": ".requests", + "AgentV1SettingsAgentContextContextMessagesItemContentRole": ".types", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem": ".types", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams": ".requests", + "AgentV1SettingsAgentContextListenProviderV1": ".types", + "AgentV1SettingsAgentContextListenProviderV1Params": ".requests", + "AgentV1SettingsAgentContextListenProviderV2": ".types", + "AgentV1SettingsAgentContextListenProviderV2LanguageHint": ".types", + "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams": ".requests", + "AgentV1SettingsAgentContextListenProviderV2Params": ".requests", + "AgentV1SettingsAgentContextMessagesItem": ".types", + "AgentV1SettingsAgentContextMessagesItemContent": ".types", + "AgentV1SettingsAgentContextMessagesItemContentParams": ".requests", + "AgentV1SettingsAgentContextMessagesItemContentRole": ".types", + "AgentV1SettingsAgentContextMessagesItemFunctionCalls": ".types", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem": ".types", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams": ".requests", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams": ".requests", + "AgentV1SettingsAgentContextMessagesItemParams": ".requests", + "AgentV1SettingsAgentListenProviderV1": ".types", + "AgentV1SettingsAgentListenProviderV1Params": ".requests", + "AgentV1SettingsAgentListenProviderV2": ".types", + "AgentV1SettingsAgentListenProviderV2Params": ".requests", + } +) + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "AgentV1AgentAudioDone", + "AgentV1AgentAudioDoneParams", + "AgentV1AgentStartedSpeaking", + "AgentV1AgentStartedSpeakingParams", + "AgentV1AgentThinking", + "AgentV1AgentThinkingParams", + "AgentV1ConversationText", + "AgentV1ConversationTextConversationalBehavior", + "AgentV1ConversationTextParams", + "AgentV1ConversationTextRole", + "AgentV1CustomFromThinkProvider", + "AgentV1CustomFromThinkProviderParams", + "AgentV1CustomToThinkProvider", + "AgentV1CustomToThinkProviderParams", + "AgentV1Error", + "AgentV1ErrorParams", + "AgentV1ForceEndTurn", + "AgentV1ForceEndTurnParams", + "AgentV1FrustrationDetected", + "AgentV1FrustrationDetectedParams", + "AgentV1FunctionCallCancelled", + "AgentV1FunctionCallCancelledFunctionsItem", + "AgentV1FunctionCallCancelledFunctionsItemParams", + "AgentV1FunctionCallCancelledParams", + "AgentV1FunctionCallRequest", + "AgentV1FunctionCallRequestFunctionsItem", + "AgentV1FunctionCallRequestFunctionsItemParams", + "AgentV1FunctionCallRequestParams", + "AgentV1History", + "AgentV1HistoryParams", + "AgentV1InjectAgentMessage", + "AgentV1InjectAgentMessageBehavior", + "AgentV1InjectAgentMessageParams", + "AgentV1InjectDynamicAgentMessage", + "AgentV1InjectDynamicAgentMessageBehavior", + "AgentV1InjectDynamicAgentMessageParams", + "AgentV1InjectUserMessage", + "AgentV1InjectUserMessageParams", + "AgentV1InjectionRefused", + "AgentV1InjectionRefusedParams", + "AgentV1KeepAlive", + "AgentV1KeepAliveParams", + "AgentV1LatencyReport", + "AgentV1LatencyReportParams", + "AgentV1ListenUpdated", + "AgentV1ListenUpdatedParams", + "AgentV1PromptUpdated", + "AgentV1PromptUpdatedParams", + "AgentV1ReceiveFunctionCallResponse", + "AgentV1ReceiveFunctionCallResponseParams", + "AgentV1SendFunctionCallResponse", + "AgentV1SendFunctionCallResponseParams", + "AgentV1Settings", + "AgentV1SettingsAgent", + "AgentV1SettingsAgentContext", + "AgentV1SettingsAgentContextContext", + "AgentV1SettingsAgentContextContextMessagesItem", + "AgentV1SettingsAgentContextContextMessagesItemParams", + "AgentV1SettingsAgentContextContextParams", + "AgentV1SettingsAgentContextListen", + "AgentV1SettingsAgentContextListenParams", + "AgentV1SettingsAgentContextListenProvider", + "AgentV1SettingsAgentContextListenProviderParams", + "AgentV1SettingsAgentContextListenProvider_V1", + "AgentV1SettingsAgentContextListenProvider_V1Params", + "AgentV1SettingsAgentContextListenProvider_V2", + "AgentV1SettingsAgentContextListenProvider_V2Params", + "AgentV1SettingsAgentContextParams", + "AgentV1SettingsAgentContextSpeak", + "AgentV1SettingsAgentContextSpeakParams", + "AgentV1SettingsAgentContextThink", + "AgentV1SettingsAgentContextThinkParams", + "AgentV1SettingsAgentListen", + "AgentV1SettingsAgentListenParams", + "AgentV1SettingsAgentListenProvider", + "AgentV1SettingsAgentListenProviderParams", + "AgentV1SettingsAgentListenProvider_V1", + "AgentV1SettingsAgentListenProvider_V1Params", + "AgentV1SettingsAgentListenProvider_V2", + "AgentV1SettingsAgentListenProvider_V2Params", + "AgentV1SettingsAgentParams", + "AgentV1SettingsAgentSpeak", + "AgentV1SettingsAgentSpeakParams", + "AgentV1SettingsAgentThink", + "AgentV1SettingsAgentThinkParams", + "AgentV1SettingsApplied", + "AgentV1SettingsAppliedParams", + "AgentV1SettingsAudio", + "AgentV1SettingsAudioInput", + "AgentV1SettingsAudioInputEncoding", + "AgentV1SettingsAudioInputParams", + "AgentV1SettingsAudioOutput", + "AgentV1SettingsAudioOutputContainer", + "AgentV1SettingsAudioOutputEncoding", + "AgentV1SettingsAudioOutputParams", + "AgentV1SettingsAudioParams", + "AgentV1SettingsFlags", + "AgentV1SettingsFlagsParams", + "AgentV1SettingsParams", + "AgentV1SpeakUpdated", + "AgentV1SpeakUpdatedParams", + "AgentV1ThinkLiveUpdated", + "AgentV1ThinkLiveUpdatedParams", + "AgentV1ThinkUpdated", + "AgentV1ThinkUpdatedParams", + "AgentV1UpdateListen", + "AgentV1UpdateListenListen", + "AgentV1UpdateListenListenParams", + "AgentV1UpdateListenListenProvider", + "AgentV1UpdateListenListenProviderParams", + "AgentV1UpdateListenListenProvider_V1", + "AgentV1UpdateListenListenProvider_V1Params", + "AgentV1UpdateListenListenProvider_V2", + "AgentV1UpdateListenListenProvider_V2Params", + "AgentV1UpdateListenParams", + "AgentV1UpdatePrompt", + "AgentV1UpdatePromptParams", + "AgentV1UpdateSpeak", + "AgentV1UpdateSpeakParams", + "AgentV1UpdateSpeakSpeak", + "AgentV1UpdateSpeakSpeakParams", + "AgentV1UpdateThink", + "AgentV1UpdateThinkLive", + "AgentV1UpdateThinkLiveParams", + "AgentV1UpdateThinkParams", + "AgentV1UpdateThinkThink", + "AgentV1UpdateThinkThinkParams", + "AgentV1UserStartedSpeaking", + "AgentV1UserStartedSpeakingParams", + "AgentV1Warning", + "AgentV1WarningParams", + "AgentV1Welcome", + "AgentV1WelcomeParams", + "ConversationHistoryMessage", + "ConversationHistoryMessageParams", + "ConversationHistoryMessageRole", + "FunctionCallHistoryMessage", + "FunctionCallHistoryMessageFunctionCallsItem", + "FunctionCallHistoryMessageFunctionCallsItemParams", + "FunctionCallHistoryMessageParams", + "settings", +] + +__all__.extend( + [ + "AgentV1HistoryContent", + "AgentV1HistoryContentParams", + "AgentV1HistoryContentRole", + "AgentV1HistoryFunctionCalls", + "AgentV1HistoryFunctionCallsFunctionCallsItem", + "AgentV1HistoryFunctionCallsFunctionCallsItemParams", + "AgentV1HistoryFunctionCallsParams", + "AgentV1SettingsAgentContextContextMessagesItemContentRole", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams", + "AgentV1SettingsAgentContextListenProviderV1", + "AgentV1SettingsAgentContextListenProviderV1Params", + "AgentV1SettingsAgentContextListenProviderV2", + "AgentV1SettingsAgentContextListenProviderV2LanguageHint", + "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams", + "AgentV1SettingsAgentContextListenProviderV2Params", + "AgentV1SettingsAgentContextMessagesItem", + "AgentV1SettingsAgentContextMessagesItemContent", + "AgentV1SettingsAgentContextMessagesItemContentParams", + "AgentV1SettingsAgentContextMessagesItemContentRole", + "AgentV1SettingsAgentContextMessagesItemFunctionCalls", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams", + "AgentV1SettingsAgentContextMessagesItemParams", + "AgentV1SettingsAgentListenProviderV1", + "AgentV1SettingsAgentListenProviderV1Params", + "AgentV1SettingsAgentListenProviderV2", + "AgentV1SettingsAgentListenProviderV2Params", + ] +) diff --git a/src/deepgram/agent/v1/requests/__init__.py.bak b/src/deepgram/agent/v1/requests/__init__.py.bak new file mode 100644 index 00000000..766d9807 --- /dev/null +++ b/src/deepgram/agent/v1/requests/__init__.py.bak @@ -0,0 +1,279 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .agent_v1agent_audio_done import AgentV1AgentAudioDoneParams + from .agent_v1agent_started_speaking import AgentV1AgentStartedSpeakingParams + from .agent_v1agent_thinking import AgentV1AgentThinkingParams + from .agent_v1conversation_text import AgentV1ConversationTextParams + from .agent_v1custom_from_think_provider import AgentV1CustomFromThinkProviderParams + from .agent_v1custom_to_think_provider import AgentV1CustomToThinkProviderParams + from .agent_v1error import AgentV1ErrorParams + from .agent_v1force_end_turn import AgentV1ForceEndTurnParams + from .agent_v1frustration_detected import AgentV1FrustrationDetectedParams + from .agent_v1function_call_cancelled import AgentV1FunctionCallCancelledParams + from .agent_v1function_call_cancelled_functions_item import AgentV1FunctionCallCancelledFunctionsItemParams + from .agent_v1function_call_request import AgentV1FunctionCallRequestParams + from .agent_v1function_call_request_functions_item import AgentV1FunctionCallRequestFunctionsItemParams + from .agent_v1history import AgentV1HistoryParams + from .agent_v1history_content import AgentV1HistoryContentParams # noqa: F401 + from .agent_v1history_function_calls import AgentV1HistoryFunctionCallsParams # noqa: F401 + from .agent_v1inject_agent_message import AgentV1InjectAgentMessageParams + from .agent_v1inject_dynamic_agent_message import AgentV1InjectDynamicAgentMessageParams + from .agent_v1inject_user_message import AgentV1InjectUserMessageParams + from .agent_v1injection_refused import AgentV1InjectionRefusedParams + from .agent_v1keep_alive import AgentV1KeepAliveParams + from .agent_v1latency_report import AgentV1LatencyReportParams + from .agent_v1listen_updated import AgentV1ListenUpdatedParams + from .agent_v1prompt_updated import AgentV1PromptUpdatedParams + from .agent_v1receive_function_call_response import AgentV1ReceiveFunctionCallResponseParams + from .agent_v1send_function_call_response import AgentV1SendFunctionCallResponseParams + from .agent_v1settings import AgentV1SettingsParams + from .agent_v1settings_agent import AgentV1SettingsAgentParams + from .agent_v1settings_agent_context import AgentV1SettingsAgentContextParams + from .agent_v1settings_agent_context_context import AgentV1SettingsAgentContextContextParams + from .agent_v1settings_agent_context_context_messages_item import ( + AgentV1SettingsAgentContextContextMessagesItemParams, + ) + from .agent_v1settings_agent_context_listen import AgentV1SettingsAgentContextListenParams + from .agent_v1settings_agent_context_listen_provider import ( + AgentV1SettingsAgentContextListenProviderParams, + AgentV1SettingsAgentContextListenProvider_V1Params, + AgentV1SettingsAgentContextListenProvider_V2Params, + ) + from .agent_v1settings_agent_context_speak import AgentV1SettingsAgentContextSpeakParams + from .agent_v1settings_agent_context_think import AgentV1SettingsAgentContextThinkParams + from .agent_v1settings_agent_listen import AgentV1SettingsAgentListenParams + from .agent_v1settings_agent_listen_provider import ( + AgentV1SettingsAgentListenProviderParams, + AgentV1SettingsAgentListenProvider_V1Params, + AgentV1SettingsAgentListenProvider_V2Params, + ) + from .agent_v1settings_agent_speak import AgentV1SettingsAgentSpeakParams + from .agent_v1settings_agent_think import AgentV1SettingsAgentThinkParams + from .agent_v1settings_applied import AgentV1SettingsAppliedParams + from .agent_v1settings_audio import AgentV1SettingsAudioParams + from .agent_v1settings_audio_input import AgentV1SettingsAudioInputParams + from .agent_v1settings_audio_output import AgentV1SettingsAudioOutputParams + from .agent_v1settings_flags import AgentV1SettingsFlagsParams + from .agent_v1speak_updated import AgentV1SpeakUpdatedParams + from .agent_v1think_live_updated import AgentV1ThinkLiveUpdatedParams + from .agent_v1think_updated import AgentV1ThinkUpdatedParams + from .agent_v1update_listen import AgentV1UpdateListenParams + from .agent_v1update_listen_listen import AgentV1UpdateListenListenParams + from .agent_v1update_listen_listen_provider import ( + AgentV1UpdateListenListenProviderParams, + AgentV1UpdateListenListenProvider_V1Params, + AgentV1UpdateListenListenProvider_V2Params, + ) + from .agent_v1update_prompt import AgentV1UpdatePromptParams + from .agent_v1update_speak import AgentV1UpdateSpeakParams + from .agent_v1update_speak_speak import AgentV1UpdateSpeakSpeakParams + from .agent_v1update_think import AgentV1UpdateThinkParams + from .agent_v1update_think_live import AgentV1UpdateThinkLiveParams + from .agent_v1update_think_think import AgentV1UpdateThinkThinkParams + from .agent_v1user_started_speaking import AgentV1UserStartedSpeakingParams + from .agent_v1warning import AgentV1WarningParams + from .agent_v1welcome import AgentV1WelcomeParams + from .conversation_history_message import ConversationHistoryMessageParams + from .function_call_history_message import FunctionCallHistoryMessageParams + from .function_call_history_message_function_calls_item import FunctionCallHistoryMessageFunctionCallsItemParams +_dynamic_imports: typing.Dict[str, str] = { + "AgentV1AgentAudioDoneParams": ".agent_v1agent_audio_done", + "AgentV1AgentStartedSpeakingParams": ".agent_v1agent_started_speaking", + "AgentV1AgentThinkingParams": ".agent_v1agent_thinking", + "AgentV1ConversationTextParams": ".agent_v1conversation_text", + "AgentV1CustomFromThinkProviderParams": ".agent_v1custom_from_think_provider", + "AgentV1CustomToThinkProviderParams": ".agent_v1custom_to_think_provider", + "AgentV1ErrorParams": ".agent_v1error", + "AgentV1ForceEndTurnParams": ".agent_v1force_end_turn", + "AgentV1FrustrationDetectedParams": ".agent_v1frustration_detected", + "AgentV1FunctionCallCancelledFunctionsItemParams": ".agent_v1function_call_cancelled_functions_item", + "AgentV1FunctionCallCancelledParams": ".agent_v1function_call_cancelled", + "AgentV1FunctionCallRequestFunctionsItemParams": ".agent_v1function_call_request_functions_item", + "AgentV1FunctionCallRequestParams": ".agent_v1function_call_request", + "AgentV1HistoryParams": ".agent_v1history", + "AgentV1InjectAgentMessageParams": ".agent_v1inject_agent_message", + "AgentV1InjectDynamicAgentMessageParams": ".agent_v1inject_dynamic_agent_message", + "AgentV1InjectUserMessageParams": ".agent_v1inject_user_message", + "AgentV1InjectionRefusedParams": ".agent_v1injection_refused", + "AgentV1KeepAliveParams": ".agent_v1keep_alive", + "AgentV1LatencyReportParams": ".agent_v1latency_report", + "AgentV1ListenUpdatedParams": ".agent_v1listen_updated", + "AgentV1PromptUpdatedParams": ".agent_v1prompt_updated", + "AgentV1ReceiveFunctionCallResponseParams": ".agent_v1receive_function_call_response", + "AgentV1SendFunctionCallResponseParams": ".agent_v1send_function_call_response", + "AgentV1SettingsAgentContextContextMessagesItemParams": ".agent_v1settings_agent_context_context_messages_item", + "AgentV1SettingsAgentContextContextParams": ".agent_v1settings_agent_context_context", + "AgentV1SettingsAgentContextListenParams": ".agent_v1settings_agent_context_listen", + "AgentV1SettingsAgentContextListenProviderParams": ".agent_v1settings_agent_context_listen_provider", + "AgentV1SettingsAgentContextListenProvider_V1Params": ".agent_v1settings_agent_context_listen_provider", + "AgentV1SettingsAgentContextListenProvider_V2Params": ".agent_v1settings_agent_context_listen_provider", + "AgentV1SettingsAgentContextParams": ".agent_v1settings_agent_context", + "AgentV1SettingsAgentContextSpeakParams": ".agent_v1settings_agent_context_speak", + "AgentV1SettingsAgentContextThinkParams": ".agent_v1settings_agent_context_think", + "AgentV1SettingsAgentListenParams": ".agent_v1settings_agent_listen", + "AgentV1SettingsAgentListenProviderParams": ".agent_v1settings_agent_listen_provider", + "AgentV1SettingsAgentListenProvider_V1Params": ".agent_v1settings_agent_listen_provider", + "AgentV1SettingsAgentListenProvider_V2Params": ".agent_v1settings_agent_listen_provider", + "AgentV1SettingsAgentParams": ".agent_v1settings_agent", + "AgentV1SettingsAgentSpeakParams": ".agent_v1settings_agent_speak", + "AgentV1SettingsAgentThinkParams": ".agent_v1settings_agent_think", + "AgentV1SettingsAppliedParams": ".agent_v1settings_applied", + "AgentV1SettingsAudioInputParams": ".agent_v1settings_audio_input", + "AgentV1SettingsAudioOutputParams": ".agent_v1settings_audio_output", + "AgentV1SettingsAudioParams": ".agent_v1settings_audio", + "AgentV1SettingsFlagsParams": ".agent_v1settings_flags", + "AgentV1SettingsParams": ".agent_v1settings", + "AgentV1SpeakUpdatedParams": ".agent_v1speak_updated", + "AgentV1ThinkLiveUpdatedParams": ".agent_v1think_live_updated", + "AgentV1ThinkUpdatedParams": ".agent_v1think_updated", + "AgentV1UpdateListenListenParams": ".agent_v1update_listen_listen", + "AgentV1UpdateListenListenProviderParams": ".agent_v1update_listen_listen_provider", + "AgentV1UpdateListenListenProvider_V1Params": ".agent_v1update_listen_listen_provider", + "AgentV1UpdateListenListenProvider_V2Params": ".agent_v1update_listen_listen_provider", + "AgentV1UpdateListenParams": ".agent_v1update_listen", + "AgentV1UpdatePromptParams": ".agent_v1update_prompt", + "AgentV1UpdateSpeakParams": ".agent_v1update_speak", + "AgentV1UpdateSpeakSpeakParams": ".agent_v1update_speak_speak", + "AgentV1UpdateThinkLiveParams": ".agent_v1update_think_live", + "AgentV1UpdateThinkParams": ".agent_v1update_think", + "AgentV1UpdateThinkThinkParams": ".agent_v1update_think_think", + "AgentV1UserStartedSpeakingParams": ".agent_v1user_started_speaking", + "AgentV1WarningParams": ".agent_v1warning", + "AgentV1WelcomeParams": ".agent_v1welcome", + "ConversationHistoryMessageParams": ".conversation_history_message", + "FunctionCallHistoryMessageFunctionCallsItemParams": ".function_call_history_message_function_calls_item", + "FunctionCallHistoryMessageParams": ".function_call_history_message", +} + +_dynamic_imports.update( + { + "AgentV1HistoryContentParams": ".agent_v1history_content", + "AgentV1HistoryFunctionCallsParams": ".agent_v1history_function_calls", + "AgentV1HistoryFunctionCallsFunctionCallsItemParams": ".agent_v1history_function_calls_function_calls_item", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams": ".agent_v1settings_agent_context_context_messages_item_function_calls_function_calls_item", + "AgentV1SettingsAgentContextListenProviderV1Params": ".agent_v1settings_agent_context_listen_provider_v1", + "AgentV1SettingsAgentContextListenProviderV2Params": ".agent_v1settings_agent_context_listen_provider_v2", + "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams": ".agent_v1settings_agent_context_listen_provider_v2language_hint", + "AgentV1SettingsAgentContextMessagesItemParams": ".agent_v1settings_agent_context_messages_item", + "AgentV1SettingsAgentContextMessagesItemContentParams": ".agent_v1settings_agent_context_messages_item_content", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams": ".agent_v1settings_agent_context_messages_item_function_calls", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams": ".agent_v1settings_agent_context_messages_item_function_calls_function_calls_item", + "AgentV1SettingsAgentListenProviderV1Params": ".agent_v1settings_agent_listen_provider_v1", + "AgentV1SettingsAgentListenProviderV2Params": ".agent_v1settings_agent_listen_provider_v2", + } +) + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "AgentV1AgentAudioDoneParams", + "AgentV1AgentStartedSpeakingParams", + "AgentV1AgentThinkingParams", + "AgentV1ConversationTextParams", + "AgentV1CustomFromThinkProviderParams", + "AgentV1CustomToThinkProviderParams", + "AgentV1ErrorParams", + "AgentV1ForceEndTurnParams", + "AgentV1FrustrationDetectedParams", + "AgentV1FunctionCallCancelledFunctionsItemParams", + "AgentV1FunctionCallCancelledParams", + "AgentV1FunctionCallRequestFunctionsItemParams", + "AgentV1FunctionCallRequestParams", + "AgentV1HistoryParams", + "AgentV1InjectAgentMessageParams", + "AgentV1InjectDynamicAgentMessageParams", + "AgentV1InjectUserMessageParams", + "AgentV1InjectionRefusedParams", + "AgentV1KeepAliveParams", + "AgentV1LatencyReportParams", + "AgentV1ListenUpdatedParams", + "AgentV1PromptUpdatedParams", + "AgentV1ReceiveFunctionCallResponseParams", + "AgentV1SendFunctionCallResponseParams", + "AgentV1SettingsAgentContextContextMessagesItemParams", + "AgentV1SettingsAgentContextContextParams", + "AgentV1SettingsAgentContextListenParams", + "AgentV1SettingsAgentContextListenProviderParams", + "AgentV1SettingsAgentContextListenProvider_V1Params", + "AgentV1SettingsAgentContextListenProvider_V2Params", + "AgentV1SettingsAgentContextParams", + "AgentV1SettingsAgentContextSpeakParams", + "AgentV1SettingsAgentContextThinkParams", + "AgentV1SettingsAgentListenParams", + "AgentV1SettingsAgentListenProviderParams", + "AgentV1SettingsAgentListenProvider_V1Params", + "AgentV1SettingsAgentListenProvider_V2Params", + "AgentV1SettingsAgentParams", + "AgentV1SettingsAgentSpeakParams", + "AgentV1SettingsAgentThinkParams", + "AgentV1SettingsAppliedParams", + "AgentV1SettingsAudioInputParams", + "AgentV1SettingsAudioOutputParams", + "AgentV1SettingsAudioParams", + "AgentV1SettingsFlagsParams", + "AgentV1SettingsParams", + "AgentV1SpeakUpdatedParams", + "AgentV1ThinkLiveUpdatedParams", + "AgentV1ThinkUpdatedParams", + "AgentV1UpdateListenListenParams", + "AgentV1UpdateListenListenProviderParams", + "AgentV1UpdateListenListenProvider_V1Params", + "AgentV1UpdateListenListenProvider_V2Params", + "AgentV1UpdateListenParams", + "AgentV1UpdatePromptParams", + "AgentV1UpdateSpeakParams", + "AgentV1UpdateSpeakSpeakParams", + "AgentV1UpdateThinkLiveParams", + "AgentV1UpdateThinkParams", + "AgentV1UpdateThinkThinkParams", + "AgentV1UserStartedSpeakingParams", + "AgentV1WarningParams", + "AgentV1WelcomeParams", + "ConversationHistoryMessageParams", + "FunctionCallHistoryMessageFunctionCallsItemParams", + "FunctionCallHistoryMessageParams", +] + +__all__.extend( + [ + "AgentV1HistoryContentParams", + "AgentV1HistoryFunctionCallsParams", + "AgentV1HistoryFunctionCallsFunctionCallsItemParams", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams", + "AgentV1SettingsAgentContextListenProviderV1Params", + "AgentV1SettingsAgentContextListenProviderV2Params", + "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams", + "AgentV1SettingsAgentContextMessagesItemParams", + "AgentV1SettingsAgentContextMessagesItemContentParams", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams", + "AgentV1SettingsAgentListenProviderV1Params", + "AgentV1SettingsAgentListenProviderV2Params", + ] +) diff --git a/src/deepgram/agent/v1/requests/agent_v1conversation_text.py.bak b/src/deepgram/agent/v1/requests/agent_v1conversation_text.py.bak new file mode 100644 index 00000000..059f094a --- /dev/null +++ b/src/deepgram/agent/v1/requests/agent_v1conversation_text.py.bak @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import typing_extensions +from ..types.agent_v1conversation_text_conversational_behavior import AgentV1ConversationTextConversationalBehavior +from ..types.agent_v1conversation_text_role import AgentV1ConversationTextRole + + +class AgentV1ConversationTextParams(typing_extensions.TypedDict): + type: typing.Literal["ConversationText"] + """ + Message type identifier for conversation text + """ + + role: AgentV1ConversationTextRole + """ + Identifies who spoke the statement + """ + + content: str + """ + The actual statement that was spoken + """ + + conversational_behavior: typing_extensions.NotRequired[AgentV1ConversationTextConversationalBehavior] + """ + Annotates what kind of utterance the message represents: `default` (a standard turn), `backchannel` (a short acknowledgement while the user held the floor), `presence_check` (a prompt after extended silence), or `filler` (a line covering a wait on a function call or a dynamic InjectAgentMessage). Always sent; it is `default` for every message while Think Live is off + """ + + languages_hinted: typing_extensions.NotRequired[typing.Sequence[str]] + """ + The language hints that were active at the time of the turn. Only present on user-role messages when the listen model is flux-general-multi. + """ + + languages: typing_extensions.NotRequired[typing.Sequence[str]] + """ + Languages detected in the user's speech, sorted by word count (descending). Only present on user-role messages when the listen model is flux-general-multi. + """ diff --git a/src/deepgram/agent/v1/requests/agent_v1inject_dynamic_agent_message.py.bak b/src/deepgram/agent/v1/requests/agent_v1inject_dynamic_agent_message.py.bak new file mode 100644 index 00000000..1d912428 --- /dev/null +++ b/src/deepgram/agent/v1/requests/agent_v1inject_dynamic_agent_message.py.bak @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import typing_extensions +from ..types.agent_v1inject_dynamic_agent_message_behavior import AgentV1InjectDynamicAgentMessageBehavior + + +class AgentV1InjectDynamicAgentMessageParams(typing_extensions.TypedDict): + type: typing.Literal["InjectAgentMessage"] + """ + Message type identifier for injecting an agent message + """ + + is_dynamic: typing.Literal[True] + """ + Must be `true`. The Think Live model generates the line, so no `message` is sent + """ + + behavior: typing_extensions.NotRequired[AgentV1InjectDynamicAgentMessageBehavior] + """ + Controls how the injection interacts with any in-progress user or agent turn. + + * `default` — The agent speaks only if neither the user nor the agent is mid-turn. If a turn is in progress, the server replies with `InjectionRefused`. + * `queue` — The message is appended after any already-queued `ConversationText` without interrupting the current agent turn or think response. If nothing is queued, the message plays immediately. + * `interrupt` — The agent immediately speaks. If the agent was already speaking, it interrupts the current speech and replaces it with the new message. If the user is speaking, the agent interrupts with the new message, but the user's continued speech triggers `UserStartedSpeaking`, which quickly interrupts the agent. + """ diff --git a/src/deepgram/agent/v1/requests/agent_v1settings.py.bak b/src/deepgram/agent/v1/requests/agent_v1settings.py.bak new file mode 100644 index 00000000..5ada0975 --- /dev/null +++ b/src/deepgram/agent/v1/requests/agent_v1settings.py.bak @@ -0,0 +1,31 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import typing_extensions +from .agent_v1settings_agent import AgentV1SettingsAgentParams +from .agent_v1settings_agent_context import AgentV1SettingsAgentContextParams +from .agent_v1settings_audio import AgentV1SettingsAudioParams +from .agent_v1settings_flags import AgentV1SettingsFlagsParams + + +class AgentV1SettingsParams(typing_extensions.TypedDict): + type: typing.Literal["Settings"] + tags: typing_extensions.NotRequired[typing.Sequence[str]] + """ + Tags to associate with the request + """ + + experimental: typing_extensions.NotRequired[bool] + """ + To enable experimental features + """ + + flags: typing_extensions.NotRequired[AgentV1SettingsFlagsParams] + mip_opt_out: typing_extensions.NotRequired[bool] + """ + To opt out of Deepgram Model Improvement Program + """ + + audio: AgentV1SettingsAudioParams + agent: typing.Union[AgentV1SettingsAgentParams, AgentV1SettingsAgentContextParams, str] diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent.py.bak b/src/deepgram/agent/v1/requests/agent_v1settings_agent.py.bak new file mode 100644 index 00000000..4a2bcf8c --- /dev/null +++ b/src/deepgram/agent/v1/requests/agent_v1settings_agent.py.bak @@ -0,0 +1,18 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing_extensions +from ....requests.think_live_settings_v1 import ThinkLiveSettingsV1Params +from .agent_v1settings_agent_context import AgentV1SettingsAgentContextParams +from .agent_v1settings_agent_listen import AgentV1SettingsAgentListenParams +from .agent_v1settings_agent_speak import AgentV1SettingsAgentSpeakParams +from .agent_v1settings_agent_think import AgentV1SettingsAgentThinkParams + + +class AgentV1SettingsAgentParams(typing_extensions.TypedDict): + language: typing_extensions.NotRequired[str] + context: typing_extensions.NotRequired[AgentV1SettingsAgentContextParams] + listen: typing_extensions.NotRequired[AgentV1SettingsAgentListenParams] + think: typing_extensions.NotRequired[AgentV1SettingsAgentThinkParams] + think_live: typing_extensions.NotRequired[ThinkLiveSettingsV1Params] + speak: typing_extensions.NotRequired[AgentV1SettingsAgentSpeakParams] + greeting: typing_extensions.NotRequired[str] diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py.bak b/src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py.bak new file mode 100644 index 00000000..19503b6f --- /dev/null +++ b/src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py.bak @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import typing_extensions +from ....requests.think_live_settings_v1 import ThinkLiveSettingsV1Params +from .agent_v1settings_agent_context_context import AgentV1SettingsAgentContextContextParams +from .agent_v1settings_agent_context_listen import AgentV1SettingsAgentContextListenParams +from .agent_v1settings_agent_context_messages_item import AgentV1SettingsAgentContextMessagesItemParams +from .agent_v1settings_agent_context_speak import AgentV1SettingsAgentContextSpeakParams +from .agent_v1settings_agent_context_think import AgentV1SettingsAgentContextThinkParams + + +class AgentV1SettingsAgentContextParams(typing_extensions.TypedDict): + language: typing_extensions.NotRequired[str] + """ + Deprecated. Use `listen.provider.language` and `speak.provider.language` fields instead. + """ + + messages: typing_extensions.NotRequired[typing.Sequence[AgentV1SettingsAgentContextMessagesItemParams]] + context: typing_extensions.NotRequired[AgentV1SettingsAgentContextContextParams] + """ + Conversation context including the history of messages and function calls + """ + + listen: typing_extensions.NotRequired[AgentV1SettingsAgentContextListenParams] + think: typing_extensions.NotRequired[AgentV1SettingsAgentContextThinkParams] + """ + Your reasoning LLM. With Think Live on, this is the reasoning half of the pair, running alongside the Think Live model configured in `think_live` + """ + + think_live: typing_extensions.NotRequired[ThinkLiveSettingsV1Params] + speak: typing_extensions.NotRequired[AgentV1SettingsAgentContextSpeakParams] + greeting: typing_extensions.NotRequired[str] + """ + Optional message that agent will speak at the start + """ diff --git a/src/deepgram/agent/v1/socket_client.py.bak b/src/deepgram/agent/v1/socket_client.py.bak new file mode 100644 index 00000000..44ffcaed --- /dev/null +++ b/src/deepgram/agent/v1/socket_client.py.bak @@ -0,0 +1,447 @@ +# This file was auto-generated by Fern from our API Definition. + +import json +import logging +import typing + +import websockets.sync.connection as websockets_sync_connection +from ...core.events import EventEmitterMixin, EventType +from ...core.unchecked_base_model import construct_type +from .types.agent_v1agent_audio_done import AgentV1AgentAudioDone +from .types.agent_v1agent_started_speaking import AgentV1AgentStartedSpeaking +from .types.agent_v1agent_thinking import AgentV1AgentThinking +from .types.agent_v1conversation_text import AgentV1ConversationText +from .types.agent_v1custom_from_think_provider import AgentV1CustomFromThinkProvider +from .types.agent_v1custom_to_think_provider import AgentV1CustomToThinkProvider +from .types.agent_v1error import AgentV1Error +from .types.agent_v1force_end_turn import AgentV1ForceEndTurn +from .types.agent_v1frustration_detected import AgentV1FrustrationDetected +from .types.agent_v1function_call_cancelled import AgentV1FunctionCallCancelled +from .types.agent_v1function_call_request import AgentV1FunctionCallRequest +from .types.agent_v1history import AgentV1History +from .types.agent_v1inject_agent_message import AgentV1InjectAgentMessage +from .types.agent_v1inject_dynamic_agent_message import AgentV1InjectDynamicAgentMessage +from .types.agent_v1inject_user_message import AgentV1InjectUserMessage +from .types.agent_v1injection_refused import AgentV1InjectionRefused +from .types.agent_v1keep_alive import AgentV1KeepAlive +from .types.agent_v1latency_report import AgentV1LatencyReport +from .types.agent_v1listen_updated import AgentV1ListenUpdated +from .types.agent_v1prompt_updated import AgentV1PromptUpdated +from .types.agent_v1receive_function_call_response import AgentV1ReceiveFunctionCallResponse +from .types.agent_v1send_function_call_response import AgentV1SendFunctionCallResponse +from .types.agent_v1settings import AgentV1Settings +from .types.agent_v1settings_applied import AgentV1SettingsApplied +from .types.agent_v1speak_updated import AgentV1SpeakUpdated +from .types.agent_v1think_live_updated import AgentV1ThinkLiveUpdated +from .types.agent_v1think_updated import AgentV1ThinkUpdated +from .types.agent_v1update_listen import AgentV1UpdateListen +from .types.agent_v1update_prompt import AgentV1UpdatePrompt +from .types.agent_v1update_speak import AgentV1UpdateSpeak +from .types.agent_v1update_think import AgentV1UpdateThink +from .types.agent_v1update_think_live import AgentV1UpdateThinkLive +from .types.agent_v1user_started_speaking import AgentV1UserStartedSpeaking +from .types.agent_v1warning import AgentV1Warning +from .types.agent_v1welcome import AgentV1Welcome + +try: + from websockets.legacy.client import WebSocketClientProtocol # type: ignore +except ImportError: + from websockets import WebSocketClientProtocol # type: ignore + + +def _sanitize_numeric_types(obj: typing.Any) -> typing.Any: + """Convert whole-number floats to integers for wire-compatible JSON.""" + if isinstance(obj, dict): + return {key: _sanitize_numeric_types(value) for key, value in obj.items()} + if isinstance(obj, list): + return [_sanitize_numeric_types(item) for item in obj] + if isinstance(obj, float) and obj.is_integer(): + return int(obj) + return obj + + +_logger = logging.getLogger(__name__) +V1SocketClientResponse = typing.Union[ + AgentV1ListenUpdated, + AgentV1ThinkUpdated, + AgentV1ThinkLiveUpdated, + AgentV1FrustrationDetected, + AgentV1ReceiveFunctionCallResponse, + AgentV1PromptUpdated, + AgentV1SpeakUpdated, + AgentV1InjectionRefused, + AgentV1Welcome, + AgentV1SettingsApplied, + AgentV1ConversationText, + AgentV1UserStartedSpeaking, + AgentV1AgentThinking, + AgentV1LatencyReport, + AgentV1FunctionCallRequest, + AgentV1FunctionCallCancelled, + AgentV1AgentStartedSpeaking, + AgentV1AgentAudioDone, + AgentV1CustomFromThinkProvider, + AgentV1Error, + AgentV1Warning, + AgentV1History, + bytes, + typing.Dict[str, typing.Any], +] + + +class AsyncV1SocketClient(EventEmitterMixin): + def __init__(self, *, websocket: WebSocketClientProtocol): + super().__init__() + self._websocket = websocket + + async def __aiter__(self) -> typing.AsyncIterator[V1SocketClientResponse]: + async for message in self._websocket: + if isinstance(message, bytes): + yield message # type: ignore + else: + try: + yield construct_type(type_=V1SocketClientResponse, object_=json.loads(message)) # type: ignore + except Exception: + _logger.warning( + "Skipping unknown WebSocket message; update your SDK version to support new message types." + ) + continue + + async def start_listening(self): + """ + Start listening for messages on the websocket connection. + + Emits events in the following order: + - EventType.OPEN when connection is established + - EventType.MESSAGE for each message received + - EventType.ERROR if an error occurs + - EventType.CLOSE when connection is closed + """ + await self._emit_async(EventType.OPEN, None) + try: + async for raw_message in self._websocket: + if isinstance(raw_message, bytes): + parsed = raw_message + else: + json_data = json.loads(raw_message) + try: + parsed = construct_type(type_=V1SocketClientResponse, object_=json_data) # type: ignore + except Exception: + _logger.warning( + "Skipping unknown WebSocket message; update your SDK version to support new message types." + ) + continue + await self._emit_async(EventType.MESSAGE, parsed) + except Exception as exc: + await self._emit_async(EventType.ERROR, exc) + finally: + await self._emit_async(EventType.CLOSE, None) + + async def send_settings(self, message: AgentV1Settings) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1Settings. + """ + await self._send_model(message) + + async def send_update_listen(self, message: AgentV1UpdateListen) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1UpdateListen. + """ + await self._send_model(message) + + async def send_update_think(self, message: AgentV1UpdateThink) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1UpdateThink. + """ + await self._send_model(message) + + async def send_update_think_live(self, message: AgentV1UpdateThinkLive) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1UpdateThinkLive. + """ + await self._send_model(message) + + async def send_update_speak(self, message: AgentV1UpdateSpeak) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1UpdateSpeak. + """ + await self._send_model(message) + + async def send_inject_user_message(self, message: AgentV1InjectUserMessage) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1InjectUserMessage. + """ + await self._send_model(message) + + async def send_inject_agent_message(self, message: AgentV1InjectAgentMessage) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1InjectAgentMessage. + """ + await self._send_model(message) + + async def send_inject_dynamic_agent_message(self, message: AgentV1InjectDynamicAgentMessage) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1InjectDynamicAgentMessage. + """ + await self._send_model(message) + + async def send_function_call_response(self, message: AgentV1SendFunctionCallResponse) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1SendFunctionCallResponse. + """ + await self._send_model(message) + + async def send_keep_alive(self, message: typing.Optional[AgentV1KeepAlive] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1KeepAlive. + """ + await self._send_model(message or AgentV1KeepAlive(type="KeepAlive")) + + async def send_update_prompt(self, message: AgentV1UpdatePrompt) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1UpdatePrompt. + """ + await self._send_model(message) + + async def send_force_end_turn(self, message: typing.Optional[AgentV1ForceEndTurn] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1ForceEndTurn. + """ + await self._send_model(message or AgentV1ForceEndTurn(type="ForceEndTurn")) + + async def send_custom_to_think_provider(self, message: AgentV1CustomToThinkProvider) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1CustomToThinkProvider. + """ + await self._send_model(message) + + async def send_raw(self, message: typing.Union[typing.Dict[str, typing.Any], str]) -> None: + """Send a JSON control frame without model validation.""" + await self._send(message) + + async def send_media(self, message: bytes) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a bytes. + """ + await self._send(message) + + async def recv(self) -> V1SocketClientResponse: + """ + Receive a message from the websocket connection. + """ + data = await self._websocket.recv() + if isinstance(data, bytes): + return data # type: ignore + json_data = json.loads(data) + try: + return construct_type(type_=V1SocketClientResponse, object_=json_data) # type: ignore + except Exception: + _logger.warning("Skipping unknown WebSocket message; update your SDK version to support new message types.") + return json_data # type: ignore + + async def _send(self, data: typing.Any) -> None: + """ + Send a message to the websocket connection. + """ + if isinstance(data, dict): + data = json.dumps(data) + await self._websocket.send(data) + + async def _send_model(self, data: typing.Any) -> None: + """ + Send a Pydantic model to the websocket connection. + """ + await self._send(_sanitize_numeric_types(data.dict())) + + +class V1SocketClient(EventEmitterMixin): + def __init__(self, *, websocket: websockets_sync_connection.Connection): + super().__init__() + self._websocket = websocket + + def __iter__(self) -> typing.Iterator[V1SocketClientResponse]: + for message in self._websocket: + if isinstance(message, bytes): + yield message # type: ignore + else: + try: + yield construct_type(type_=V1SocketClientResponse, object_=json.loads(message)) # type: ignore + except Exception: + _logger.warning( + "Skipping unknown WebSocket message; update your SDK version to support new message types." + ) + continue + + def start_listening(self): + """ + Start listening for messages on the websocket connection. + + Emits events in the following order: + - EventType.OPEN when connection is established + - EventType.MESSAGE for each message received + - EventType.ERROR if an error occurs + - EventType.CLOSE when connection is closed + """ + self._emit(EventType.OPEN, None) + try: + for raw_message in self._websocket: + if isinstance(raw_message, bytes): + parsed = raw_message + else: + json_data = json.loads(raw_message) + try: + parsed = construct_type(type_=V1SocketClientResponse, object_=json_data) # type: ignore + except Exception: + _logger.warning( + "Skipping unknown WebSocket message; update your SDK version to support new message types." + ) + continue + self._emit(EventType.MESSAGE, parsed) + except Exception as exc: + self._emit(EventType.ERROR, exc) + finally: + self._emit(EventType.CLOSE, None) + + def send_settings(self, message: AgentV1Settings) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1Settings. + """ + self._send_model(message) + + def send_update_listen(self, message: AgentV1UpdateListen) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1UpdateListen. + """ + self._send_model(message) + + def send_update_think(self, message: AgentV1UpdateThink) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1UpdateThink. + """ + self._send_model(message) + + def send_update_think_live(self, message: AgentV1UpdateThinkLive) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1UpdateThinkLive. + """ + self._send_model(message) + + def send_update_speak(self, message: AgentV1UpdateSpeak) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1UpdateSpeak. + """ + self._send_model(message) + + def send_inject_user_message(self, message: AgentV1InjectUserMessage) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1InjectUserMessage. + """ + self._send_model(message) + + def send_inject_agent_message(self, message: AgentV1InjectAgentMessage) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1InjectAgentMessage. + """ + self._send_model(message) + + def send_inject_dynamic_agent_message(self, message: AgentV1InjectDynamicAgentMessage) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1InjectDynamicAgentMessage. + """ + self._send_model(message) + + def send_function_call_response(self, message: AgentV1SendFunctionCallResponse) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1SendFunctionCallResponse. + """ + self._send_model(message) + + def send_keep_alive(self, message: typing.Optional[AgentV1KeepAlive] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1KeepAlive. + """ + self._send_model(message or AgentV1KeepAlive(type="KeepAlive")) + + def send_update_prompt(self, message: AgentV1UpdatePrompt) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1UpdatePrompt. + """ + self._send_model(message) + + def send_force_end_turn(self, message: typing.Optional[AgentV1ForceEndTurn] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1ForceEndTurn. + """ + self._send_model(message or AgentV1ForceEndTurn(type="ForceEndTurn")) + + def send_custom_to_think_provider(self, message: AgentV1CustomToThinkProvider) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1CustomToThinkProvider. + """ + self._send_model(message) + + def send_raw(self, message: typing.Union[typing.Dict[str, typing.Any], str]) -> None: + """Send a JSON control frame without model validation.""" + self._send(message) + + def send_media(self, message: bytes) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a bytes. + """ + self._send(message) + + def recv(self) -> V1SocketClientResponse: + """ + Receive a message from the websocket connection. + """ + data = self._websocket.recv() + if isinstance(data, bytes): + return data # type: ignore + json_data = json.loads(data) + try: + return construct_type(type_=V1SocketClientResponse, object_=json_data) # type: ignore + except Exception: + _logger.warning("Skipping unknown WebSocket message; update your SDK version to support new message types.") + return json_data # type: ignore + + def _send(self, data: typing.Any) -> None: + """ + Send a message to the websocket connection. + """ + if isinstance(data, dict): + data = json.dumps(data) + self._websocket.send(data) + + def _send_model(self, data: typing.Any) -> None: + """ + Send a Pydantic model to the websocket connection. + """ + self._send(_sanitize_numeric_types(data.dict())) diff --git a/src/deepgram/agent/v1/types/__init__.py.bak b/src/deepgram/agent/v1/types/__init__.py.bak new file mode 100644 index 00000000..e6a3fdc7 --- /dev/null +++ b/src/deepgram/agent/v1/types/__init__.py.bak @@ -0,0 +1,305 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .agent_v1agent_audio_done import AgentV1AgentAudioDone + from .agent_v1agent_started_speaking import AgentV1AgentStartedSpeaking + from .agent_v1agent_thinking import AgentV1AgentThinking + from .agent_v1conversation_text import AgentV1ConversationText + from .agent_v1conversation_text_conversational_behavior import AgentV1ConversationTextConversationalBehavior + from .agent_v1conversation_text_role import AgentV1ConversationTextRole + from .agent_v1custom_from_think_provider import AgentV1CustomFromThinkProvider + from .agent_v1custom_to_think_provider import AgentV1CustomToThinkProvider + from .agent_v1error import AgentV1Error + from .agent_v1force_end_turn import AgentV1ForceEndTurn + from .agent_v1frustration_detected import AgentV1FrustrationDetected + from .agent_v1function_call_cancelled import AgentV1FunctionCallCancelled + from .agent_v1function_call_cancelled_functions_item import AgentV1FunctionCallCancelledFunctionsItem + from .agent_v1function_call_request import AgentV1FunctionCallRequest + from .agent_v1function_call_request_functions_item import AgentV1FunctionCallRequestFunctionsItem + from .agent_v1history import AgentV1History + from .agent_v1inject_agent_message import AgentV1InjectAgentMessage + from .agent_v1inject_agent_message_behavior import AgentV1InjectAgentMessageBehavior + from .agent_v1inject_dynamic_agent_message import AgentV1InjectDynamicAgentMessage + from .agent_v1inject_dynamic_agent_message_behavior import AgentV1InjectDynamicAgentMessageBehavior + from .agent_v1inject_user_message import AgentV1InjectUserMessage + from .agent_v1injection_refused import AgentV1InjectionRefused + from .agent_v1keep_alive import AgentV1KeepAlive + from .agent_v1latency_report import AgentV1LatencyReport + from .agent_v1listen_updated import AgentV1ListenUpdated + from .agent_v1prompt_updated import AgentV1PromptUpdated + from .agent_v1receive_function_call_response import AgentV1ReceiveFunctionCallResponse + from .agent_v1send_function_call_response import AgentV1SendFunctionCallResponse + from .agent_v1settings import AgentV1Settings + from .agent_v1settings_agent import AgentV1SettingsAgent + from .agent_v1settings_agent_context import AgentV1SettingsAgentContext + from .agent_v1settings_agent_context_context import AgentV1SettingsAgentContextContext + from .agent_v1settings_agent_context_context_messages_item import AgentV1SettingsAgentContextContextMessagesItem + from .agent_v1settings_agent_context_listen import AgentV1SettingsAgentContextListen + from .agent_v1settings_agent_context_listen_provider import ( + AgentV1SettingsAgentContextListenProvider, + AgentV1SettingsAgentContextListenProvider_V1, + AgentV1SettingsAgentContextListenProvider_V2, + ) + from .agent_v1settings_agent_context_speak import AgentV1SettingsAgentContextSpeak + from .agent_v1settings_agent_context_think import AgentV1SettingsAgentContextThink + from .agent_v1settings_agent_listen import AgentV1SettingsAgentListen + from .agent_v1settings_agent_listen_provider import ( + AgentV1SettingsAgentListenProvider, + AgentV1SettingsAgentListenProvider_V1, + AgentV1SettingsAgentListenProvider_V2, + ) + from .agent_v1settings_agent_speak import AgentV1SettingsAgentSpeak + from .agent_v1settings_agent_think import AgentV1SettingsAgentThink + from .agent_v1settings_applied import AgentV1SettingsApplied + from .agent_v1settings_audio import AgentV1SettingsAudio + from .agent_v1settings_audio_input import AgentV1SettingsAudioInput + from .agent_v1settings_audio_input_encoding import AgentV1SettingsAudioInputEncoding + from .agent_v1settings_audio_output import AgentV1SettingsAudioOutput + from .agent_v1settings_audio_output_container import AgentV1SettingsAudioOutputContainer + from .agent_v1settings_audio_output_encoding import AgentV1SettingsAudioOutputEncoding + from .agent_v1settings_flags import AgentV1SettingsFlags + from .agent_v1speak_updated import AgentV1SpeakUpdated + from .agent_v1think_live_updated import AgentV1ThinkLiveUpdated + from .agent_v1think_updated import AgentV1ThinkUpdated + from .agent_v1update_listen import AgentV1UpdateListen + from .agent_v1update_listen_listen import AgentV1UpdateListenListen + from .agent_v1update_listen_listen_provider import ( + AgentV1UpdateListenListenProvider, + AgentV1UpdateListenListenProvider_V1, + AgentV1UpdateListenListenProvider_V2, + ) + from .agent_v1update_prompt import AgentV1UpdatePrompt + from .agent_v1update_speak import AgentV1UpdateSpeak + from .agent_v1update_speak_speak import AgentV1UpdateSpeakSpeak + from .agent_v1update_think import AgentV1UpdateThink + from .agent_v1update_think_live import AgentV1UpdateThinkLive + from .agent_v1update_think_think import AgentV1UpdateThinkThink + from .agent_v1user_started_speaking import AgentV1UserStartedSpeaking + from .agent_v1warning import AgentV1Warning + from .agent_v1welcome import AgentV1Welcome + from .conversation_history_message import ConversationHistoryMessage + from .conversation_history_message_role import ConversationHistoryMessageRole + from .function_call_history_message import FunctionCallHistoryMessage + from .function_call_history_message_function_calls_item import FunctionCallHistoryMessageFunctionCallsItem +_dynamic_imports: typing.Dict[str, str] = { + "AgentV1AgentAudioDone": ".agent_v1agent_audio_done", + "AgentV1AgentStartedSpeaking": ".agent_v1agent_started_speaking", + "AgentV1AgentThinking": ".agent_v1agent_thinking", + "AgentV1ConversationText": ".agent_v1conversation_text", + "AgentV1ConversationTextConversationalBehavior": ".agent_v1conversation_text_conversational_behavior", + "AgentV1ConversationTextRole": ".agent_v1conversation_text_role", + "AgentV1CustomFromThinkProvider": ".agent_v1custom_from_think_provider", + "AgentV1CustomToThinkProvider": ".agent_v1custom_to_think_provider", + "AgentV1Error": ".agent_v1error", + "AgentV1ForceEndTurn": ".agent_v1force_end_turn", + "AgentV1FrustrationDetected": ".agent_v1frustration_detected", + "AgentV1FunctionCallCancelled": ".agent_v1function_call_cancelled", + "AgentV1FunctionCallCancelledFunctionsItem": ".agent_v1function_call_cancelled_functions_item", + "AgentV1FunctionCallRequest": ".agent_v1function_call_request", + "AgentV1FunctionCallRequestFunctionsItem": ".agent_v1function_call_request_functions_item", + "AgentV1History": ".agent_v1history", + "AgentV1InjectAgentMessage": ".agent_v1inject_agent_message", + "AgentV1InjectAgentMessageBehavior": ".agent_v1inject_agent_message_behavior", + "AgentV1InjectDynamicAgentMessage": ".agent_v1inject_dynamic_agent_message", + "AgentV1InjectDynamicAgentMessageBehavior": ".agent_v1inject_dynamic_agent_message_behavior", + "AgentV1InjectUserMessage": ".agent_v1inject_user_message", + "AgentV1InjectionRefused": ".agent_v1injection_refused", + "AgentV1KeepAlive": ".agent_v1keep_alive", + "AgentV1LatencyReport": ".agent_v1latency_report", + "AgentV1ListenUpdated": ".agent_v1listen_updated", + "AgentV1PromptUpdated": ".agent_v1prompt_updated", + "AgentV1ReceiveFunctionCallResponse": ".agent_v1receive_function_call_response", + "AgentV1SendFunctionCallResponse": ".agent_v1send_function_call_response", + "AgentV1Settings": ".agent_v1settings", + "AgentV1SettingsAgent": ".agent_v1settings_agent", + "AgentV1SettingsAgentContext": ".agent_v1settings_agent_context", + "AgentV1SettingsAgentContextContext": ".agent_v1settings_agent_context_context", + "AgentV1SettingsAgentContextContextMessagesItem": ".agent_v1settings_agent_context_context_messages_item", + "AgentV1SettingsAgentContextListen": ".agent_v1settings_agent_context_listen", + "AgentV1SettingsAgentContextListenProvider": ".agent_v1settings_agent_context_listen_provider", + "AgentV1SettingsAgentContextListenProvider_V1": ".agent_v1settings_agent_context_listen_provider", + "AgentV1SettingsAgentContextListenProvider_V2": ".agent_v1settings_agent_context_listen_provider", + "AgentV1SettingsAgentContextSpeak": ".agent_v1settings_agent_context_speak", + "AgentV1SettingsAgentContextThink": ".agent_v1settings_agent_context_think", + "AgentV1SettingsAgentListen": ".agent_v1settings_agent_listen", + "AgentV1SettingsAgentListenProvider": ".agent_v1settings_agent_listen_provider", + "AgentV1SettingsAgentListenProvider_V1": ".agent_v1settings_agent_listen_provider", + "AgentV1SettingsAgentListenProvider_V2": ".agent_v1settings_agent_listen_provider", + "AgentV1SettingsAgentSpeak": ".agent_v1settings_agent_speak", + "AgentV1SettingsAgentThink": ".agent_v1settings_agent_think", + "AgentV1SettingsApplied": ".agent_v1settings_applied", + "AgentV1SettingsAudio": ".agent_v1settings_audio", + "AgentV1SettingsAudioInput": ".agent_v1settings_audio_input", + "AgentV1SettingsAudioInputEncoding": ".agent_v1settings_audio_input_encoding", + "AgentV1SettingsAudioOutput": ".agent_v1settings_audio_output", + "AgentV1SettingsAudioOutputContainer": ".agent_v1settings_audio_output_container", + "AgentV1SettingsAudioOutputEncoding": ".agent_v1settings_audio_output_encoding", + "AgentV1SettingsFlags": ".agent_v1settings_flags", + "AgentV1SpeakUpdated": ".agent_v1speak_updated", + "AgentV1ThinkLiveUpdated": ".agent_v1think_live_updated", + "AgentV1ThinkUpdated": ".agent_v1think_updated", + "AgentV1UpdateListen": ".agent_v1update_listen", + "AgentV1UpdateListenListen": ".agent_v1update_listen_listen", + "AgentV1UpdateListenListenProvider": ".agent_v1update_listen_listen_provider", + "AgentV1UpdateListenListenProvider_V1": ".agent_v1update_listen_listen_provider", + "AgentV1UpdateListenListenProvider_V2": ".agent_v1update_listen_listen_provider", + "AgentV1UpdatePrompt": ".agent_v1update_prompt", + "AgentV1UpdateSpeak": ".agent_v1update_speak", + "AgentV1UpdateSpeakSpeak": ".agent_v1update_speak_speak", + "AgentV1UpdateThink": ".agent_v1update_think", + "AgentV1UpdateThinkLive": ".agent_v1update_think_live", + "AgentV1UpdateThinkThink": ".agent_v1update_think_think", + "AgentV1UserStartedSpeaking": ".agent_v1user_started_speaking", + "AgentV1Warning": ".agent_v1warning", + "AgentV1Welcome": ".agent_v1welcome", + "ConversationHistoryMessage": ".conversation_history_message", + "ConversationHistoryMessageRole": ".conversation_history_message_role", + "FunctionCallHistoryMessage": ".function_call_history_message", + "FunctionCallHistoryMessageFunctionCallsItem": ".function_call_history_message_function_calls_item", +} + +_dynamic_imports.update( + { + "AgentV1HistoryContent": ".agent_v1history_content", + "AgentV1HistoryContentRole": ".agent_v1history_content_role", + "AgentV1HistoryFunctionCalls": ".agent_v1history_function_calls", + "AgentV1HistoryFunctionCallsFunctionCallsItem": ".agent_v1history_function_calls_function_calls_item", + "AgentV1SettingsAgentContextContextMessagesItemContentRole": ".agent_v1settings_agent_context_context_messages_item_content_role", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem": ".agent_v1settings_agent_context_context_messages_item_function_calls_function_calls_item", + "AgentV1SettingsAgentContextListenProviderV1": ".agent_v1settings_agent_context_listen_provider_v1", + "AgentV1SettingsAgentContextListenProviderV2": ".agent_v1settings_agent_context_listen_provider_v2", + "AgentV1SettingsAgentContextListenProviderV2LanguageHint": ".agent_v1settings_agent_context_listen_provider_v2language_hint", + "AgentV1SettingsAgentContextMessagesItem": ".agent_v1settings_agent_context_messages_item", + "AgentV1SettingsAgentContextMessagesItemContent": ".agent_v1settings_agent_context_messages_item_content", + "AgentV1SettingsAgentContextMessagesItemContentRole": ".agent_v1settings_agent_context_messages_item_content_role", + "AgentV1SettingsAgentContextMessagesItemFunctionCalls": ".agent_v1settings_agent_context_messages_item_function_calls", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem": ".agent_v1settings_agent_context_messages_item_function_calls_function_calls_item", + "AgentV1SettingsAgentListenProviderV1": ".agent_v1settings_agent_listen_provider_v1", + "AgentV1SettingsAgentListenProviderV2": ".agent_v1settings_agent_listen_provider_v2", + } +) + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "AgentV1AgentAudioDone", + "AgentV1AgentStartedSpeaking", + "AgentV1AgentThinking", + "AgentV1ConversationText", + "AgentV1ConversationTextConversationalBehavior", + "AgentV1ConversationTextRole", + "AgentV1CustomFromThinkProvider", + "AgentV1CustomToThinkProvider", + "AgentV1Error", + "AgentV1ForceEndTurn", + "AgentV1FrustrationDetected", + "AgentV1FunctionCallCancelled", + "AgentV1FunctionCallCancelledFunctionsItem", + "AgentV1FunctionCallRequest", + "AgentV1FunctionCallRequestFunctionsItem", + "AgentV1History", + "AgentV1InjectAgentMessage", + "AgentV1InjectAgentMessageBehavior", + "AgentV1InjectDynamicAgentMessage", + "AgentV1InjectDynamicAgentMessageBehavior", + "AgentV1InjectUserMessage", + "AgentV1InjectionRefused", + "AgentV1KeepAlive", + "AgentV1LatencyReport", + "AgentV1ListenUpdated", + "AgentV1PromptUpdated", + "AgentV1ReceiveFunctionCallResponse", + "AgentV1SendFunctionCallResponse", + "AgentV1Settings", + "AgentV1SettingsAgent", + "AgentV1SettingsAgentContext", + "AgentV1SettingsAgentContextContext", + "AgentV1SettingsAgentContextContextMessagesItem", + "AgentV1SettingsAgentContextListen", + "AgentV1SettingsAgentContextListenProvider", + "AgentV1SettingsAgentContextListenProvider_V1", + "AgentV1SettingsAgentContextListenProvider_V2", + "AgentV1SettingsAgentContextSpeak", + "AgentV1SettingsAgentContextThink", + "AgentV1SettingsAgentListen", + "AgentV1SettingsAgentListenProvider", + "AgentV1SettingsAgentListenProvider_V1", + "AgentV1SettingsAgentListenProvider_V2", + "AgentV1SettingsAgentSpeak", + "AgentV1SettingsAgentThink", + "AgentV1SettingsApplied", + "AgentV1SettingsAudio", + "AgentV1SettingsAudioInput", + "AgentV1SettingsAudioInputEncoding", + "AgentV1SettingsAudioOutput", + "AgentV1SettingsAudioOutputContainer", + "AgentV1SettingsAudioOutputEncoding", + "AgentV1SettingsFlags", + "AgentV1SpeakUpdated", + "AgentV1ThinkLiveUpdated", + "AgentV1ThinkUpdated", + "AgentV1UpdateListen", + "AgentV1UpdateListenListen", + "AgentV1UpdateListenListenProvider", + "AgentV1UpdateListenListenProvider_V1", + "AgentV1UpdateListenListenProvider_V2", + "AgentV1UpdatePrompt", + "AgentV1UpdateSpeak", + "AgentV1UpdateSpeakSpeak", + "AgentV1UpdateThink", + "AgentV1UpdateThinkLive", + "AgentV1UpdateThinkThink", + "AgentV1UserStartedSpeaking", + "AgentV1Warning", + "AgentV1Welcome", + "ConversationHistoryMessage", + "ConversationHistoryMessageRole", + "FunctionCallHistoryMessage", + "FunctionCallHistoryMessageFunctionCallsItem", +] + +__all__.extend( + [ + "AgentV1HistoryContent", + "AgentV1HistoryContentRole", + "AgentV1HistoryFunctionCalls", + "AgentV1HistoryFunctionCallsFunctionCallsItem", + "AgentV1SettingsAgentContextContextMessagesItemContentRole", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem", + "AgentV1SettingsAgentContextListenProviderV1", + "AgentV1SettingsAgentContextListenProviderV2", + "AgentV1SettingsAgentContextListenProviderV2LanguageHint", + "AgentV1SettingsAgentContextMessagesItem", + "AgentV1SettingsAgentContextMessagesItemContent", + "AgentV1SettingsAgentContextMessagesItemContentRole", + "AgentV1SettingsAgentContextMessagesItemFunctionCalls", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem", + "AgentV1SettingsAgentListenProviderV1", + "AgentV1SettingsAgentListenProviderV2", + ] +) diff --git a/src/deepgram/agent/v1/types/agent_v1conversation_text.py.bak b/src/deepgram/agent/v1/types/agent_v1conversation_text.py.bak new file mode 100644 index 00000000..eb33f9f0 --- /dev/null +++ b/src/deepgram/agent/v1/types/agent_v1conversation_text.py.bak @@ -0,0 +1,50 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel +from .agent_v1conversation_text_conversational_behavior import AgentV1ConversationTextConversationalBehavior +from .agent_v1conversation_text_role import AgentV1ConversationTextRole + + +class AgentV1ConversationText(UncheckedBaseModel): + type: typing.Literal["ConversationText"] = pydantic.Field(default="ConversationText") + """ + Message type identifier for conversation text + """ + + role: AgentV1ConversationTextRole = pydantic.Field() + """ + Identifies who spoke the statement + """ + + content: str = pydantic.Field() + """ + The actual statement that was spoken + """ + + conversational_behavior: AgentV1ConversationTextConversationalBehavior = pydantic.Field(default="default") + """ + Annotates what kind of utterance the message represents: `default` (a standard turn), `backchannel` (a short acknowledgement while the user held the floor), `presence_check` (a prompt after extended silence), or `filler` (a line covering a wait on a function call or a dynamic InjectAgentMessage). Always sent; it is `default` for every message while Think Live is off. Defaults to `default` when an older or self-hosted server omits it. + """ + + languages_hinted: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + The language hints that were active at the time of the turn. Only present on user-role messages when the listen model is flux-general-multi. + """ + + languages: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Languages detected in the user's speech, sorted by word count (descending). Only present on user-role messages when the listen model is flux-general-multi. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1inject_dynamic_agent_message.py.bak b/src/deepgram/agent/v1/types/agent_v1inject_dynamic_agent_message.py.bak new file mode 100644 index 00000000..471d6f61 --- /dev/null +++ b/src/deepgram/agent/v1/types/agent_v1inject_dynamic_agent_message.py.bak @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel +from .agent_v1inject_dynamic_agent_message_behavior import AgentV1InjectDynamicAgentMessageBehavior + + +class AgentV1InjectDynamicAgentMessage(UncheckedBaseModel): + type: typing.Literal["InjectAgentMessage"] = pydantic.Field(default="InjectAgentMessage") + """ + Message type identifier for injecting an agent message + """ + + is_dynamic: typing.Literal[True] = pydantic.Field(default=True) + """ + Must be `true`. The Think Live model generates the line, so no `message` is sent + """ + + behavior: typing.Optional[AgentV1InjectDynamicAgentMessageBehavior] = pydantic.Field(default=None) + """ + Controls how the injection interacts with any in-progress user or agent turn. + + * `default` — The agent speaks only if neither the user nor the agent is mid-turn. If a turn is in progress, the server replies with `InjectionRefused`. + * `queue` — The message is appended after any already-queued `ConversationText` without interrupting the current agent turn or think response. If nothing is queued, the message plays immediately. + * `interrupt` — The agent immediately speaks. If the agent was already speaking, it interrupts the current speech and replaces it with the new message. If the user is speaking, the agent interrupts with the new message, but the user's continued speech triggers `UserStartedSpeaking`, which quickly interrupts the agent. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings.py.bak b/src/deepgram/agent/v1/types/agent_v1settings.py.bak new file mode 100644 index 00000000..ff58da13 --- /dev/null +++ b/src/deepgram/agent/v1/types/agent_v1settings.py.bak @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel +from .agent_v1settings_agent import AgentV1SettingsAgent +from .agent_v1settings_agent_context import AgentV1SettingsAgentContext +from .agent_v1settings_audio import AgentV1SettingsAudio +from .agent_v1settings_flags import AgentV1SettingsFlags + + +class AgentV1Settings(UncheckedBaseModel): + type: typing.Literal["Settings"] = "Settings" + tags: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Tags to associate with the request + """ + + experimental: typing.Optional[bool] = pydantic.Field(default=None) + """ + To enable experimental features + """ + + flags: typing.Optional[AgentV1SettingsFlags] = None + mip_opt_out: typing.Optional[bool] = pydantic.Field(default=None) + """ + To opt out of Deepgram Model Improvement Program + """ + + audio: AgentV1SettingsAudio + agent: typing.Union[AgentV1SettingsAgent, AgentV1SettingsAgentContext, str] + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent.py.bak b/src/deepgram/agent/v1/types/agent_v1settings_agent.py.bak new file mode 100644 index 00000000..1a4d67fd --- /dev/null +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent.py.bak @@ -0,0 +1,58 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from .agent_v1settings_agent_context import AgentV1SettingsAgentContext +from .agent_v1settings_agent_listen import AgentV1SettingsAgentListen + + +class AgentV1SettingsAgent(AgentV1SettingsAgentContext): + if IS_PYDANTIC_V2: + + @pydantic.model_validator(mode="before") + @classmethod + def _migrate_legacy_nested_context(cls, values: typing.Any) -> typing.Any: + if not isinstance(values, dict): + return values + context = values.get("context") + if isinstance(context, AgentV1SettingsAgentContext) and ( + context.context is not None + and context.language is None + and context.listen is None + and context.think is None + and context.think_live is None + and context.speak is None + and context.greeting is None + ): + values = dict(values) + values["context"] = context.context + listen = values.get("listen") + if isinstance(listen, AgentV1SettingsAgentListen): + values = dict(values) + values["listen"] = listen.dict() + return values + else: + + @pydantic.root_validator(pre=True) # type: ignore[deprecated] + def _migrate_legacy_nested_context(cls, values: typing.Any) -> typing.Any: # type: ignore[no-redef] + if not isinstance(values, dict): + return values + context = values.get("context") + if isinstance(context, AgentV1SettingsAgentContext) and ( + context.context is not None + and context.language is None + and context.listen is None + and context.think is None + and context.think_live is None + and context.speak is None + and context.greeting is None + ): + values = dict(values) + values["context"] = context.context + listen = values.get("listen") + if isinstance(listen, AgentV1SettingsAgentListen): + values = dict(values) + values["listen"] = listen.dict() + return values diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_context.py.bak b/src/deepgram/agent/v1/types/agent_v1settings_agent_context.py.bak new file mode 100644 index 00000000..181472b4 --- /dev/null +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent_context.py.bak @@ -0,0 +1,67 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel +from ....types.think_live_settings_v1 import ThinkLiveSettingsV1 +from .agent_v1settings_agent_context_context import AgentV1SettingsAgentContextContext +from .agent_v1settings_agent_context_listen import AgentV1SettingsAgentContextListen +from .agent_v1settings_agent_context_messages_item import AgentV1SettingsAgentContextMessagesItem +from .agent_v1settings_agent_context_speak import AgentV1SettingsAgentContextSpeak +from .agent_v1settings_agent_context_think import AgentV1SettingsAgentContextThink + + +class AgentV1SettingsAgentContext(UncheckedBaseModel): + language: typing.Optional[str] = pydantic.Field(default=None) + """ + Deprecated. Use `listen.provider.language` and `speak.provider.language` fields instead. + """ + + context: typing.Optional[AgentV1SettingsAgentContextContext] = pydantic.Field(default=None) + """ + Conversation context including the history of messages and function calls + """ + + listen: typing.Optional[AgentV1SettingsAgentContextListen] = None + think: typing.Optional[AgentV1SettingsAgentContextThink] = pydantic.Field(default=None) + """ + Your reasoning LLM. With Think Live on, this is the reasoning half of the pair, running alongside the Think Live model configured in `think_live` + """ + + think_live: typing.Optional[ThinkLiveSettingsV1] = None + speak: typing.Optional[AgentV1SettingsAgentContextSpeak] = None + greeting: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional message that agent will speak at the start + """ + + if IS_PYDANTIC_V2: + + @pydantic.model_validator(mode="before") + @classmethod + def _migrate_legacy_messages_to_context(cls, values: typing.Any) -> typing.Any: + if isinstance(values, dict) and "messages" in values and "context" not in values: + values = dict(values) + values["context"] = {"messages": values.pop("messages")} + return values + + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + @pydantic.root_validator(pre=True) # type: ignore[deprecated] + def _migrate_legacy_messages_to_context(cls, values: typing.Any) -> typing.Any: # type: ignore[no-redef] + if isinstance(values, dict) and "messages" in values and "context" not in values: + values = dict(values) + values["context"] = {"messages": values.pop("messages")} + return values + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + @property + def messages(self) -> typing.Optional[typing.List[AgentV1SettingsAgentContextMessagesItem]]: + return None if self.context is None else self.context.messages diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py.bak b/src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py.bak new file mode 100644 index 00000000..222c18a3 --- /dev/null +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py.bak @@ -0,0 +1,77 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class AgentV1SettingsAgentContextListenProvider_V1(UncheckedBaseModel): + version: typing.Literal["v1"] = "v1" + type: typing.Literal["deepgram"] = "deepgram" + model: typing.Optional[str] = None + language: typing.Optional[str] = None + keyterms: typing.Optional[typing.List[str]] = None + smart_format: typing.Optional[bool] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class AgentV1SettingsAgentContextListenProvider_V2(UncheckedBaseModel): + version: typing.Literal["v2"] = "v2" + type: typing.Literal["deepgram"] = "deepgram" + model: str + language_hints: typing.Optional[typing.List[str]] = None + language_hint: typing.Optional[typing.Union[str, typing.List[str]]] = pydantic.Field(default=None, exclude=True) + eot_threshold: typing.Optional[float] = None + eager_eot_threshold: typing.Optional[float] = None + eot_timeout_ms: typing.Optional[int] = None + keyterms: typing.Optional[typing.List[str]] = None + + if IS_PYDANTIC_V2: + + @pydantic.model_validator(mode="before") + @classmethod + def _migrate_language_hint(cls, values: typing.Any) -> typing.Any: + if not isinstance(values, dict) or "language_hint" not in values: + return values + values = dict(values) + hint = values.pop("language_hint") + if hint is not None and values.get("language_hints") is None: + values["language_hints"] = [hint] if isinstance(hint, str) else list(hint) + return values + + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + @pydantic.root_validator(pre=True) # type: ignore[deprecated] + def _migrate_language_hint(cls, values: typing.Any) -> typing.Any: # type: ignore[no-redef] + if not isinstance(values, dict) or "language_hint" not in values: + return values + values = dict(values) + hint = values.pop("language_hint") + if hint is not None and values.get("language_hints") is None: + values["language_hints"] = [hint] if isinstance(hint, str) else list(hint) + return values + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +AgentV1SettingsAgentContextListenProvider = typing_extensions.Annotated[ + typing.Union[AgentV1SettingsAgentContextListenProvider_V1, AgentV1SettingsAgentContextListenProvider_V2], + UnionMetadata(discriminant="version"), +] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py.bak b/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py.bak new file mode 100644 index 00000000..d225e261 --- /dev/null +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py.bak @@ -0,0 +1,77 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class AgentV1SettingsAgentListenProvider_V1(UncheckedBaseModel): + version: typing.Literal["v1"] = "v1" + type: typing.Literal["deepgram"] = "deepgram" + model: typing.Optional[str] = None + language: typing.Optional[str] = None + keyterms: typing.Optional[typing.List[str]] = None + smart_format: typing.Optional[bool] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class AgentV1SettingsAgentListenProvider_V2(UncheckedBaseModel): + version: typing.Literal["v2"] = "v2" + type: typing.Literal["deepgram"] = "deepgram" + model: str + language_hints: typing.Optional[typing.List[str]] = None + language_hint: typing.Optional[typing.Union[str, typing.List[str]]] = pydantic.Field(default=None, exclude=True) + eot_threshold: typing.Optional[float] = None + eager_eot_threshold: typing.Optional[float] = None + eot_timeout_ms: typing.Optional[int] = None + keyterms: typing.Optional[typing.List[str]] = None + + if IS_PYDANTIC_V2: + + @pydantic.model_validator(mode="before") + @classmethod + def _migrate_language_hint(cls, values: typing.Any) -> typing.Any: + if not isinstance(values, dict) or "language_hint" not in values: + return values + values = dict(values) + hint = values.pop("language_hint") + if hint is not None and values.get("language_hints") is None: + values["language_hints"] = [hint] if isinstance(hint, str) else list(hint) + return values + + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + @pydantic.root_validator(pre=True) # type: ignore[deprecated] + def _migrate_language_hint(cls, values: typing.Any) -> typing.Any: # type: ignore[no-redef] + if not isinstance(values, dict) or "language_hint" not in values: + return values + values = dict(values) + hint = values.pop("language_hint") + if hint is not None and values.get("language_hints") is None: + values["language_hints"] = [hint] if isinstance(hint, str) else list(hint) + return values + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +AgentV1SettingsAgentListenProvider = typing_extensions.Annotated[ + typing.Union[AgentV1SettingsAgentListenProvider_V1, AgentV1SettingsAgentListenProvider_V2], + UnionMetadata(discriminant="version"), +] diff --git a/src/deepgram/agent/v1/types/agent_v1update_listen_listen.py.bak b/src/deepgram/agent/v1/types/agent_v1update_listen_listen.py.bak new file mode 100644 index 00000000..d7ed4fab --- /dev/null +++ b/src/deepgram/agent/v1/types/agent_v1update_listen_listen.py.bak @@ -0,0 +1,61 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel +from ....types.deepgram_listen_provider_v1 import DeepgramListenProviderV1 +from ....types.deepgram_listen_provider_v2 import DeepgramListenProviderV2 +from .agent_v1update_listen_listen_provider import AgentV1UpdateListenListenProvider + +_V1_ONLY_KEYS = frozenset({"language", "smart_format"}) + + +def _coerce_legacy_update_listen_provider(values: typing.Any) -> typing.Any: + if not isinstance(values, dict): + return values + provider = values.get("provider") + if isinstance(provider, DeepgramListenProviderV2): + values = dict(values) + values["provider"] = {**provider.dict(), "version": "v2"} + elif isinstance(provider, DeepgramListenProviderV1): + values = dict(values) + values["provider"] = {**provider.dict(), "version": "v1"} + elif isinstance(provider, dict) and "version" not in provider: + values = dict(values) + version = "v1" if _V1_ONLY_KEYS & provider.keys() else "v2" + provider_cls = DeepgramListenProviderV1 if version == "v1" else DeepgramListenProviderV2 + try: + coerced = provider_cls(**provider).dict() + except Exception: + coerced = dict(provider) + values["provider"] = {**coerced, "version": version} + return values + + +class AgentV1UpdateListenListen(UncheckedBaseModel): + """ + Listen configuration to update. Contains a provider object with the same schema as Settings. The model and language can be changed mid-session. Keyterms can only be updated mid-session for Flux models. + """ + + provider: AgentV1UpdateListenListenProvider + + if IS_PYDANTIC_V2: + + @pydantic.model_validator(mode="before") + @classmethod + def _migrate_legacy_provider(cls, values: typing.Any) -> typing.Any: + return _coerce_legacy_update_listen_provider(values) + + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + @pydantic.root_validator(pre=True) # type: ignore[deprecated] + def _migrate_legacy_provider(cls, values: typing.Any) -> typing.Any: # type: ignore[no-redef] + return _coerce_legacy_update_listen_provider(values) + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/deepgram/core/api_error.py.bak b/src/deepgram/core/api_error.py.bak new file mode 100644 index 00000000..2aa93914 --- /dev/null +++ b/src/deepgram/core/api_error.py.bak @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +from typing import Any, Dict, Optional + +from .._secure_logging import redact_sensitive_headers + + +class ApiError(Exception): + headers: Optional[Dict[str, str]] + status_code: Optional[int] + body: Any + + def __init__( + self, + *, + headers: Optional[Dict[str, str]] = None, + status_code: Optional[int] = None, + body: Any = None, + ) -> None: + self.headers = redact_sensitive_headers(headers) + self.status_code = status_code + self.body = body + + def __str__(self) -> str: + return f"headers: {self.headers}, status_code: {self.status_code}, body: {self.body}" diff --git a/src/deepgram/core/client_wrapper.py.bak b/src/deepgram/core/client_wrapper.py.bak new file mode 100644 index 00000000..546975dd --- /dev/null +++ b/src/deepgram/core/client_wrapper.py.bak @@ -0,0 +1,146 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import httpx +from ..environment import DeepgramClientEnvironment +from .http_client import AsyncHttpClient, HttpClient +from .logging import LogConfig, Logger + + +class BaseClientWrapper: + def __init__( + self, + *, + api_key: str, + headers: typing.Optional[typing.Dict[str, str]] = None, + environment: DeepgramClientEnvironment, + timeout: typing.Optional[float] = None, + max_retries: int = 2, + stream_reconnection_enabled: typing.Optional[bool] = None, + max_stream_reconnection_attempts: typing.Optional[int] = None, + logging: typing.Optional[typing.Union[LogConfig, Logger]] = None, + ): + self.api_key = api_key + self._headers = headers + self._environment = environment + self._timeout = timeout + self._max_retries = max_retries + self._stream_reconnection_enabled = stream_reconnection_enabled + self._max_stream_reconnection_attempts = max_stream_reconnection_attempts + self._logging = logging + + def get_headers(self) -> typing.Dict[str, str]: + import platform + from importlib import metadata as _fern_importlib_metadata + + try: + _sdk_version = _fern_importlib_metadata.version("deepgram-sdk") + except _fern_importlib_metadata.PackageNotFoundError: + _sdk_version = "7.21.0" # x-release-please-version + + headers: typing.Dict[str, str] = { + "User-Agent": "deepgram-sdk/" + _sdk_version, + "X-Fern-Language": "Python", + "X-Fern-Runtime": f"python/{platform.python_version()}", + "X-Fern-Platform": f"{platform.system().lower()}/{platform.release()}", + "X-Fern-SDK-Name": "deepgram-sdk", + "X-Fern-SDK-Version": _sdk_version, + **(self.get_custom_headers() or {}), + } + headers["Authorization"] = f"Token {self.api_key}" + return headers + + def get_custom_headers(self) -> typing.Optional[typing.Dict[str, str]]: + return self._headers + + def get_environment(self) -> DeepgramClientEnvironment: + return self._environment + + def get_timeout(self) -> typing.Optional[float]: + return self._timeout + + def get_max_retries(self) -> int: + return self._max_retries + + def get_stream_reconnection_enabled(self) -> bool: + return self._stream_reconnection_enabled if self._stream_reconnection_enabled is not None else True + + def get_max_stream_reconnection_attempts(self) -> typing.Optional[int]: + return self._max_stream_reconnection_attempts + + +class SyncClientWrapper(BaseClientWrapper): + def __init__( + self, + *, + api_key: str, + headers: typing.Optional[typing.Dict[str, str]] = None, + environment: DeepgramClientEnvironment, + timeout: typing.Optional[float] = None, + max_retries: int = 2, + stream_reconnection_enabled: typing.Optional[bool] = None, + max_stream_reconnection_attempts: typing.Optional[int] = None, + logging: typing.Optional[typing.Union[LogConfig, Logger]] = None, + httpx_client: httpx.Client, + ): + super().__init__( + api_key=api_key, + headers=headers, + environment=environment, + timeout=timeout, + max_retries=max_retries, + stream_reconnection_enabled=stream_reconnection_enabled, + max_stream_reconnection_attempts=max_stream_reconnection_attempts, + logging=logging, + ) + self.httpx_client = HttpClient( + httpx_client=httpx_client, + base_headers=self.get_headers, + base_timeout=self.get_timeout, + base_max_retries=self.get_max_retries(), + logging_config=self._logging, + ) + + +class AsyncClientWrapper(BaseClientWrapper): + def __init__( + self, + *, + api_key: str, + headers: typing.Optional[typing.Dict[str, str]] = None, + environment: DeepgramClientEnvironment, + timeout: typing.Optional[float] = None, + max_retries: int = 2, + stream_reconnection_enabled: typing.Optional[bool] = None, + max_stream_reconnection_attempts: typing.Optional[int] = None, + logging: typing.Optional[typing.Union[LogConfig, Logger]] = None, + async_token: typing.Optional[typing.Callable[[], typing.Awaitable[str]]] = None, + httpx_client: httpx.AsyncClient, + ): + super().__init__( + api_key=api_key, + headers=headers, + environment=environment, + timeout=timeout, + max_retries=max_retries, + stream_reconnection_enabled=stream_reconnection_enabled, + max_stream_reconnection_attempts=max_stream_reconnection_attempts, + logging=logging, + ) + self._async_token = async_token + self.httpx_client = AsyncHttpClient( + httpx_client=httpx_client, + base_headers=self.get_headers, + base_timeout=self.get_timeout, + base_max_retries=self.get_max_retries(), + async_base_headers=self.async_get_headers, + logging_config=self._logging, + ) + + async def async_get_headers(self) -> typing.Dict[str, str]: + headers = self.get_headers() + if self._async_token is not None: + token = await self._async_token() + headers["Authorization"] = f"Bearer {token}" + return headers diff --git a/src/deepgram/core/parse_error.py.bak b/src/deepgram/core/parse_error.py.bak new file mode 100644 index 00000000..c510c0e8 --- /dev/null +++ b/src/deepgram/core/parse_error.py.bak @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +from typing import Any, Dict, Optional + +from .._secure_logging import redact_sensitive_headers + + +class ParsingError(Exception): + """ + Raised when the SDK fails to parse/validate a response from the server. + This typically indicates that the server returned a response whose shape + does not match the expected schema. + """ + + headers: Optional[Dict[str, str]] + status_code: Optional[int] + body: Any + cause: Optional[Exception] + + def __init__( + self, + *, + headers: Optional[Dict[str, str]] = None, + status_code: Optional[int] = None, + body: Any = None, + cause: Optional[Exception] = None, + ) -> None: + self.headers = redact_sensitive_headers(headers) + self.status_code = status_code + self.body = body + self.cause = cause + super().__init__() + if cause is not None: + self.__cause__ = cause + + def __str__(self) -> str: + cause_str = f", cause: {self.cause}" if self.cause is not None else "" + return f"headers: {self.headers}, status_code: {self.status_code}, body: {self.body}{cause_str}" diff --git a/src/deepgram/core/query_encoder.py.bak b/src/deepgram/core/query_encoder.py.bak new file mode 100644 index 00000000..58088258 --- /dev/null +++ b/src/deepgram/core/query_encoder.py.bak @@ -0,0 +1,65 @@ +# This file was auto-generated by Fern from our API Definition. + +from typing import Any, Dict, List, Optional, Tuple + +import pydantic + + +def _coerce_query_value(value: Any) -> Any: + # urllib.parse.urlencode would otherwise turn bools into "True"/"False". + if isinstance(value, bool): + return "true" if value else "false" + return value + + +# Flattens dicts to be of the form {"key[subkey][subkey2]": value} where value is not a dict +def traverse_query_dict(dict_flat: Dict[str, Any], key_prefix: Optional[str] = None) -> List[Tuple[str, Any]]: + result = [] + for k, v in dict_flat.items(): + key = f"{key_prefix}[{k}]" if key_prefix is not None else k + if isinstance(v, dict): + result.extend(traverse_query_dict(v, key)) + elif isinstance(v, list): + for arr_v in v: + if isinstance(arr_v, dict): + result.extend(traverse_query_dict(arr_v, key)) + else: + result.append((key, _coerce_query_value(arr_v))) + else: + result.append((key, _coerce_query_value(v))) + return result + + +def single_query_encoder(query_key: str, query_value: Any) -> List[Tuple[str, Any]]: + if isinstance(query_value, pydantic.BaseModel) or isinstance(query_value, dict): + if isinstance(query_value, pydantic.BaseModel): + obj_dict = query_value.dict(by_alias=True) + else: + obj_dict = query_value + return traverse_query_dict(obj_dict, query_key) + elif isinstance(query_value, list): + encoded_values: List[Tuple[str, Any]] = [] + for value in query_value: + if isinstance(value, pydantic.BaseModel) or isinstance(value, dict): + if isinstance(value, pydantic.BaseModel): + obj_dict = value.dict(by_alias=True) + elif isinstance(value, dict): + obj_dict = value + + encoded_values.extend(single_query_encoder(query_key, obj_dict)) + else: + encoded_values.append((query_key, _coerce_query_value(value))) + + return encoded_values + + return [(query_key, _coerce_query_value(query_value))] + + +def encode_query(query: Optional[Dict[str, Any]]) -> Optional[List[Tuple[str, Any]]]: + if query is None: + return None + + encoded_query = [] + for k, v in query.items(): + encoded_query.extend(single_query_encoder(k, v)) + return encoded_query diff --git a/src/deepgram/listen/__init__.py.bak b/src/deepgram/listen/__init__.py.bak new file mode 100644 index 00000000..d2b6487e --- /dev/null +++ b/src/deepgram/listen/__init__.py.bak @@ -0,0 +1,246 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import v1, v2 + from .v1 import ( + DiarizeModel, + ListenV1CloseStream, + ListenV1CloseStreamParams, + ListenV1CloseStreamType, + ListenV1Configure, + ListenV1ConfigureFailure, + ListenV1ConfigureFailureCode, + ListenV1ConfigureFailureParams, + ListenV1ConfigureParams, + ListenV1ConfigureSuccess, + ListenV1ConfigureSuccessParams, + ListenV1Error, + ListenV1ErrorParams, + ListenV1Finalize, + ListenV1FinalizeParams, + ListenV1FinalizeType, + ListenV1KeepAlive, + ListenV1KeepAliveParams, + ListenV1KeepAliveType, + ListenV1Metadata, + ListenV1MetadataParams, + ListenV1Results, + ListenV1ResultsChannel, + ListenV1ResultsChannelAlternativesItem, + ListenV1ResultsChannelAlternativesItemParams, + ListenV1ResultsChannelAlternativesItemWordsItem, + ListenV1ResultsChannelAlternativesItemWordsItemParams, + ListenV1ResultsChannelParams, + ListenV1ResultsEntitiesItem, + ListenV1ResultsEntitiesItemParams, + ListenV1ResultsMetadata, + ListenV1ResultsMetadataDiarizeInfo, + ListenV1ResultsMetadataDiarizeInfoParams, + ListenV1ResultsMetadataModelInfo, + ListenV1ResultsMetadataModelInfoParams, + ListenV1ResultsMetadataParams, + ListenV1ResultsParams, + ListenV1SpeechStarted, + ListenV1SpeechStartedParams, + ListenV1UtteranceEnd, + ListenV1UtteranceEndParams, + ) + from .v2 import ( + ListenV2CloseStream, + ListenV2CloseStreamParams, + ListenV2Configure, + ListenV2ConfigureFailure, + ListenV2ConfigureFailureParams, + ListenV2ConfigureParams, + ListenV2ConfigureSuccess, + ListenV2ConfigureSuccessParams, + ListenV2ConfigureSuccessThresholds, + ListenV2ConfigureSuccessThresholdsParams, + ListenV2ConfigureThresholds, + ListenV2ConfigureThresholdsParams, + ListenV2Connected, + ListenV2ConnectedParams, + ListenV2FatalError, + ListenV2FatalErrorParams, + ListenV2ForceEndTurn, + ListenV2ForceEndTurnParams, + ListenV2TurnInfo, + ListenV2TurnInfoEvent, + ListenV2TurnInfoParams, + ListenV2TurnInfoWordsItem, + ListenV2TurnInfoWordsItemParams, + ListenV2Warning, + ListenV2WarningParams, + ) +_dynamic_imports: typing.Dict[str, str] = { + "DiarizeModel": ".v1", + "ListenV1CloseStream": ".v1", + "ListenV1CloseStreamParams": ".v1", + "ListenV1CloseStreamType": ".v1", + "ListenV1Configure": ".v1", + "ListenV1ConfigureFailure": ".v1", + "ListenV1ConfigureFailureCode": ".v1", + "ListenV1ConfigureFailureParams": ".v1", + "ListenV1ConfigureParams": ".v1", + "ListenV1ConfigureSuccess": ".v1", + "ListenV1ConfigureSuccessParams": ".v1", + "ListenV1Error": ".v1", + "ListenV1ErrorParams": ".v1", + "ListenV1Finalize": ".v1", + "ListenV1FinalizeParams": ".v1", + "ListenV1FinalizeType": ".v1", + "ListenV1KeepAlive": ".v1", + "ListenV1KeepAliveParams": ".v1", + "ListenV1KeepAliveType": ".v1", + "ListenV1Metadata": ".v1", + "ListenV1MetadataParams": ".v1", + "ListenV1Results": ".v1", + "ListenV1ResultsChannel": ".v1", + "ListenV1ResultsChannelAlternativesItem": ".v1", + "ListenV1ResultsChannelAlternativesItemParams": ".v1", + "ListenV1ResultsChannelAlternativesItemWordsItem": ".v1", + "ListenV1ResultsChannelAlternativesItemWordsItemParams": ".v1", + "ListenV1ResultsChannelParams": ".v1", + "ListenV1ResultsEntitiesItem": ".v1", + "ListenV1ResultsEntitiesItemParams": ".v1", + "ListenV1ResultsMetadata": ".v1", + "ListenV1ResultsMetadataDiarizeInfo": ".v1", + "ListenV1ResultsMetadataDiarizeInfoParams": ".v1", + "ListenV1ResultsMetadataModelInfo": ".v1", + "ListenV1ResultsMetadataModelInfoParams": ".v1", + "ListenV1ResultsMetadataParams": ".v1", + "ListenV1ResultsParams": ".v1", + "ListenV1SpeechStarted": ".v1", + "ListenV1SpeechStartedParams": ".v1", + "ListenV1UtteranceEnd": ".v1", + "ListenV1UtteranceEndParams": ".v1", + "ListenV2CloseStream": ".v2", + "ListenV2CloseStreamParams": ".v2", + "ListenV2Configure": ".v2", + "ListenV2ConfigureFailure": ".v2", + "ListenV2ConfigureFailureParams": ".v2", + "ListenV2ConfigureParams": ".v2", + "ListenV2ConfigureSuccess": ".v2", + "ListenV2ConfigureSuccessParams": ".v2", + "ListenV2ConfigureSuccessThresholds": ".v2", + "ListenV2ConfigureSuccessThresholdsParams": ".v2", + "ListenV2ConfigureThresholds": ".v2", + "ListenV2ConfigureThresholdsParams": ".v2", + "ListenV2Connected": ".v2", + "ListenV2ConnectedParams": ".v2", + "ListenV2FatalError": ".v2", + "ListenV2FatalErrorParams": ".v2", + "ListenV2ForceEndTurn": ".v2", + "ListenV2ForceEndTurnParams": ".v2", + "ListenV2TurnInfo": ".v2", + "ListenV2TurnInfoEvent": ".v2", + "ListenV2TurnInfoParams": ".v2", + "ListenV2TurnInfoWordsItem": ".v2", + "ListenV2TurnInfoWordsItemParams": ".v2", + "ListenV2Warning": ".v2", + "ListenV2WarningParams": ".v2", + "v1": ".v1", + "v2": ".v2", +} + +_dynamic_imports["ListenV2CloseStreamType"] = ".v2" + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "DiarizeModel", + "ListenV1CloseStream", + "ListenV1CloseStreamParams", + "ListenV1CloseStreamType", + "ListenV1Configure", + "ListenV1ConfigureFailure", + "ListenV1ConfigureFailureCode", + "ListenV1ConfigureFailureParams", + "ListenV1ConfigureParams", + "ListenV1ConfigureSuccess", + "ListenV1ConfigureSuccessParams", + "ListenV1Error", + "ListenV1ErrorParams", + "ListenV1Finalize", + "ListenV1FinalizeParams", + "ListenV1FinalizeType", + "ListenV1KeepAlive", + "ListenV1KeepAliveParams", + "ListenV1KeepAliveType", + "ListenV1Metadata", + "ListenV1MetadataParams", + "ListenV1Results", + "ListenV1ResultsChannel", + "ListenV1ResultsChannelAlternativesItem", + "ListenV1ResultsChannelAlternativesItemParams", + "ListenV1ResultsChannelAlternativesItemWordsItem", + "ListenV1ResultsChannelAlternativesItemWordsItemParams", + "ListenV1ResultsChannelParams", + "ListenV1ResultsEntitiesItem", + "ListenV1ResultsEntitiesItemParams", + "ListenV1ResultsMetadata", + "ListenV1ResultsMetadataDiarizeInfo", + "ListenV1ResultsMetadataDiarizeInfoParams", + "ListenV1ResultsMetadataModelInfo", + "ListenV1ResultsMetadataModelInfoParams", + "ListenV1ResultsMetadataParams", + "ListenV1ResultsParams", + "ListenV1SpeechStarted", + "ListenV1SpeechStartedParams", + "ListenV1UtteranceEnd", + "ListenV1UtteranceEndParams", + "ListenV2CloseStream", + "ListenV2CloseStreamParams", + "ListenV2Configure", + "ListenV2ConfigureFailure", + "ListenV2ConfigureFailureParams", + "ListenV2ConfigureParams", + "ListenV2ConfigureSuccess", + "ListenV2ConfigureSuccessParams", + "ListenV2ConfigureSuccessThresholds", + "ListenV2ConfigureSuccessThresholdsParams", + "ListenV2ConfigureThresholds", + "ListenV2ConfigureThresholdsParams", + "ListenV2Connected", + "ListenV2ConnectedParams", + "ListenV2FatalError", + "ListenV2FatalErrorParams", + "ListenV2ForceEndTurn", + "ListenV2ForceEndTurnParams", + "ListenV2TurnInfo", + "ListenV2TurnInfoEvent", + "ListenV2TurnInfoParams", + "ListenV2TurnInfoWordsItem", + "ListenV2TurnInfoWordsItemParams", + "ListenV2Warning", + "ListenV2WarningParams", + "v1", + "v2", +] + +__all__.append("ListenV2CloseStreamType") diff --git a/src/deepgram/listen/v1/requests/listen_v1configure_failure.py.bak b/src/deepgram/listen/v1/requests/listen_v1configure_failure.py.bak new file mode 100644 index 00000000..af007f39 --- /dev/null +++ b/src/deepgram/listen/v1/requests/listen_v1configure_failure.py.bak @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import typing_extensions +from ..types.listen_v1configure_failure_code import ListenV1ConfigureFailureCode + + +class ListenV1ConfigureFailureParams(typing_extensions.TypedDict): + type: typing.Literal["ConfigureFailure"] + """ + Message type identifier + """ + + request_id: str + """ + The unique identifier of the request + """ + + code: ListenV1ConfigureFailureCode + """ + Identifies why the `Configure` was rejected. + + - `CONFIGURE_KEYTERMS_NOT_SUPPORTED`: the stream's model does not support mid-stream keyterm updates. Only + Nova-3 models do. + - `CONFIGURE_KEYTERM_LIMIT_EXCEEDED`: the keyterms exceed the 500-token keyterm limit. + - `CONFIGURE_ALREADY_PENDING`: another `Configure` is still awaiting its response. + - `CONFIGURE_INTERNAL_ERROR`: the server failed to apply the configuration. + """ + + description: str + """ + A human-readable explanation of the rejection + """ diff --git a/src/deepgram/listen/v1/socket_client.py.bak b/src/deepgram/listen/v1/socket_client.py.bak new file mode 100644 index 00000000..20d466f4 --- /dev/null +++ b/src/deepgram/listen/v1/socket_client.py.bak @@ -0,0 +1,262 @@ +# This file was auto-generated by Fern from our API Definition. + +import json +import logging +import typing + +import websockets.sync.connection as websockets_sync_connection +from ...core.events import EventEmitterMixin, EventType +from ...core.unchecked_base_model import construct_type +from .types.listen_v1close_stream import ListenV1CloseStream +from .types.listen_v1configure import ListenV1Configure +from .types.listen_v1configure_failure import ListenV1ConfigureFailure +from .types.listen_v1configure_success import ListenV1ConfigureSuccess +from .types.listen_v1error import ListenV1Error +from .types.listen_v1finalize import ListenV1Finalize +from .types.listen_v1keep_alive import ListenV1KeepAlive +from .types.listen_v1metadata import ListenV1Metadata +from .types.listen_v1results import ListenV1Results +from .types.listen_v1speech_started import ListenV1SpeechStarted +from .types.listen_v1utterance_end import ListenV1UtteranceEnd + +try: + from websockets.legacy.client import WebSocketClientProtocol # type: ignore +except ImportError: + from websockets import WebSocketClientProtocol # type: ignore + +_logger = logging.getLogger(__name__) +V1SocketClientResponse = typing.Union[ + bytes, + ListenV1ConfigureSuccess, + ListenV1ConfigureFailure, + ListenV1Results, + ListenV1Metadata, + ListenV1UtteranceEnd, + ListenV1SpeechStarted, + ListenV1Error, + typing.Dict[str, typing.Any], +] + + +class AsyncV1SocketClient(EventEmitterMixin): + def __init__(self, *, websocket: WebSocketClientProtocol): + super().__init__() + self._websocket = websocket + + async def __aiter__(self) -> typing.AsyncIterator[V1SocketClientResponse]: + async for message in self._websocket: + if isinstance(message, bytes): + yield message # type: ignore + else: + try: + yield construct_type(type_=V1SocketClientResponse, object_=json.loads(message)) # type: ignore + except Exception: + _logger.warning( + "Skipping unknown WebSocket message; update your SDK version to support new message types." + ) + continue + + async def start_listening(self): + """ + Start listening for messages on the websocket connection. + + Emits events in the following order: + - EventType.OPEN when connection is established + - EventType.MESSAGE for each message received + - EventType.ERROR if an error occurs + - EventType.CLOSE when connection is closed + """ + await self._emit_async(EventType.OPEN, None) + try: + async for raw_message in self._websocket: + if isinstance(raw_message, bytes): + parsed = raw_message + else: + json_data = json.loads(raw_message) + try: + parsed = construct_type(type_=V1SocketClientResponse, object_=json_data) # type: ignore + except Exception: + _logger.warning( + "Skipping unknown WebSocket message; update your SDK version to support new message types." + ) + continue + await self._emit_async(EventType.MESSAGE, parsed) + except Exception as exc: + await self._emit_async(EventType.ERROR, exc) + finally: + await self._emit_async(EventType.CLOSE, None) + + async def send_media(self, message: bytes) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a bytes. + """ + await self._send(message) + + async def send_finalize(self, message: typing.Optional[ListenV1Finalize] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a ListenV1Finalize. + """ + await self._send_model(message or ListenV1Finalize(type="Finalize")) + + async def send_close_stream(self, message: typing.Optional[ListenV1CloseStream] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a ListenV1CloseStream. + """ + await self._send_model(message or ListenV1CloseStream(type="CloseStream")) + + async def send_keep_alive(self, message: typing.Optional[ListenV1KeepAlive] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a ListenV1KeepAlive. + """ + await self._send_model(message or ListenV1KeepAlive(type="KeepAlive")) + + async def send_configure(self, message: ListenV1Configure) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a ListenV1Configure. + """ + await self._send_model(message) + + async def recv(self) -> V1SocketClientResponse: + """ + Receive a message from the websocket connection. + """ + data = await self._websocket.recv() + if isinstance(data, bytes): + return data # type: ignore + json_data = json.loads(data) + try: + return construct_type(type_=V1SocketClientResponse, object_=json_data) # type: ignore + except Exception: + _logger.warning("Skipping unknown WebSocket message; update your SDK version to support new message types.") + return json_data # type: ignore + + async def _send(self, data: typing.Any) -> None: + """ + Send a message to the websocket connection. + """ + if isinstance(data, dict): + data = json.dumps(data) + await self._websocket.send(data) + + async def _send_model(self, data: typing.Any) -> None: + """ + Send a Pydantic model to the websocket connection. + """ + await self._send(data.dict()) + + +class V1SocketClient(EventEmitterMixin): + def __init__(self, *, websocket: websockets_sync_connection.Connection): + super().__init__() + self._websocket = websocket + + def __iter__(self) -> typing.Iterator[V1SocketClientResponse]: + for message in self._websocket: + if isinstance(message, bytes): + yield message # type: ignore + else: + try: + yield construct_type(type_=V1SocketClientResponse, object_=json.loads(message)) # type: ignore + except Exception: + _logger.warning( + "Skipping unknown WebSocket message; update your SDK version to support new message types." + ) + continue + + def start_listening(self): + """ + Start listening for messages on the websocket connection. + + Emits events in the following order: + - EventType.OPEN when connection is established + - EventType.MESSAGE for each message received + - EventType.ERROR if an error occurs + - EventType.CLOSE when connection is closed + """ + self._emit(EventType.OPEN, None) + try: + for raw_message in self._websocket: + if isinstance(raw_message, bytes): + parsed = raw_message + else: + json_data = json.loads(raw_message) + try: + parsed = construct_type(type_=V1SocketClientResponse, object_=json_data) # type: ignore + except Exception: + _logger.warning( + "Skipping unknown WebSocket message; update your SDK version to support new message types." + ) + continue + self._emit(EventType.MESSAGE, parsed) + except Exception as exc: + self._emit(EventType.ERROR, exc) + finally: + self._emit(EventType.CLOSE, None) + + def send_media(self, message: bytes) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a bytes. + """ + self._send(message) + + def send_finalize(self, message: typing.Optional[ListenV1Finalize] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a ListenV1Finalize. + """ + self._send_model(message or ListenV1Finalize(type="Finalize")) + + def send_close_stream(self, message: typing.Optional[ListenV1CloseStream] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a ListenV1CloseStream. + """ + self._send_model(message or ListenV1CloseStream(type="CloseStream")) + + def send_keep_alive(self, message: typing.Optional[ListenV1KeepAlive] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a ListenV1KeepAlive. + """ + self._send_model(message or ListenV1KeepAlive(type="KeepAlive")) + + def send_configure(self, message: ListenV1Configure) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a ListenV1Configure. + """ + self._send_model(message) + + def recv(self) -> V1SocketClientResponse: + """ + Receive a message from the websocket connection. + """ + data = self._websocket.recv() + if isinstance(data, bytes): + return data # type: ignore + json_data = json.loads(data) + try: + return construct_type(type_=V1SocketClientResponse, object_=json_data) # type: ignore + except Exception: + _logger.warning("Skipping unknown WebSocket message; update your SDK version to support new message types.") + return json_data # type: ignore + + def _send(self, data: typing.Any) -> None: + """ + Send a message to the websocket connection. + """ + if isinstance(data, dict): + data = json.dumps(data) + self._websocket.send(data) + + def _send_model(self, data: typing.Any) -> None: + """ + Send a Pydantic model to the websocket connection. + """ + self._send(data.dict()) diff --git a/src/deepgram/listen/v1/types/listen_v1configure_failure.py.bak b/src/deepgram/listen/v1/types/listen_v1configure_failure.py.bak new file mode 100644 index 00000000..859a834c --- /dev/null +++ b/src/deepgram/listen/v1/types/listen_v1configure_failure.py.bak @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel +from .listen_v1configure_failure_code import ListenV1ConfigureFailureCode + + +class ListenV1ConfigureFailure(UncheckedBaseModel): + type: typing.Literal["ConfigureFailure"] = pydantic.Field(default="ConfigureFailure") + """ + Message type identifier + """ + + request_id: str = pydantic.Field() + """ + The unique identifier of the request + """ + + code: ListenV1ConfigureFailureCode = pydantic.Field() + """ + Identifies why the `Configure` was rejected. + + - `CONFIGURE_KEYTERMS_NOT_SUPPORTED`: the stream's model does not support mid-stream keyterm updates. Only + Nova-3 models do. + - `CONFIGURE_KEYTERM_LIMIT_EXCEEDED`: the keyterms exceed the 500-token keyterm limit. + - `CONFIGURE_ALREADY_PENDING`: another `Configure` is still awaiting its response. + - `CONFIGURE_INTERNAL_ERROR`: the server failed to apply the configuration. + """ + + description: str = pydantic.Field() + """ + A human-readable explanation of the rejection + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/deepgram/listen/v2/__init__.py.bak b/src/deepgram/listen/v2/__init__.py.bak new file mode 100644 index 00000000..7585b5ab --- /dev/null +++ b/src/deepgram/listen/v2/__init__.py.bak @@ -0,0 +1,118 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + ListenV2CloseStream, + ListenV2Configure, + ListenV2ConfigureFailure, + ListenV2ConfigureSuccess, + ListenV2ConfigureSuccessThresholds, + ListenV2ConfigureThresholds, + ListenV2Connected, + ListenV2FatalError, + ListenV2ForceEndTurn, + ListenV2TurnInfo, + ListenV2TurnInfoEvent, + ListenV2TurnInfoWordsItem, + ListenV2Warning, + ) + from .requests import ( + ListenV2CloseStreamParams, + ListenV2ConfigureFailureParams, + ListenV2ConfigureParams, + ListenV2ConfigureSuccessParams, + ListenV2ConfigureSuccessThresholdsParams, + ListenV2ConfigureThresholdsParams, + ListenV2ConnectedParams, + ListenV2FatalErrorParams, + ListenV2ForceEndTurnParams, + ListenV2TurnInfoParams, + ListenV2TurnInfoWordsItemParams, + ListenV2WarningParams, + ) +_dynamic_imports: typing.Dict[str, str] = { + "ListenV2CloseStream": ".types", + "ListenV2CloseStreamParams": ".requests", + "ListenV2Configure": ".types", + "ListenV2ConfigureFailure": ".types", + "ListenV2ConfigureFailureParams": ".requests", + "ListenV2ConfigureParams": ".requests", + "ListenV2ConfigureSuccess": ".types", + "ListenV2ConfigureSuccessParams": ".requests", + "ListenV2ConfigureSuccessThresholds": ".types", + "ListenV2ConfigureSuccessThresholdsParams": ".requests", + "ListenV2ConfigureThresholds": ".types", + "ListenV2ConfigureThresholdsParams": ".requests", + "ListenV2Connected": ".types", + "ListenV2ConnectedParams": ".requests", + "ListenV2FatalError": ".types", + "ListenV2FatalErrorParams": ".requests", + "ListenV2ForceEndTurn": ".types", + "ListenV2ForceEndTurnParams": ".requests", + "ListenV2TurnInfo": ".types", + "ListenV2TurnInfoEvent": ".types", + "ListenV2TurnInfoParams": ".requests", + "ListenV2TurnInfoWordsItem": ".types", + "ListenV2TurnInfoWordsItemParams": ".requests", + "ListenV2Warning": ".types", + "ListenV2WarningParams": ".requests", +} + +_dynamic_imports["ListenV2CloseStreamType"] = ".types" + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "ListenV2CloseStream", + "ListenV2CloseStreamParams", + "ListenV2Configure", + "ListenV2ConfigureFailure", + "ListenV2ConfigureFailureParams", + "ListenV2ConfigureParams", + "ListenV2ConfigureSuccess", + "ListenV2ConfigureSuccessParams", + "ListenV2ConfigureSuccessThresholds", + "ListenV2ConfigureSuccessThresholdsParams", + "ListenV2ConfigureThresholds", + "ListenV2ConfigureThresholdsParams", + "ListenV2Connected", + "ListenV2ConnectedParams", + "ListenV2FatalError", + "ListenV2FatalErrorParams", + "ListenV2ForceEndTurn", + "ListenV2ForceEndTurnParams", + "ListenV2TurnInfo", + "ListenV2TurnInfoEvent", + "ListenV2TurnInfoParams", + "ListenV2TurnInfoWordsItem", + "ListenV2TurnInfoWordsItemParams", + "ListenV2Warning", + "ListenV2WarningParams", +] + +__all__.append("ListenV2CloseStreamType") diff --git a/src/deepgram/listen/v2/socket_client.py.bak b/src/deepgram/listen/v2/socket_client.py.bak new file mode 100644 index 00000000..4295e44c --- /dev/null +++ b/src/deepgram/listen/v2/socket_client.py.bak @@ -0,0 +1,251 @@ +# This file was auto-generated by Fern from our API Definition. + +import json +import logging +import typing + +import websockets.sync.connection as websockets_sync_connection +from ...core.events import EventEmitterMixin, EventType +from ...core.unchecked_base_model import construct_type +from .types.listen_v2close_stream import ListenV2CloseStream +from .types.listen_v2configure import ListenV2Configure +from .types.listen_v2configure_failure import ListenV2ConfigureFailure +from .types.listen_v2configure_success import ListenV2ConfigureSuccess +from .types.listen_v2connected import ListenV2Connected +from .types.listen_v2fatal_error import ListenV2FatalError +from .types.listen_v2force_end_turn import ListenV2ForceEndTurn +from .types.listen_v2turn_info import ListenV2TurnInfo +from .types.listen_v2warning import ListenV2Warning + +try: + from websockets.legacy.client import WebSocketClientProtocol # type: ignore +except ImportError: + from websockets import WebSocketClientProtocol # type: ignore + +_logger = logging.getLogger(__name__) +V2SocketClientResponse = typing.Union[ + bytes, + ListenV2Connected, + ListenV2TurnInfo, + ListenV2ConfigureSuccess, + ListenV2ConfigureFailure, + ListenV2Warning, + ListenV2FatalError, + typing.Dict[str, typing.Any], +] + + +class AsyncV2SocketClient(EventEmitterMixin): + def __init__(self, *, websocket: WebSocketClientProtocol): + super().__init__() + self._websocket = websocket + + async def __aiter__(self) -> typing.AsyncIterator[V2SocketClientResponse]: + async for message in self._websocket: + if isinstance(message, bytes): + yield message # type: ignore + else: + try: + yield construct_type(type_=V2SocketClientResponse, object_=json.loads(message)) # type: ignore + except Exception: + _logger.warning( + "Skipping unknown WebSocket message; update your SDK version to support new message types." + ) + continue + + async def start_listening(self): + """ + Start listening for messages on the websocket connection. + + Emits events in the following order: + - EventType.OPEN when connection is established + - EventType.MESSAGE for each message received + - EventType.ERROR if an error occurs + - EventType.CLOSE when connection is closed + """ + await self._emit_async(EventType.OPEN, None) + try: + async for raw_message in self._websocket: + if isinstance(raw_message, bytes): + parsed = raw_message + else: + json_data = json.loads(raw_message) + try: + parsed = construct_type(type_=V2SocketClientResponse, object_=json_data) # type: ignore + except Exception: + _logger.warning( + "Skipping unknown WebSocket message; update your SDK version to support new message types." + ) + continue + await self._emit_async(EventType.MESSAGE, parsed) + except Exception as exc: + await self._emit_async(EventType.ERROR, exc) + finally: + await self._emit_async(EventType.CLOSE, None) + + async def send_media(self, message: bytes) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a bytes. + """ + await self._send(message) + + async def send_close_stream(self, message: typing.Optional[ListenV2CloseStream] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a ListenV2CloseStream. + """ + await self._send_model(message or ListenV2CloseStream(type="CloseStream")) + + async def send_force_end_turn(self, message: typing.Optional[ListenV2ForceEndTurn] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a ListenV2ForceEndTurn. + """ + await self._send_model(message or ListenV2ForceEndTurn(type="ForceEndTurn")) + + async def send_configure(self, message: typing.Union[ListenV2Configure, typing.Dict[str, typing.Any]]) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a ListenV2Configure. + """ + if isinstance(message, dict): + await self._send(message) + else: + await self._send_model(message) + + async def recv(self) -> V2SocketClientResponse: + """ + Receive a message from the websocket connection. + """ + data = await self._websocket.recv() + if isinstance(data, bytes): + return data # type: ignore + json_data = json.loads(data) + try: + return construct_type(type_=V2SocketClientResponse, object_=json_data) # type: ignore + except Exception: + _logger.warning("Skipping unknown WebSocket message; update your SDK version to support new message types.") + return json_data # type: ignore + + async def _send(self, data: typing.Any) -> None: + """ + Send a message to the websocket connection. + """ + if isinstance(data, dict): + data = json.dumps(data) + await self._websocket.send(data) + + async def _send_model(self, data: typing.Any) -> None: + """ + Send a Pydantic model to the websocket connection. + """ + await self._send(data.dict()) + + +class V2SocketClient(EventEmitterMixin): + def __init__(self, *, websocket: websockets_sync_connection.Connection): + super().__init__() + self._websocket = websocket + + def __iter__(self) -> typing.Iterator[V2SocketClientResponse]: + for message in self._websocket: + if isinstance(message, bytes): + yield message # type: ignore + else: + try: + yield construct_type(type_=V2SocketClientResponse, object_=json.loads(message)) # type: ignore + except Exception: + _logger.warning( + "Skipping unknown WebSocket message; update your SDK version to support new message types." + ) + continue + + def start_listening(self): + """ + Start listening for messages on the websocket connection. + + Emits events in the following order: + - EventType.OPEN when connection is established + - EventType.MESSAGE for each message received + - EventType.ERROR if an error occurs + - EventType.CLOSE when connection is closed + """ + self._emit(EventType.OPEN, None) + try: + for raw_message in self._websocket: + if isinstance(raw_message, bytes): + parsed = raw_message + else: + json_data = json.loads(raw_message) + try: + parsed = construct_type(type_=V2SocketClientResponse, object_=json_data) # type: ignore + except Exception: + _logger.warning( + "Skipping unknown WebSocket message; update your SDK version to support new message types." + ) + continue + self._emit(EventType.MESSAGE, parsed) + except Exception as exc: + self._emit(EventType.ERROR, exc) + finally: + self._emit(EventType.CLOSE, None) + + def send_media(self, message: bytes) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a bytes. + """ + self._send(message) + + def send_close_stream(self, message: typing.Optional[ListenV2CloseStream] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a ListenV2CloseStream. + """ + self._send_model(message or ListenV2CloseStream(type="CloseStream")) + + def send_force_end_turn(self, message: typing.Optional[ListenV2ForceEndTurn] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a ListenV2ForceEndTurn. + """ + self._send_model(message or ListenV2ForceEndTurn(type="ForceEndTurn")) + + def send_configure(self, message: typing.Union[ListenV2Configure, typing.Dict[str, typing.Any]]) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a ListenV2Configure. + """ + if isinstance(message, dict): + self._send(message) + else: + self._send_model(message) + + def recv(self) -> V2SocketClientResponse: + """ + Receive a message from the websocket connection. + """ + data = self._websocket.recv() + if isinstance(data, bytes): + return data # type: ignore + json_data = json.loads(data) + try: + return construct_type(type_=V2SocketClientResponse, object_=json_data) # type: ignore + except Exception: + _logger.warning("Skipping unknown WebSocket message; update your SDK version to support new message types.") + return json_data # type: ignore + + def _send(self, data: typing.Any) -> None: + """ + Send a message to the websocket connection. + """ + if isinstance(data, dict): + data = json.dumps(data) + self._websocket.send(data) + + def _send_model(self, data: typing.Any) -> None: + """ + Send a Pydantic model to the websocket connection. + """ + self._send(data.dict()) diff --git a/src/deepgram/listen/v2/types/__init__.py.bak b/src/deepgram/listen/v2/types/__init__.py.bak new file mode 100644 index 00000000..8ec84d29 --- /dev/null +++ b/src/deepgram/listen/v2/types/__init__.py.bak @@ -0,0 +1,78 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .listen_v2close_stream import ListenV2CloseStream + from .listen_v2configure import ListenV2Configure + from .listen_v2configure_failure import ListenV2ConfigureFailure + from .listen_v2configure_success import ListenV2ConfigureSuccess + from .listen_v2configure_success_thresholds import ListenV2ConfigureSuccessThresholds + from .listen_v2configure_thresholds import ListenV2ConfigureThresholds + from .listen_v2connected import ListenV2Connected + from .listen_v2fatal_error import ListenV2FatalError + from .listen_v2force_end_turn import ListenV2ForceEndTurn + from .listen_v2turn_info import ListenV2TurnInfo + from .listen_v2turn_info_event import ListenV2TurnInfoEvent + from .listen_v2turn_info_words_item import ListenV2TurnInfoWordsItem + from .listen_v2warning import ListenV2Warning +_dynamic_imports: typing.Dict[str, str] = { + "ListenV2CloseStream": ".listen_v2close_stream", + "ListenV2Configure": ".listen_v2configure", + "ListenV2ConfigureFailure": ".listen_v2configure_failure", + "ListenV2ConfigureSuccess": ".listen_v2configure_success", + "ListenV2ConfigureSuccessThresholds": ".listen_v2configure_success_thresholds", + "ListenV2ConfigureThresholds": ".listen_v2configure_thresholds", + "ListenV2Connected": ".listen_v2connected", + "ListenV2FatalError": ".listen_v2fatal_error", + "ListenV2ForceEndTurn": ".listen_v2force_end_turn", + "ListenV2TurnInfo": ".listen_v2turn_info", + "ListenV2TurnInfoEvent": ".listen_v2turn_info_event", + "ListenV2TurnInfoWordsItem": ".listen_v2turn_info_words_item", + "ListenV2Warning": ".listen_v2warning", +} + +_dynamic_imports["ListenV2CloseStreamType"] = ".listen_v2close_stream_type" + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "ListenV2CloseStream", + "ListenV2Configure", + "ListenV2ConfigureFailure", + "ListenV2ConfigureSuccess", + "ListenV2ConfigureSuccessThresholds", + "ListenV2ConfigureThresholds", + "ListenV2Connected", + "ListenV2FatalError", + "ListenV2ForceEndTurn", + "ListenV2TurnInfo", + "ListenV2TurnInfoEvent", + "ListenV2TurnInfoWordsItem", + "ListenV2Warning", +] + +__all__.append("ListenV2CloseStreamType") diff --git a/src/deepgram/listen/v2/types/listen_v2configure_failure.py.bak b/src/deepgram/listen/v2/types/listen_v2configure_failure.py.bak new file mode 100644 index 00000000..1daf8af6 --- /dev/null +++ b/src/deepgram/listen/v2/types/listen_v2configure_failure.py.bak @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ._dict_compat import ListenV2ResponseDictCompatModel + + +class ListenV2ConfigureFailure(ListenV2ResponseDictCompatModel): + type: typing.Literal["ConfigureFailure"] = pydantic.Field(default="ConfigureFailure") + """ + Message type identifier + """ + + request_id: str = pydantic.Field() + """ + The unique identifier of the request + """ + + sequence_id: int = pydantic.Field() + """ + Starts at `0` and increments for each message the server sends + to the client. This includes messages of other types, like + `TurnInfo` messages. + """ + + code: typing.Optional[str] = pydantic.Field(default=None) + """ + Failure code identifying the rejected configuration + """ + + description: typing.Optional[str] = pydantic.Field(default=None) + """ + A human-readable description of the configuration failure + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/deepgram/listen/v2/types/listen_v2configure_success.py.bak b/src/deepgram/listen/v2/types/listen_v2configure_success.py.bak new file mode 100644 index 00000000..0faaec9d --- /dev/null +++ b/src/deepgram/listen/v2/types/listen_v2configure_success.py.bak @@ -0,0 +1,60 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....types.listen_v2configure_numerals import ListenV2ConfigureNumerals +from ....types.listen_v2keyterm import ListenV2Keyterm +from ._dict_compat import ListenV2ResponseDictCompatModel +from .listen_v2configure_success_thresholds import ListenV2ConfigureSuccessThresholds + + +class ListenV2ConfigureSuccess(ListenV2ResponseDictCompatModel): + type: typing.Literal["ConfigureSuccess"] = pydantic.Field(default="ConfigureSuccess") + """ + Message type identifier + """ + + request_id: str = pydantic.Field() + """ + The unique identifier of the request + """ + + thresholds: ListenV2ConfigureSuccessThresholds = pydantic.Field() + """ + Updates each parameter, if it is supplied. If a particular threshold parameter + is not supplied, the configuration continues using the currently configured value. + """ + + keyterms: ListenV2Keyterm + language_hints: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + The currently active language hints. Only applicable to the flux-general-multi model. + """ + + numerals: typing.Optional[ListenV2ConfigureNumerals] = pydantic.Field(default=None) + """ + Whether numeral formatting is enabled for transcripts Flux STT sends after it processes the update. + """ + + redact_usage: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether usage redaction is on for this connection. + """ + + sequence_id: int = pydantic.Field() + """ + Starts at `0` and increments for each message the server sends + to the client. This includes messages of other types, like + `TurnInfo` messages. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/deepgram/listen/v2/types/listen_v2configure_success_thresholds.py.bak b/src/deepgram/listen/v2/types/listen_v2configure_success_thresholds.py.bak new file mode 100644 index 00000000..e0353ec9 --- /dev/null +++ b/src/deepgram/listen/v2/types/listen_v2configure_success_thresholds.py.bak @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....types.listen_v2eager_eot_threshold import ListenV2EagerEotThreshold +from ....types.listen_v2eot_threshold import ListenV2EotThreshold +from ....types.listen_v2eot_timeout_ms import ListenV2EotTimeoutMs +from ._dict_compat import ListenV2ResponseDictCompatModel + + +class ListenV2ConfigureSuccessThresholds(ListenV2ResponseDictCompatModel): + """ + Updates each parameter, if it is supplied. If a particular threshold parameter + is not supplied, the configuration continues using the currently configured value. + """ + + eager_eot_threshold: typing.Optional[ListenV2EagerEotThreshold] = None + eot_threshold: typing.Optional[ListenV2EotThreshold] = None + eot_timeout_ms: typing.Optional[ListenV2EotTimeoutMs] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/deepgram/listen/v2/types/listen_v2connected.py.bak b/src/deepgram/listen/v2/types/listen_v2connected.py.bak new file mode 100644 index 00000000..b253d86c --- /dev/null +++ b/src/deepgram/listen/v2/types/listen_v2connected.py.bak @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ._dict_compat import ListenV2ResponseDictCompatModel + + +class ListenV2Connected(ListenV2ResponseDictCompatModel): + type: typing.Literal["Connected"] = pydantic.Field(default="Connected") + """ + Message type identifier + """ + + request_id: str = pydantic.Field() + """ + The unique identifier of the request + """ + + sequence_id: int = pydantic.Field() + """ + Starts at `0` and increments for each message the server sends + to the client. This includes messages of other types, like + `TurnInfo` messages. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/deepgram/listen/v2/types/listen_v2fatal_error.py.bak b/src/deepgram/listen/v2/types/listen_v2fatal_error.py.bak new file mode 100644 index 00000000..2202c82e --- /dev/null +++ b/src/deepgram/listen/v2/types/listen_v2fatal_error.py.bak @@ -0,0 +1,40 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ._dict_compat import ListenV2ResponseDictCompatModel + + +class ListenV2FatalError(ListenV2ResponseDictCompatModel): + type: typing.Literal["Error"] = pydantic.Field(default="Error") + """ + Message type identifier + """ + + sequence_id: int = pydantic.Field() + """ + Starts at `0` and increments for each message the server sends + to the client. This includes messages of other types, like + `Connected` messages. + """ + + code: str = pydantic.Field() + """ + A string code describing the error, e.g. `INTERNAL_SERVER_ERROR` + """ + + description: str = pydantic.Field() + """ + Prose description of the error + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/deepgram/listen/v2/types/listen_v2turn_info.py.bak b/src/deepgram/listen/v2/types/listen_v2turn_info.py.bak new file mode 100644 index 00000000..969d6d0c --- /dev/null +++ b/src/deepgram/listen/v2/types/listen_v2turn_info.py.bak @@ -0,0 +1,102 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ._dict_compat import ListenV2ResponseDictCompatModel +from .listen_v2turn_info_event import ListenV2TurnInfoEvent +from .listen_v2turn_info_words_item import ListenV2TurnInfoWordsItem + + +class ListenV2TurnInfo(ListenV2ResponseDictCompatModel): + """ + Describes the current turn and latest state of the turn + """ + + type: typing.Literal["TurnInfo"] = "TurnInfo" + request_id: str = pydantic.Field() + """ + The unique identifier of the request + """ + + sequence_id: int = pydantic.Field() + """ + Starts at `0` and increments for each message the server sends to the client. This includes messages of other types, like `Connected` messages. + """ + + event: ListenV2TurnInfoEvent = pydantic.Field() + """ + The type of event being reported. + + - **Update** - Additional audio has been transcribed, but the turn state hasn't changed + - **StartOfTurn** - The user has begun speaking for the first time in the turn + - **EagerEndOfTurn** - The system has moderate confidence that the user has finished speaking for the turn. This is an opportunity to begin preparing an agent reply + - **TurnResumed** - The system detected that speech had ended and therefore sent an **EagerEndOfTurn** event, but speech is actually continuing for this turn + - **EndOfTurn** - The user has finished speaking for the turn + """ + + turn_index: int = pydantic.Field() + """ + The index of the current turn + """ + + audio_window_start: float = pydantic.Field() + """ + Start time in seconds of the audio range that was transcribed + """ + + audio_window_end: float = pydantic.Field() + """ + End time in seconds of the audio range that was transcribed + """ + + transcript: str = pydantic.Field() + """ + Text that was said over the course of the current turn + """ + + words: typing.List[ListenV2TurnInfoWordsItem] = pydantic.Field() + """ + The words in the `transcript` + """ + + end_of_turn_confidence: float = pydantic.Field() + """ + Confidence that no more speech is coming in this turn + """ + + trigger: typing.Optional[str] = pydantic.Field(default=None) + """ + The cause of the turn ending. Present on every `EndOfTurn` event and only there. + + - **model** - the turn ended by Flux's native end-of-turn detection + + - **manual** - the turn ended because a `ForceEndTurn` message was sent + + - **timeout** - the turn ended because `eot_timeout_ms` elapsed + + This is an open enum. New values may be added over time, so clients must tolerate values they do not recognize. + """ + + languages: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Detected languages sorted by descending frequency in the + transcript. Only present when the flux-general-multi model + detects languages in the audio. + """ + + languages_hinted: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + The language hints that were supplied for this turn. Only + present when language hints are configured. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/deepgram/listen/v2/types/listen_v2turn_info_words_item.py.bak b/src/deepgram/listen/v2/types/listen_v2turn_info_words_item.py.bak new file mode 100644 index 00000000..88240cd9 --- /dev/null +++ b/src/deepgram/listen/v2/types/listen_v2turn_info_words_item.py.bak @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ._dict_compat import ListenV2ResponseDictCompatModel + + +class ListenV2TurnInfoWordsItem(ListenV2ResponseDictCompatModel): + word: str = pydantic.Field() + """ + The individual punctuated, properly-cased word from the transcript + """ + + confidence: float = pydantic.Field() + """ + Confidence that this word was transcribed correctly + """ + + start: typing.Optional[float] = pydantic.Field(default=None) + """ + The start time of the word + """ + + end: typing.Optional[float] = pydantic.Field(default=None) + """ + The end time of the word + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/deepgram/listen/v2/types/listen_v2warning.py.bak b/src/deepgram/listen/v2/types/listen_v2warning.py.bak new file mode 100644 index 00000000..19bfe19a --- /dev/null +++ b/src/deepgram/listen/v2/types/listen_v2warning.py.bak @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ._dict_compat import ListenV2ResponseDictCompatModel + + +class ListenV2Warning(ListenV2ResponseDictCompatModel): + type: typing.Literal["Warning"] = pydantic.Field(default="Warning") + """ + Message type identifier + """ + + request_id: str = pydantic.Field() + """ + The unique identifier of the request + """ + + sequence_id: int = pydantic.Field() + """ + Starts at `0` and increments for each message the server sends + to the client. This includes messages of other types, like + `TurnInfo` messages. + """ + + code: str = pydantic.Field() + """ + Warning code identifying the condition, in `SCREAMING_SNAKE_CASE` + """ + + description: str = pydantic.Field() + """ + A human-readable description of the warning + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/deepgram/manage/v1/projects/keys/client.py.bak b/src/deepgram/manage/v1/projects/keys/client.py.bak new file mode 100644 index 00000000..1ccf2e9c --- /dev/null +++ b/src/deepgram/manage/v1/projects/keys/client.py.bak @@ -0,0 +1,449 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.request_options import RequestOptions +from .....requests.create_key_v1request import CreateKeyV1RequestParams +from .....types.create_key_v1response import CreateKeyV1Response +from .....types.delete_project_key_v1response import DeleteProjectKeyV1Response +from .....types.get_project_key_v1response import GetProjectKeyV1Response +from .....types.list_project_keys_v1response import ListProjectKeysV1Response +from .raw_client import AsyncRawKeysClient, RawKeysClient +from .types.keys_list_request_status import KeysListRequestStatus + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class KeysClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawKeysClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawKeysClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawKeysClient + """ + return self._raw_client + + def list( + self, + project_id: str, + *, + status: typing.Optional[KeysListRequestStatus] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ListProjectKeysV1Response: + """ + Retrieves all API keys associated with the specified project + + Parameters + ---------- + project_id : str + The unique identifier of the project + + status : typing.Optional[KeysListRequestStatus] + Only return keys with a specific status + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListProjectKeysV1Response + A list of API keys + + Examples + -------- + from deepgram import DeepgramClient + + client = DeepgramClient( + api_key="YOUR_API_KEY", + ) + client.manage.v1.projects.keys.list( + project_id="123456-7890-1234-5678-901234", + status="active", + ) + """ + _response = self._raw_client.list(project_id, status=status, request_options=request_options) + return _response.data + + def create( + self, + project_id: str, + *, + comment: typing.Optional[str] = OMIT, + scopes: typing.Optional[typing.Sequence[str]] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + expiration_date: typing.Optional[dt.datetime] = OMIT, + time_to_live_in_seconds: typing.Optional[float] = OMIT, + request: typing.Optional[CreateKeyV1RequestParams] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> CreateKeyV1Response: + """ + Creates a new API key with specified settings for the project + + Parameters + ---------- + project_id : str + The unique identifier of the project + + comment : typing.Optional[str] + Required unless the deprecated `request` argument is supplied. + + scopes : typing.Optional[typing.Sequence[str]] + Required unless the deprecated `request` argument is supplied. + + tags : typing.Optional[typing.Sequence[str]] + + expiration_date : typing.Optional[dt.datetime] + + time_to_live_in_seconds : typing.Optional[float] + + request : typing.Optional[CreateKeyV1RequestParams] + Deprecated. The pre-2026-12 single-mapping form of this call. It is forwarded as the + request body; the arguments above override the matching keys. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreateKeyV1Response + API key created successfully + + Examples + -------- + from deepgram import DeepgramClient + + client = DeepgramClient( + api_key="YOUR_API_KEY", + ) + client.manage.v1.projects.keys.create( + project_id="123456-7890-1234-5678-901234", + comment="A comment", + scopes=["admin"], + ) + """ + _response = self._raw_client.create( + project_id, + comment=comment, + scopes=scopes, + tags=tags, + expiration_date=expiration_date, + time_to_live_in_seconds=time_to_live_in_seconds, + request=request, + request_options=request_options, + ) + return _response.data + + def get( + self, project_id: str, key_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetProjectKeyV1Response: + """ + Retrieves information about a specified API key + + Parameters + ---------- + project_id : str + The unique identifier of the project + + key_id : str + The unique identifier of the API key + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetProjectKeyV1Response + A specific API key + + Examples + -------- + from deepgram import DeepgramClient + + client = DeepgramClient( + api_key="YOUR_API_KEY", + ) + client.manage.v1.projects.keys.get( + project_id="123456-7890-1234-5678-901234", + key_id="123456789012345678901234", + ) + """ + _response = self._raw_client.get(project_id, key_id, request_options=request_options) + return _response.data + + def delete( + self, project_id: str, key_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteProjectKeyV1Response: + """ + Deletes an API key for a specific project + + Parameters + ---------- + project_id : str + The unique identifier of the project + + key_id : str + The unique identifier of the API key + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteProjectKeyV1Response + API key deleted + + Examples + -------- + from deepgram import DeepgramClient + + client = DeepgramClient( + api_key="YOUR_API_KEY", + ) + client.manage.v1.projects.keys.delete( + project_id="123456-7890-1234-5678-901234", + key_id="123456789012345678901234", + ) + """ + _response = self._raw_client.delete(project_id, key_id, request_options=request_options) + return _response.data + + +class AsyncKeysClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawKeysClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawKeysClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawKeysClient + """ + return self._raw_client + + async def list( + self, + project_id: str, + *, + status: typing.Optional[KeysListRequestStatus] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ListProjectKeysV1Response: + """ + Retrieves all API keys associated with the specified project + + Parameters + ---------- + project_id : str + The unique identifier of the project + + status : typing.Optional[KeysListRequestStatus] + Only return keys with a specific status + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListProjectKeysV1Response + A list of API keys + + Examples + -------- + import asyncio + + from deepgram import AsyncDeepgramClient + + client = AsyncDeepgramClient( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.manage.v1.projects.keys.list( + project_id="123456-7890-1234-5678-901234", + status="active", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(project_id, status=status, request_options=request_options) + return _response.data + + async def create( + self, + project_id: str, + *, + comment: typing.Optional[str] = OMIT, + scopes: typing.Optional[typing.Sequence[str]] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + expiration_date: typing.Optional[dt.datetime] = OMIT, + time_to_live_in_seconds: typing.Optional[float] = OMIT, + request: typing.Optional[CreateKeyV1RequestParams] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> CreateKeyV1Response: + """ + Creates a new API key with specified settings for the project + + Parameters + ---------- + project_id : str + The unique identifier of the project + + comment : typing.Optional[str] + Required unless the deprecated `request` argument is supplied. + + scopes : typing.Optional[typing.Sequence[str]] + Required unless the deprecated `request` argument is supplied. + + tags : typing.Optional[typing.Sequence[str]] + + expiration_date : typing.Optional[dt.datetime] + + time_to_live_in_seconds : typing.Optional[float] + + request : typing.Optional[CreateKeyV1RequestParams] + Deprecated. The pre-2026-12 single-mapping form of this call. It is forwarded as the + request body; the arguments above override the matching keys. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreateKeyV1Response + API key created successfully + + Examples + -------- + import asyncio + + from deepgram import AsyncDeepgramClient + + client = AsyncDeepgramClient( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.manage.v1.projects.keys.create( + project_id="123456-7890-1234-5678-901234", + comment="A comment", + scopes=["admin"], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + project_id, + comment=comment, + scopes=scopes, + tags=tags, + expiration_date=expiration_date, + time_to_live_in_seconds=time_to_live_in_seconds, + request=request, + request_options=request_options, + ) + return _response.data + + async def get( + self, project_id: str, key_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetProjectKeyV1Response: + """ + Retrieves information about a specified API key + + Parameters + ---------- + project_id : str + The unique identifier of the project + + key_id : str + The unique identifier of the API key + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetProjectKeyV1Response + A specific API key + + Examples + -------- + import asyncio + + from deepgram import AsyncDeepgramClient + + client = AsyncDeepgramClient( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.manage.v1.projects.keys.get( + project_id="123456-7890-1234-5678-901234", + key_id="123456789012345678901234", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(project_id, key_id, request_options=request_options) + return _response.data + + async def delete( + self, project_id: str, key_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteProjectKeyV1Response: + """ + Deletes an API key for a specific project + + Parameters + ---------- + project_id : str + The unique identifier of the project + + key_id : str + The unique identifier of the API key + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteProjectKeyV1Response + API key deleted + + Examples + -------- + import asyncio + + from deepgram import AsyncDeepgramClient + + client = AsyncDeepgramClient( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.manage.v1.projects.keys.delete( + project_id="123456-7890-1234-5678-901234", + key_id="123456789012345678901234", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(project_id, key_id, request_options=request_options) + return _response.data diff --git a/src/deepgram/manage/v1/projects/keys/raw_client.py.bak b/src/deepgram/manage/v1/projects/keys/raw_client.py.bak new file mode 100644 index 00000000..2ca5aef0 --- /dev/null +++ b/src/deepgram/manage/v1/projects/keys/raw_client.py.bak @@ -0,0 +1,624 @@ +# This file was auto-generated by Fern from our API Definition. + +import collections.abc +import datetime as dt +import typing +from json.decoder import JSONDecodeError + +from .....core.api_error import ApiError +from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.http_response import AsyncHttpResponse, HttpResponse +from .....core.jsonable_encoder import encode_path_param +from .....core.parse_error import ParsingError +from .....core.request_options import RequestOptions +from .....core.unchecked_base_model import construct_type +from .....errors.bad_request_error import BadRequestError +from .....requests.create_key_v1request import CreateKeyV1RequestParams +from .....types.create_key_v1response import CreateKeyV1Response +from .....types.delete_project_key_v1response import DeleteProjectKeyV1Response +from .....types.get_project_key_v1response import GetProjectKeyV1Response +from .....types.list_project_keys_v1response import ListProjectKeysV1Response +from .types.keys_list_request_status import KeysListRequestStatus +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +def _build_create_key_body( + request: typing.Any, + comment: typing.Any, + scopes: typing.Any, + tags: typing.Any, + expiration_date: typing.Any, + time_to_live_in_seconds: typing.Any, +) -> typing.Any: + """Build the create-key request body from either the current or the deprecated call shape. + + Through SDK 7.21 this endpoint took a single `request` argument annotated `Any`, which the SDK + handed to the JSON encoder without inspecting it. The 2026-12-01 regeneration replaced it with + explicit keyword arguments, which raises TypeError for every caller written against an earlier + release, so the old argument is still accepted. + + The legacy path is a passthrough, and deliberately a total one: any object that reached the + encoder before still reaches it, because the server, not the SDK, decided what a valid body + was. That is why a non-mapping (a pydantic model, a dataclass, even a string) is forwarded + rather than rejected, and why `request=None` still produces the empty body it always did. + Narrowing this to `dict` silently broke every caller passing a `Mapping` that was not one. + + All six arguments default to OMIT rather than None, so `None` always means "the caller asked + for a null value" and never "the caller omitted this". Explicit keyword arguments are merged + over the mapping, so they win where both supply a key. + """ + explicit: typing.Dict[str, typing.Any] = {} + for key, value in ( + ("comment", comment), + ("scopes", scopes), + ("tags", tags), + ("expiration_date", expiration_date), + ("time_to_live_in_seconds", time_to_live_in_seconds), + ): + if value is not OMIT: + explicit[key] = value + + if request is OMIT: + for key in ("comment", "scopes"): + if key not in explicit: + raise TypeError(f"create() missing required keyword argument: {key!r}") + return explicit + + if isinstance(request, collections.abc.Mapping): + body = dict(request) + body.update(explicit) + return body + + # Not a mapping, so there is nothing to merge into. Forward it exactly as 7.21 and earlier did. + if explicit: + raise TypeError( + f"`request` must be a mapping when keyword arguments are also supplied, got {type(request).__name__}" + ) + return request + + +class RawKeysClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + project_id: str, + *, + status: typing.Optional[KeysListRequestStatus] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ListProjectKeysV1Response]: + """ + Retrieves all API keys associated with the specified project + + Parameters + ---------- + project_id : str + The unique identifier of the project + + status : typing.Optional[KeysListRequestStatus] + Only return keys with a specific status + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ListProjectKeysV1Response] + A list of API keys + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/projects/{encode_path_param(project_id)}/keys", + base_url=self._client_wrapper.get_environment().base, + method="GET", + params={ + "status": status, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ListProjectKeysV1Response, + construct_type( + type_=ListProjectKeysV1Response, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + project_id: str, + *, + comment: typing.Optional[str] = OMIT, + scopes: typing.Optional[typing.Sequence[str]] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + expiration_date: typing.Optional[dt.datetime] = OMIT, + time_to_live_in_seconds: typing.Optional[float] = OMIT, + request: typing.Optional[CreateKeyV1RequestParams] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[CreateKeyV1Response]: + """ + Creates a new API key with specified settings for the project + + Parameters + ---------- + project_id : str + The unique identifier of the project + + comment : typing.Optional[str] + Required unless the deprecated `request` argument is supplied. + + scopes : typing.Optional[typing.Sequence[str]] + Required unless the deprecated `request` argument is supplied. + + tags : typing.Optional[typing.Sequence[str]] + + expiration_date : typing.Optional[dt.datetime] + + time_to_live_in_seconds : typing.Optional[float] + + request : typing.Optional[CreateKeyV1RequestParams] + Deprecated. The pre-2026-12 single-mapping form of this call. Its keys are forwarded + as the request body; the arguments above override the matching keys. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[CreateKeyV1Response] + API key created successfully + """ + _body = _build_create_key_body(request, comment, scopes, tags, expiration_date, time_to_live_in_seconds) + _response = self._client_wrapper.httpx_client.request( + f"v1/projects/{encode_path_param(project_id)}/keys", + base_url=self._client_wrapper.get_environment().base, + method="POST", + json=_body, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreateKeyV1Response, + construct_type( + type_=CreateKeyV1Response, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, project_id: str, key_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[GetProjectKeyV1Response]: + """ + Retrieves information about a specified API key + + Parameters + ---------- + project_id : str + The unique identifier of the project + + key_id : str + The unique identifier of the API key + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetProjectKeyV1Response] + A specific API key + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/projects/{encode_path_param(project_id)}/keys/{encode_path_param(key_id)}", + base_url=self._client_wrapper.get_environment().base, + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetProjectKeyV1Response, + construct_type( + type_=GetProjectKeyV1Response, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, project_id: str, key_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DeleteProjectKeyV1Response]: + """ + Deletes an API key for a specific project + + Parameters + ---------- + project_id : str + The unique identifier of the project + + key_id : str + The unique identifier of the API key + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DeleteProjectKeyV1Response] + API key deleted + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/projects/{encode_path_param(project_id)}/keys/{encode_path_param(key_id)}", + base_url=self._client_wrapper.get_environment().base, + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteProjectKeyV1Response, + construct_type( + type_=DeleteProjectKeyV1Response, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawKeysClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + project_id: str, + *, + status: typing.Optional[KeysListRequestStatus] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ListProjectKeysV1Response]: + """ + Retrieves all API keys associated with the specified project + + Parameters + ---------- + project_id : str + The unique identifier of the project + + status : typing.Optional[KeysListRequestStatus] + Only return keys with a specific status + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ListProjectKeysV1Response] + A list of API keys + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/projects/{encode_path_param(project_id)}/keys", + base_url=self._client_wrapper.get_environment().base, + method="GET", + params={ + "status": status, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ListProjectKeysV1Response, + construct_type( + type_=ListProjectKeysV1Response, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + project_id: str, + *, + comment: typing.Optional[str] = OMIT, + scopes: typing.Optional[typing.Sequence[str]] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + expiration_date: typing.Optional[dt.datetime] = OMIT, + time_to_live_in_seconds: typing.Optional[float] = OMIT, + request: typing.Optional[CreateKeyV1RequestParams] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[CreateKeyV1Response]: + """ + Creates a new API key with specified settings for the project + + Parameters + ---------- + project_id : str + The unique identifier of the project + + comment : typing.Optional[str] + Required unless the deprecated `request` argument is supplied. + + scopes : typing.Optional[typing.Sequence[str]] + Required unless the deprecated `request` argument is supplied. + + tags : typing.Optional[typing.Sequence[str]] + + expiration_date : typing.Optional[dt.datetime] + + time_to_live_in_seconds : typing.Optional[float] + + request : typing.Optional[CreateKeyV1RequestParams] + Deprecated. The pre-2026-12 single-mapping form of this call. Its keys are forwarded + as the request body; the arguments above override the matching keys. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[CreateKeyV1Response] + API key created successfully + """ + _body = _build_create_key_body(request, comment, scopes, tags, expiration_date, time_to_live_in_seconds) + _response = await self._client_wrapper.httpx_client.request( + f"v1/projects/{encode_path_param(project_id)}/keys", + base_url=self._client_wrapper.get_environment().base, + method="POST", + json=_body, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreateKeyV1Response, + construct_type( + type_=CreateKeyV1Response, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, project_id: str, key_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetProjectKeyV1Response]: + """ + Retrieves information about a specified API key + + Parameters + ---------- + project_id : str + The unique identifier of the project + + key_id : str + The unique identifier of the API key + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetProjectKeyV1Response] + A specific API key + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/projects/{encode_path_param(project_id)}/keys/{encode_path_param(key_id)}", + base_url=self._client_wrapper.get_environment().base, + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetProjectKeyV1Response, + construct_type( + type_=GetProjectKeyV1Response, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, project_id: str, key_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DeleteProjectKeyV1Response]: + """ + Deletes an API key for a specific project + + Parameters + ---------- + project_id : str + The unique identifier of the project + + key_id : str + The unique identifier of the API key + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DeleteProjectKeyV1Response] + API key deleted + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/projects/{encode_path_param(project_id)}/keys/{encode_path_param(key_id)}", + base_url=self._client_wrapper.get_environment().base, + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteProjectKeyV1Response, + construct_type( + type_=DeleteProjectKeyV1Response, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/deepgram/requests/__init__.py.bak b/src/deepgram/requests/__init__.py.bak new file mode 100644 index 00000000..93f0b503 --- /dev/null +++ b/src/deepgram/requests/__init__.py.bak @@ -0,0 +1,624 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .agent_configuration_v1 import AgentConfigurationV1Params + from .agent_think_models_v1response import AgentThinkModelsV1ResponseParams + from .agent_think_models_v1response_models_item import AgentThinkModelsV1ResponseModelsItemParams + from .agent_think_models_v1response_models_item_id import AgentThinkModelsV1ResponseModelsItemIdParams + from .agent_think_models_v1response_models_item_one import AgentThinkModelsV1ResponseModelsItemOneParams + from .agent_think_models_v1response_models_item_three import AgentThinkModelsV1ResponseModelsItemThreeParams + from .agent_think_models_v1response_models_item_two import AgentThinkModelsV1ResponseModelsItemTwoParams + from .agent_think_models_v1response_models_item_zero import AgentThinkModelsV1ResponseModelsItemZeroParams + from .agent_variable_v1 import AgentVariableV1Params + from .anthropic import AnthropicParams + from .aws_bedrock_think_provider import AwsBedrockThinkProviderParams + from .aws_bedrock_think_provider_credentials import AwsBedrockThinkProviderCredentialsParams + from .aws_polly_speak_provider import AwsPollySpeakProviderParams + from .aws_polly_speak_provider_credentials import AwsPollySpeakProviderCredentialsParams + from .billing_breakdown_v1response import BillingBreakdownV1ResponseParams + from .billing_breakdown_v1response_resolution import BillingBreakdownV1ResponseResolutionParams + from .billing_breakdown_v1response_results_item import BillingBreakdownV1ResponseResultsItemParams + from .billing_breakdown_v1response_results_item_grouping import BillingBreakdownV1ResponseResultsItemGroupingParams + from .cartesia import CartesiaParams + from .cartesia_voice import CartesiaVoiceParams + from .create_agent_configuration_v1response import CreateAgentConfigurationV1ResponseParams + from .create_key_v1request import CreateKeyV1RequestParams + from .create_key_v1response import CreateKeyV1ResponseParams + from .create_project_distribution_credentials_v1response import CreateProjectDistributionCredentialsV1ResponseParams + from .create_project_distribution_credentials_v1response_distribution_credentials import ( + CreateProjectDistributionCredentialsV1ResponseDistributionCredentialsParams, + ) + from .create_project_distribution_credentials_v1response_member import ( + CreateProjectDistributionCredentialsV1ResponseMemberParams, + ) + from .create_project_invite_v1response import CreateProjectInviteV1ResponseParams + from .deepgram import DeepgramParams + from .deepgram_listen_provider_v1 import DeepgramListenProviderV1Params + from .deepgram_listen_provider_v2 import DeepgramListenProviderV2Params + from .deepgram_think_live_provider_v1 import DeepgramThinkLiveProviderV1Params + from .deepgram_think_provider import DeepgramThinkProviderParams + from .delete_project_invite_v1response import DeleteProjectInviteV1ResponseParams + from .delete_project_key_v1response import DeleteProjectKeyV1ResponseParams + from .delete_project_member_v1response import DeleteProjectMemberV1ResponseParams + from .delete_project_v1response import DeleteProjectV1ResponseParams + from .eleven_labs_speak_provider import ElevenLabsSpeakProviderParams + from .error_response import ErrorResponseParams + from .error_response_legacy_error import ErrorResponseLegacyErrorParams + from .error_response_modern_error import ErrorResponseModernErrorParams + from .get_model_v1response import GetModelV1ResponseParams + from .get_model_v1response_batch import GetModelV1ResponseBatchParams + from .get_model_v1response_metadata import GetModelV1ResponseMetadataParams + from .get_model_v1response_metadata_metadata import GetModelV1ResponseMetadataMetadataParams + from .get_project_balance_v1response import GetProjectBalanceV1ResponseParams + from .get_project_distribution_credentials_v1response import GetProjectDistributionCredentialsV1ResponseParams + from .get_project_distribution_credentials_v1response_distribution_credentials import ( + GetProjectDistributionCredentialsV1ResponseDistributionCredentialsParams, + ) + from .get_project_distribution_credentials_v1response_member import ( + GetProjectDistributionCredentialsV1ResponseMemberParams, + ) + from .get_project_key_v1response import GetProjectKeyV1ResponseParams + from .get_project_key_v1response_item import GetProjectKeyV1ResponseItemParams + from .get_project_key_v1response_item_member import GetProjectKeyV1ResponseItemMemberParams + from .get_project_key_v1response_item_member_api_key import GetProjectKeyV1ResponseItemMemberApiKeyParams + from .get_project_request_v1response import GetProjectRequestV1ResponseParams + from .get_project_v1response import GetProjectV1ResponseParams + from .google import GoogleParams + from .grant_v1response import GrantV1ResponseParams + from .groq import GroqParams + from .leave_project_v1response import LeaveProjectV1ResponseParams + from .list_agent_configurations_v1response import ListAgentConfigurationsV1ResponseParams + from .list_agent_variables_v1response import ListAgentVariablesV1ResponseParams + from .list_billing_fields_v1response import ListBillingFieldsV1ResponseParams + from .list_models_v1response import ListModelsV1ResponseParams + from .list_models_v1response_stt_models import ListModelsV1ResponseSttModelsParams + from .list_models_v1response_tts_models import ListModelsV1ResponseTtsModelsParams + from .list_models_v1response_tts_models_metadata import ListModelsV1ResponseTtsModelsMetadataParams + from .list_project_balances_v1response import ListProjectBalancesV1ResponseParams + from .list_project_balances_v1response_balances_item import ListProjectBalancesV1ResponseBalancesItemParams + from .list_project_distribution_credentials_v1response import ListProjectDistributionCredentialsV1ResponseParams + from .list_project_distribution_credentials_v1response_distribution_credentials_item import ( + ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemParams, + ) + from .list_project_distribution_credentials_v1response_distribution_credentials_item_distribution_credentials import ( + ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentialsParams, + ) + from .list_project_distribution_credentials_v1response_distribution_credentials_item_member import ( + ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMemberParams, + ) + from .list_project_invites_v1response import ListProjectInvitesV1ResponseParams + from .list_project_invites_v1response_invites_item import ListProjectInvitesV1ResponseInvitesItemParams + from .list_project_keys_v1response import ListProjectKeysV1ResponseParams + from .list_project_keys_v1response_api_keys_item import ListProjectKeysV1ResponseApiKeysItemParams + from .list_project_keys_v1response_api_keys_item_api_key import ListProjectKeysV1ResponseApiKeysItemApiKeyParams + from .list_project_keys_v1response_api_keys_item_member import ListProjectKeysV1ResponseApiKeysItemMemberParams + from .list_project_member_scopes_v1response import ListProjectMemberScopesV1ResponseParams + from .list_project_members_v1response import ListProjectMembersV1ResponseParams + from .list_project_members_v1response_members_item import ListProjectMembersV1ResponseMembersItemParams + from .list_project_purchases_v1response import ListProjectPurchasesV1ResponseParams + from .list_project_purchases_v1response_orders_item import ListProjectPurchasesV1ResponseOrdersItemParams + from .list_project_requests_v1response import ListProjectRequestsV1ResponseParams + from .list_projects_v1response import ListProjectsV1ResponseParams + from .list_projects_v1response_projects_item import ListProjectsV1ResponseProjectsItemParams + from .listen_v1accepted_response import ListenV1AcceptedResponseParams + from .listen_v1language_hint import ListenV1LanguageHintParams + from .listen_v1response import ListenV1ResponseParams + from .listen_v1response_metadata import ListenV1ResponseMetadataParams + from .listen_v1response_metadata_diarize_info import ListenV1ResponseMetadataDiarizeInfoParams + from .listen_v1response_metadata_intents_info import ListenV1ResponseMetadataIntentsInfoParams + from .listen_v1response_metadata_sentiment_info import ListenV1ResponseMetadataSentimentInfoParams + from .listen_v1response_metadata_summary_info import ListenV1ResponseMetadataSummaryInfoParams + from .listen_v1response_metadata_topics_info import ListenV1ResponseMetadataTopicsInfoParams + from .listen_v1response_results import ListenV1ResponseResultsParams + from .listen_v1response_results_channels import ListenV1ResponseResultsChannelsParams + from .listen_v1response_results_channels_item import ListenV1ResponseResultsChannelsItemParams + from .listen_v1response_results_channels_item_alternatives_item import ( + ListenV1ResponseResultsChannelsItemAlternativesItemParams, + ) + from .listen_v1response_results_channels_item_alternatives_item_entities_item import ( + ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItemParams, + ) + from .listen_v1response_results_channels_item_alternatives_item_paragraphs import ( + ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParams, + ) + from .listen_v1response_results_channels_item_alternatives_item_paragraphs_paragraphs_item import ( + ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemParams, + ) + from .listen_v1response_results_channels_item_alternatives_item_paragraphs_paragraphs_item_sentences_item import ( + ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItemParams, + ) + from .listen_v1response_results_channels_item_alternatives_item_summaries_item import ( + ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItemParams, + ) + from .listen_v1response_results_channels_item_alternatives_item_topics_item import ( + ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItemParams, + ) + from .listen_v1response_results_channels_item_alternatives_item_words_item import ( + ListenV1ResponseResultsChannelsItemAlternativesItemWordsItemParams, + ) + from .listen_v1response_results_channels_item_search_item import ListenV1ResponseResultsChannelsItemSearchItemParams + from .listen_v1response_results_channels_item_search_item_hits_item import ( + ListenV1ResponseResultsChannelsItemSearchItemHitsItemParams, + ) + from .listen_v1response_results_summary import ListenV1ResponseResultsSummaryParams + from .listen_v1response_results_utterances import ListenV1ResponseResultsUtterancesParams + from .listen_v1response_results_utterances_item import ListenV1ResponseResultsUtterancesItemParams + from .listen_v1response_results_utterances_item_words_item import ( + ListenV1ResponseResultsUtterancesItemWordsItemParams, + ) + from .listen_v2keyterm import ListenV2KeytermParams + from .listen_v2language_hint import ListenV2LanguageHintParams + from .nvidia import NvidiaParams + from .open_ai_speak_provider import OpenAiSpeakProviderParams + from .open_ai_think_provider import OpenAiThinkProviderParams + from .project_request_response import ProjectRequestResponseParams + from .read_v1request import ReadV1RequestParams + from .read_v1request_text import ReadV1RequestTextParams + from .read_v1request_url import ReadV1RequestUrlParams + from .read_v1response import ReadV1ResponseParams + from .read_v1response_metadata import ReadV1ResponseMetadataParams + from .read_v1response_metadata_metadata import ReadV1ResponseMetadataMetadataParams + from .read_v1response_metadata_metadata_intents_info import ReadV1ResponseMetadataMetadataIntentsInfoParams + from .read_v1response_metadata_metadata_sentiment_info import ReadV1ResponseMetadataMetadataSentimentInfoParams + from .read_v1response_metadata_metadata_summary_info import ReadV1ResponseMetadataMetadataSummaryInfoParams + from .read_v1response_metadata_metadata_topics_info import ReadV1ResponseMetadataMetadataTopicsInfoParams + from .read_v1response_results import ReadV1ResponseResultsParams + from .read_v1response_results_summary import ReadV1ResponseResultsSummaryParams + from .read_v1response_results_summary_results import ReadV1ResponseResultsSummaryResultsParams + from .read_v1response_results_summary_results_summary import ReadV1ResponseResultsSummaryResultsSummaryParams + from .shared_intents import SharedIntentsParams + from .shared_intents_segments_item import SharedIntentsSegmentsItemParams + from .shared_intents_segments_item_intents_item import SharedIntentsSegmentsItemIntentsItemParams + from .shared_sentiments import SharedSentimentsParams + from .shared_sentiments_average import SharedSentimentsAverageParams + from .shared_sentiments_segments_item import SharedSentimentsSegmentsItemParams + from .shared_topics import SharedTopicsParams + from .shared_topics_segments_item import SharedTopicsSegmentsItemParams + from .shared_topics_segments_item_topics_item import SharedTopicsSegmentsItemTopicsItemParams + from .speak_settings_v1 import SpeakSettingsV1Params + from .speak_settings_v1endpoint import SpeakSettingsV1EndpointParams + from .speak_settings_v1provider import ( + SpeakSettingsV1ProviderParams, + SpeakSettingsV1Provider_AwsPollyParams, + SpeakSettingsV1Provider_CartesiaParams, + SpeakSettingsV1Provider_DeepgramParams, + SpeakSettingsV1Provider_ElevenLabsParams, + SpeakSettingsV1Provider_OpenAiParams, + ) + from .speak_v2accepted_response import SpeakV2AcceptedResponseParams + from .think_live_settings_v1 import ThinkLiveSettingsV1Params + from .think_settings_v1 import ThinkSettingsV1Params + from .think_settings_v1context_length import ThinkSettingsV1ContextLengthParams + from .think_settings_v1endpoint import ThinkSettingsV1EndpointParams + from .think_settings_v1functions_item import ThinkSettingsV1FunctionsItemParams + from .think_settings_v1functions_item_endpoint import ThinkSettingsV1FunctionsItemEndpointParams + from .think_settings_v1provider import ( + ThinkSettingsV1ProviderParams, + ThinkSettingsV1Provider_AnthropicParams, + ThinkSettingsV1Provider_AwsBedrockParams, + ThinkSettingsV1Provider_DeepgramParams, + ThinkSettingsV1Provider_GoogleParams, + ThinkSettingsV1Provider_GroqParams, + ThinkSettingsV1Provider_NvidiaParams, + ThinkSettingsV1Provider_OpenAiParams, + ) + from .update_project_member_scopes_v1response import UpdateProjectMemberScopesV1ResponseParams + from .update_project_v1response import UpdateProjectV1ResponseParams + from .usage_breakdown_v1response import UsageBreakdownV1ResponseParams + from .usage_breakdown_v1response_resolution import UsageBreakdownV1ResponseResolutionParams + from .usage_breakdown_v1response_results_item import UsageBreakdownV1ResponseResultsItemParams + from .usage_breakdown_v1response_results_item_grouping import UsageBreakdownV1ResponseResultsItemGroupingParams + from .usage_fields_v1response import UsageFieldsV1ResponseParams + from .usage_fields_v1response_models_item import UsageFieldsV1ResponseModelsItemParams + from .usage_v1response import UsageV1ResponseParams + from .usage_v1response_resolution import UsageV1ResponseResolutionParams +_dynamic_imports: typing.Dict[str, str] = { + "AgentConfigurationV1Params": ".agent_configuration_v1", + "AgentThinkModelsV1ResponseModelsItemIdParams": ".agent_think_models_v1response_models_item_id", + "AgentThinkModelsV1ResponseModelsItemOneParams": ".agent_think_models_v1response_models_item_one", + "AgentThinkModelsV1ResponseModelsItemParams": ".agent_think_models_v1response_models_item", + "AgentThinkModelsV1ResponseModelsItemThreeParams": ".agent_think_models_v1response_models_item_three", + "AgentThinkModelsV1ResponseModelsItemTwoParams": ".agent_think_models_v1response_models_item_two", + "AgentThinkModelsV1ResponseModelsItemZeroParams": ".agent_think_models_v1response_models_item_zero", + "AgentThinkModelsV1ResponseParams": ".agent_think_models_v1response", + "AgentVariableV1Params": ".agent_variable_v1", + "AnthropicParams": ".anthropic", + "AwsBedrockThinkProviderCredentialsParams": ".aws_bedrock_think_provider_credentials", + "AwsBedrockThinkProviderParams": ".aws_bedrock_think_provider", + "AwsPollySpeakProviderCredentialsParams": ".aws_polly_speak_provider_credentials", + "AwsPollySpeakProviderParams": ".aws_polly_speak_provider", + "BillingBreakdownV1ResponseParams": ".billing_breakdown_v1response", + "BillingBreakdownV1ResponseResolutionParams": ".billing_breakdown_v1response_resolution", + "BillingBreakdownV1ResponseResultsItemGroupingParams": ".billing_breakdown_v1response_results_item_grouping", + "BillingBreakdownV1ResponseResultsItemParams": ".billing_breakdown_v1response_results_item", + "CartesiaParams": ".cartesia", + "CartesiaVoiceParams": ".cartesia_voice", + "CreateAgentConfigurationV1ResponseParams": ".create_agent_configuration_v1response", + "CreateKeyV1RequestParams": ".create_key_v1request", + "CreateKeyV1ResponseParams": ".create_key_v1response", + "CreateProjectDistributionCredentialsV1ResponseDistributionCredentialsParams": ".create_project_distribution_credentials_v1response_distribution_credentials", + "CreateProjectDistributionCredentialsV1ResponseMemberParams": ".create_project_distribution_credentials_v1response_member", + "CreateProjectDistributionCredentialsV1ResponseParams": ".create_project_distribution_credentials_v1response", + "CreateProjectInviteV1ResponseParams": ".create_project_invite_v1response", + "DeepgramListenProviderV1Params": ".deepgram_listen_provider_v1", + "DeepgramListenProviderV2Params": ".deepgram_listen_provider_v2", + "DeepgramParams": ".deepgram", + "DeepgramThinkLiveProviderV1Params": ".deepgram_think_live_provider_v1", + "DeepgramThinkProviderParams": ".deepgram_think_provider", + "DeleteProjectInviteV1ResponseParams": ".delete_project_invite_v1response", + "DeleteProjectKeyV1ResponseParams": ".delete_project_key_v1response", + "DeleteProjectMemberV1ResponseParams": ".delete_project_member_v1response", + "DeleteProjectV1ResponseParams": ".delete_project_v1response", + "ElevenLabsSpeakProviderParams": ".eleven_labs_speak_provider", + "ErrorResponseLegacyErrorParams": ".error_response_legacy_error", + "ErrorResponseModernErrorParams": ".error_response_modern_error", + "ErrorResponseParams": ".error_response", + "GetModelV1ResponseBatchParams": ".get_model_v1response_batch", + "GetModelV1ResponseMetadataMetadataParams": ".get_model_v1response_metadata_metadata", + "GetModelV1ResponseMetadataParams": ".get_model_v1response_metadata", + "GetModelV1ResponseParams": ".get_model_v1response", + "GetProjectBalanceV1ResponseParams": ".get_project_balance_v1response", + "GetProjectDistributionCredentialsV1ResponseDistributionCredentialsParams": ".get_project_distribution_credentials_v1response_distribution_credentials", + "GetProjectDistributionCredentialsV1ResponseMemberParams": ".get_project_distribution_credentials_v1response_member", + "GetProjectDistributionCredentialsV1ResponseParams": ".get_project_distribution_credentials_v1response", + "GetProjectKeyV1ResponseItemMemberApiKeyParams": ".get_project_key_v1response_item_member_api_key", + "GetProjectKeyV1ResponseItemMemberParams": ".get_project_key_v1response_item_member", + "GetProjectKeyV1ResponseItemParams": ".get_project_key_v1response_item", + "GetProjectKeyV1ResponseParams": ".get_project_key_v1response", + "GetProjectRequestV1ResponseParams": ".get_project_request_v1response", + "GetProjectV1ResponseParams": ".get_project_v1response", + "GoogleParams": ".google", + "GrantV1ResponseParams": ".grant_v1response", + "GroqParams": ".groq", + "LeaveProjectV1ResponseParams": ".leave_project_v1response", + "ListAgentConfigurationsV1ResponseParams": ".list_agent_configurations_v1response", + "ListAgentVariablesV1ResponseParams": ".list_agent_variables_v1response", + "ListBillingFieldsV1ResponseParams": ".list_billing_fields_v1response", + "ListModelsV1ResponseParams": ".list_models_v1response", + "ListModelsV1ResponseSttModelsParams": ".list_models_v1response_stt_models", + "ListModelsV1ResponseTtsModelsMetadataParams": ".list_models_v1response_tts_models_metadata", + "ListModelsV1ResponseTtsModelsParams": ".list_models_v1response_tts_models", + "ListProjectBalancesV1ResponseBalancesItemParams": ".list_project_balances_v1response_balances_item", + "ListProjectBalancesV1ResponseParams": ".list_project_balances_v1response", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentialsParams": ".list_project_distribution_credentials_v1response_distribution_credentials_item_distribution_credentials", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMemberParams": ".list_project_distribution_credentials_v1response_distribution_credentials_item_member", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemParams": ".list_project_distribution_credentials_v1response_distribution_credentials_item", + "ListProjectDistributionCredentialsV1ResponseParams": ".list_project_distribution_credentials_v1response", + "ListProjectInvitesV1ResponseInvitesItemParams": ".list_project_invites_v1response_invites_item", + "ListProjectInvitesV1ResponseParams": ".list_project_invites_v1response", + "ListProjectKeysV1ResponseApiKeysItemApiKeyParams": ".list_project_keys_v1response_api_keys_item_api_key", + "ListProjectKeysV1ResponseApiKeysItemMemberParams": ".list_project_keys_v1response_api_keys_item_member", + "ListProjectKeysV1ResponseApiKeysItemParams": ".list_project_keys_v1response_api_keys_item", + "ListProjectKeysV1ResponseParams": ".list_project_keys_v1response", + "ListProjectMemberScopesV1ResponseParams": ".list_project_member_scopes_v1response", + "ListProjectMembersV1ResponseMembersItemParams": ".list_project_members_v1response_members_item", + "ListProjectMembersV1ResponseParams": ".list_project_members_v1response", + "ListProjectPurchasesV1ResponseOrdersItemParams": ".list_project_purchases_v1response_orders_item", + "ListProjectPurchasesV1ResponseParams": ".list_project_purchases_v1response", + "ListProjectRequestsV1ResponseParams": ".list_project_requests_v1response", + "ListProjectsV1ResponseParams": ".list_projects_v1response", + "ListProjectsV1ResponseProjectsItemParams": ".list_projects_v1response_projects_item", + "ListenV1AcceptedResponseParams": ".listen_v1accepted_response", + "ListenV1LanguageHintParams": ".listen_v1language_hint", + "ListenV1ResponseMetadataDiarizeInfoParams": ".listen_v1response_metadata_diarize_info", + "ListenV1ResponseMetadataIntentsInfoParams": ".listen_v1response_metadata_intents_info", + "ListenV1ResponseMetadataParams": ".listen_v1response_metadata", + "ListenV1ResponseMetadataSentimentInfoParams": ".listen_v1response_metadata_sentiment_info", + "ListenV1ResponseMetadataSummaryInfoParams": ".listen_v1response_metadata_summary_info", + "ListenV1ResponseMetadataTopicsInfoParams": ".listen_v1response_metadata_topics_info", + "ListenV1ResponseParams": ".listen_v1response", + "ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItemParams": ".listen_v1response_results_channels_item_alternatives_item_entities_item", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemParams": ".listen_v1response_results_channels_item_alternatives_item_paragraphs_paragraphs_item", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItemParams": ".listen_v1response_results_channels_item_alternatives_item_paragraphs_paragraphs_item_sentences_item", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParams": ".listen_v1response_results_channels_item_alternatives_item_paragraphs", + "ListenV1ResponseResultsChannelsItemAlternativesItemParams": ".listen_v1response_results_channels_item_alternatives_item", + "ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItemParams": ".listen_v1response_results_channels_item_alternatives_item_summaries_item", + "ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItemParams": ".listen_v1response_results_channels_item_alternatives_item_topics_item", + "ListenV1ResponseResultsChannelsItemAlternativesItemWordsItemParams": ".listen_v1response_results_channels_item_alternatives_item_words_item", + "ListenV1ResponseResultsChannelsItemParams": ".listen_v1response_results_channels_item", + "ListenV1ResponseResultsChannelsItemSearchItemHitsItemParams": ".listen_v1response_results_channels_item_search_item_hits_item", + "ListenV1ResponseResultsChannelsItemSearchItemParams": ".listen_v1response_results_channels_item_search_item", + "ListenV1ResponseResultsChannelsParams": ".listen_v1response_results_channels", + "ListenV1ResponseResultsParams": ".listen_v1response_results", + "ListenV1ResponseResultsSummaryParams": ".listen_v1response_results_summary", + "ListenV1ResponseResultsUtterancesItemParams": ".listen_v1response_results_utterances_item", + "ListenV1ResponseResultsUtterancesItemWordsItemParams": ".listen_v1response_results_utterances_item_words_item", + "ListenV1ResponseResultsUtterancesParams": ".listen_v1response_results_utterances", + "ListenV2KeytermParams": ".listen_v2keyterm", + "ListenV2LanguageHintParams": ".listen_v2language_hint", + "NvidiaParams": ".nvidia", + "OpenAiSpeakProviderParams": ".open_ai_speak_provider", + "OpenAiThinkProviderParams": ".open_ai_think_provider", + "ProjectRequestResponseParams": ".project_request_response", + "ReadV1RequestParams": ".read_v1request", + "ReadV1RequestTextParams": ".read_v1request_text", + "ReadV1RequestUrlParams": ".read_v1request_url", + "ReadV1ResponseMetadataMetadataIntentsInfoParams": ".read_v1response_metadata_metadata_intents_info", + "ReadV1ResponseMetadataMetadataParams": ".read_v1response_metadata_metadata", + "ReadV1ResponseMetadataMetadataSentimentInfoParams": ".read_v1response_metadata_metadata_sentiment_info", + "ReadV1ResponseMetadataMetadataSummaryInfoParams": ".read_v1response_metadata_metadata_summary_info", + "ReadV1ResponseMetadataMetadataTopicsInfoParams": ".read_v1response_metadata_metadata_topics_info", + "ReadV1ResponseMetadataParams": ".read_v1response_metadata", + "ReadV1ResponseParams": ".read_v1response", + "ReadV1ResponseResultsParams": ".read_v1response_results", + "ReadV1ResponseResultsSummaryParams": ".read_v1response_results_summary", + "ReadV1ResponseResultsSummaryResultsParams": ".read_v1response_results_summary_results", + "ReadV1ResponseResultsSummaryResultsSummaryParams": ".read_v1response_results_summary_results_summary", + "SharedIntentsParams": ".shared_intents", + "SharedIntentsSegmentsItemIntentsItemParams": ".shared_intents_segments_item_intents_item", + "SharedIntentsSegmentsItemParams": ".shared_intents_segments_item", + "SharedSentimentsAverageParams": ".shared_sentiments_average", + "SharedSentimentsParams": ".shared_sentiments", + "SharedSentimentsSegmentsItemParams": ".shared_sentiments_segments_item", + "SharedTopicsParams": ".shared_topics", + "SharedTopicsSegmentsItemParams": ".shared_topics_segments_item", + "SharedTopicsSegmentsItemTopicsItemParams": ".shared_topics_segments_item_topics_item", + "SpeakSettingsV1EndpointParams": ".speak_settings_v1endpoint", + "SpeakSettingsV1Params": ".speak_settings_v1", + "SpeakSettingsV1ProviderParams": ".speak_settings_v1provider", + "SpeakSettingsV1Provider_AwsPollyParams": ".speak_settings_v1provider", + "SpeakSettingsV1Provider_CartesiaParams": ".speak_settings_v1provider", + "SpeakSettingsV1Provider_DeepgramParams": ".speak_settings_v1provider", + "SpeakSettingsV1Provider_ElevenLabsParams": ".speak_settings_v1provider", + "SpeakSettingsV1Provider_OpenAiParams": ".speak_settings_v1provider", + "SpeakV2AcceptedResponseParams": ".speak_v2accepted_response", + "ThinkLiveSettingsV1Params": ".think_live_settings_v1", + "ThinkSettingsV1ContextLengthParams": ".think_settings_v1context_length", + "ThinkSettingsV1EndpointParams": ".think_settings_v1endpoint", + "ThinkSettingsV1FunctionsItemEndpointParams": ".think_settings_v1functions_item_endpoint", + "ThinkSettingsV1FunctionsItemParams": ".think_settings_v1functions_item", + "ThinkSettingsV1Params": ".think_settings_v1", + "ThinkSettingsV1ProviderParams": ".think_settings_v1provider", + "ThinkSettingsV1Provider_AnthropicParams": ".think_settings_v1provider", + "ThinkSettingsV1Provider_AwsBedrockParams": ".think_settings_v1provider", + "ThinkSettingsV1Provider_DeepgramParams": ".think_settings_v1provider", + "ThinkSettingsV1Provider_GoogleParams": ".think_settings_v1provider", + "ThinkSettingsV1Provider_GroqParams": ".think_settings_v1provider", + "ThinkSettingsV1Provider_NvidiaParams": ".think_settings_v1provider", + "ThinkSettingsV1Provider_OpenAiParams": ".think_settings_v1provider", + "UpdateProjectMemberScopesV1ResponseParams": ".update_project_member_scopes_v1response", + "UpdateProjectV1ResponseParams": ".update_project_v1response", + "UsageBreakdownV1ResponseParams": ".usage_breakdown_v1response", + "UsageBreakdownV1ResponseResolutionParams": ".usage_breakdown_v1response_resolution", + "UsageBreakdownV1ResponseResultsItemGroupingParams": ".usage_breakdown_v1response_results_item_grouping", + "UsageBreakdownV1ResponseResultsItemParams": ".usage_breakdown_v1response_results_item", + "UsageFieldsV1ResponseModelsItemParams": ".usage_fields_v1response_models_item", + "UsageFieldsV1ResponseParams": ".usage_fields_v1response", + "UsageV1ResponseParams": ".usage_v1response", + "UsageV1ResponseResolutionParams": ".usage_v1response_resolution", +} + +_dynamic_imports.update( + { + "SharedIntentsResultsParams": ".shared_intents_results", + "SharedIntentsResultsIntentsParams": ".shared_intents_results_intents", + "SharedIntentsResultsIntentsSegmentsItemParams": ".shared_intents_results_intents_segments_item", + "SharedIntentsResultsIntentsSegmentsItemIntentsItemParams": ".shared_intents_results_intents_segments_item_intents_item", + "SharedTopicsResultsParams": ".shared_topics_results", + "SharedTopicsResultsTopicsParams": ".shared_topics_results_topics", + "SharedTopicsResultsTopicsSegmentsItemParams": ".shared_topics_results_topics_segments_item", + "SharedTopicsResultsTopicsSegmentsItemTopicsItemParams": ".shared_topics_results_topics_segments_item_topics_item", + "CartesiaSpeakProviderVoiceParams": ".cartesia_speak_provider_voice", + "CreateKeyV1RequestOneParams": ".create_key_v1request_one", + "DeepgramListenProviderV2LanguageHintParams": ".deepgram_listen_provider_v2language_hint", + } +) + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "AgentConfigurationV1Params", + "AgentThinkModelsV1ResponseModelsItemIdParams", + "AgentThinkModelsV1ResponseModelsItemOneParams", + "AgentThinkModelsV1ResponseModelsItemParams", + "AgentThinkModelsV1ResponseModelsItemThreeParams", + "AgentThinkModelsV1ResponseModelsItemTwoParams", + "AgentThinkModelsV1ResponseModelsItemZeroParams", + "AgentThinkModelsV1ResponseParams", + "AgentVariableV1Params", + "AnthropicParams", + "AwsBedrockThinkProviderCredentialsParams", + "AwsBedrockThinkProviderParams", + "AwsPollySpeakProviderCredentialsParams", + "AwsPollySpeakProviderParams", + "BillingBreakdownV1ResponseParams", + "BillingBreakdownV1ResponseResolutionParams", + "BillingBreakdownV1ResponseResultsItemGroupingParams", + "BillingBreakdownV1ResponseResultsItemParams", + "CartesiaParams", + "CartesiaVoiceParams", + "CreateAgentConfigurationV1ResponseParams", + "CreateKeyV1RequestParams", + "CreateKeyV1ResponseParams", + "CreateProjectDistributionCredentialsV1ResponseDistributionCredentialsParams", + "CreateProjectDistributionCredentialsV1ResponseMemberParams", + "CreateProjectDistributionCredentialsV1ResponseParams", + "CreateProjectInviteV1ResponseParams", + "DeepgramListenProviderV1Params", + "DeepgramListenProviderV2Params", + "DeepgramParams", + "DeepgramThinkLiveProviderV1Params", + "DeepgramThinkProviderParams", + "DeleteProjectInviteV1ResponseParams", + "DeleteProjectKeyV1ResponseParams", + "DeleteProjectMemberV1ResponseParams", + "DeleteProjectV1ResponseParams", + "ElevenLabsSpeakProviderParams", + "ErrorResponseLegacyErrorParams", + "ErrorResponseModernErrorParams", + "ErrorResponseParams", + "GetModelV1ResponseBatchParams", + "GetModelV1ResponseMetadataMetadataParams", + "GetModelV1ResponseMetadataParams", + "GetModelV1ResponseParams", + "GetProjectBalanceV1ResponseParams", + "GetProjectDistributionCredentialsV1ResponseDistributionCredentialsParams", + "GetProjectDistributionCredentialsV1ResponseMemberParams", + "GetProjectDistributionCredentialsV1ResponseParams", + "GetProjectKeyV1ResponseItemMemberApiKeyParams", + "GetProjectKeyV1ResponseItemMemberParams", + "GetProjectKeyV1ResponseItemParams", + "GetProjectKeyV1ResponseParams", + "GetProjectRequestV1ResponseParams", + "GetProjectV1ResponseParams", + "GoogleParams", + "GrantV1ResponseParams", + "GroqParams", + "LeaveProjectV1ResponseParams", + "ListAgentConfigurationsV1ResponseParams", + "ListAgentVariablesV1ResponseParams", + "ListBillingFieldsV1ResponseParams", + "ListModelsV1ResponseParams", + "ListModelsV1ResponseSttModelsParams", + "ListModelsV1ResponseTtsModelsMetadataParams", + "ListModelsV1ResponseTtsModelsParams", + "ListProjectBalancesV1ResponseBalancesItemParams", + "ListProjectBalancesV1ResponseParams", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentialsParams", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMemberParams", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemParams", + "ListProjectDistributionCredentialsV1ResponseParams", + "ListProjectInvitesV1ResponseInvitesItemParams", + "ListProjectInvitesV1ResponseParams", + "ListProjectKeysV1ResponseApiKeysItemApiKeyParams", + "ListProjectKeysV1ResponseApiKeysItemMemberParams", + "ListProjectKeysV1ResponseApiKeysItemParams", + "ListProjectKeysV1ResponseParams", + "ListProjectMemberScopesV1ResponseParams", + "ListProjectMembersV1ResponseMembersItemParams", + "ListProjectMembersV1ResponseParams", + "ListProjectPurchasesV1ResponseOrdersItemParams", + "ListProjectPurchasesV1ResponseParams", + "ListProjectRequestsV1ResponseParams", + "ListProjectsV1ResponseParams", + "ListProjectsV1ResponseProjectsItemParams", + "ListenV1AcceptedResponseParams", + "ListenV1LanguageHintParams", + "ListenV1ResponseMetadataDiarizeInfoParams", + "ListenV1ResponseMetadataIntentsInfoParams", + "ListenV1ResponseMetadataParams", + "ListenV1ResponseMetadataSentimentInfoParams", + "ListenV1ResponseMetadataSummaryInfoParams", + "ListenV1ResponseMetadataTopicsInfoParams", + "ListenV1ResponseParams", + "ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItemParams", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemParams", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItemParams", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParams", + "ListenV1ResponseResultsChannelsItemAlternativesItemParams", + "ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItemParams", + "ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItemParams", + "ListenV1ResponseResultsChannelsItemAlternativesItemWordsItemParams", + "ListenV1ResponseResultsChannelsItemParams", + "ListenV1ResponseResultsChannelsItemSearchItemHitsItemParams", + "ListenV1ResponseResultsChannelsItemSearchItemParams", + "ListenV1ResponseResultsChannelsParams", + "ListenV1ResponseResultsParams", + "ListenV1ResponseResultsSummaryParams", + "ListenV1ResponseResultsUtterancesItemParams", + "ListenV1ResponseResultsUtterancesItemWordsItemParams", + "ListenV1ResponseResultsUtterancesParams", + "ListenV2KeytermParams", + "ListenV2LanguageHintParams", + "NvidiaParams", + "OpenAiSpeakProviderParams", + "OpenAiThinkProviderParams", + "ProjectRequestResponseParams", + "ReadV1RequestParams", + "ReadV1RequestTextParams", + "ReadV1RequestUrlParams", + "ReadV1ResponseMetadataMetadataIntentsInfoParams", + "ReadV1ResponseMetadataMetadataParams", + "ReadV1ResponseMetadataMetadataSentimentInfoParams", + "ReadV1ResponseMetadataMetadataSummaryInfoParams", + "ReadV1ResponseMetadataMetadataTopicsInfoParams", + "ReadV1ResponseMetadataParams", + "ReadV1ResponseParams", + "ReadV1ResponseResultsParams", + "ReadV1ResponseResultsSummaryParams", + "ReadV1ResponseResultsSummaryResultsParams", + "ReadV1ResponseResultsSummaryResultsSummaryParams", + "SharedIntentsParams", + "SharedIntentsSegmentsItemIntentsItemParams", + "SharedIntentsSegmentsItemParams", + "SharedSentimentsAverageParams", + "SharedSentimentsParams", + "SharedSentimentsSegmentsItemParams", + "SharedTopicsParams", + "SharedTopicsSegmentsItemParams", + "SharedTopicsSegmentsItemTopicsItemParams", + "SpeakSettingsV1EndpointParams", + "SpeakSettingsV1Params", + "SpeakSettingsV1ProviderParams", + "SpeakSettingsV1Provider_AwsPollyParams", + "SpeakSettingsV1Provider_CartesiaParams", + "SpeakSettingsV1Provider_DeepgramParams", + "SpeakSettingsV1Provider_ElevenLabsParams", + "SpeakSettingsV1Provider_OpenAiParams", + "SpeakV2AcceptedResponseParams", + "ThinkLiveSettingsV1Params", + "ThinkSettingsV1ContextLengthParams", + "ThinkSettingsV1EndpointParams", + "ThinkSettingsV1FunctionsItemEndpointParams", + "ThinkSettingsV1FunctionsItemParams", + "ThinkSettingsV1Params", + "ThinkSettingsV1ProviderParams", + "ThinkSettingsV1Provider_AnthropicParams", + "ThinkSettingsV1Provider_AwsBedrockParams", + "ThinkSettingsV1Provider_DeepgramParams", + "ThinkSettingsV1Provider_GoogleParams", + "ThinkSettingsV1Provider_GroqParams", + "ThinkSettingsV1Provider_NvidiaParams", + "ThinkSettingsV1Provider_OpenAiParams", + "UpdateProjectMemberScopesV1ResponseParams", + "UpdateProjectV1ResponseParams", + "UsageBreakdownV1ResponseParams", + "UsageBreakdownV1ResponseResolutionParams", + "UsageBreakdownV1ResponseResultsItemGroupingParams", + "UsageBreakdownV1ResponseResultsItemParams", + "UsageFieldsV1ResponseModelsItemParams", + "UsageFieldsV1ResponseParams", + "UsageV1ResponseParams", + "UsageV1ResponseResolutionParams", +] + +__all__.extend( + [ + "SharedIntentsResultsParams", + "SharedIntentsResultsIntentsParams", + "SharedIntentsResultsIntentsSegmentsItemParams", + "SharedIntentsResultsIntentsSegmentsItemIntentsItemParams", + "SharedTopicsResultsParams", + "SharedTopicsResultsTopicsParams", + "SharedTopicsResultsTopicsSegmentsItemParams", + "SharedTopicsResultsTopicsSegmentsItemTopicsItemParams", + "CartesiaSpeakProviderVoiceParams", + "CreateKeyV1RequestOneParams", + "DeepgramListenProviderV2LanguageHintParams", + ] +) diff --git a/src/deepgram/requests/shared_intents.py.bak b/src/deepgram/requests/shared_intents.py.bak new file mode 100644 index 00000000..8f699d26 --- /dev/null +++ b/src/deepgram/requests/shared_intents.py.bak @@ -0,0 +1,16 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import typing_extensions +from .shared_intents_results import SharedIntentsResultsParams +from .shared_intents_segments_item import SharedIntentsSegmentsItemParams + + +class SharedIntentsParams(typing_extensions.TypedDict): + """ + Output whenever `intents=true` is used + """ + + segments: typing_extensions.NotRequired[typing.Sequence[SharedIntentsSegmentsItemParams]] + results: typing_extensions.NotRequired[SharedIntentsResultsParams] diff --git a/src/deepgram/requests/shared_topics.py.bak b/src/deepgram/requests/shared_topics.py.bak new file mode 100644 index 00000000..88c0816d --- /dev/null +++ b/src/deepgram/requests/shared_topics.py.bak @@ -0,0 +1,16 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import typing_extensions +from .shared_topics_results import SharedTopicsResultsParams +from .shared_topics_segments_item import SharedTopicsSegmentsItemParams + + +class SharedTopicsParams(typing_extensions.TypedDict): + """ + Output whenever `topics=true` is used + """ + + segments: typing_extensions.NotRequired[typing.Sequence[SharedTopicsSegmentsItemParams]] + results: typing_extensions.NotRequired[SharedTopicsResultsParams] diff --git a/src/deepgram/speak/v1/socket_client.py.bak b/src/deepgram/speak/v1/socket_client.py.bak new file mode 100644 index 00000000..f268acb4 --- /dev/null +++ b/src/deepgram/speak/v1/socket_client.py.bak @@ -0,0 +1,237 @@ +# This file was auto-generated by Fern from our API Definition. + +import json +import logging +import typing + +import websockets.sync.connection as websockets_sync_connection +from ...core.events import EventEmitterMixin, EventType +from ...core.unchecked_base_model import construct_type +from .types.speak_v1clear import SpeakV1Clear +from .types.speak_v1cleared import SpeakV1Cleared +from .types.speak_v1close import SpeakV1Close +from .types.speak_v1flush import SpeakV1Flush +from .types.speak_v1flushed import SpeakV1Flushed +from .types.speak_v1metadata import SpeakV1Metadata +from .types.speak_v1text import SpeakV1Text +from .types.speak_v1warning import SpeakV1Warning + +try: + from websockets.legacy.client import WebSocketClientProtocol # type: ignore +except ImportError: + from websockets import WebSocketClientProtocol # type: ignore + +_logger = logging.getLogger(__name__) +V1SocketClientResponse = typing.Union[ + bytes, SpeakV1Metadata, SpeakV1Flushed, SpeakV1Cleared, SpeakV1Warning, typing.Dict[str, typing.Any] +] + + +class AsyncV1SocketClient(EventEmitterMixin): + def __init__(self, *, websocket: WebSocketClientProtocol): + super().__init__() + self._websocket = websocket + + async def __aiter__(self) -> typing.AsyncIterator[V1SocketClientResponse]: + async for message in self._websocket: + if isinstance(message, bytes): + yield message # type: ignore + else: + try: + yield construct_type(type_=V1SocketClientResponse, object_=json.loads(message)) # type: ignore + except Exception: + _logger.warning( + "Skipping unknown WebSocket message; update your SDK version to support new message types." + ) + continue + + async def start_listening(self): + """ + Start listening for messages on the websocket connection. + + Emits events in the following order: + - EventType.OPEN when connection is established + - EventType.MESSAGE for each message received + - EventType.ERROR if an error occurs + - EventType.CLOSE when connection is closed + """ + await self._emit_async(EventType.OPEN, None) + try: + async for raw_message in self._websocket: + if isinstance(raw_message, bytes): + parsed = raw_message + else: + json_data = json.loads(raw_message) + try: + parsed = construct_type(type_=V1SocketClientResponse, object_=json_data) # type: ignore + except Exception: + _logger.warning( + "Skipping unknown WebSocket message; update your SDK version to support new message types." + ) + continue + await self._emit_async(EventType.MESSAGE, parsed) + except Exception as exc: + await self._emit_async(EventType.ERROR, exc) + finally: + await self._emit_async(EventType.CLOSE, None) + + async def send_text(self, message: SpeakV1Text) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a SpeakV1Text. + """ + await self._send_model(message) + + async def send_flush(self, message: typing.Optional[SpeakV1Flush] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a SpeakV1Flush. + """ + await self._send_model(message or SpeakV1Flush(type="Flush")) + + async def send_clear(self, message: typing.Optional[SpeakV1Clear] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a SpeakV1Clear. + """ + await self._send_model(message or SpeakV1Clear(type="Clear")) + + async def send_close(self, message: typing.Optional[SpeakV1Close] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a SpeakV1Close. + """ + await self._send_model(message or SpeakV1Close(type="Close")) + + async def recv(self) -> V1SocketClientResponse: + """ + Receive a message from the websocket connection. + """ + data = await self._websocket.recv() + if isinstance(data, bytes): + return data # type: ignore + json_data = json.loads(data) + try: + return construct_type(type_=V1SocketClientResponse, object_=json_data) # type: ignore + except Exception: + _logger.warning("Skipping unknown WebSocket message; update your SDK version to support new message types.") + return json_data # type: ignore + + async def _send(self, data: typing.Any) -> None: + """ + Send a message to the websocket connection. + """ + if isinstance(data, dict): + data = json.dumps(data) + await self._websocket.send(data) + + async def _send_model(self, data: typing.Any) -> None: + """ + Send a Pydantic model to the websocket connection. + """ + await self._send(data.dict()) + + +class V1SocketClient(EventEmitterMixin): + def __init__(self, *, websocket: websockets_sync_connection.Connection): + super().__init__() + self._websocket = websocket + + def __iter__(self) -> typing.Iterator[V1SocketClientResponse]: + for message in self._websocket: + if isinstance(message, bytes): + yield message # type: ignore + else: + try: + yield construct_type(type_=V1SocketClientResponse, object_=json.loads(message)) # type: ignore + except Exception: + _logger.warning( + "Skipping unknown WebSocket message; update your SDK version to support new message types." + ) + continue + + def start_listening(self): + """ + Start listening for messages on the websocket connection. + + Emits events in the following order: + - EventType.OPEN when connection is established + - EventType.MESSAGE for each message received + - EventType.ERROR if an error occurs + - EventType.CLOSE when connection is closed + """ + self._emit(EventType.OPEN, None) + try: + for raw_message in self._websocket: + if isinstance(raw_message, bytes): + parsed = raw_message + else: + json_data = json.loads(raw_message) + try: + parsed = construct_type(type_=V1SocketClientResponse, object_=json_data) # type: ignore + except Exception: + _logger.warning( + "Skipping unknown WebSocket message; update your SDK version to support new message types." + ) + continue + self._emit(EventType.MESSAGE, parsed) + except Exception as exc: + self._emit(EventType.ERROR, exc) + finally: + self._emit(EventType.CLOSE, None) + + def send_text(self, message: SpeakV1Text) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a SpeakV1Text. + """ + self._send_model(message) + + def send_flush(self, message: typing.Optional[SpeakV1Flush] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a SpeakV1Flush. + """ + self._send_model(message or SpeakV1Flush(type="Flush")) + + def send_clear(self, message: typing.Optional[SpeakV1Clear] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a SpeakV1Clear. + """ + self._send_model(message or SpeakV1Clear(type="Clear")) + + def send_close(self, message: typing.Optional[SpeakV1Close] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a SpeakV1Close. + """ + self._send_model(message or SpeakV1Close(type="Close")) + + def recv(self) -> V1SocketClientResponse: + """ + Receive a message from the websocket connection. + """ + data = self._websocket.recv() + if isinstance(data, bytes): + return data # type: ignore + json_data = json.loads(data) + try: + return construct_type(type_=V1SocketClientResponse, object_=json_data) # type: ignore + except Exception: + _logger.warning("Skipping unknown WebSocket message; update your SDK version to support new message types.") + return json_data # type: ignore + + def _send(self, data: typing.Any) -> None: + """ + Send a message to the websocket connection. + """ + if isinstance(data, dict): + data = json.dumps(data) + self._websocket.send(data) + + def _send_model(self, data: typing.Any) -> None: + """ + Send a Pydantic model to the websocket connection. + """ + self._send(data.dict()) diff --git a/src/deepgram/speak/v2/requests/speak_v2warning.py.bak b/src/deepgram/speak/v2/requests/speak_v2warning.py.bak new file mode 100644 index 00000000..6686af44 --- /dev/null +++ b/src/deepgram/speak/v2/requests/speak_v2warning.py.bak @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import typing_extensions + + +class SpeakV2WarningParams(typing_extensions.TypedDict): + type: typing.Literal["Warning"] + """ + Message type identifier + """ + + code: str + """ + Warning code identifying the condition, in `SCREAMING_SNAKE_CASE`. + + Turn-scoped codes: `NO_ACTIVE_SPEECH` (a speech-scoped message arrived with no active turn), `NO_SYNTHESIZABLE_TEXT` (the turn's text was entirely whitespace or punctuation, so it produced no audio and is completed with a zero-duration `SpeechMetadata`), and `SYNTHESIS_RETRYING` (a synthesis request failed and is being retried). + + Pronunciation codes: `PRONUNCIATION_WARNINGS` (a pronunciation override contained invalid IPA; it is still applied best-effort and counted in `pronunciations_applied`), `PRONUNCIATION_TOO_LONG` (an IPA string exceeded the length limit), `PRONUNCIATIONS_LIMIT_EXCEEDED` (too many pronunciation controls in one turn). + + Pause codes (`BREAKS_LIMIT_EXCEEDED`, `BREAK_TOKENS_OUT_OF_RANGE`, `BREAK_TOKENS_WITH_INVALID_INCREMENTS`) are reserved and not emitted: inline pause controls are batch-only, and a pause marker on the WebSocket fails the connection instead. + + Interrupt-scoped codes, each meaning the `Interrupt` was ignored: `NO_AUDIO_GENERATED` (the session has produced no audio yet, so there is nothing to interrupt), `INTERRUPT_IN_PROGRESS` (an earlier `Interrupt` is still being processed — at most one is handled at a time), `INVALID_INTERRUPT_OFFSET` (the `playback_offset` did not advance past the position a prior interrupt established). + """ + + description: str + """ + A human-readable description of the warning + """ diff --git a/src/deepgram/speak/v2/socket_client.py.bak b/src/deepgram/speak/v2/socket_client.py.bak new file mode 100644 index 00000000..57c5f8ab --- /dev/null +++ b/src/deepgram/speak/v2/socket_client.py.bak @@ -0,0 +1,269 @@ +# This file was auto-generated by Fern from our API Definition. + +import json +import logging +import typing + +import websockets.sync.connection as websockets_sync_connection +from ...core.events import EventEmitterMixin, EventType +from ...core.unchecked_base_model import construct_type +from .types.speak_v2close import SpeakV2Close +from .types.speak_v2configure import SpeakV2Configure +from .types.speak_v2configure_failure import SpeakV2ConfigureFailure +from .types.speak_v2configure_success import SpeakV2ConfigureSuccess +from .types.speak_v2connected import SpeakV2Connected +from .types.speak_v2error import SpeakV2Error +from .types.speak_v2flush import SpeakV2Flush +from .types.speak_v2flushed import SpeakV2Flushed +from .types.speak_v2interrupt import SpeakV2Interrupt +from .types.speak_v2session_metadata import SpeakV2SessionMetadata +from .types.speak_v2speak import SpeakV2Speak +from .types.speak_v2speech_interrupted import SpeakV2SpeechInterrupted +from .types.speak_v2speech_metadata import SpeakV2SpeechMetadata +from .types.speak_v2speech_started import SpeakV2SpeechStarted +from .types.speak_v2warning import SpeakV2Warning + +try: + from websockets.legacy.client import WebSocketClientProtocol # type: ignore +except ImportError: + from websockets import WebSocketClientProtocol # type: ignore + +_logger = logging.getLogger(__name__) +V2SocketClientResponse = typing.Union[ + bytes, + SpeakV2Connected, + SpeakV2SpeechStarted, + SpeakV2SpeechMetadata, + SpeakV2SpeechInterrupted, + SpeakV2Flushed, + SpeakV2SessionMetadata, + SpeakV2ConfigureSuccess, + SpeakV2ConfigureFailure, + SpeakV2Warning, + SpeakV2Error, + typing.Dict[str, typing.Any], +] + + +class AsyncV2SocketClient(EventEmitterMixin): + def __init__(self, *, websocket: WebSocketClientProtocol): + super().__init__() + self._websocket = websocket + + async def __aiter__(self) -> typing.AsyncIterator[V2SocketClientResponse]: + async for message in self._websocket: + if isinstance(message, bytes): + yield message # type: ignore + else: + try: + yield construct_type(type_=V2SocketClientResponse, object_=json.loads(message)) # type: ignore + except Exception: + _logger.warning( + "Skipping unknown WebSocket message; update your SDK version to support new message types." + ) + continue + + async def start_listening(self): + """ + Start listening for messages on the websocket connection. + + Emits events in the following order: + - EventType.OPEN when connection is established + - EventType.MESSAGE for each message received + - EventType.ERROR if an error occurs + - EventType.CLOSE when connection is closed + """ + await self._emit_async(EventType.OPEN, None) + try: + async for raw_message in self._websocket: + if isinstance(raw_message, bytes): + parsed = raw_message + else: + json_data = json.loads(raw_message) + try: + parsed = construct_type(type_=V2SocketClientResponse, object_=json_data) # type: ignore + except Exception: + _logger.warning( + "Skipping unknown WebSocket message; update your SDK version to support new message types." + ) + continue + await self._emit_async(EventType.MESSAGE, parsed) + except Exception as exc: + await self._emit_async(EventType.ERROR, exc) + finally: + await self._emit_async(EventType.CLOSE, None) + + async def send_speak(self, message: SpeakV2Speak) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a SpeakV2Speak. + """ + await self._send_model(message) + + async def send_flush(self, message: typing.Optional[SpeakV2Flush] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a SpeakV2Flush. + """ + await self._send_model(message or SpeakV2Flush(type="Flush")) + + async def send_interrupt(self, message: typing.Optional[SpeakV2Interrupt] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a SpeakV2Interrupt. + """ + await self._send_model(message or SpeakV2Interrupt(type="Interrupt")) + + async def send_configure(self, message: SpeakV2Configure) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a SpeakV2Configure. + """ + await self._send_model(message) + + async def send_close(self, message: typing.Optional[SpeakV2Close] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a SpeakV2Close. + """ + await self._send_model(message or SpeakV2Close(type="Close")) + + async def recv(self) -> V2SocketClientResponse: + """ + Receive a message from the websocket connection. + """ + data = await self._websocket.recv() + if isinstance(data, bytes): + return data # type: ignore + json_data = json.loads(data) + try: + return construct_type(type_=V2SocketClientResponse, object_=json_data) # type: ignore + except Exception: + _logger.warning("Skipping unknown WebSocket message; update your SDK version to support new message types.") + return json_data # type: ignore + + async def _send(self, data: typing.Any) -> None: + """ + Send a message to the websocket connection. + """ + if isinstance(data, dict): + data = json.dumps(data) + await self._websocket.send(data) + + async def _send_model(self, data: typing.Any) -> None: + """ + Send a Pydantic model to the websocket connection. + """ + await self._send(data.dict()) + + +class V2SocketClient(EventEmitterMixin): + def __init__(self, *, websocket: websockets_sync_connection.Connection): + super().__init__() + self._websocket = websocket + + def __iter__(self) -> typing.Iterator[V2SocketClientResponse]: + for message in self._websocket: + if isinstance(message, bytes): + yield message # type: ignore + else: + try: + yield construct_type(type_=V2SocketClientResponse, object_=json.loads(message)) # type: ignore + except Exception: + _logger.warning( + "Skipping unknown WebSocket message; update your SDK version to support new message types." + ) + continue + + def start_listening(self): + """ + Start listening for messages on the websocket connection. + + Emits events in the following order: + - EventType.OPEN when connection is established + - EventType.MESSAGE for each message received + - EventType.ERROR if an error occurs + - EventType.CLOSE when connection is closed + """ + self._emit(EventType.OPEN, None) + try: + for raw_message in self._websocket: + if isinstance(raw_message, bytes): + parsed = raw_message + else: + json_data = json.loads(raw_message) + try: + parsed = construct_type(type_=V2SocketClientResponse, object_=json_data) # type: ignore + except Exception: + _logger.warning( + "Skipping unknown WebSocket message; update your SDK version to support new message types." + ) + continue + self._emit(EventType.MESSAGE, parsed) + except Exception as exc: + self._emit(EventType.ERROR, exc) + finally: + self._emit(EventType.CLOSE, None) + + def send_speak(self, message: SpeakV2Speak) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a SpeakV2Speak. + """ + self._send_model(message) + + def send_flush(self, message: typing.Optional[SpeakV2Flush] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a SpeakV2Flush. + """ + self._send_model(message or SpeakV2Flush(type="Flush")) + + def send_interrupt(self, message: typing.Optional[SpeakV2Interrupt] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a SpeakV2Interrupt. + """ + self._send_model(message or SpeakV2Interrupt(type="Interrupt")) + + def send_configure(self, message: SpeakV2Configure) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a SpeakV2Configure. + """ + self._send_model(message) + + def send_close(self, message: typing.Optional[SpeakV2Close] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a SpeakV2Close. + """ + self._send_model(message or SpeakV2Close(type="Close")) + + def recv(self) -> V2SocketClientResponse: + """ + Receive a message from the websocket connection. + """ + data = self._websocket.recv() + if isinstance(data, bytes): + return data # type: ignore + json_data = json.loads(data) + try: + return construct_type(type_=V2SocketClientResponse, object_=json_data) # type: ignore + except Exception: + _logger.warning("Skipping unknown WebSocket message; update your SDK version to support new message types.") + return json_data # type: ignore + + def _send(self, data: typing.Any) -> None: + """ + Send a message to the websocket connection. + """ + if isinstance(data, dict): + data = json.dumps(data) + self._websocket.send(data) + + def _send_model(self, data: typing.Any) -> None: + """ + Send a Pydantic model to the websocket connection. + """ + self._send(data.dict()) diff --git a/src/deepgram/speak/v2/types/speak_v2warning.py.bak b/src/deepgram/speak/v2/types/speak_v2warning.py.bak new file mode 100644 index 00000000..ac771641 --- /dev/null +++ b/src/deepgram/speak/v2/types/speak_v2warning.py.bak @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel + + +class SpeakV2Warning(UncheckedBaseModel): + type: typing.Literal["Warning"] = pydantic.Field(default="Warning") + """ + Message type identifier + """ + + code: str = pydantic.Field() + """ + Warning code identifying the condition, in `SCREAMING_SNAKE_CASE`. + + Turn-scoped codes: `NO_ACTIVE_SPEECH` (a speech-scoped message arrived with no active turn), `NO_SYNTHESIZABLE_TEXT` (the turn's text was entirely whitespace or punctuation, so it produced no audio and is completed with a zero-duration `SpeechMetadata`), and `SYNTHESIS_RETRYING` (a synthesis request failed and is being retried). + + Pronunciation codes: `PRONUNCIATION_WARNINGS` (a pronunciation override contained invalid IPA; it is still applied best-effort and counted in `pronunciations_applied`), `PRONUNCIATION_TOO_LONG` (an IPA string exceeded the length limit), `PRONUNCIATIONS_LIMIT_EXCEEDED` (too many pronunciation controls in one turn). + + Pause codes (`BREAKS_LIMIT_EXCEEDED`, `BREAK_TOKENS_OUT_OF_RANGE`, `BREAK_TOKENS_WITH_INVALID_INCREMENTS`) are reserved and not emitted: inline pause controls are batch-only, and a pause marker on the WebSocket fails the connection instead. + + Interrupt-scoped codes, each meaning the `Interrupt` was ignored: `NO_AUDIO_GENERATED` (the session has produced no audio yet, so there is nothing to interrupt), `INTERRUPT_IN_PROGRESS` (an earlier `Interrupt` is still being processed — at most one is handled at a time), `INVALID_INTERRUPT_OFFSET` (the `playback_offset` did not advance past the position a prior interrupt established). + """ + + description: str = pydantic.Field() + """ + A human-readable description of the warning + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/deepgram/types/__init__.py.bak b/src/deepgram/types/__init__.py.bak new file mode 100644 index 00000000..fb555899 --- /dev/null +++ b/src/deepgram/types/__init__.py.bak @@ -0,0 +1,892 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .agent_configuration_v1 import AgentConfigurationV1 + from .agent_think_models_v1response import AgentThinkModelsV1Response + from .agent_think_models_v1response_models_item import AgentThinkModelsV1ResponseModelsItem + from .agent_think_models_v1response_models_item_id import AgentThinkModelsV1ResponseModelsItemId + from .agent_think_models_v1response_models_item_one import AgentThinkModelsV1ResponseModelsItemOne + from .agent_think_models_v1response_models_item_one_id import AgentThinkModelsV1ResponseModelsItemOneId + from .agent_think_models_v1response_models_item_three import AgentThinkModelsV1ResponseModelsItemThree + from .agent_think_models_v1response_models_item_two import AgentThinkModelsV1ResponseModelsItemTwo + from .agent_think_models_v1response_models_item_two_id import AgentThinkModelsV1ResponseModelsItemTwoId + from .agent_think_models_v1response_models_item_zero import AgentThinkModelsV1ResponseModelsItemZero + from .agent_think_models_v1response_models_item_zero_id import AgentThinkModelsV1ResponseModelsItemZeroId + from .agent_variable_v1 import AgentVariableV1 + from .anthropic import Anthropic + from .anthropic_model import AnthropicModel + from .aws_bedrock_think_provider import AwsBedrockThinkProvider + from .aws_bedrock_think_provider_credentials import AwsBedrockThinkProviderCredentials + from .aws_bedrock_think_provider_credentials_type import AwsBedrockThinkProviderCredentialsType + from .aws_bedrock_think_provider_model import AwsBedrockThinkProviderModel + from .aws_polly_speak_provider import AwsPollySpeakProvider + from .aws_polly_speak_provider_credentials import AwsPollySpeakProviderCredentials + from .aws_polly_speak_provider_credentials_type import AwsPollySpeakProviderCredentialsType + from .aws_polly_speak_provider_engine import AwsPollySpeakProviderEngine + from .aws_polly_speak_provider_voice import AwsPollySpeakProviderVoice + from .billing_breakdown_v1response import BillingBreakdownV1Response + from .billing_breakdown_v1response_resolution import BillingBreakdownV1ResponseResolution + from .billing_breakdown_v1response_results_item import BillingBreakdownV1ResponseResultsItem + from .billing_breakdown_v1response_results_item_grouping import BillingBreakdownV1ResponseResultsItemGrouping + from .cartesia import Cartesia + from .cartesia_model_id import CartesiaModelId + from .cartesia_voice import CartesiaVoice + from .create_agent_configuration_v1response import CreateAgentConfigurationV1Response + from .create_key_v1request import CreateKeyV1Request + from .create_key_v1response import CreateKeyV1Response + from .create_project_distribution_credentials_v1response import CreateProjectDistributionCredentialsV1Response + from .create_project_distribution_credentials_v1response_distribution_credentials import ( + CreateProjectDistributionCredentialsV1ResponseDistributionCredentials, + ) + from .create_project_distribution_credentials_v1response_member import ( + CreateProjectDistributionCredentialsV1ResponseMember, + ) + from .create_project_invite_v1response import CreateProjectInviteV1Response + from .deepgram import Deepgram + from .deepgram_listen_provider_v1 import DeepgramListenProviderV1 + from .deepgram_listen_provider_v2 import DeepgramListenProviderV2 + from .deepgram_model import DeepgramModel + from .deepgram_think_live_provider_v1 import DeepgramThinkLiveProviderV1 + from .deepgram_think_provider import DeepgramThinkProvider + from .deepgram_think_provider_model import DeepgramThinkProviderModel + from .deepgram_think_provider_reasoning_mode import DeepgramThinkProviderReasoningMode + from .delete_agent_configuration_v1response import DeleteAgentConfigurationV1Response + from .delete_agent_variable_v1response import DeleteAgentVariableV1Response + from .delete_project_invite_v1response import DeleteProjectInviteV1Response + from .delete_project_key_v1response import DeleteProjectKeyV1Response + from .delete_project_member_v1response import DeleteProjectMemberV1Response + from .delete_project_v1response import DeleteProjectV1Response + from .eleven_labs_speak_provider import ElevenLabsSpeakProvider + from .eleven_labs_speak_provider_model_id import ElevenLabsSpeakProviderModelId + from .error_response import ErrorResponse + from .error_response_legacy_error import ErrorResponseLegacyError + from .error_response_modern_error import ErrorResponseModernError + from .error_response_text_error import ErrorResponseTextError + from .get_model_v1response import GetModelV1Response + from .get_model_v1response_batch import GetModelV1ResponseBatch + from .get_model_v1response_metadata import GetModelV1ResponseMetadata + from .get_model_v1response_metadata_metadata import GetModelV1ResponseMetadataMetadata + from .get_project_balance_v1response import GetProjectBalanceV1Response + from .get_project_distribution_credentials_v1response import GetProjectDistributionCredentialsV1Response + from .get_project_distribution_credentials_v1response_distribution_credentials import ( + GetProjectDistributionCredentialsV1ResponseDistributionCredentials, + ) + from .get_project_distribution_credentials_v1response_member import ( + GetProjectDistributionCredentialsV1ResponseMember, + ) + from .get_project_key_v1response import GetProjectKeyV1Response + from .get_project_key_v1response_item import GetProjectKeyV1ResponseItem + from .get_project_key_v1response_item_member import GetProjectKeyV1ResponseItemMember + from .get_project_key_v1response_item_member_api_key import GetProjectKeyV1ResponseItemMemberApiKey + from .get_project_request_v1response import GetProjectRequestV1Response + from .get_project_v1response import GetProjectV1Response + from .google import Google + from .google_model import GoogleModel + from .google_version import GoogleVersion + from .grant_v1response import GrantV1Response + from .groq import Groq + from .groq_reasoning_mode import GroqReasoningMode + from .leave_project_v1response import LeaveProjectV1Response + from .list_agent_configurations_v1response import ListAgentConfigurationsV1Response + from .list_agent_variables_v1response import ListAgentVariablesV1Response + from .list_billing_fields_v1response import ListBillingFieldsV1Response + from .list_billing_fields_v1response_deployments_item import ListBillingFieldsV1ResponseDeploymentsItem + from .list_models_v1response import ListModelsV1Response + from .list_models_v1response_stt_models import ListModelsV1ResponseSttModels + from .list_models_v1response_tts_models import ListModelsV1ResponseTtsModels + from .list_models_v1response_tts_models_metadata import ListModelsV1ResponseTtsModelsMetadata + from .list_project_balances_v1response import ListProjectBalancesV1Response + from .list_project_balances_v1response_balances_item import ListProjectBalancesV1ResponseBalancesItem + from .list_project_distribution_credentials_v1response import ListProjectDistributionCredentialsV1Response + from .list_project_distribution_credentials_v1response_distribution_credentials_item import ( + ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem, + ) + from .list_project_distribution_credentials_v1response_distribution_credentials_item_distribution_credentials import ( + ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials, + ) + from .list_project_distribution_credentials_v1response_distribution_credentials_item_member import ( + ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember, + ) + from .list_project_invites_v1response import ListProjectInvitesV1Response + from .list_project_invites_v1response_invites_item import ListProjectInvitesV1ResponseInvitesItem + from .list_project_keys_v1response import ListProjectKeysV1Response + from .list_project_keys_v1response_api_keys_item import ListProjectKeysV1ResponseApiKeysItem + from .list_project_keys_v1response_api_keys_item_api_key import ListProjectKeysV1ResponseApiKeysItemApiKey + from .list_project_keys_v1response_api_keys_item_member import ListProjectKeysV1ResponseApiKeysItemMember + from .list_project_member_scopes_v1response import ListProjectMemberScopesV1Response + from .list_project_members_v1response import ListProjectMembersV1Response + from .list_project_members_v1response_members_item import ListProjectMembersV1ResponseMembersItem + from .list_project_purchases_v1response import ListProjectPurchasesV1Response + from .list_project_purchases_v1response_orders_item import ListProjectPurchasesV1ResponseOrdersItem + from .list_project_requests_v1response import ListProjectRequestsV1Response + from .list_projects_v1response import ListProjectsV1Response + from .list_projects_v1response_projects_item import ListProjectsV1ResponseProjectsItem + from .listen_v1accepted_response import ListenV1AcceptedResponse + from .listen_v1callback import ListenV1Callback + from .listen_v1callback_method import ListenV1CallbackMethod + from .listen_v1channels import ListenV1Channels + from .listen_v1detect_entities import ListenV1DetectEntities + from .listen_v1diarize import ListenV1Diarize + from .listen_v1dictation import ListenV1Dictation + from .listen_v1encoding import ListenV1Encoding + from .listen_v1endpointing import ListenV1Endpointing + from .listen_v1extra import ListenV1Extra + from .listen_v1interim_results import ListenV1InterimResults + from .listen_v1keyterm import ListenV1Keyterm + from .listen_v1keywords import ListenV1Keywords + from .listen_v1language import ListenV1Language + from .listen_v1language_hint import ListenV1LanguageHint + from .listen_v1mip_opt_out import ListenV1MipOptOut + from .listen_v1model import ListenV1Model + from .listen_v1multichannel import ListenV1Multichannel + from .listen_v1numerals import ListenV1Numerals + from .listen_v1profanity_filter import ListenV1ProfanityFilter + from .listen_v1punctuate import ListenV1Punctuate + from .listen_v1redact import ListenV1Redact + from .listen_v1redact_usage import ListenV1RedactUsage + from .listen_v1replace import ListenV1Replace + from .listen_v1request_file import ListenV1RequestFile + from .listen_v1response import ListenV1Response + from .listen_v1response_metadata import ListenV1ResponseMetadata + from .listen_v1response_metadata_diarize_info import ListenV1ResponseMetadataDiarizeInfo + from .listen_v1response_metadata_intents_info import ListenV1ResponseMetadataIntentsInfo + from .listen_v1response_metadata_sentiment_info import ListenV1ResponseMetadataSentimentInfo + from .listen_v1response_metadata_summary_info import ListenV1ResponseMetadataSummaryInfo + from .listen_v1response_metadata_topics_info import ListenV1ResponseMetadataTopicsInfo + from .listen_v1response_results import ListenV1ResponseResults + from .listen_v1response_results_channels import ListenV1ResponseResultsChannels + from .listen_v1response_results_channels_item import ListenV1ResponseResultsChannelsItem + from .listen_v1response_results_channels_item_alternatives_item import ( + ListenV1ResponseResultsChannelsItemAlternativesItem, + ) + from .listen_v1response_results_channels_item_alternatives_item_entities_item import ( + ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem, + ) + from .listen_v1response_results_channels_item_alternatives_item_paragraphs import ( + ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs, + ) + from .listen_v1response_results_channels_item_alternatives_item_paragraphs_paragraphs_item import ( + ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem, + ) + from .listen_v1response_results_channels_item_alternatives_item_paragraphs_paragraphs_item_sentences_item import ( + ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem, + ) + from .listen_v1response_results_channels_item_alternatives_item_summaries_item import ( + ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem, + ) + from .listen_v1response_results_channels_item_alternatives_item_topics_item import ( + ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem, + ) + from .listen_v1response_results_channels_item_alternatives_item_words_item import ( + ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem, + ) + from .listen_v1response_results_channels_item_search_item import ListenV1ResponseResultsChannelsItemSearchItem + from .listen_v1response_results_channels_item_search_item_hits_item import ( + ListenV1ResponseResultsChannelsItemSearchItemHitsItem, + ) + from .listen_v1response_results_summary import ListenV1ResponseResultsSummary + from .listen_v1response_results_utterances import ListenV1ResponseResultsUtterances + from .listen_v1response_results_utterances_item import ListenV1ResponseResultsUtterancesItem + from .listen_v1response_results_utterances_item_words_item import ListenV1ResponseResultsUtterancesItemWordsItem + from .listen_v1sample_rate import ListenV1SampleRate + from .listen_v1search import ListenV1Search + from .listen_v1smart_format import ListenV1SmartFormat + from .listen_v1tag import ListenV1Tag + from .listen_v1utterance_end_ms import ListenV1UtteranceEndMs + from .listen_v1vad_events import ListenV1VadEvents + from .listen_v1version import ListenV1Version + from .listen_v2configure_numerals import ListenV2ConfigureNumerals + from .listen_v2configure_redact_usage import ListenV2ConfigureRedactUsage + from .listen_v2eager_eot_threshold import ListenV2EagerEotThreshold + from .listen_v2encoding import ListenV2Encoding + from .listen_v2eot_threshold import ListenV2EotThreshold + from .listen_v2eot_timeout_ms import ListenV2EotTimeoutMs + from .listen_v2keyterm import ListenV2Keyterm + from .listen_v2language_hint import ListenV2LanguageHint + from .listen_v2mip_opt_out import ListenV2MipOptOut + from .listen_v2model import ListenV2Model + from .listen_v2numerals import ListenV2Numerals + from .listen_v2profanity_filter import ListenV2ProfanityFilter + from .listen_v2redact import ListenV2Redact + from .listen_v2redact_usage import ListenV2RedactUsage + from .listen_v2sample_rate import ListenV2SampleRate + from .listen_v2tag import ListenV2Tag + from .nvidia import Nvidia + from .nvidia_reasoning_mode import NvidiaReasoningMode + from .open_ai_speak_provider import OpenAiSpeakProvider + from .open_ai_speak_provider_model import OpenAiSpeakProviderModel + from .open_ai_speak_provider_voice import OpenAiSpeakProviderVoice + from .open_ai_think_provider import OpenAiThinkProvider + from .open_ai_think_provider_model import OpenAiThinkProviderModel + from .open_ai_think_provider_reasoning_mode import OpenAiThinkProviderReasoningMode + from .project_request_response import ProjectRequestResponse + from .read_v1request import ReadV1Request + from .read_v1request_text import ReadV1RequestText + from .read_v1request_url import ReadV1RequestUrl + from .read_v1response import ReadV1Response + from .read_v1response_metadata import ReadV1ResponseMetadata + from .read_v1response_metadata_metadata import ReadV1ResponseMetadataMetadata + from .read_v1response_metadata_metadata_intents_info import ReadV1ResponseMetadataMetadataIntentsInfo + from .read_v1response_metadata_metadata_sentiment_info import ReadV1ResponseMetadataMetadataSentimentInfo + from .read_v1response_metadata_metadata_summary_info import ReadV1ResponseMetadataMetadataSummaryInfo + from .read_v1response_metadata_metadata_topics_info import ReadV1ResponseMetadataMetadataTopicsInfo + from .read_v1response_results import ReadV1ResponseResults + from .read_v1response_results_summary import ReadV1ResponseResultsSummary + from .read_v1response_results_summary_results import ReadV1ResponseResultsSummaryResults + from .read_v1response_results_summary_results_summary import ReadV1ResponseResultsSummaryResultsSummary + from .shared_intents import SharedIntents + from .shared_intents_segments_item import SharedIntentsSegmentsItem + from .shared_intents_segments_item_intents_item import SharedIntentsSegmentsItemIntentsItem + from .shared_sentiments import SharedSentiments + from .shared_sentiments_average import SharedSentimentsAverage + from .shared_sentiments_segments_item import SharedSentimentsSegmentsItem + from .shared_topics import SharedTopics + from .shared_topics_segments_item import SharedTopicsSegmentsItem + from .shared_topics_segments_item_topics_item import SharedTopicsSegmentsItemTopicsItem + from .speak_settings_v1 import SpeakSettingsV1 + from .speak_settings_v1endpoint import SpeakSettingsV1Endpoint + from .speak_settings_v1provider import ( + SpeakSettingsV1Provider, + SpeakSettingsV1Provider_AwsPolly, + SpeakSettingsV1Provider_Cartesia, + SpeakSettingsV1Provider_Deepgram, + SpeakSettingsV1Provider_ElevenLabs, + SpeakSettingsV1Provider_OpenAi, + ) + from .speak_v1encoding import SpeakV1Encoding + from .speak_v1mip_opt_out import SpeakV1MipOptOut + from .speak_v1model import SpeakV1Model + from .speak_v1response import SpeakV1Response + from .speak_v1sample_rate import SpeakV1SampleRate + from .speak_v1speed import SpeakV1Speed + from .speak_v2accepted_response import SpeakV2AcceptedResponse + from .speak_v2encoding import SpeakV2Encoding + from .speak_v2expressivity import SpeakV2Expressivity + from .speak_v2mip_opt_out import SpeakV2MipOptOut + from .speak_v2model import SpeakV2Model + from .speak_v2normalize_volume import SpeakV2NormalizeVolume + from .speak_v2response import SpeakV2Response + from .speak_v2sample_rate import SpeakV2SampleRate + from .speak_v2speed import SpeakV2Speed + from .speak_v2speed_value import SpeakV2SpeedValue + from .speak_v2tag import SpeakV2Tag + from .think_live_settings_v1 import ThinkLiveSettingsV1 + from .think_settings_v1 import ThinkSettingsV1 + from .think_settings_v1context_length import ThinkSettingsV1ContextLength + from .think_settings_v1endpoint import ThinkSettingsV1Endpoint + from .think_settings_v1functions_item import ThinkSettingsV1FunctionsItem + from .think_settings_v1functions_item_endpoint import ThinkSettingsV1FunctionsItemEndpoint + from .think_settings_v1provider import ( + ThinkSettingsV1Provider, + ThinkSettingsV1Provider_Anthropic, + ThinkSettingsV1Provider_AwsBedrock, + ThinkSettingsV1Provider_Deepgram, + ThinkSettingsV1Provider_Google, + ThinkSettingsV1Provider_Groq, + ThinkSettingsV1Provider_Nvidia, + ThinkSettingsV1Provider_OpenAi, + ) + from .update_project_member_scopes_v1response import UpdateProjectMemberScopesV1Response + from .update_project_v1response import UpdateProjectV1Response + from .usage_breakdown_v1response import UsageBreakdownV1Response + from .usage_breakdown_v1response_resolution import UsageBreakdownV1ResponseResolution + from .usage_breakdown_v1response_results_item import UsageBreakdownV1ResponseResultsItem + from .usage_breakdown_v1response_results_item_grouping import UsageBreakdownV1ResponseResultsItemGrouping + from .usage_fields_v1response import UsageFieldsV1Response + from .usage_fields_v1response_models_item import UsageFieldsV1ResponseModelsItem + from .usage_v1response import UsageV1Response + from .usage_v1response_resolution import UsageV1ResponseResolution +_dynamic_imports: typing.Dict[str, str] = { + "AgentConfigurationV1": ".agent_configuration_v1", + "AgentThinkModelsV1Response": ".agent_think_models_v1response", + "AgentThinkModelsV1ResponseModelsItem": ".agent_think_models_v1response_models_item", + "AgentThinkModelsV1ResponseModelsItemId": ".agent_think_models_v1response_models_item_id", + "AgentThinkModelsV1ResponseModelsItemOne": ".agent_think_models_v1response_models_item_one", + "AgentThinkModelsV1ResponseModelsItemOneId": ".agent_think_models_v1response_models_item_one_id", + "AgentThinkModelsV1ResponseModelsItemThree": ".agent_think_models_v1response_models_item_three", + "AgentThinkModelsV1ResponseModelsItemTwo": ".agent_think_models_v1response_models_item_two", + "AgentThinkModelsV1ResponseModelsItemTwoId": ".agent_think_models_v1response_models_item_two_id", + "AgentThinkModelsV1ResponseModelsItemZero": ".agent_think_models_v1response_models_item_zero", + "AgentThinkModelsV1ResponseModelsItemZeroId": ".agent_think_models_v1response_models_item_zero_id", + "AgentVariableV1": ".agent_variable_v1", + "Anthropic": ".anthropic", + "AnthropicModel": ".anthropic_model", + "AwsBedrockThinkProvider": ".aws_bedrock_think_provider", + "AwsBedrockThinkProviderCredentials": ".aws_bedrock_think_provider_credentials", + "AwsBedrockThinkProviderCredentialsType": ".aws_bedrock_think_provider_credentials_type", + "AwsBedrockThinkProviderModel": ".aws_bedrock_think_provider_model", + "AwsPollySpeakProvider": ".aws_polly_speak_provider", + "AwsPollySpeakProviderCredentials": ".aws_polly_speak_provider_credentials", + "AwsPollySpeakProviderCredentialsType": ".aws_polly_speak_provider_credentials_type", + "AwsPollySpeakProviderEngine": ".aws_polly_speak_provider_engine", + "AwsPollySpeakProviderVoice": ".aws_polly_speak_provider_voice", + "BillingBreakdownV1Response": ".billing_breakdown_v1response", + "BillingBreakdownV1ResponseResolution": ".billing_breakdown_v1response_resolution", + "BillingBreakdownV1ResponseResultsItem": ".billing_breakdown_v1response_results_item", + "BillingBreakdownV1ResponseResultsItemGrouping": ".billing_breakdown_v1response_results_item_grouping", + "Cartesia": ".cartesia", + "CartesiaModelId": ".cartesia_model_id", + "CartesiaVoice": ".cartesia_voice", + "CreateAgentConfigurationV1Response": ".create_agent_configuration_v1response", + "CreateKeyV1Request": ".create_key_v1request", + "CreateKeyV1Response": ".create_key_v1response", + "CreateProjectDistributionCredentialsV1Response": ".create_project_distribution_credentials_v1response", + "CreateProjectDistributionCredentialsV1ResponseDistributionCredentials": ".create_project_distribution_credentials_v1response_distribution_credentials", + "CreateProjectDistributionCredentialsV1ResponseMember": ".create_project_distribution_credentials_v1response_member", + "CreateProjectInviteV1Response": ".create_project_invite_v1response", + "Deepgram": ".deepgram", + "DeepgramListenProviderV1": ".deepgram_listen_provider_v1", + "DeepgramListenProviderV2": ".deepgram_listen_provider_v2", + "DeepgramModel": ".deepgram_model", + "DeepgramThinkLiveProviderV1": ".deepgram_think_live_provider_v1", + "DeepgramThinkProvider": ".deepgram_think_provider", + "DeepgramThinkProviderModel": ".deepgram_think_provider_model", + "DeepgramThinkProviderReasoningMode": ".deepgram_think_provider_reasoning_mode", + "DeleteAgentConfigurationV1Response": ".delete_agent_configuration_v1response", + "DeleteAgentVariableV1Response": ".delete_agent_variable_v1response", + "DeleteProjectInviteV1Response": ".delete_project_invite_v1response", + "DeleteProjectKeyV1Response": ".delete_project_key_v1response", + "DeleteProjectMemberV1Response": ".delete_project_member_v1response", + "DeleteProjectV1Response": ".delete_project_v1response", + "ElevenLabsSpeakProvider": ".eleven_labs_speak_provider", + "ElevenLabsSpeakProviderModelId": ".eleven_labs_speak_provider_model_id", + "ErrorResponse": ".error_response", + "ErrorResponseLegacyError": ".error_response_legacy_error", + "ErrorResponseModernError": ".error_response_modern_error", + "ErrorResponseTextError": ".error_response_text_error", + "GetModelV1Response": ".get_model_v1response", + "GetModelV1ResponseBatch": ".get_model_v1response_batch", + "GetModelV1ResponseMetadata": ".get_model_v1response_metadata", + "GetModelV1ResponseMetadataMetadata": ".get_model_v1response_metadata_metadata", + "GetProjectBalanceV1Response": ".get_project_balance_v1response", + "GetProjectDistributionCredentialsV1Response": ".get_project_distribution_credentials_v1response", + "GetProjectDistributionCredentialsV1ResponseDistributionCredentials": ".get_project_distribution_credentials_v1response_distribution_credentials", + "GetProjectDistributionCredentialsV1ResponseMember": ".get_project_distribution_credentials_v1response_member", + "GetProjectKeyV1Response": ".get_project_key_v1response", + "GetProjectKeyV1ResponseItem": ".get_project_key_v1response_item", + "GetProjectKeyV1ResponseItemMember": ".get_project_key_v1response_item_member", + "GetProjectKeyV1ResponseItemMemberApiKey": ".get_project_key_v1response_item_member_api_key", + "GetProjectRequestV1Response": ".get_project_request_v1response", + "GetProjectV1Response": ".get_project_v1response", + "Google": ".google", + "GoogleModel": ".google_model", + "GoogleVersion": ".google_version", + "GrantV1Response": ".grant_v1response", + "Groq": ".groq", + "GroqReasoningMode": ".groq_reasoning_mode", + "LeaveProjectV1Response": ".leave_project_v1response", + "ListAgentConfigurationsV1Response": ".list_agent_configurations_v1response", + "ListAgentVariablesV1Response": ".list_agent_variables_v1response", + "ListBillingFieldsV1Response": ".list_billing_fields_v1response", + "ListBillingFieldsV1ResponseDeploymentsItem": ".list_billing_fields_v1response_deployments_item", + "ListModelsV1Response": ".list_models_v1response", + "ListModelsV1ResponseSttModels": ".list_models_v1response_stt_models", + "ListModelsV1ResponseTtsModels": ".list_models_v1response_tts_models", + "ListModelsV1ResponseTtsModelsMetadata": ".list_models_v1response_tts_models_metadata", + "ListProjectBalancesV1Response": ".list_project_balances_v1response", + "ListProjectBalancesV1ResponseBalancesItem": ".list_project_balances_v1response_balances_item", + "ListProjectDistributionCredentialsV1Response": ".list_project_distribution_credentials_v1response", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem": ".list_project_distribution_credentials_v1response_distribution_credentials_item", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials": ".list_project_distribution_credentials_v1response_distribution_credentials_item_distribution_credentials", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember": ".list_project_distribution_credentials_v1response_distribution_credentials_item_member", + "ListProjectInvitesV1Response": ".list_project_invites_v1response", + "ListProjectInvitesV1ResponseInvitesItem": ".list_project_invites_v1response_invites_item", + "ListProjectKeysV1Response": ".list_project_keys_v1response", + "ListProjectKeysV1ResponseApiKeysItem": ".list_project_keys_v1response_api_keys_item", + "ListProjectKeysV1ResponseApiKeysItemApiKey": ".list_project_keys_v1response_api_keys_item_api_key", + "ListProjectKeysV1ResponseApiKeysItemMember": ".list_project_keys_v1response_api_keys_item_member", + "ListProjectMemberScopesV1Response": ".list_project_member_scopes_v1response", + "ListProjectMembersV1Response": ".list_project_members_v1response", + "ListProjectMembersV1ResponseMembersItem": ".list_project_members_v1response_members_item", + "ListProjectPurchasesV1Response": ".list_project_purchases_v1response", + "ListProjectPurchasesV1ResponseOrdersItem": ".list_project_purchases_v1response_orders_item", + "ListProjectRequestsV1Response": ".list_project_requests_v1response", + "ListProjectsV1Response": ".list_projects_v1response", + "ListProjectsV1ResponseProjectsItem": ".list_projects_v1response_projects_item", + "ListenV1AcceptedResponse": ".listen_v1accepted_response", + "ListenV1Callback": ".listen_v1callback", + "ListenV1CallbackMethod": ".listen_v1callback_method", + "ListenV1Channels": ".listen_v1channels", + "ListenV1DetectEntities": ".listen_v1detect_entities", + "ListenV1Diarize": ".listen_v1diarize", + "ListenV1Dictation": ".listen_v1dictation", + "ListenV1Encoding": ".listen_v1encoding", + "ListenV1Endpointing": ".listen_v1endpointing", + "ListenV1Extra": ".listen_v1extra", + "ListenV1InterimResults": ".listen_v1interim_results", + "ListenV1Keyterm": ".listen_v1keyterm", + "ListenV1Keywords": ".listen_v1keywords", + "ListenV1Language": ".listen_v1language", + "ListenV1LanguageHint": ".listen_v1language_hint", + "ListenV1MipOptOut": ".listen_v1mip_opt_out", + "ListenV1Model": ".listen_v1model", + "ListenV1Multichannel": ".listen_v1multichannel", + "ListenV1Numerals": ".listen_v1numerals", + "ListenV1ProfanityFilter": ".listen_v1profanity_filter", + "ListenV1Punctuate": ".listen_v1punctuate", + "ListenV1Redact": ".listen_v1redact", + "ListenV1RedactUsage": ".listen_v1redact_usage", + "ListenV1Replace": ".listen_v1replace", + "ListenV1RequestFile": ".listen_v1request_file", + "ListenV1Response": ".listen_v1response", + "ListenV1ResponseMetadata": ".listen_v1response_metadata", + "ListenV1ResponseMetadataDiarizeInfo": ".listen_v1response_metadata_diarize_info", + "ListenV1ResponseMetadataIntentsInfo": ".listen_v1response_metadata_intents_info", + "ListenV1ResponseMetadataSentimentInfo": ".listen_v1response_metadata_sentiment_info", + "ListenV1ResponseMetadataSummaryInfo": ".listen_v1response_metadata_summary_info", + "ListenV1ResponseMetadataTopicsInfo": ".listen_v1response_metadata_topics_info", + "ListenV1ResponseResults": ".listen_v1response_results", + "ListenV1ResponseResultsChannels": ".listen_v1response_results_channels", + "ListenV1ResponseResultsChannelsItem": ".listen_v1response_results_channels_item", + "ListenV1ResponseResultsChannelsItemAlternativesItem": ".listen_v1response_results_channels_item_alternatives_item", + "ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem": ".listen_v1response_results_channels_item_alternatives_item_entities_item", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs": ".listen_v1response_results_channels_item_alternatives_item_paragraphs", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem": ".listen_v1response_results_channels_item_alternatives_item_paragraphs_paragraphs_item", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem": ".listen_v1response_results_channels_item_alternatives_item_paragraphs_paragraphs_item_sentences_item", + "ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem": ".listen_v1response_results_channels_item_alternatives_item_summaries_item", + "ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem": ".listen_v1response_results_channels_item_alternatives_item_topics_item", + "ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem": ".listen_v1response_results_channels_item_alternatives_item_words_item", + "ListenV1ResponseResultsChannelsItemSearchItem": ".listen_v1response_results_channels_item_search_item", + "ListenV1ResponseResultsChannelsItemSearchItemHitsItem": ".listen_v1response_results_channels_item_search_item_hits_item", + "ListenV1ResponseResultsSummary": ".listen_v1response_results_summary", + "ListenV1ResponseResultsUtterances": ".listen_v1response_results_utterances", + "ListenV1ResponseResultsUtterancesItem": ".listen_v1response_results_utterances_item", + "ListenV1ResponseResultsUtterancesItemWordsItem": ".listen_v1response_results_utterances_item_words_item", + "ListenV1SampleRate": ".listen_v1sample_rate", + "ListenV1Search": ".listen_v1search", + "ListenV1SmartFormat": ".listen_v1smart_format", + "ListenV1Tag": ".listen_v1tag", + "ListenV1UtteranceEndMs": ".listen_v1utterance_end_ms", + "ListenV1VadEvents": ".listen_v1vad_events", + "ListenV1Version": ".listen_v1version", + "ListenV2ConfigureNumerals": ".listen_v2configure_numerals", + "ListenV2ConfigureRedactUsage": ".listen_v2configure_redact_usage", + "ListenV2EagerEotThreshold": ".listen_v2eager_eot_threshold", + "ListenV2Encoding": ".listen_v2encoding", + "ListenV2EotThreshold": ".listen_v2eot_threshold", + "ListenV2EotTimeoutMs": ".listen_v2eot_timeout_ms", + "ListenV2Keyterm": ".listen_v2keyterm", + "ListenV2LanguageHint": ".listen_v2language_hint", + "ListenV2MipOptOut": ".listen_v2mip_opt_out", + "ListenV2Model": ".listen_v2model", + "ListenV2Numerals": ".listen_v2numerals", + "ListenV2ProfanityFilter": ".listen_v2profanity_filter", + "ListenV2Redact": ".listen_v2redact", + "ListenV2RedactUsage": ".listen_v2redact_usage", + "ListenV2SampleRate": ".listen_v2sample_rate", + "ListenV2Tag": ".listen_v2tag", + "Nvidia": ".nvidia", + "NvidiaReasoningMode": ".nvidia_reasoning_mode", + "OpenAiSpeakProvider": ".open_ai_speak_provider", + "OpenAiSpeakProviderModel": ".open_ai_speak_provider_model", + "OpenAiSpeakProviderVoice": ".open_ai_speak_provider_voice", + "OpenAiThinkProvider": ".open_ai_think_provider", + "OpenAiThinkProviderModel": ".open_ai_think_provider_model", + "OpenAiThinkProviderReasoningMode": ".open_ai_think_provider_reasoning_mode", + "ProjectRequestResponse": ".project_request_response", + "ReadV1Request": ".read_v1request", + "ReadV1RequestText": ".read_v1request_text", + "ReadV1RequestUrl": ".read_v1request_url", + "ReadV1Response": ".read_v1response", + "ReadV1ResponseMetadata": ".read_v1response_metadata", + "ReadV1ResponseMetadataMetadata": ".read_v1response_metadata_metadata", + "ReadV1ResponseMetadataMetadataIntentsInfo": ".read_v1response_metadata_metadata_intents_info", + "ReadV1ResponseMetadataMetadataSentimentInfo": ".read_v1response_metadata_metadata_sentiment_info", + "ReadV1ResponseMetadataMetadataSummaryInfo": ".read_v1response_metadata_metadata_summary_info", + "ReadV1ResponseMetadataMetadataTopicsInfo": ".read_v1response_metadata_metadata_topics_info", + "ReadV1ResponseResults": ".read_v1response_results", + "ReadV1ResponseResultsSummary": ".read_v1response_results_summary", + "ReadV1ResponseResultsSummaryResults": ".read_v1response_results_summary_results", + "ReadV1ResponseResultsSummaryResultsSummary": ".read_v1response_results_summary_results_summary", + "SharedIntents": ".shared_intents", + "SharedIntentsSegmentsItem": ".shared_intents_segments_item", + "SharedIntentsSegmentsItemIntentsItem": ".shared_intents_segments_item_intents_item", + "SharedSentiments": ".shared_sentiments", + "SharedSentimentsAverage": ".shared_sentiments_average", + "SharedSentimentsSegmentsItem": ".shared_sentiments_segments_item", + "SharedTopics": ".shared_topics", + "SharedTopicsSegmentsItem": ".shared_topics_segments_item", + "SharedTopicsSegmentsItemTopicsItem": ".shared_topics_segments_item_topics_item", + "SpeakSettingsV1": ".speak_settings_v1", + "SpeakSettingsV1Endpoint": ".speak_settings_v1endpoint", + "SpeakSettingsV1Provider": ".speak_settings_v1provider", + "SpeakSettingsV1Provider_AwsPolly": ".speak_settings_v1provider", + "SpeakSettingsV1Provider_Cartesia": ".speak_settings_v1provider", + "SpeakSettingsV1Provider_Deepgram": ".speak_settings_v1provider", + "SpeakSettingsV1Provider_ElevenLabs": ".speak_settings_v1provider", + "SpeakSettingsV1Provider_OpenAi": ".speak_settings_v1provider", + "SpeakV1Encoding": ".speak_v1encoding", + "SpeakV1MipOptOut": ".speak_v1mip_opt_out", + "SpeakV1Model": ".speak_v1model", + "SpeakV1Response": ".speak_v1response", + "SpeakV1SampleRate": ".speak_v1sample_rate", + "SpeakV1Speed": ".speak_v1speed", + "SpeakV2AcceptedResponse": ".speak_v2accepted_response", + "SpeakV2Encoding": ".speak_v2encoding", + "SpeakV2Expressivity": ".speak_v2expressivity", + "SpeakV2MipOptOut": ".speak_v2mip_opt_out", + "SpeakV2Model": ".speak_v2model", + "SpeakV2NormalizeVolume": ".speak_v2normalize_volume", + "SpeakV2Response": ".speak_v2response", + "SpeakV2SampleRate": ".speak_v2sample_rate", + "SpeakV2Speed": ".speak_v2speed", + "SpeakV2SpeedValue": ".speak_v2speed_value", + "SpeakV2Tag": ".speak_v2tag", + "ThinkLiveSettingsV1": ".think_live_settings_v1", + "ThinkSettingsV1": ".think_settings_v1", + "ThinkSettingsV1ContextLength": ".think_settings_v1context_length", + "ThinkSettingsV1Endpoint": ".think_settings_v1endpoint", + "ThinkSettingsV1FunctionsItem": ".think_settings_v1functions_item", + "ThinkSettingsV1FunctionsItemEndpoint": ".think_settings_v1functions_item_endpoint", + "ThinkSettingsV1Provider": ".think_settings_v1provider", + "ThinkSettingsV1Provider_Anthropic": ".think_settings_v1provider", + "ThinkSettingsV1Provider_AwsBedrock": ".think_settings_v1provider", + "ThinkSettingsV1Provider_Deepgram": ".think_settings_v1provider", + "ThinkSettingsV1Provider_Google": ".think_settings_v1provider", + "ThinkSettingsV1Provider_Groq": ".think_settings_v1provider", + "ThinkSettingsV1Provider_Nvidia": ".think_settings_v1provider", + "ThinkSettingsV1Provider_OpenAi": ".think_settings_v1provider", + "UpdateProjectMemberScopesV1Response": ".update_project_member_scopes_v1response", + "UpdateProjectV1Response": ".update_project_v1response", + "UsageBreakdownV1Response": ".usage_breakdown_v1response", + "UsageBreakdownV1ResponseResolution": ".usage_breakdown_v1response_resolution", + "UsageBreakdownV1ResponseResultsItem": ".usage_breakdown_v1response_results_item", + "UsageBreakdownV1ResponseResultsItemGrouping": ".usage_breakdown_v1response_results_item_grouping", + "UsageFieldsV1Response": ".usage_fields_v1response", + "UsageFieldsV1ResponseModelsItem": ".usage_fields_v1response_models_item", + "UsageV1Response": ".usage_v1response", + "UsageV1ResponseResolution": ".usage_v1response_resolution", +} + +_dynamic_imports.update( + { + "SharedIntentsResults": ".shared_intents_results", + "SharedIntentsResultsIntents": ".shared_intents_results_intents", + "SharedIntentsResultsIntentsSegmentsItem": ".shared_intents_results_intents_segments_item", + "SharedIntentsResultsIntentsSegmentsItemIntentsItem": ".shared_intents_results_intents_segments_item_intents_item", + "SharedTopicsResults": ".shared_topics_results", + "SharedTopicsResultsTopics": ".shared_topics_results_topics", + "SharedTopicsResultsTopicsSegmentsItem": ".shared_topics_results_topics_segments_item", + "SharedTopicsResultsTopicsSegmentsItemTopicsItem": ".shared_topics_results_topics_segments_item_topics_item", + "AnthropicThinkProviderModel": ".anthropic_think_provider_model", + "CartesiaSpeakProviderModelId": ".cartesia_speak_provider_model_id", + "CartesiaSpeakProviderVoice": ".cartesia_speak_provider_voice", + "CreateKeyV1RequestOne": ".create_key_v1request_one", + "DeepgramListenProviderV2LanguageHint": ".deepgram_listen_provider_v2language_hint", + "DeepgramSpeakProviderModel": ".deepgram_speak_provider_model", + "GoogleThinkProviderModel": ".google_think_provider_model", + "GoogleThinkProviderVersion": ".google_think_provider_version", + "GroqThinkProviderReasoningMode": ".groq_think_provider_reasoning_mode", + } +) + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "AgentConfigurationV1", + "AgentThinkModelsV1Response", + "AgentThinkModelsV1ResponseModelsItem", + "AgentThinkModelsV1ResponseModelsItemId", + "AgentThinkModelsV1ResponseModelsItemOne", + "AgentThinkModelsV1ResponseModelsItemOneId", + "AgentThinkModelsV1ResponseModelsItemThree", + "AgentThinkModelsV1ResponseModelsItemTwo", + "AgentThinkModelsV1ResponseModelsItemTwoId", + "AgentThinkModelsV1ResponseModelsItemZero", + "AgentThinkModelsV1ResponseModelsItemZeroId", + "AgentVariableV1", + "Anthropic", + "AnthropicModel", + "AwsBedrockThinkProvider", + "AwsBedrockThinkProviderCredentials", + "AwsBedrockThinkProviderCredentialsType", + "AwsBedrockThinkProviderModel", + "AwsPollySpeakProvider", + "AwsPollySpeakProviderCredentials", + "AwsPollySpeakProviderCredentialsType", + "AwsPollySpeakProviderEngine", + "AwsPollySpeakProviderVoice", + "BillingBreakdownV1Response", + "BillingBreakdownV1ResponseResolution", + "BillingBreakdownV1ResponseResultsItem", + "BillingBreakdownV1ResponseResultsItemGrouping", + "Cartesia", + "CartesiaModelId", + "CartesiaVoice", + "CreateAgentConfigurationV1Response", + "CreateKeyV1Request", + "CreateKeyV1Response", + "CreateProjectDistributionCredentialsV1Response", + "CreateProjectDistributionCredentialsV1ResponseDistributionCredentials", + "CreateProjectDistributionCredentialsV1ResponseMember", + "CreateProjectInviteV1Response", + "Deepgram", + "DeepgramListenProviderV1", + "DeepgramListenProviderV2", + "DeepgramModel", + "DeepgramThinkLiveProviderV1", + "DeepgramThinkProvider", + "DeepgramThinkProviderModel", + "DeepgramThinkProviderReasoningMode", + "DeleteAgentConfigurationV1Response", + "DeleteAgentVariableV1Response", + "DeleteProjectInviteV1Response", + "DeleteProjectKeyV1Response", + "DeleteProjectMemberV1Response", + "DeleteProjectV1Response", + "ElevenLabsSpeakProvider", + "ElevenLabsSpeakProviderModelId", + "ErrorResponse", + "ErrorResponseLegacyError", + "ErrorResponseModernError", + "ErrorResponseTextError", + "GetModelV1Response", + "GetModelV1ResponseBatch", + "GetModelV1ResponseMetadata", + "GetModelV1ResponseMetadataMetadata", + "GetProjectBalanceV1Response", + "GetProjectDistributionCredentialsV1Response", + "GetProjectDistributionCredentialsV1ResponseDistributionCredentials", + "GetProjectDistributionCredentialsV1ResponseMember", + "GetProjectKeyV1Response", + "GetProjectKeyV1ResponseItem", + "GetProjectKeyV1ResponseItemMember", + "GetProjectKeyV1ResponseItemMemberApiKey", + "GetProjectRequestV1Response", + "GetProjectV1Response", + "Google", + "GoogleModel", + "GoogleVersion", + "GrantV1Response", + "Groq", + "GroqReasoningMode", + "LeaveProjectV1Response", + "ListAgentConfigurationsV1Response", + "ListAgentVariablesV1Response", + "ListBillingFieldsV1Response", + "ListBillingFieldsV1ResponseDeploymentsItem", + "ListModelsV1Response", + "ListModelsV1ResponseSttModels", + "ListModelsV1ResponseTtsModels", + "ListModelsV1ResponseTtsModelsMetadata", + "ListProjectBalancesV1Response", + "ListProjectBalancesV1ResponseBalancesItem", + "ListProjectDistributionCredentialsV1Response", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember", + "ListProjectInvitesV1Response", + "ListProjectInvitesV1ResponseInvitesItem", + "ListProjectKeysV1Response", + "ListProjectKeysV1ResponseApiKeysItem", + "ListProjectKeysV1ResponseApiKeysItemApiKey", + "ListProjectKeysV1ResponseApiKeysItemMember", + "ListProjectMemberScopesV1Response", + "ListProjectMembersV1Response", + "ListProjectMembersV1ResponseMembersItem", + "ListProjectPurchasesV1Response", + "ListProjectPurchasesV1ResponseOrdersItem", + "ListProjectRequestsV1Response", + "ListProjectsV1Response", + "ListProjectsV1ResponseProjectsItem", + "ListenV1AcceptedResponse", + "ListenV1Callback", + "ListenV1CallbackMethod", + "ListenV1Channels", + "ListenV1DetectEntities", + "ListenV1Diarize", + "ListenV1Dictation", + "ListenV1Encoding", + "ListenV1Endpointing", + "ListenV1Extra", + "ListenV1InterimResults", + "ListenV1Keyterm", + "ListenV1Keywords", + "ListenV1Language", + "ListenV1LanguageHint", + "ListenV1MipOptOut", + "ListenV1Model", + "ListenV1Multichannel", + "ListenV1Numerals", + "ListenV1ProfanityFilter", + "ListenV1Punctuate", + "ListenV1Redact", + "ListenV1RedactUsage", + "ListenV1Replace", + "ListenV1RequestFile", + "ListenV1Response", + "ListenV1ResponseMetadata", + "ListenV1ResponseMetadataDiarizeInfo", + "ListenV1ResponseMetadataIntentsInfo", + "ListenV1ResponseMetadataSentimentInfo", + "ListenV1ResponseMetadataSummaryInfo", + "ListenV1ResponseMetadataTopicsInfo", + "ListenV1ResponseResults", + "ListenV1ResponseResultsChannels", + "ListenV1ResponseResultsChannelsItem", + "ListenV1ResponseResultsChannelsItemAlternativesItem", + "ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem", + "ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem", + "ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem", + "ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem", + "ListenV1ResponseResultsChannelsItemSearchItem", + "ListenV1ResponseResultsChannelsItemSearchItemHitsItem", + "ListenV1ResponseResultsSummary", + "ListenV1ResponseResultsUtterances", + "ListenV1ResponseResultsUtterancesItem", + "ListenV1ResponseResultsUtterancesItemWordsItem", + "ListenV1SampleRate", + "ListenV1Search", + "ListenV1SmartFormat", + "ListenV1Tag", + "ListenV1UtteranceEndMs", + "ListenV1VadEvents", + "ListenV1Version", + "ListenV2ConfigureNumerals", + "ListenV2ConfigureRedactUsage", + "ListenV2EagerEotThreshold", + "ListenV2Encoding", + "ListenV2EotThreshold", + "ListenV2EotTimeoutMs", + "ListenV2Keyterm", + "ListenV2LanguageHint", + "ListenV2MipOptOut", + "ListenV2Model", + "ListenV2Numerals", + "ListenV2ProfanityFilter", + "ListenV2Redact", + "ListenV2RedactUsage", + "ListenV2SampleRate", + "ListenV2Tag", + "Nvidia", + "NvidiaReasoningMode", + "OpenAiSpeakProvider", + "OpenAiSpeakProviderModel", + "OpenAiSpeakProviderVoice", + "OpenAiThinkProvider", + "OpenAiThinkProviderModel", + "OpenAiThinkProviderReasoningMode", + "ProjectRequestResponse", + "ReadV1Request", + "ReadV1RequestText", + "ReadV1RequestUrl", + "ReadV1Response", + "ReadV1ResponseMetadata", + "ReadV1ResponseMetadataMetadata", + "ReadV1ResponseMetadataMetadataIntentsInfo", + "ReadV1ResponseMetadataMetadataSentimentInfo", + "ReadV1ResponseMetadataMetadataSummaryInfo", + "ReadV1ResponseMetadataMetadataTopicsInfo", + "ReadV1ResponseResults", + "ReadV1ResponseResultsSummary", + "ReadV1ResponseResultsSummaryResults", + "ReadV1ResponseResultsSummaryResultsSummary", + "SharedIntents", + "SharedIntentsSegmentsItem", + "SharedIntentsSegmentsItemIntentsItem", + "SharedSentiments", + "SharedSentimentsAverage", + "SharedSentimentsSegmentsItem", + "SharedTopics", + "SharedTopicsSegmentsItem", + "SharedTopicsSegmentsItemTopicsItem", + "SpeakSettingsV1", + "SpeakSettingsV1Endpoint", + "SpeakSettingsV1Provider", + "SpeakSettingsV1Provider_AwsPolly", + "SpeakSettingsV1Provider_Cartesia", + "SpeakSettingsV1Provider_Deepgram", + "SpeakSettingsV1Provider_ElevenLabs", + "SpeakSettingsV1Provider_OpenAi", + "SpeakV1Encoding", + "SpeakV1MipOptOut", + "SpeakV1Model", + "SpeakV1Response", + "SpeakV1SampleRate", + "SpeakV1Speed", + "SpeakV2AcceptedResponse", + "SpeakV2Encoding", + "SpeakV2Expressivity", + "SpeakV2MipOptOut", + "SpeakV2Model", + "SpeakV2NormalizeVolume", + "SpeakV2Response", + "SpeakV2SampleRate", + "SpeakV2Speed", + "SpeakV2SpeedValue", + "SpeakV2Tag", + "ThinkLiveSettingsV1", + "ThinkSettingsV1", + "ThinkSettingsV1ContextLength", + "ThinkSettingsV1Endpoint", + "ThinkSettingsV1FunctionsItem", + "ThinkSettingsV1FunctionsItemEndpoint", + "ThinkSettingsV1Provider", + "ThinkSettingsV1Provider_Anthropic", + "ThinkSettingsV1Provider_AwsBedrock", + "ThinkSettingsV1Provider_Deepgram", + "ThinkSettingsV1Provider_Google", + "ThinkSettingsV1Provider_Groq", + "ThinkSettingsV1Provider_Nvidia", + "ThinkSettingsV1Provider_OpenAi", + "UpdateProjectMemberScopesV1Response", + "UpdateProjectV1Response", + "UsageBreakdownV1Response", + "UsageBreakdownV1ResponseResolution", + "UsageBreakdownV1ResponseResultsItem", + "UsageBreakdownV1ResponseResultsItemGrouping", + "UsageFieldsV1Response", + "UsageFieldsV1ResponseModelsItem", + "UsageV1Response", + "UsageV1ResponseResolution", +] + +__all__.extend( + [ + "SharedIntentsResults", + "SharedIntentsResultsIntents", + "SharedIntentsResultsIntentsSegmentsItem", + "SharedIntentsResultsIntentsSegmentsItemIntentsItem", + "SharedTopicsResults", + "SharedTopicsResultsTopics", + "SharedTopicsResultsTopicsSegmentsItem", + "SharedTopicsResultsTopicsSegmentsItemTopicsItem", + "AnthropicThinkProviderModel", + "CartesiaSpeakProviderModelId", + "CartesiaSpeakProviderVoice", + "CreateKeyV1RequestOne", + "DeepgramListenProviderV2LanguageHint", + "DeepgramSpeakProviderModel", + "GoogleThinkProviderModel", + "GoogleThinkProviderVersion", + "GroqThinkProviderReasoningMode", + ] +) diff --git a/src/deepgram/types/deepgram.py.bak b/src/deepgram/types/deepgram.py.bak new file mode 100644 index 00000000..994f7a2c --- /dev/null +++ b/src/deepgram/types/deepgram.py.bak @@ -0,0 +1,44 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .deepgram_model import DeepgramModel + + +class Deepgram(UncheckedBaseModel): + """ + Deepgram text-to-speech provider. Aura models use version v1 (default); Flux TTS uses version v2 and a flux-* model. Flux TTS is the default when agent.speak is omitted, using the flux-kit-en voice. + """ + + type: typing.Literal["deepgram"] = "deepgram" + version: typing.Optional[str] = pydantic.Field(default=None) + """ + The Deepgram text-to-speech model family. Accepted values: `v1` (Aura, the default) and `v2` (Flux TTS). Use `v1` with an aura-* model and `v2` with a flux-* model. Defaults to `v1` when omitted. + """ + + model: DeepgramModel = pydantic.Field() + """ + Deepgram TTS model. Aura models (version v1) use the aura-* voices; Flux TTS (version v2) uses the flux-{voice}-{language} voices (e.g. flux-alexis-en). Defaults to flux-kit-en when agent.speak is omitted. + """ + + speed: typing.Optional[float] = pydantic.Field(default=None) + """ + Speaking rate multiplier that adjusts the pace of generated speech while preserving natural prosody and voice quality. Aura (version v1) accepts any value from 0.7 to 1.5. Flux TTS (version v2) accepts values from 0.5 to 1.5 in 0.05 increments; a value the family does not accept ends the session with FAILED_TO_SPEAK. Not yet supported in all languages. + """ + + expressivity: typing.Optional[pydantic.StrictInt] = pydantic.Field(default=None) + """ + Delivery register of the generated speech, on a calm-to-animated axis. Flux TTS (version v2) only, on every Flux voice. Accepts the whole numbers -2 to 2, where 0 (the default) is the voice's tuned delivery and the only value validated for production, -2 the calm end of the range and 2 the animated end. Fixed for the session. Beta: behavior may change in future model versions, and non-default values increase the risk of hallucinations and pronunciation errors. See [Expressivity](/docs/tts-expressivity). + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/deepgram/types/deepgram_listen_provider_v2.py.bak b/src/deepgram/types/deepgram_listen_provider_v2.py.bak new file mode 100644 index 00000000..d24729a0 --- /dev/null +++ b/src/deepgram/types/deepgram_listen_provider_v2.py.bak @@ -0,0 +1,86 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeepgramListenProviderV2(UncheckedBaseModel): + type: typing.Literal["deepgram"] = pydantic.Field(default="deepgram") + """ + Provider type for speech-to-text + """ + + version: typing.Optional[typing.Literal["v2"]] = pydantic.Field(default=None) + """ + Specifies usage of the V2 Deepgram speech-to-text API (e.g. Flux) + """ + + model: str = pydantic.Field() + """ + Model to use for speech to text using the V2 API (e.g. flux-general-en, flux-general-multi) + """ + + language_hints: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + An array of one or more BCP-47 language codes to bias the model toward specific languages. Only supported when model is flux-general-multi. Without hints, the model auto-detects the spoken language. See the Language Prompting guide for details. + """ + + language_hint: typing.Optional[typing.Union[str, typing.List[str]]] = pydantic.Field(default=None, exclude=True) + """ + Deprecated. Use `language_hints`. Accepted for backward compatibility and + remapped before serialization so the singular field never reaches the API. + """ + + eot_threshold: typing.Optional[float] = pydantic.Field(default=None) + """ + End-of-turn confidence required to finish a turn. Valid range: 0.5 - 1.0. Defaults to 0.7. Set to 1.0 to fully suppress confidence-based end-of-turn detection. `eot_timeout_ms` still ends idle turns; increase it when using ForceEndTurn for full manual turn control. + """ + + eager_eot_threshold: typing.Optional[float] = pydantic.Field(default=None) + """ + End-of-turn confidence required to fire an eager end-of-turn event. When set, enables EagerEndOfTurn and TurnResumed events. Valid range: 0.3 - 0.9. + """ + + eot_timeout_ms: typing.Optional[int] = pydantic.Field(default=None) + """ + A turn will be finished when this much time in milliseconds has passed after speech, regardless of EOT confidence. Defaults to 5000. + """ + + keyterms: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Prompt keyterm recognition to improve Keyword Recall Rate + """ + + if IS_PYDANTIC_V2: + + @pydantic.model_validator(mode="before") + @classmethod + def _migrate_language_hint(cls, values: typing.Any) -> typing.Any: + if not isinstance(values, dict) or "language_hint" not in values: + return values + values = dict(values) + hint = values.pop("language_hint") + if hint is not None and values.get("language_hints") is None: + values["language_hints"] = [hint] if isinstance(hint, str) else list(hint) + return values + + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + @pydantic.root_validator(pre=True) # type: ignore[deprecated] + def _migrate_language_hint(cls, values: typing.Any) -> typing.Any: # type: ignore[no-redef] + if not isinstance(values, dict) or "language_hint" not in values: + return values + values = dict(values) + hint = values.pop("language_hint") + if hint is not None and values.get("language_hints") is None: + values["language_hints"] = [hint] if isinstance(hint, str) else list(hint) + return values + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/deepgram/types/shared_intents.py.bak b/src/deepgram/types/shared_intents.py.bak new file mode 100644 index 00000000..ad991bcf --- /dev/null +++ b/src/deepgram/types/shared_intents.py.bak @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .shared_intents_results import SharedIntentsResults +from .shared_intents_results_intents import SharedIntentsResultsIntents +from .shared_intents_segments_item import SharedIntentsSegmentsItem + + +class SharedIntents(UncheckedBaseModel): + """ + Output whenever `intents=true` is used + """ + + segments: typing.Optional[typing.List[SharedIntentsSegmentsItem]] = None + + @property + def results(self) -> typing.Optional[SharedIntentsResults]: + """Deprecated facade for the pre-7.12 ``results.intents.segments`` path.""" + if self.segments is None: + return None + return SharedIntentsResults(intents=SharedIntentsResultsIntents(segments=self.segments)) + + if IS_PYDANTIC_V2: + + @pydantic.model_validator(mode="before") + @classmethod + def _migrate_legacy_results(cls, values: typing.Any) -> typing.Any: + if not isinstance(values, dict) or "results" not in values: + return values + values = dict(values) + results = values.pop("results") + if "segments" in values: + return values + intents = results.get("intents") if isinstance(results, dict) else getattr(results, "intents", None) + if intents is not None: + values["segments"] = intents.get("segments") if isinstance(intents, dict) else intents.segments + return values + + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + @pydantic.root_validator(pre=True) # type: ignore[deprecated] + def _migrate_legacy_results(cls, values: typing.Any) -> typing.Any: # type: ignore[no-redef] + if not isinstance(values, dict) or "results" not in values: + return values + values = dict(values) + results = values.pop("results") + if "segments" in values: + return values + intents = results.get("intents") if isinstance(results, dict) else getattr(results, "intents", None) + if intents is not None: + values["segments"] = intents.get("segments") if isinstance(intents, dict) else intents.segments + return values + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/deepgram/types/shared_topics.py.bak b/src/deepgram/types/shared_topics.py.bak new file mode 100644 index 00000000..4f26c3b7 --- /dev/null +++ b/src/deepgram/types/shared_topics.py.bak @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .shared_topics_results import SharedTopicsResults +from .shared_topics_results_topics import SharedTopicsResultsTopics +from .shared_topics_segments_item import SharedTopicsSegmentsItem + + +class SharedTopics(UncheckedBaseModel): + """ + Output whenever `topics=true` is used + """ + + segments: typing.Optional[typing.List[SharedTopicsSegmentsItem]] = None + + @property + def results(self) -> typing.Optional[SharedTopicsResults]: + """Deprecated facade for the pre-7.12 ``results.topics.segments`` path.""" + if self.segments is None: + return None + return SharedTopicsResults(topics=SharedTopicsResultsTopics(segments=self.segments)) + + if IS_PYDANTIC_V2: + + @pydantic.model_validator(mode="before") + @classmethod + def _migrate_legacy_results(cls, values: typing.Any) -> typing.Any: + if not isinstance(values, dict) or "results" not in values: + return values + values = dict(values) + results = values.pop("results") + if "segments" in values: + return values + topics = results.get("topics") if isinstance(results, dict) else getattr(results, "topics", None) + if topics is not None: + values["segments"] = topics.get("segments") if isinstance(topics, dict) else topics.segments + return values + + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + @pydantic.root_validator(pre=True) # type: ignore[deprecated] + def _migrate_legacy_results(cls, values: typing.Any) -> typing.Any: # type: ignore[no-redef] + if not isinstance(values, dict) or "results" not in values: + return values + values = dict(values) + results = values.pop("results") + if "segments" in values: + return values + topics = results.get("topics") if isinstance(results, dict) else getattr(results, "topics", None) + if topics is not None: + values["segments"] = topics.get("segments") if isinstance(topics, dict) else topics.segments + return values + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/deepgram/types/speak_settings_v1provider.py.bak b/src/deepgram/types/speak_settings_v1provider.py.bak new file mode 100644 index 00000000..3fbef168 --- /dev/null +++ b/src/deepgram/types/speak_settings_v1provider.py.bak @@ -0,0 +1,117 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .aws_polly_speak_provider_credentials import AwsPollySpeakProviderCredentials +from .aws_polly_speak_provider_engine import AwsPollySpeakProviderEngine +from .aws_polly_speak_provider_voice import AwsPollySpeakProviderVoice +from .cartesia_model_id import CartesiaModelId +from .cartesia_voice import CartesiaVoice +from .deepgram_model import DeepgramModel +from .eleven_labs_speak_provider_model_id import ElevenLabsSpeakProviderModelId +from .open_ai_speak_provider_model import OpenAiSpeakProviderModel +from .open_ai_speak_provider_voice import OpenAiSpeakProviderVoice + + +class SpeakSettingsV1Provider_Deepgram(UncheckedBaseModel): + type: typing.Literal["deepgram"] = "deepgram" + version: typing.Optional[str] = None + model: DeepgramModel + speed: typing.Optional[float] = None + expressivity: typing.Optional[pydantic.StrictInt] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class SpeakSettingsV1Provider_ElevenLabs(UncheckedBaseModel): + type: typing.Literal["eleven_labs"] = "eleven_labs" + version: typing.Optional[typing.Literal["v1"]] = None + model_id: ElevenLabsSpeakProviderModelId + language: typing.Optional[str] = None + language_code: typing.Optional[str] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class SpeakSettingsV1Provider_Cartesia(UncheckedBaseModel): + type: typing.Literal["cartesia"] = "cartesia" + version: typing.Optional[typing.Literal["2025-03-17"]] = None + model_id: CartesiaModelId + voice: CartesiaVoice + language: typing.Optional[str] = None + volume: typing.Optional[float] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class SpeakSettingsV1Provider_OpenAi(UncheckedBaseModel): + type: typing.Literal["open_ai"] = "open_ai" + version: typing.Optional[typing.Literal["v1"]] = None + model: OpenAiSpeakProviderModel + voice: OpenAiSpeakProviderVoice + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class SpeakSettingsV1Provider_AwsPolly(UncheckedBaseModel): + type: typing.Literal["aws_polly"] = "aws_polly" + voice: AwsPollySpeakProviderVoice + language: str + language_code: typing.Optional[str] = None + engine: AwsPollySpeakProviderEngine + credentials: AwsPollySpeakProviderCredentials + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +SpeakSettingsV1Provider = typing_extensions.Annotated[ + typing.Union[ + SpeakSettingsV1Provider_Deepgram, + SpeakSettingsV1Provider_ElevenLabs, + SpeakSettingsV1Provider_Cartesia, + SpeakSettingsV1Provider_OpenAi, + SpeakSettingsV1Provider_AwsPolly, + ], + UnionMetadata(discriminant="type"), +] diff --git a/tests/wire/test_listen_v1_media.py.bak b/tests/wire/test_listen_v1_media.py.bak new file mode 100644 index 00000000..9998a387 --- /dev/null +++ b/tests/wire/test_listen_v1_media.py.bak @@ -0,0 +1,105 @@ +from .conftest import get_client, verify_request_count + + +def test_listen_v1_media_transcribe_url() -> None: + """Test transcribeUrl endpoint with WireMock""" + test_id = "listen.v1.media.transcribe_url.0" + client = get_client(test_id) + client.listen.v1.media.transcribe_url( + url="https://dpgr.am/spacewalk.wav", + ) + verify_request_count(test_id, "POST", "/v1/listen", None, 1) + + +def test_listen_v1_media_transcribe_url_serializes_all_query_params() -> None: + test_id = "listen.v1.media.transcribe_url.query_params" + client = get_client(test_id) + client.listen.v1.media.transcribe_url( + callback="callback", + callback_method="POST", + extra=["extra"], + sentiment=True, + summarize="v2", + tag=["tag"], + topics=True, + custom_topic=["custom_topic"], + custom_topic_mode="extended", + intents=True, + custom_intent=["custom_intent"], + custom_intent_mode="extended", + detect_entities=True, + detect_language=True, + diarize=True, + diarize_model="latest", + dictation=True, + encoding="linear16", + filler_words=True, + keyterm=["keyterm"], + keywords=["keywords"], + language="multi", + language_hint=["en", "es"], + measurements=True, + model="nova-3", + multichannel=True, + numerals=True, + paragraphs=True, + profanity_filter=True, + punctuate=True, + redact="redact", + redact_usage=True, + replace=["replace"], + search=["search"], + smart_format=True, + utterances=True, + utt_split=1.1, + version="latest", + mip_opt_out=True, + url="https://dpgr.am/spacewalk.wav", + ) + verify_request_count( + test_id, + "POST", + "/v1/listen", + { + "callback": "callback", + "callback_method": "POST", + "extra": "extra", + "sentiment": "true", + "summarize": "v2", + "tag": "tag", + "topics": "true", + "custom_topic": "custom_topic", + "custom_topic_mode": "extended", + "intents": "true", + "custom_intent": "custom_intent", + "custom_intent_mode": "extended", + "detect_entities": "true", + "detect_language": "true", + "diarize": "true", + "diarize_model": "latest", + "dictation": "true", + "encoding": "linear16", + "filler_words": "true", + "keyterm": "keyterm", + "keywords": "keywords", + "language": "multi", + "language_hint": ["en", "es"], + "measurements": "true", + "model": "nova-3", + "multichannel": "true", + "numerals": "true", + "paragraphs": "true", + "profanity_filter": "true", + "punctuate": "true", + "redact": "redact", + "redact_usage": "true", + "replace": "replace", + "search": "search", + "smart_format": "true", + "utterances": "true", + "utt_split": "1.1", + "version": "latest", + "mip_opt_out": "true", + }, + 1, + ) diff --git a/tests/wire/test_manage_v1_projects_keys.py.bak b/tests/wire/test_manage_v1_projects_keys.py.bak new file mode 100644 index 00000000..5509b22d --- /dev/null +++ b/tests/wire/test_manage_v1_projects_keys.py.bak @@ -0,0 +1,66 @@ +from .conftest import get_client, verify_request_count + +from deepgram.requests import CreateKeyV1RequestOneParams + + +def test_manage_v1_projects_keys_list_() -> None: + """Test list endpoint with WireMock""" + test_id = "manage.v1.projects.keys.list_.0" + client = get_client(test_id) + client.manage.v1.projects.keys.list( + project_id="123456-7890-1234-5678-901234", + status="active", + ) + verify_request_count(test_id, "GET", "/v1/projects/123456-7890-1234-5678-901234/keys", {"status": "active"}, 1) + + +def test_manage_v1_projects_keys_create() -> None: + """Test create endpoint with WireMock""" + test_id = "manage.v1.projects.keys.create.0" + client = get_client(test_id) + client.manage.v1.projects.keys.create( + project_id="123456-7890-1234-5678-901234", + comment="A comment", + scopes=["admin"], + ) + verify_request_count(test_id, "POST", "/v1/projects/123456-7890-1234-5678-901234/keys", None, 1) + + +def test_manage_v1_projects_keys_create_with_legacy_request_mapping() -> None: + """The pre-2026-12 single-mapping form of create() still reaches the same request. + + The 2026-12-01 regen replaced the opaque `request` argument with explicit keyword arguments. + Callers written against every prior release pass `request=`, so that form is still unpacked; + this pins it, along with the `CreateKeyV1RequestOneParams` alias they annotate it with. + """ + test_id = "manage.v1.projects.keys.create.legacy_request" + client = get_client(test_id) + request: CreateKeyV1RequestOneParams = {"comment": "A comment", "scopes": ["admin"]} + client.manage.v1.projects.keys.create(project_id="123456-7890-1234-5678-901234", request=request) + verify_request_count(test_id, "POST", "/v1/projects/123456-7890-1234-5678-901234/keys", None, 1) + + +def test_manage_v1_projects_keys_get() -> None: + """Test get endpoint with WireMock""" + test_id = "manage.v1.projects.keys.get.0" + client = get_client(test_id) + client.manage.v1.projects.keys.get( + project_id="123456-7890-1234-5678-901234", + key_id="123456789012345678901234", + ) + verify_request_count( + test_id, "GET", "/v1/projects/123456-7890-1234-5678-901234/keys/123456789012345678901234", None, 1 + ) + + +def test_manage_v1_projects_keys_delete() -> None: + """Test delete endpoint with WireMock""" + test_id = "manage.v1.projects.keys.delete.0" + client = get_client(test_id) + client.manage.v1.projects.keys.delete( + project_id="123456-7890-1234-5678-901234", + key_id="123456789012345678901234", + ) + verify_request_count( + test_id, "DELETE", "/v1/projects/123456-7890-1234-5678-901234/keys/123456789012345678901234", None, 1 + ) diff --git a/tests/wire/test_manage_v1_projects_requests.py.bak b/tests/wire/test_manage_v1_projects_requests.py.bak new file mode 100644 index 00000000..daccaba9 --- /dev/null +++ b/tests/wire/test_manage_v1_projects_requests.py.bak @@ -0,0 +1,66 @@ +import datetime + +from .conftest import get_client, verify_request_count + + +def test_manage_v1_projects_requests_list_() -> None: + """Test list endpoint with WireMock""" + test_id = "manage.v1.projects.requests.list_.0" + client = get_client(test_id) + client.manage.v1.projects.requests.list( + project_id="12345678-90ab-cdef-1234-567890abcdef", + ) + verify_request_count(test_id, "GET", "/v1/projects/12345678-90ab-cdef-1234-567890abcdef/requests", None, 1) + + +def test_manage_v1_projects_requests_list_serializes_all_query_params() -> None: + test_id = "manage.v1.projects.requests.list_.query_params" + client = get_client(test_id) + client.manage.v1.projects.requests.list( + project_id="12345678-90ab-cdef-1234-567890abcdef", + start=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), + end=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), + limit=1.1, + page=1.1, + accessor="12345678-1234-1234-1234-123456789012", + request_id="12345678-1234-1234-1234-123456789012", + deployment="hosted", + endpoint="listen", + method="sync", + status="succeeded", + ) + verify_request_count( + test_id, + "GET", + "/v1/projects/12345678-90ab-cdef-1234-567890abcdef/requests", + { + "start": "2024-01-15T09:30:00Z", + "end": "2024-01-15T09:30:00Z", + "limit": "1.1", + "page": "1.1", + "accessor": "12345678-1234-1234-1234-123456789012", + "request_id": "12345678-1234-1234-1234-123456789012", + "deployment": "hosted", + "endpoint": "listen", + "method": "sync", + "status": "succeeded", + }, + 1, + ) + + +def test_manage_v1_projects_requests_get() -> None: + """Test get endpoint with WireMock""" + test_id = "manage.v1.projects.requests.get.0" + client = get_client(test_id) + client.manage.v1.projects.requests.get( + project_id="12345678-90ab-cdef-1234-567890abcdef", + request_id="a3f1c9d2-4b7e-4f9a-8c3d-2e5f7b9a1c0d", + ) + verify_request_count( + test_id, + "GET", + "/v1/projects/12345678-90ab-cdef-1234-567890abcdef/requests/a3f1c9d2-4b7e-4f9a-8c3d-2e5f7b9a1c0d", + None, + 1, + )