From 319e8bbed0ab56eb45f4ae2268581a79cf6371a1 Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Thu, 12 Nov 2026 12:56:47 +0000 Subject: [PATCH 1/9] chore: initialize SDK regeneration branch From 0ed7200054a795cf65f1391e3376357f794041a5 Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Thu, 12 Nov 2026 12:58:24 +0000 Subject: [PATCH 2/9] chore: unfreeze files pending regen --- .fernignore | 110 +- .gitignore.bak | 8 + src/deepgram/__init__.py.bak | 1408 +++++++++++++++++ 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 | 446 ++++++ 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 | 56 + .../agent_v1settings_agent_context.py.bak | 66 + ...tings_agent_context_listen_provider.py.bak | 76 + ...nt_v1settings_agent_listen_provider.py.bak | 76 + .../types/agent_v1update_listen_listen.py.bak | 60 + 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 | 55 + ...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 + src/deepgram/requests/__init__.py.bak | 618 ++++++++ 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 | 871 ++++++++++ src/deepgram/types/deepgram.py.bak | 44 + .../types/deepgram_listen_provider_v2.py.bak | 85 + src/deepgram/types/shared_intents.py.bak | 61 + src/deepgram/types/shared_topics.py.bak | 61 + .../types/speak_settings_v1provider.py.bak | 117 ++ tests/wire/test_listen_v1_media.py.bak | 103 ++ .../wire/test_manage_v1_projects_keys.py.bak | 59 + .../test_manage_v1_projects_requests.py.bak | 66 + 56 files changed, 8567 insertions(+), 55 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/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 caea8da9..1f8bc9fc 100644 --- a/.fernignore +++ b/.fernignore @@ -44,18 +44,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) @@ -70,17 +70,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 @@ -88,12 +88,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. @@ -168,9 +168,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 @@ -179,7 +179,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 @@ -192,17 +192,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 @@ -219,40 +219,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 @@ -295,14 +295,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 @@ -311,7 +311,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 @@ -361,7 +361,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..86e0445a --- /dev/null +++ b/src/deepgram/__init__.py.bak @@ -0,0 +1,1408 @@ +# 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, + 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, + ListenV2EagerEotThreshold, + ListenV2Encoding, + ListenV2EotThreshold, + ListenV2EotTimeoutMs, + ListenV2Keyterm, + ListenV2LanguageHint, + ListenV2MipOptOut, + ListenV2Model, + ListenV2Numerals, + ListenV2ProfanityFilter, + ListenV2Redact, + ListenV2SampleRate, + ListenV2Tag, + 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, + SpeakV2Response, + SpeakV2SampleRate, + SpeakV2Speed, + SpeakV2SpeedValue, + SpeakV2Tag, + ThinkLiveSettingsV1, + ThinkSettingsV1, + ThinkSettingsV1ContextLength, + ThinkSettingsV1Endpoint, + ThinkSettingsV1FunctionsItem, + ThinkSettingsV1FunctionsItemEndpoint, + ThinkSettingsV1Provider, + ThinkSettingsV1Provider_Anthropic, + ThinkSettingsV1Provider_AwsBedrock, + ThinkSettingsV1Provider_Deepgram, + ThinkSettingsV1Provider_Google, + ThinkSettingsV1Provider_Groq, + 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, + 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_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", + "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", + "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", + "ListenV2SampleRate": ".types", + "ListenV2Tag": ".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", + "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_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", + "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", + "ListenV2EagerEotThreshold", + "ListenV2Encoding", + "ListenV2EotThreshold", + "ListenV2EotTimeoutMs", + "ListenV2Keyterm", + "ListenV2KeytermParams", + "ListenV2LanguageHint", + "ListenV2LanguageHintParams", + "ListenV2MipOptOut", + "ListenV2Model", + "ListenV2Numerals", + "ListenV2ProfanityFilter", + "ListenV2Redact", + "ListenV2SampleRate", + "ListenV2Tag", + "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", + "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_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..ef56cc79 --- /dev/null +++ b/src/deepgram/agent/v1/socket_client.py.bak @@ -0,0 +1,446 @@ +# 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..b55a8345 --- /dev/null +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent.py.bak @@ -0,0 +1,56 @@ +# 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..6b74f1ee --- /dev/null +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent_context.py.bak @@ -0,0 +1,66 @@ +# 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..d7f6670b --- /dev/null +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py.bak @@ -0,0 +1,76 @@ +# 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..1e7f78e5 --- /dev/null +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py.bak @@ -0,0 +1,76 @@ +# 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..c60cb378 --- /dev/null +++ b/src/deepgram/agent/v1/types/agent_v1update_listen_listen.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 ....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..e9cc30c9 --- /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.18.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..e9f508ba --- /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 + 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 + 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 + 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 + 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..6b15d6fd --- /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 + 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 + 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 + 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 + 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..cf7c1c80 --- /dev/null +++ b/src/deepgram/listen/v2/types/listen_v2configure_success.py.bak @@ -0,0 +1,55 @@ +# 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. + """ + + 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/requests/__init__.py.bak b/src/deepgram/requests/__init__.py.bak new file mode 100644 index 00000000..beb2e2db --- /dev/null +++ b/src/deepgram/requests/__init__.py.bak @@ -0,0 +1,618 @@ +# 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 .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_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", + "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_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", + "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_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..d3c52c67 --- /dev/null +++ b/src/deepgram/types/__init__.py.bak @@ -0,0 +1,871 @@ +# 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_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_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_v2sample_rate import ListenV2SampleRate + from .listen_v2tag import ListenV2Tag + 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_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_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", + "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", + "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", + "ListenV2SampleRate": ".listen_v2sample_rate", + "ListenV2Tag": ".listen_v2tag", + "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", + "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_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", + "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", + "ListenV2EagerEotThreshold", + "ListenV2Encoding", + "ListenV2EotThreshold", + "ListenV2EotTimeoutMs", + "ListenV2Keyterm", + "ListenV2LanguageHint", + "ListenV2MipOptOut", + "ListenV2Model", + "ListenV2Numerals", + "ListenV2ProfanityFilter", + "ListenV2Redact", + "ListenV2SampleRate", + "ListenV2Tag", + "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", + "SpeakV2Response", + "SpeakV2SampleRate", + "SpeakV2Speed", + "SpeakV2SpeedValue", + "SpeakV2Tag", + "ThinkLiveSettingsV1", + "ThinkSettingsV1", + "ThinkSettingsV1ContextLength", + "ThinkSettingsV1Endpoint", + "ThinkSettingsV1FunctionsItem", + "ThinkSettingsV1FunctionsItemEndpoint", + "ThinkSettingsV1Provider", + "ThinkSettingsV1Provider_Anthropic", + "ThinkSettingsV1Provider_AwsBedrock", + "ThinkSettingsV1Provider_Deepgram", + "ThinkSettingsV1Provider_Google", + "ThinkSettingsV1Provider_Groq", + "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..c974e7fa --- /dev/null +++ b/src/deepgram/types/deepgram_listen_provider_v2.py.bak @@ -0,0 +1,85 @@ +# 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..619a4eba --- /dev/null +++ b/src/deepgram/types/shared_intents.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 .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..b2b00fa4 --- /dev/null +++ b/src/deepgram/types/shared_topics.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 .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..44dd3752 --- /dev/null +++ b/tests/wire/test_listen_v1_media.py.bak @@ -0,0 +1,103 @@ +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", + 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", + "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..4b7a8100 --- /dev/null +++ b/tests/wire/test_manage_v1_projects_keys.py.bak @@ -0,0 +1,59 @@ +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="project_id", + request={"key": "value"}, + ) + verify_request_count(test_id, "POST", "/v1/projects/project_id/keys", None, 1) + + +def test_manage_v1_projects_keys_create_with_old_request_alias() -> None: + test_id = "manage.v1.projects.keys.create.compat" + client = get_client(test_id) + request: CreateKeyV1RequestOneParams = {"key": "value"} + client.manage.v1.projects.keys.create(project_id="project_id", request=request) + verify_request_count(test_id, "POST", "/v1/projects/project_id/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, + ) From eef6a85e02acaba63ec56c81e993fe95db3b877b Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Thu, 12 Nov 2026 13:02:07 +0000 Subject: [PATCH 3/9] SDK regeneration --- .fern/metadata.json | 6 +- .gitignore | 3 - poetry.lock | 297 +++++++++--------- pyproject.toml | 2 +- src/deepgram/__init__.py | 76 +---- src/deepgram/agent/__init__.py | 68 ---- src/deepgram/agent/v1/__init__.py | 68 ---- src/deepgram/agent/v1/requests/__init__.py | 38 --- .../v1/requests/agent_v1conversation_text.py | 2 +- .../agent_v1inject_dynamic_agent_message.py | 2 +- .../agent/v1/requests/agent_v1settings.py | 3 +- .../v1/requests/agent_v1settings_agent.py | 17 +- .../agent_v1settings_agent_context.py | 4 - src/deepgram/agent/v1/socket_client.py | 46 +-- src/deepgram/agent/v1/types/__init__.py | 42 --- .../v1/types/agent_v1conversation_text.py | 4 +- .../agent_v1inject_dynamic_agent_message.py | 2 +- .../agent/v1/types/agent_v1settings.py | 3 +- .../agent/v1/types/agent_v1settings_agent.py | 51 +-- .../types/agent_v1settings_agent_context.py | 20 -- ...1settings_agent_context_listen_provider.py | 22 -- .../agent_v1settings_agent_listen_provider.py | 22 -- .../v1/types/agent_v1update_listen_listen.py | 35 --- src/deepgram/core/api_error.py | 4 +- src/deepgram/core/client_wrapper.py | 2 +- src/deepgram/core/parse_error.py | 4 +- src/deepgram/core/query_encoder.py | 15 +- src/deepgram/listen/__init__.py | 4 - src/deepgram/listen/v1/client.py | 9 + src/deepgram/listen/v1/media/client.py | 20 ++ src/deepgram/listen/v1/media/raw_client.py | 20 ++ src/deepgram/listen/v1/raw_client.py | 9 + .../v1/requests/listen_v1configure_failure.py | 2 +- src/deepgram/listen/v1/socket_client.py | 40 +-- .../v1/types/listen_v1configure_failure.py | 2 +- src/deepgram/listen/v2/__init__.py | 4 - src/deepgram/listen/v2/client.py | 9 + src/deepgram/listen/v2/raw_client.py | 9 + .../listen/v2/requests/listen_v2configure.py | 2 + .../v2/requests/listen_v2configure_success.py | 5 + src/deepgram/listen/v2/socket_client.py | 46 ++- src/deepgram/listen/v2/types/__init__.py | 4 - .../listen/v2/types/listen_v2configure.py | 2 + .../v2/types/listen_v2configure_failure.py | 4 +- .../v2/types/listen_v2configure_success.py | 9 +- .../listen_v2configure_success_thresholds.py | 4 +- .../listen/v2/types/listen_v2connected.py | 4 +- .../listen/v2/types/listen_v2fatal_error.py | 4 +- .../listen/v2/types/listen_v2turn_info.py | 4 +- .../v2/types/listen_v2turn_info_words_item.py | 4 +- .../listen/v2/types/listen_v2warning.py | 4 +- src/deepgram/requests/__init__.py | 32 -- src/deepgram/requests/shared_intents.py | 2 - src/deepgram/requests/shared_topics.py | 2 - src/deepgram/speak/v1/socket_client.py | 34 +- src/deepgram/speak/v2/audio/client.py | 10 + src/deepgram/speak/v2/audio/raw_client.py | 10 + src/deepgram/speak/v2/client.py | 9 + src/deepgram/speak/v2/raw_client.py | 9 + .../speak/v2/requests/speak_v2warning.py | 8 +- src/deepgram/speak/v2/socket_client.py | 31 +- .../speak/v2/types/speak_v2warning.py | 8 +- src/deepgram/types/__init__.py | 56 +--- src/deepgram/types/deepgram.py | 2 +- .../types/deepgram_listen_provider_v2.py | 27 -- src/deepgram/types/deepgram_model.py | 230 ++++++++++++++ src/deepgram/types/listen_v1redact_usage.py | 5 + .../types/listen_v2configure_redact_usage.py | 6 + src/deepgram/types/listen_v2redact_usage.py | 5 + src/deepgram/types/shared_intents.py | 36 --- src/deepgram/types/shared_topics.py | 36 --- .../types/speak_settings_v1provider.py | 2 +- .../types/speak_v2normalize_volume.py | 5 + tests/wire/test_listen_v1_media.py | 92 ------ tests/wire/test_manage_v1_projects_keys.py | 10 - .../wire/test_manage_v1_projects_requests.py | 38 --- 76 files changed, 688 insertions(+), 1099 deletions(-) create mode 100644 src/deepgram/types/listen_v1redact_usage.py create mode 100644 src/deepgram/types/listen_v2configure_redact_usage.py create mode 100644 src/deepgram/types/listen_v2redact_usage.py create mode 100644 src/deepgram/types/speak_v2normalize_volume.py diff --git a/.fern/metadata.json b/.fern/metadata.json index 17981925..6b7c695a 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -21,8 +21,8 @@ "skip_validation": true } }, - "originGitCommit": "330b1dab41a5004329de2c1ea6396dc4b1ea930c", + "originGitCommit": "229defd4c32f220af07902c24efca5e94b4c47a4", "originGitCommitIsDirty": true, "invokedBy": "manual", - "sdkVersion": "7.18.0" -} + "sdkVersion": "7.18.1" +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 765eb109..d2e4ca80 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,3 @@ __pycache__/ dist/ poetry.toml -.coverage -htmlcov/ -coverage.xml diff --git a/poetry.lock b/poetry.lock index 5578b5d7..bbc6a71f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1335,19 +1335,19 @@ files = [ [[package]] name = "pydantic" -version = "2.14.2" +version = "2.14.3" description = "Data validation using Python type hints" optional = false python-versions = ">=3.10" groups = ["main"] files = [ - {file = "pydantic-2.14.2-py3-none-any.whl", hash = "sha256:7efbf7507b937931cd32a5755acb00ea1cf5ccb1d4e8067a5850d5069e382118"}, - {file = "pydantic-2.14.2.tar.gz", hash = "sha256:fb7b2db6cefe8414dd612edeede49c4c433acb0432b0f92b95024e45f66c505d"}, + {file = "pydantic-2.14.3-py3-none-any.whl", hash = "sha256:3f7b347782ab7e4cf4c798496ae3a82787d9f21ec12676a9c564355eeef8daa8"}, + {file = "pydantic-2.14.3.tar.gz", hash = "sha256:1054f237f4d4733e5a30e1e2333bd33a2004ab9ab1510bd053a9a31bb48e232d"}, ] [package.dependencies] annotated-types = ">=0.6.0" -pydantic-core = "2.50.2" +pydantic-core = "2.50.4" typing-extensions = ">=4.16.0" typing-inspection = ">=0.4.4" @@ -1357,153 +1357,152 @@ timezone = ["tzdata ; platform_system == \"Windows\""] [[package]] name = "pydantic-core" -version = "2.50.2" +version = "2.50.4" description = "Core functionality for Pydantic validation and serialization" optional = false python-versions = ">=3.10" groups = ["main"] files = [ - {file = "pydantic_core-2.50.2-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:6258754c473b3045a7aa30b833a8a331a1ab36c6147cb230789861d80bb26f83"}, - {file = "pydantic_core-2.50.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:a786cf782ebb2e45a43c7118d75d452aac982b79577dfe804d8dbf2878f0b589"}, - {file = "pydantic_core-2.50.2-cp310-cp310-manylinux1_i686.manylinux_2_5_i686.whl", hash = "sha256:ea71b94a2eb5d2fc102926321f56d2ee8eddfad2673eadb1d23e9f287a492715"}, - {file = "pydantic_core-2.50.2-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:71615edeaf1ae70f5f3f558426072eede0168b7e5190fd9633878e29a0b85732"}, - {file = "pydantic_core-2.50.2-cp310-cp310-manylinux2014_armv7l.manylinux_2_17_armv7l.whl", hash = "sha256:1a5e859f5a8a6d834b0a13acaa0eaddf1a9b4b015fcda13bab7b471e18299d32"}, - {file = "pydantic_core-2.50.2-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:d71a9a9352acbcb5c73d39dd003383599428067b6eda5cf7c5d335a7a0da37e1"}, - {file = "pydantic_core-2.50.2-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:bf7f99a0e6616cea754e2334d129091f3260d011369d9b8c658522bfb2427619"}, - {file = "pydantic_core-2.50.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:5c12a5a080570a91bbcbf6d10db008b80e3f5dea015ef2f0137bbec70f24f3f3"}, - {file = "pydantic_core-2.50.2-cp310-cp310-manylinux_2_31_riscv64.whl", hash = "sha256:89213368eef163350af37127939ace099010e8102757905c3e329f1175950ed8"}, - {file = "pydantic_core-2.50.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:d93c066a38f83376b5bc020e563666784d1b680a70d6ceb625fdb541af7a312e"}, - {file = "pydantic_core-2.50.2-cp310-cp310-musllinux_1_1_armv7l.whl", hash = "sha256:eec187d2876abb6a74203efbe2aa796455c1809334acf4e739dde35da8cfb69f"}, - {file = "pydantic_core-2.50.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:701bc55d08c22f981973ca4f6fdf4ea102ee1ee3a21b818b66fdb161ea711a4a"}, - {file = "pydantic_core-2.50.2-cp310-cp310-win32.whl", hash = "sha256:7f9821dfc0c473c96ad55ce4189c7cb4f9c94e7d4f563afb874173243dec1162"}, - {file = "pydantic_core-2.50.2-cp310-cp310-win_amd64.whl", hash = "sha256:3939538e640c94ab779a05f2d45dafedd01d65d93e1290797f3ac5b59fcb6455"}, - {file = "pydantic_core-2.50.2-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:2115d7ca6d58554af8a14da3dd32d361a4fe999fae52f115a6155679b5b00e72"}, - {file = "pydantic_core-2.50.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:b2dd65864aad38dbcc57c3d0e2c978d4286e063378137d8fc0c9fcd558943285"}, - {file = "pydantic_core-2.50.2-cp311-cp311-manylinux1_i686.manylinux_2_5_i686.whl", hash = "sha256:26b778d4ebb75f181d36220ff0f54a513fc46f053d9b09ce79993c2f00bc45cc"}, - {file = "pydantic_core-2.50.2-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:e80c47314c7233e7105a7efcfffd89d56e479e558189d1959eeeaf2639a27680"}, - {file = "pydantic_core-2.50.2-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.whl", hash = "sha256:3bfe12243b3ded517c6734d91f127489e2f51bf95cb533b53130fe360333db80"}, - {file = "pydantic_core-2.50.2-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:01eb0282d0b3a065d55956d1be9ce398c46db3dd6d277a6cb2358c8aa8c53179"}, - {file = "pydantic_core-2.50.2-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:196b87b48b2695426920e8470d20f9e99f019ebd86f15808aa018b68086840cd"}, - {file = "pydantic_core-2.50.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:86e7abd24a67f61a4bfe8df059b67a2bdd8bf33705178e98463195d140bd3780"}, - {file = "pydantic_core-2.50.2-cp311-cp311-manylinux_2_31_riscv64.whl", hash = "sha256:aff31602e8518594e6f6bc670cdb27e37cb7dbeb2d5d0b76a7707b70fe951ddf"}, - {file = "pydantic_core-2.50.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:a88851e8e332588cb8cced8b5318d1163c7d0bb87830aa8dcafbc4ae9602b73c"}, - {file = "pydantic_core-2.50.2-cp311-cp311-musllinux_1_1_armv7l.whl", hash = "sha256:3b1bb3950e0794a795c9344d818d5b476189b0c9c9755e8eb8fde87c3acee17a"}, - {file = "pydantic_core-2.50.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:928a44ad1e21a7e923eb924d601605f0694cd187d2ce5d40bf7ad76650f4627d"}, - {file = "pydantic_core-2.50.2-cp311-cp311-win32.whl", hash = "sha256:9a87744e683d9a13f60b7fa5242c17f8d283ffa94ad727cb19063b48c3d34960"}, - {file = "pydantic_core-2.50.2-cp311-cp311-win_amd64.whl", hash = "sha256:b958c217c6e56bef261f516e4caf5d490b079ad6a428752afada5a764cca6c71"}, - {file = "pydantic_core-2.50.2-cp311-cp311-win_arm64.whl", hash = "sha256:b0e6a2152706d84f7da8b9d34dcecc7e9bde678af32c40bd5b405f427ae0fbdb"}, - {file = "pydantic_core-2.50.2-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:e3d824b6152e1c0fd58dc6266f2de470eb7b2286135294f5f7cd26a0f0693738"}, - {file = "pydantic_core-2.50.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:596921489390a002d6a5e303384a0f1f98384f8bb550fbf38a1aafa6093da0f9"}, - {file = "pydantic_core-2.50.2-cp312-cp312-manylinux1_i686.manylinux_2_5_i686.whl", hash = "sha256:36d8b9725684ca3bf658b90a101d335fc8cae405bb22196b7b5ef41344913756"}, - {file = "pydantic_core-2.50.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:43a8fd56f3c681f3cda2d5c842ad28e88241df742dfcbe8fd1dd437a3056e1f6"}, - {file = "pydantic_core-2.50.2-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.whl", hash = "sha256:6f5a432c6c1ef18a1a02a04b3616b8d3f2f88b13faa46caae1ac6559ab202234"}, - {file = "pydantic_core-2.50.2-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:5d3cd8be71c4da3c9b42cc92f17e5e3036bdca98bf18555a0e072c3fe87abbb4"}, - {file = "pydantic_core-2.50.2-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:6a438cb8a3f87f2c49e82e43fb19511d4d5043f53e0787dc4df937ccb904373a"}, - {file = "pydantic_core-2.50.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:9667637665acba166a7dbbc786f14c50512d3a01f7199e0e1a13b929e92d7c7a"}, - {file = "pydantic_core-2.50.2-cp312-cp312-manylinux_2_31_riscv64.whl", hash = "sha256:b3e681208e2d39fde13fbea449ef2736a85ec1ea2afa41e9193a8c536e71dafe"}, - {file = "pydantic_core-2.50.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:6eb6ff07964f39e33c6f57fefe939514e76b8c0d4a694e5663e2e04e80cc1798"}, - {file = "pydantic_core-2.50.2-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:4eb54c25e3463d73e1e4ed439ffc45d1d7e590df40bc7bb06f11a906afd996c3"}, - {file = "pydantic_core-2.50.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:91238117cd296352f54f24117ff5a227bdea428865dba1244aa0cdd1424c0bc2"}, - {file = "pydantic_core-2.50.2-cp312-cp312-win32.whl", hash = "sha256:98722314e12a8e4fa346e0afd3fff2098b5732875ff45592b450a7b589b43c4f"}, - {file = "pydantic_core-2.50.2-cp312-cp312-win_amd64.whl", hash = "sha256:b381574614245f18fdb2d6d1aa8f149e225869c47b5ee7f81812de8977817314"}, - {file = "pydantic_core-2.50.2-cp312-cp312-win_arm64.whl", hash = "sha256:f07c965a8aa6d62145f122641f292129984f39a3e3697585b19298a1488287db"}, - {file = "pydantic_core-2.50.2-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:93eb41d626d9a2749a678823c70bba8c25033cef474ae8001fd7621adbbd8437"}, - {file = "pydantic_core-2.50.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:7c539d452cba22f250103c7d1c00cbe9038eb705e657476e701c43374efd9f2e"}, - {file = "pydantic_core-2.50.2-cp313-cp313-manylinux1_i686.manylinux_2_5_i686.whl", hash = "sha256:53bd25e8ab54c02bb4c55d4848c1d36f75f3b9a7356e83179fe27794d9e9e6c4"}, - {file = "pydantic_core-2.50.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:f142cd663d1148ed32993ed9a58e5c67ea312f446a01a6c13a956945aafc9f23"}, - {file = "pydantic_core-2.50.2-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.whl", hash = "sha256:126f158474346f457c0759c29c1a6334acd5f7f99dd272bb27d19314f3d81b4d"}, - {file = "pydantic_core-2.50.2-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:0b94a515f44f1ebcb25395bcdba506c4cdaf6d3fcb0466b9658521b41e5ff057"}, - {file = "pydantic_core-2.50.2-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:a55c1163e829a08707b4a92c8ee02a5a3a3847ced74aa4da94e3e975ffe1ec63"}, - {file = "pydantic_core-2.50.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:31a1fb3ffbd1195b24490f671d12623dd4c9bfa56d6af0a299fa43b516134f5b"}, - {file = "pydantic_core-2.50.2-cp313-cp313-manylinux_2_31_riscv64.whl", hash = "sha256:83d6f42ae6eba44548a1a3d4f900a5b1500fdd14f09f04754a8800ab0d544432"}, - {file = "pydantic_core-2.50.2-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:9fcde11462e0faab4c2a2ae8cd4516f7dd8239eec583bd88c5524d8064ad2d0c"}, - {file = "pydantic_core-2.50.2-cp313-cp313-musllinux_1_1_armv7l.whl", hash = "sha256:848984e231190ae49bc8b5229e64d2a6fba4231dc6046e1b6b28ddc060bc7601"}, - {file = "pydantic_core-2.50.2-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:8772c2c0091e6fc2d0499151793d31bf811826986b0727052935a95104845544"}, - {file = "pydantic_core-2.50.2-cp313-cp313-win32.whl", hash = "sha256:bd6ecae08c0d871cf93b6f0d4ee76b06c65be44ea22311981a022b2f1948cf9d"}, - {file = "pydantic_core-2.50.2-cp313-cp313-win_amd64.whl", hash = "sha256:e5c801bdf3cc92274b8fc2c7023c8751e5ae81260c009ac558ff55ce712a2d45"}, - {file = "pydantic_core-2.50.2-cp313-cp313-win_arm64.whl", hash = "sha256:fd9aa71a800c87c0f7ab53fa38009169a23a82c685989626ca74a4bd483e1b67"}, - {file = "pydantic_core-2.50.2-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:efad0bdc67d3b119c3bab6b94d341a27333c2bb89ed75dfa182a4a06cd0ea329"}, - {file = "pydantic_core-2.50.2-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:6ffb4dce3ecb2cd563aa30f9eb5088a1cf1f4f688b90cbb374fa96e49fc50b02"}, - {file = "pydantic_core-2.50.2-cp314-cp314-manylinux1_i686.manylinux_2_5_i686.whl", hash = "sha256:150f6e101f575c21a4ecfed1be1c05bb89a0ad49cb9c846ed377583bd71b32c2"}, - {file = "pydantic_core-2.50.2-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:1db9cab6197e797824f0479dd2ae5fd2e272aa61c61b7faa5a6e450ca7a0d3b7"}, - {file = "pydantic_core-2.50.2-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.whl", hash = "sha256:1b9f652e17a13bbc09b45f74c3c326cca72059ce4dcdef687fcb04389db413a9"}, - {file = "pydantic_core-2.50.2-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:823b222c4fc861a82c650998a6117ecbd150cc71bf8b78f9a31bf3f48c456108"}, - {file = "pydantic_core-2.50.2-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:783abdfac21247d33bec40aa683d26bba30d61655c40de38b2decc4797aabf92"}, - {file = "pydantic_core-2.50.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:b29b7c5adf4b2be7c941f7f76432aa3269cd5052ff8610376b8ece24d7b02c51"}, - {file = "pydantic_core-2.50.2-cp314-cp314-manylinux_2_31_riscv64.whl", hash = "sha256:4ac996e42a93d80122a23edce44e02c6b9c4913f5c6198a077da31475341a39a"}, - {file = "pydantic_core-2.50.2-cp314-cp314-musllinux_1_1_aarch64.whl", hash = "sha256:99e1d482138a71902415ba375bb4627679a5fefd3bd07803c3a8f37632f4981d"}, - {file = "pydantic_core-2.50.2-cp314-cp314-musllinux_1_1_armv7l.whl", hash = "sha256:a53d5f11cd6d15569ba3e53f3498077f0d5e633f6ec604d2ea613e895017ebee"}, - {file = "pydantic_core-2.50.2-cp314-cp314-musllinux_1_1_x86_64.whl", hash = "sha256:23385c4626f8b5a7792aa381ea573d9432cfbf4c21375a0a5eed2a4fb64e0e58"}, - {file = "pydantic_core-2.50.2-cp314-cp314-pyemscripten_2026_0_wasm32.whl", hash = "sha256:9a8a62281fd9c6a373b3fd3d473685e6838d43341eecde5f47729748e2c11ee3"}, - {file = "pydantic_core-2.50.2-cp314-cp314-win32.whl", hash = "sha256:18f008ef58cd30782f81b6e0119e20b7e884edcefbc2d370162ebe033f6e5c99"}, - {file = "pydantic_core-2.50.2-cp314-cp314-win_amd64.whl", hash = "sha256:b62c89545d21d930c333208fd548e7b4f262228ba3a322fd75c987a75ab11f31"}, - {file = "pydantic_core-2.50.2-cp314-cp314-win_arm64.whl", hash = "sha256:6e731bf5a5e8e25398544d7709e39068ec4230b0177e4db7fa955692fd415ba3"}, - {file = "pydantic_core-2.50.2-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:33c6800ab9563adaa0d7893e9cd8f5b972ef1e6a23df70498e05c24f3fcec5e1"}, - {file = "pydantic_core-2.50.2-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:f81df206b937d0dca5efb38c25fc99037d82dbcd3740e34c3f81997d2322ac1c"}, - {file = "pydantic_core-2.50.2-cp314-cp314t-manylinux1_i686.manylinux_2_5_i686.whl", hash = "sha256:21ea3b00f1e87c66f3f9e92f9f6fec20495ac0e60d7d2e68ba1fc49739d7cf40"}, - {file = "pydantic_core-2.50.2-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:9eff570402175c7d5fff8497d5a9c05580664a79bb66c07b8f205d17f69e580b"}, - {file = "pydantic_core-2.50.2-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.whl", hash = "sha256:240fec32a74af0979f7253532859b3fd209ad5eea822416bb010929dba445c3d"}, - {file = "pydantic_core-2.50.2-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:92acf02c770b9d5c4e9a3e8d64e9d95ae26456a86ebb7b7cf64a97f899e5871b"}, - {file = "pydantic_core-2.50.2-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:1ac5b99bc7b0a68ec64f5f75a6828a7bab5535c8df0cdc07901deb50e0815910"}, - {file = "pydantic_core-2.50.2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:713d7c33c0e231e3786eb0ec95885814dd65d5f3a09754399b6acbf5e9365f11"}, - {file = "pydantic_core-2.50.2-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:61e13100b30d8d25fc0d1f0297014b32941bf0975a3584bd08f3adebb68d1ead"}, - {file = "pydantic_core-2.50.2-cp314-cp314t-musllinux_1_1_aarch64.whl", hash = "sha256:523fe6574aea50f456cbc301c1cdddcbf237939f7657f9af99b4f0f71942b59c"}, - {file = "pydantic_core-2.50.2-cp314-cp314t-musllinux_1_1_armv7l.whl", hash = "sha256:6c25b8826be85714b27dafe908d3461e1b09e3e31c0279a7029040c832c781ef"}, - {file = "pydantic_core-2.50.2-cp314-cp314t-musllinux_1_1_x86_64.whl", hash = "sha256:a59db03b80a156a6fbeae41096866d1cb89cdf31031ba44c768a804538880636"}, - {file = "pydantic_core-2.50.2-cp314-cp314t-win32.whl", hash = "sha256:0d090ae76d5b09c003600c7779b3adcf3d1b49268f616c5c51d844e54c8e318d"}, - {file = "pydantic_core-2.50.2-cp314-cp314t-win_amd64.whl", hash = "sha256:9b01a092955c1c7530196ad526755cff4f2d11f37ca9a6fc9ebe37ca49a48977"}, - {file = "pydantic_core-2.50.2-cp314-cp314t-win_arm64.whl", hash = "sha256:4ea01f30e119f1ec7a2034e85c40f491d469896aef02cd6436fd9292fe1be3fb"}, - {file = "pydantic_core-2.50.2-cp315-cp315-macosx_10_12_x86_64.whl", hash = "sha256:a3317630e2791f56071b82f89bb71624146125e4311e6643f708c6ba744b5ac5"}, - {file = "pydantic_core-2.50.2-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:f73930dacad5e611fe019e18df6f53c30629b1843d038d303b8dec86a32493bd"}, - {file = "pydantic_core-2.50.2-cp315-cp315-manylinux1_i686.manylinux_2_5_i686.whl", hash = "sha256:e2e6240a0a5ad847017b3d65187877fdb7a11d5a58d43c30736f9f523478913b"}, - {file = "pydantic_core-2.50.2-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:1fdf5b52ed22f1404c2433d0b46df2d86d9befb742d0b9b4042a2325c43cdb97"}, - {file = "pydantic_core-2.50.2-cp315-cp315-manylinux2014_armv7l.manylinux_2_17_armv7l.whl", hash = "sha256:4e9392ddf67fe97ab9889f796d468c9908a8754b8b6c7520eb03a65012b9a1e7"}, - {file = "pydantic_core-2.50.2-cp315-cp315-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:48e944091b7bff233920bed8a60b0ed6c96c73d3c5836bf51c4b9a4bfb58e4ca"}, - {file = "pydantic_core-2.50.2-cp315-cp315-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:91c92856b846aa690ea6239ffd6c5003c5e3e296a69095570bf4efee5bfa0bdc"}, - {file = "pydantic_core-2.50.2-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:5299296ff5cafcb69851fd652de8f9268a0bb036bcbedbfcaa94cf743baf3986"}, - {file = "pydantic_core-2.50.2-cp315-cp315-manylinux_2_31_riscv64.whl", hash = "sha256:d3d049b557875f9d15230eec8a731749a7a873d8ed6a051903b05bdf46e0e65f"}, - {file = "pydantic_core-2.50.2-cp315-cp315-musllinux_1_1_aarch64.whl", hash = "sha256:b0b25d647036972c2951059046cb498f72b7af5a2def27bf8e5f44c3067ab7dd"}, - {file = "pydantic_core-2.50.2-cp315-cp315-musllinux_1_1_armv7l.whl", hash = "sha256:8835566b3e94026da3ce2249f9ee35c9d2ebe4cd131f6a39bfc82708d3010a46"}, - {file = "pydantic_core-2.50.2-cp315-cp315-musllinux_1_1_x86_64.whl", hash = "sha256:3fbcd402e4b607d4b8de5d4591215f31f042af03f9d09e58f693a6221e32833f"}, - {file = "pydantic_core-2.50.2-cp315-cp315-win32.whl", hash = "sha256:8431ecb131489cbdaf6f51f7ade47475f73aff4f1912552f75ba19a6cfe233a8"}, - {file = "pydantic_core-2.50.2-cp315-cp315-win_amd64.whl", hash = "sha256:04cf672960b8c4fc28bb159c8cdd101fbd311c520237a5c0360448b851adfb41"}, - {file = "pydantic_core-2.50.2-cp315-cp315-win_arm64.whl", hash = "sha256:36917e29c0b815d6b940bc91560fcf453b5b85d55c579796373f0ea11d1c111a"}, - {file = "pydantic_core-2.50.2-cp315-cp315t-macosx_10_12_x86_64.whl", hash = "sha256:bd1fe69056a19c377a6c6de2c1240fb8676ba0512a969965efb486510c5e0f1f"}, - {file = "pydantic_core-2.50.2-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:9b2383933b1dd7a8c93e02f99ebfd305f1286057172483b8e6898bed3fef69d3"}, - {file = "pydantic_core-2.50.2-cp315-cp315t-manylinux1_i686.manylinux_2_5_i686.whl", hash = "sha256:a1b4d60bad57d6e0e7cd30cc4d1dc646d258dd6dfb7935ce76c7dd72dd1e98b0"}, - {file = "pydantic_core-2.50.2-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:93bedc68c4138088ea3c042189c01d2945f530f0dcc36e1ea02df8418bd4f1cd"}, - {file = "pydantic_core-2.50.2-cp315-cp315t-manylinux2014_armv7l.manylinux_2_17_armv7l.whl", hash = "sha256:d684ff87d00de2f6abcbbfa9b0fdce8b513dd799a900809dcfa7eb62ad69832a"}, - {file = "pydantic_core-2.50.2-cp315-cp315t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:bb6d49f00e2babd40af4889d6b9f4bf50879f522dd4e2e22cb705cac5e0c5e8e"}, - {file = "pydantic_core-2.50.2-cp315-cp315t-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:6d47b2d0e00e030e0ebdb08115a37da7294e7a6d196d134a77ed7ee6c142284b"}, - {file = "pydantic_core-2.50.2-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:95838be125133fa314753f8cc5168f7c41e3a9dd5eef5383dbbbeed511bd4853"}, - {file = "pydantic_core-2.50.2-cp315-cp315t-manylinux_2_31_riscv64.whl", hash = "sha256:2d4a043c820363359e40ac96270e1915e5376e116be1f59cee0701775de3e376"}, - {file = "pydantic_core-2.50.2-cp315-cp315t-musllinux_1_1_aarch64.whl", hash = "sha256:57bccd3e1128736c792094da1feac6da46ec3feb1957ef649a9b3e4f8de6fa04"}, - {file = "pydantic_core-2.50.2-cp315-cp315t-musllinux_1_1_armv7l.whl", hash = "sha256:24120c644322a35b5eb765416ac8442214c45689e255f5fc6e761e7e7c743c8b"}, - {file = "pydantic_core-2.50.2-cp315-cp315t-musllinux_1_1_x86_64.whl", hash = "sha256:b1adf2f37521b578c438f6ec61d1c1d0c20b076863ddd5d8b6f3ab658857db3f"}, - {file = "pydantic_core-2.50.2-cp315-cp315t-win32.whl", hash = "sha256:d79aaa468193c1bed6b0560d3c5c9f9e369e3efb0b128b38a2537e2d51d42773"}, - {file = "pydantic_core-2.50.2-cp315-cp315t-win_amd64.whl", hash = "sha256:cc488daac19e6f5292180fac5e0ef7efffabeef4e096af9a17a75a7d3d6781f6"}, - {file = "pydantic_core-2.50.2-cp315-cp315t-win_arm64.whl", hash = "sha256:91315aea7adb51821d4a3378ede953bfdd76e3bf71551de4a82d7638cef7dc02"}, - {file = "pydantic_core-2.50.2-graalpy311-graalpy242_311_native-macosx_10_12_x86_64.whl", hash = "sha256:adec010c824290d4ca87047e8d8bfa4f85ac29f545f326cd5321696805d311ed"}, - {file = "pydantic_core-2.50.2-graalpy311-graalpy242_311_native-macosx_11_0_arm64.whl", hash = "sha256:f47c1349c3b4274aeb18459d54244881a5c0dee0fdccedffca45704ba5c9e0a0"}, - {file = "pydantic_core-2.50.2-graalpy311-graalpy242_311_native-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:4ee64baeab403b9de9c92846c5c1abec28ffb046cbc023bfae059897841f88af"}, - {file = "pydantic_core-2.50.2-graalpy311-graalpy242_311_native-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:16ec8e07c37f02dcf68939cc7f202ba9a148cc155ee2acf22d337e10b24c2cb7"}, - {file = "pydantic_core-2.50.2-graalpy312-graalpy250_312_native-macosx_10_12_x86_64.whl", hash = "sha256:d18d56c1ec63b304f4bb3c7db7e0d311e61cca1b1c944590a4b13ac39b2ca92b"}, - {file = "pydantic_core-2.50.2-graalpy312-graalpy250_312_native-macosx_11_0_arm64.whl", hash = "sha256:41ed8abeffda6a880207fdc0cd1343a448cec3cc6b38b53f730c0745f745292d"}, - {file = "pydantic_core-2.50.2-graalpy312-graalpy250_312_native-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:b7abcfaf66c1dc14c5ed928c349614f223c972a8b021b4be9548dbea6c817371"}, - {file = "pydantic_core-2.50.2-graalpy312-graalpy250_312_native-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:9e7460abce637f90e37f8c443559fbd687c38884d05cb69ef265e634945f4324"}, - {file = "pydantic_core-2.50.2-pp311-pypy311_pp73-macosx_10_12_x86_64.whl", hash = "sha256:b583ddeee6a6bb5bbc04462167c68034913221139d52d9f155ca6d1637a2fdcf"}, - {file = "pydantic_core-2.50.2-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:5ab5738c39b25b5dc5a721270e2269a2f5e86e614375e6c07ee6caab8cbc0f2f"}, - {file = "pydantic_core-2.50.2-pp311-pypy311_pp73-manylinux1_i686.manylinux_2_5_i686.whl", hash = "sha256:21a902e546032c82b7275552345a2342d862e0541aea7226c91067c396e68b3f"}, - {file = "pydantic_core-2.50.2-pp311-pypy311_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:92ada606285dab054e40848a951f583c537cde1e54701ea1305ec0096877012d"}, - {file = "pydantic_core-2.50.2-pp311-pypy311_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:c1b65a42afc73b39e6ae908ec7b9c3b9898676a7b15ce4c66d4965f7071007c8"}, - {file = "pydantic_core-2.50.2-pp311-pypy311_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:c324a7e0c0012e3974053f81a270d8f1aa23227571f4ddd3254c911bb356459b"}, - {file = "pydantic_core-2.50.2-pp311-pypy311_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:cb8d2d7b07cbe2d7488de7e53671f836c4f4a8032dcda079df33dc1b7e2397c0"}, - {file = "pydantic_core-2.50.2-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:7c6e1bd6cadae13958e52897ef020e85c9916a95917149fca463bb0c0421a7c6"}, - {file = "pydantic_core-2.50.2-pp311-pypy311_pp80-macosx_10_12_x86_64.whl", hash = "sha256:f078e276848bc23d1f92f46fc88d5b9cbb824b9acc60d9e07116620e502e16a9"}, - {file = "pydantic_core-2.50.2-pp311-pypy311_pp80-macosx_11_0_arm64.whl", hash = "sha256:3435c443da7510a6de1a30c68beae338852a11f0440cc8320ea756a162f38dbe"}, - {file = "pydantic_core-2.50.2-pp311-pypy311_pp80-manylinux_2_28_x86_64.whl", hash = "sha256:b5675a12a7b67063fe3ca187e735b0463cf13fabc10166ae4d4b2f775fd0632d"}, - {file = "pydantic_core-2.50.2-pp311-pypy311_pp80-win_amd64.whl", hash = "sha256:f5ba7ef10ce82737e173fa95cafa1c8210918f7e653715b2c7a7a31877a74848"}, - {file = "pydantic_core-2.50.2.tar.gz", hash = "sha256:1b0e8dc3932cf4e9ed5727570325cacc716b9409ffc794a221c0ccc72e8eb775"}, + {file = "pydantic_core-2.50.4-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:83d2beac85b757bfc404c5c0612df51c4ef33bbb7be65cf4a96b4da7cbc4ff4f"}, + {file = "pydantic_core-2.50.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:76e0065998159244ff4c097a6c05ff08019c6fbb6e597a85846e73044f0215b3"}, + {file = "pydantic_core-2.50.4-cp310-cp310-manylinux1_i686.manylinux_2_5_i686.whl", hash = "sha256:25e7e1080f9f7ce7cd9d114b31470ce912771bd02f38c824721d3c35d312abff"}, + {file = "pydantic_core-2.50.4-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:c4c5a1770ecfe8bdb6c6f09f8d81ea4de04f7efb012fac1efa4ad315dccc1fd1"}, + {file = "pydantic_core-2.50.4-cp310-cp310-manylinux2014_armv7l.manylinux_2_17_armv7l.whl", hash = "sha256:2f6767122b37c780bb756a720a4eef2bc6a050a0a1143428834b3cbc89448bd2"}, + {file = "pydantic_core-2.50.4-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:86c7c4615634b5c57a79770f5b738354e45ae219a89949aeae84f19169a05283"}, + {file = "pydantic_core-2.50.4-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:6c7d7b0b596319e9ce79ef96ce57a14054a2eac629c0588a0539187a218be799"}, + {file = "pydantic_core-2.50.4-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:ed9c0b6f236648dbf30d57e9f57e1f74878caafa04833a19f529b5ba5164b7a8"}, + {file = "pydantic_core-2.50.4-cp310-cp310-manylinux_2_31_riscv64.whl", hash = "sha256:dfcf6e51000b34f7026322cd9ea9bc340d745637e27e0bbc22f504b4f6b967ee"}, + {file = "pydantic_core-2.50.4-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:bd46bcc28ed85d3cf71581b42d90b4ebd1f2062f81879519fed209f8a4d1cfc6"}, + {file = "pydantic_core-2.50.4-cp310-cp310-musllinux_1_1_armv7l.whl", hash = "sha256:696613a0c0e7b2b35356e389ba4195ce20cfe7a2fc2e992c87d974d973eabec7"}, + {file = "pydantic_core-2.50.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:2980a701be88f9128a7470189fa3bcda5387f76c298a6f8e000fc29eb2a6f4e7"}, + {file = "pydantic_core-2.50.4-cp310-cp310-win32.whl", hash = "sha256:dd8bed00731a21e3106e5dd6bbffb6c775a2c0bbc7c0c9face534d830057bdc9"}, + {file = "pydantic_core-2.50.4-cp310-cp310-win_amd64.whl", hash = "sha256:e512c75ec5cf4475c1aa50ad975ecdf253f4963b06e152e1a11edd6de4010753"}, + {file = "pydantic_core-2.50.4-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:3e547ceec1da7382f01f9e13963023e53367a71802c88778b21b9645a077cbdf"}, + {file = "pydantic_core-2.50.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:c813ada7a651193acda85b6bc1cf12abd4b37cd25c7c6a75d7183512cc374969"}, + {file = "pydantic_core-2.50.4-cp311-cp311-manylinux1_i686.manylinux_2_5_i686.whl", hash = "sha256:57fa0a9490785139f1a4e4f43891830d55dfe4408845c0c9cb5eff4aeaf75f69"}, + {file = "pydantic_core-2.50.4-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:30d4dc35bc0eea52202a90b3820445ee0072c820241bfa710a623a078c9b267b"}, + {file = "pydantic_core-2.50.4-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.whl", hash = "sha256:789f88dea57841cdebef392b5d6e90444d767117e9ff2e0d9172df5c9de6690c"}, + {file = "pydantic_core-2.50.4-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:d690121e80ab16e623415351ab24713534d4e500b3cadff216409cb6826063d4"}, + {file = "pydantic_core-2.50.4-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:b42f64825f5d750228f08318a9bf4d723b7ecb4c472aedcb3013c3ec2dc1f949"}, + {file = "pydantic_core-2.50.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:0574866e05f6adeecc520d87e87dd06210c0a51706341f6ef8421572f5a64444"}, + {file = "pydantic_core-2.50.4-cp311-cp311-manylinux_2_31_riscv64.whl", hash = "sha256:dcf2c7eaaa4cafe8e49b017e5bb49e76e084ab6f0cd712ee4019c812b5cf68b8"}, + {file = "pydantic_core-2.50.4-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:3b8ee2589a082739c522c1fe4be227412fcf108b903abb6672ae2f5570558882"}, + {file = "pydantic_core-2.50.4-cp311-cp311-musllinux_1_1_armv7l.whl", hash = "sha256:aec3c2d741a8e3ee993de7f95f37afb51e31b169c95dbd29da4cf6688f340914"}, + {file = "pydantic_core-2.50.4-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:8923fcd49f875e8a0448d7223d1fdf1a9973ae2d1f20d4158753ceb8909facd2"}, + {file = "pydantic_core-2.50.4-cp311-cp311-win32.whl", hash = "sha256:fc04affef30be98c1f36f0c422a4061ef618fdc1dde79f5ad5458dd496fecffa"}, + {file = "pydantic_core-2.50.4-cp311-cp311-win_amd64.whl", hash = "sha256:15bece43a02ad543c621c8305e67dedb5f27d378c5ba741e5a2c36523f8ef37f"}, + {file = "pydantic_core-2.50.4-cp311-cp311-win_arm64.whl", hash = "sha256:e498900bfbf7ddddd862f810440c09e9b81674739e8a11d619b40906dccd4a9a"}, + {file = "pydantic_core-2.50.4-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:32a991aebd165f227b7c7c60bb9d66c2c7de9c24308552da264c9938fde0f8d6"}, + {file = "pydantic_core-2.50.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:1e20cbde2b6deb33a51d08cd168454dd9044ec7d4474056f4d98d63f51578783"}, + {file = "pydantic_core-2.50.4-cp312-cp312-manylinux1_i686.manylinux_2_5_i686.whl", hash = "sha256:8cceae48ae7f94990c2f4e36291e9ec9868735e8b0f19e4489a17b0422338466"}, + {file = "pydantic_core-2.50.4-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:16902a147b3da4840612164a5e67947104d63e978f7a57c395877a5e26690b9c"}, + {file = "pydantic_core-2.50.4-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.whl", hash = "sha256:d6e3485a5e5c01fb5339c1ee3d4b9e21e2135a2a9d44caafb71acd994487ee7c"}, + {file = "pydantic_core-2.50.4-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:629eae995185540406e3635df5d5cf1d44f19ea240840b835d3f44541ff694d8"}, + {file = "pydantic_core-2.50.4-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:41b2cd8b29dbb5a4c9828a70f50d1abfc92011115c813213d3a91205c6f731b3"}, + {file = "pydantic_core-2.50.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:c81d98e27d9d9261909dcccab1ba5d6ea1c98b0bb9470e368604614fd1d36ddd"}, + {file = "pydantic_core-2.50.4-cp312-cp312-manylinux_2_31_riscv64.whl", hash = "sha256:ca83a32b2b41653d89f09a3d22b770bca96da72273bef8f7a68136bdd1e8b823"}, + {file = "pydantic_core-2.50.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:817953730e4a73a09008b010c4a42396cefe799616a22df2ac21d3927b3080cf"}, + {file = "pydantic_core-2.50.4-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:664e74848c2f5fc27db8505fe24e1ecd3ac669412913bf73d176916f86cc08e2"}, + {file = "pydantic_core-2.50.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:219114f8dcdcbe4720d82ef016b1287ce5a0a67d7c69ca61524eb72e82aac344"}, + {file = "pydantic_core-2.50.4-cp312-cp312-win32.whl", hash = "sha256:67f7cc397e1d5556a801d1cba74de0d27d827eb242e6c036c0ca273c745414f1"}, + {file = "pydantic_core-2.50.4-cp312-cp312-win_amd64.whl", hash = "sha256:ea2f61b0bc12f3592288503961b764579dea0658852d96a0b3d823614d808821"}, + {file = "pydantic_core-2.50.4-cp312-cp312-win_arm64.whl", hash = "sha256:32d6dda86383645ec428ea64dfc277036f5cbc60a72238eab28b91a3fdb9a113"}, + {file = "pydantic_core-2.50.4-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:0f87ae9db5ba8d8de40dcb93982cf8dd544e6552a80d3345af51941cc2146b80"}, + {file = "pydantic_core-2.50.4-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:1239daaf063e62213ca1f34d96663900bd7510c42a786e843fd328af70e46445"}, + {file = "pydantic_core-2.50.4-cp313-cp313-manylinux1_i686.manylinux_2_5_i686.whl", hash = "sha256:1afefe44ec042fbabfb4483ea258c04cf75ff4ff328d754f09b321fdaa232aca"}, + {file = "pydantic_core-2.50.4-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:a9ee990bf2cfbd81574c5d4f9f6c9d480a14b5b43d2c4f2ca13f4c6f48089394"}, + {file = "pydantic_core-2.50.4-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.whl", hash = "sha256:ab2822bcdcefb54d1e8ca29f5e3ec3afe160fb794bb3a3a73b09d11ed2671104"}, + {file = "pydantic_core-2.50.4-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:0001d6920e3a5d92758cda460d6dc9f918a78ad6d5d092f1c8b5395e6b775356"}, + {file = "pydantic_core-2.50.4-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:ad92d255a165cde5f9882ff69699eaf5495e0a1f32e97566bbbb80f11e46781f"}, + {file = "pydantic_core-2.50.4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:fb2bb5b557080da398b866408117d98fe9731a12334afd0cdff221b458cdc5dc"}, + {file = "pydantic_core-2.50.4-cp313-cp313-manylinux_2_31_riscv64.whl", hash = "sha256:92f8f63df729061bb14558ed740e7a222f6e2aa6c2e6a5bcfb4e706676562049"}, + {file = "pydantic_core-2.50.4-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:2a60ec2a57ac3ef3767e526e9bf706ec75aa3d79c4ea134d9d4fcf7c62a297a7"}, + {file = "pydantic_core-2.50.4-cp313-cp313-musllinux_1_1_armv7l.whl", hash = "sha256:a2f8716344bbbd10443391be0b1f2003b34949e3c4e6883005c2bc498ab6b64b"}, + {file = "pydantic_core-2.50.4-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:b300a30304c4c6aeab03ed06809819d9eceacdd58441d3c7dffe41edfd006091"}, + {file = "pydantic_core-2.50.4-cp313-cp313-win32.whl", hash = "sha256:ef8a9ddb2e2a4eae4abb72dc0710eca6c2726779b0664bd10c3ce9fcfaed8c4e"}, + {file = "pydantic_core-2.50.4-cp313-cp313-win_amd64.whl", hash = "sha256:4c29b8f2d6417069bb1f257e6b9113f5d64dc2f554cc200ea90b4fe2c5cdb733"}, + {file = "pydantic_core-2.50.4-cp313-cp313-win_arm64.whl", hash = "sha256:a0c5210d038418a115e7cf8706bfa611bd14add2f5787274dba45aadca3155e0"}, + {file = "pydantic_core-2.50.4-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:5c074454dc6d4f6f4ba6561a56bf33a14db7651d882a5a5321ba3ae8868e082d"}, + {file = "pydantic_core-2.50.4-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:a4bb174bd65f795c39ad6642d9d5bdc43351b306b7d0a654ab0d0abb38be245f"}, + {file = "pydantic_core-2.50.4-cp314-cp314-manylinux1_i686.manylinux_2_5_i686.whl", hash = "sha256:0ec20aca2b067369913716847f7dfe5f4dddf16a46965b7a70bbad5defaaba86"}, + {file = "pydantic_core-2.50.4-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:70dbc9f83c41f37a4faa62dae5203853847223a891da446f48ef2efcfd5df806"}, + {file = "pydantic_core-2.50.4-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.whl", hash = "sha256:3de6c2a4df2af0ac9ab4dc1488746fe8b1a90e27955d870d9edda3187d20092b"}, + {file = "pydantic_core-2.50.4-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:3a48a5254d15a0ad050318bfc7a9566d4ec740118187e8f303e47a6840287eb7"}, + {file = "pydantic_core-2.50.4-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:0af56dbf8822ba9f4efcbbfdc15478f8b6fb08f1609860cb50aa2cc8476b3c34"}, + {file = "pydantic_core-2.50.4-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:f1d62fb172db35c6478c9323da34ff37d1f3d37d7d44337a9d94ba8c583e5730"}, + {file = "pydantic_core-2.50.4-cp314-cp314-manylinux_2_31_riscv64.whl", hash = "sha256:5c1013647be741647895c102831dcf79c34209662dbb683df9efb864417ed7d5"}, + {file = "pydantic_core-2.50.4-cp314-cp314-musllinux_1_1_aarch64.whl", hash = "sha256:aeb2e123cbf978a905e9f55155c1b8316fbbfa7cf64d04521fe174bab302d100"}, + {file = "pydantic_core-2.50.4-cp314-cp314-musllinux_1_1_armv7l.whl", hash = "sha256:523466eba8ee10f7480f3c2057563145978011c583130d2cc01fb1e7af808e25"}, + {file = "pydantic_core-2.50.4-cp314-cp314-musllinux_1_1_x86_64.whl", hash = "sha256:c9e70012926e97069cdd09221861aff412aa94e4cac2e019055cdb79485b150c"}, + {file = "pydantic_core-2.50.4-cp314-cp314-pyemscripten_2026_0_wasm32.whl", hash = "sha256:e6da138a1ecc1341c8b788a5ee822670b03788e1f5decf7af9d461de6e508b8e"}, + {file = "pydantic_core-2.50.4-cp314-cp314-win32.whl", hash = "sha256:13b6dd62b5279f5b9d72f3bf918a35443ee8bd549241d9dc52d79a2c3b6d7016"}, + {file = "pydantic_core-2.50.4-cp314-cp314-win_amd64.whl", hash = "sha256:b0cdb655fbd1562c2dfc9986f9103a106f7058cd0915afc6e656d4b1d73f3387"}, + {file = "pydantic_core-2.50.4-cp314-cp314-win_arm64.whl", hash = "sha256:df1c174796cd63eb6b139f7daf783affe1f3ed659605850e843b24764c21bfc5"}, + {file = "pydantic_core-2.50.4-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:edbca8789fd10f0de534b660a6b4c71f1fd18039679c918dad392ab044bb37e4"}, + {file = "pydantic_core-2.50.4-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:33b21f69540a12c2053cd1d95766d8bd9667a3897f7c712a642de8aa37eb0865"}, + {file = "pydantic_core-2.50.4-cp314-cp314t-manylinux1_i686.manylinux_2_5_i686.whl", hash = "sha256:ffb616d8d55965839670301dc3bae3abacff560a7e137a89056058a8a9da4d96"}, + {file = "pydantic_core-2.50.4-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:6c5687b59b6ba0f663c4f2f15470f68507d6b45ccd3a19ee6d224f95cbee70d8"}, + {file = "pydantic_core-2.50.4-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.whl", hash = "sha256:c733087ecf7dde06b1d071679bfd5f3ba03266ba77814c1c7253bc48c9adedd9"}, + {file = "pydantic_core-2.50.4-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:94733cb447c37b0ce6f71b39ca1288d5f966a084023a5617b4cc35a852586859"}, + {file = "pydantic_core-2.50.4-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:b26f39a5be3cd91a2035818be3d0ffdf5282c3e1f5f53d3b80b7024021acee52"}, + {file = "pydantic_core-2.50.4-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:c856e439a9d54d514e81a7131229ba151cdf81df7c408e0f6c89340e5003dfe2"}, + {file = "pydantic_core-2.50.4-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:cbf0777d54672990b10cb8ca9b0523499e182d7e2ea39f86b138519a902aa601"}, + {file = "pydantic_core-2.50.4-cp314-cp314t-musllinux_1_1_aarch64.whl", hash = "sha256:edc17549ab592e33cfcaf285f047bb75fcd98f608aa9309af1187fd736ce9641"}, + {file = "pydantic_core-2.50.4-cp314-cp314t-musllinux_1_1_armv7l.whl", hash = "sha256:23a9ba564b2db709ff16eca990992ba95a19069972b34bff87c81d4b473cd755"}, + {file = "pydantic_core-2.50.4-cp314-cp314t-musllinux_1_1_x86_64.whl", hash = "sha256:41f4f8ae714e4fea1d635880f8a1af715ecf080eed4d13c5b04a0f3210f9c61a"}, + {file = "pydantic_core-2.50.4-cp314-cp314t-win32.whl", hash = "sha256:601fce6cea9ddeaa85329e12e7f351def38d233075f42a3012b9c48071b02941"}, + {file = "pydantic_core-2.50.4-cp314-cp314t-win_amd64.whl", hash = "sha256:22e874666bdbd96d6bf629d32cd8ab376fedf1fd62585b52a42b9fa9fa6c20b6"}, + {file = "pydantic_core-2.50.4-cp314-cp314t-win_arm64.whl", hash = "sha256:71395a43da5584bb70556f380387e15f845c0dcf76373c1afbfa0025737576ac"}, + {file = "pydantic_core-2.50.4-cp315-cp315-macosx_10_12_x86_64.whl", hash = "sha256:7ac2769a7ddd661e07e26c12220adc31b17014c48234b2a5a88993b8d4109e09"}, + {file = "pydantic_core-2.50.4-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:930ad463d3fb7a340d323bcc496ec32dae469ec9974c29ff569f19806b6b03b4"}, + {file = "pydantic_core-2.50.4-cp315-cp315-manylinux1_i686.manylinux_2_5_i686.whl", hash = "sha256:b867f9fd183d76977f810c626d539265183c25b2284762893a31e8d6cacc81c0"}, + {file = "pydantic_core-2.50.4-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:49eb1241a969a5994db6880c18c012b6cbe2340343d8f529721571806583e500"}, + {file = "pydantic_core-2.50.4-cp315-cp315-manylinux2014_armv7l.manylinux_2_17_armv7l.whl", hash = "sha256:477af785d1846e4e96bf56983b92ea7553aaeccdeb8acdaa55c7cee9eda0ae32"}, + {file = "pydantic_core-2.50.4-cp315-cp315-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:29358a8ca74e7d81158d14e2b10c904bd18773293ae3788716c0626fe0342347"}, + {file = "pydantic_core-2.50.4-cp315-cp315-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:300753f71c73302e218124baf995f00058e085cd01869bd9610bcbd0bd4500c1"}, + {file = "pydantic_core-2.50.4-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:26cb012c4b8ca9f847bd0ac15978bd3d0f55b050bfbe6c47355edfc7e945029b"}, + {file = "pydantic_core-2.50.4-cp315-cp315-manylinux_2_31_riscv64.whl", hash = "sha256:9be1cfe715ecaa060ffd5d599ef410b94ef2697a0eed4cee562f788a2aa2175b"}, + {file = "pydantic_core-2.50.4-cp315-cp315-musllinux_1_1_aarch64.whl", hash = "sha256:c81e35862aced259177a537ce1a6264c3a97bae1ced184ca9dc10ea754563688"}, + {file = "pydantic_core-2.50.4-cp315-cp315-musllinux_1_1_armv7l.whl", hash = "sha256:b2f2d13239487cecaae98c9f4d5904ad0737643cdf8873c88ec6a78b12214f20"}, + {file = "pydantic_core-2.50.4-cp315-cp315-musllinux_1_1_x86_64.whl", hash = "sha256:e6b4b08d09054310a4dc389fa61ee22a7a5a292cb23ab8a985136ca8828bf924"}, + {file = "pydantic_core-2.50.4-cp315-cp315-win32.whl", hash = "sha256:6619d49a89a15cd04334f76fec530c155923bfc60da74ff5d815a52629e1aa6c"}, + {file = "pydantic_core-2.50.4-cp315-cp315-win_amd64.whl", hash = "sha256:e5bd109d095aaae989a0463d5ef0fcc43e9ddd5de125e656d3c119a79e466380"}, + {file = "pydantic_core-2.50.4-cp315-cp315-win_arm64.whl", hash = "sha256:6118e5a5550e36582e19bac1a403711a748f9f18251b054c326d3db02aaa7a18"}, + {file = "pydantic_core-2.50.4-cp315-cp315t-macosx_10_12_x86_64.whl", hash = "sha256:d8201c9f9035520cdcc7dcad383b039ec8123969b87e01cf27c3dd883c02313b"}, + {file = "pydantic_core-2.50.4-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:1de7be9a66fc8536770481ab64a05aae5067c725f2b29a09543af00e6a417b97"}, + {file = "pydantic_core-2.50.4-cp315-cp315t-manylinux1_i686.manylinux_2_5_i686.whl", hash = "sha256:789a6453e5ffd18a7ab6b8c3a0dd8403053829197ec258ecb90c604c21ffcc99"}, + {file = "pydantic_core-2.50.4-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:6348ad12fa741bcc9c2f173e99fbf27cbc038826d8c31a4a7d836eca27878ba2"}, + {file = "pydantic_core-2.50.4-cp315-cp315t-manylinux2014_armv7l.manylinux_2_17_armv7l.whl", hash = "sha256:d49127f137f871cde3c5650af33bbbdcee02679dae76e020902fa106f522b8ae"}, + {file = "pydantic_core-2.50.4-cp315-cp315t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:2f5cc5bcb94063fbbdfd285a2b302da34af07491337c10bb35de1d5220fa1583"}, + {file = "pydantic_core-2.50.4-cp315-cp315t-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:b99bed995ed7c41515c11fe2beb86f8a6cc298e5537cae2f736de2f982f74ef0"}, + {file = "pydantic_core-2.50.4-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:faa4e96385c820ce9d7f7a623486e23d4134ae3c9ba2071e44e0ab5a5a5002c4"}, + {file = "pydantic_core-2.50.4-cp315-cp315t-manylinux_2_31_riscv64.whl", hash = "sha256:d6a166978f22f10cb91413f70519861605219346decf65bc79008f9257c94afe"}, + {file = "pydantic_core-2.50.4-cp315-cp315t-musllinux_1_1_aarch64.whl", hash = "sha256:a70d5effebd81ebd8e15a8aabdc7980832367b2b00c36543bac378977004cc80"}, + {file = "pydantic_core-2.50.4-cp315-cp315t-musllinux_1_1_armv7l.whl", hash = "sha256:f8fd23653a252cefabea11cd041efd7b80bdf403e43a36dea53f9cb0aaa21f0f"}, + {file = "pydantic_core-2.50.4-cp315-cp315t-musllinux_1_1_x86_64.whl", hash = "sha256:7646353a5a7c553c04167aca628e2550b538f492765b03ccf34321a560acc43c"}, + {file = "pydantic_core-2.50.4-cp315-cp315t-win32.whl", hash = "sha256:65376dbe1ab4dbc768ca2b72b7c13993562c035f5925fd3bc7ff9c8c585c515d"}, + {file = "pydantic_core-2.50.4-cp315-cp315t-win_amd64.whl", hash = "sha256:f08ee8248aad2d054e5bc4c73554d4505464698f6d754f16198dbc5764e9821d"}, + {file = "pydantic_core-2.50.4-cp315-cp315t-win_arm64.whl", hash = "sha256:da779ae50b46f3f7d1e1b5f362fdc0ad376a49fd55f6f3122dc2b6149936cdf7"}, + {file = "pydantic_core-2.50.4-graalpy312-graalpy250_312_native-macosx_10_12_x86_64.whl", hash = "sha256:c04e9d920e2674f54651fd260a15c5d2843526c73d5242ee4311325ddc9573b3"}, + {file = "pydantic_core-2.50.4-graalpy312-graalpy250_312_native-macosx_11_0_arm64.whl", hash = "sha256:5bc1811ef2b4d4ba63e8e452f6e332b6374bd1d2cbbfdf66826c8cb1f71dd10d"}, + {file = "pydantic_core-2.50.4-graalpy312-graalpy250_312_native-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:0b059a7968b1911be5a2d9a8234827ab0bef9d1e465d4b42da525894143550e8"}, + {file = "pydantic_core-2.50.4-graalpy312-graalpy250_312_native-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:bee28aab5a580eec673f7b68dfa8dece3dd37bd207ef8d22fafe23a8e9837296"}, + {file = "pydantic_core-2.50.4-graalpy313-graalpy253_313_native-macosx_11_0_arm64.whl", hash = "sha256:71e03d2ea1a221d020cfc5b6cc8bbbedef23a06704c70fcf4d0afb42965b22d1"}, + {file = "pydantic_core-2.50.4-graalpy313-graalpy253_313_native-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:09450778e3ab58d3f565899fcfbf6c82926e31af29e28e799d1d50941316e0cb"}, + {file = "pydantic_core-2.50.4-graalpy313-graalpy253_313_native-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:4eb15be588407148ef5937dc8d9256a71f6b115e6cddadb7aa20b6ee384680dc"}, + {file = "pydantic_core-2.50.4-pp311-pypy311_pp73-macosx_10_12_x86_64.whl", hash = "sha256:39f489ce31272073e6e146f6781690f9c1ee8c126836e6403361ef91154d89fe"}, + {file = "pydantic_core-2.50.4-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:5b26e5f1793b96cdc60242bf38da86ff24a27a708aa396214cac9b534bf571c7"}, + {file = "pydantic_core-2.50.4-pp311-pypy311_pp73-manylinux1_i686.manylinux_2_5_i686.whl", hash = "sha256:7210398a1607ad607dc73196e575b3148b00a333cbb602ddbe1b60ba54554f43"}, + {file = "pydantic_core-2.50.4-pp311-pypy311_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:2f42584e5785385f681163a42506cab0d51295e17599a648396c52a7046c1372"}, + {file = "pydantic_core-2.50.4-pp311-pypy311_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:2039e323acee9abfec1fb5f661776e8965fe5928f3b7f8431900a774cba5c317"}, + {file = "pydantic_core-2.50.4-pp311-pypy311_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:71ade6d2e445839350d589ff99bbddfde16f3f32db28da5c894a09f99c8b2a03"}, + {file = "pydantic_core-2.50.4-pp311-pypy311_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:d7d406709ae924cf0b08b8282ca2f0e1c90526911d93bc040557cbc83b74c55f"}, + {file = "pydantic_core-2.50.4-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:7472c39480ccc11dda69a196d1b7c7a6b48eb6594b77f05d945599d3e47f731c"}, + {file = "pydantic_core-2.50.4-pp311-pypy311_pp80-macosx_10_12_x86_64.whl", hash = "sha256:b67d38e8bb0ade7e6e84575e4bb153fab35b122458077273aeb08fdf12be9d2c"}, + {file = "pydantic_core-2.50.4-pp311-pypy311_pp80-macosx_11_0_arm64.whl", hash = "sha256:4eda7e3fdef382b7d4492745988a5baaf6953923a337f8b9dde5f76fa8afde20"}, + {file = "pydantic_core-2.50.4-pp311-pypy311_pp80-manylinux_2_28_x86_64.whl", hash = "sha256:474f7e598c7902165662a5d5160d3fce31037890a2975a9871ebf7c05862300b"}, + {file = "pydantic_core-2.50.4-pp311-pypy311_pp80-win_amd64.whl", hash = "sha256:3e0b395648c6cb871bceb2906907f255dc876ec425f2d5b024e129985cea8519"}, + {file = "pydantic_core-2.50.4.tar.gz", hash = "sha256:aead3b74b68396bf0feab5d57e050b730ded7df55853c1e048a87e00aaf033c6"}, ] [package.dependencies] @@ -1819,14 +1818,14 @@ files = [ [[package]] name = "typing-inspection" -version = "0.4.4" +version = "0.4.5" description = "Runtime typing introspection tools" optional = false python-versions = ">=3.10" groups = ["main"] files = [ - {file = "typing_inspection-0.4.4-py3-none-any.whl", hash = "sha256:65b8397ba37ccbce054456aaccddfc91e6e3083c92824df348d96ca832f3f147"}, - {file = "typing_inspection-0.4.4.tar.gz", hash = "sha256:547274fa6b0a561ccf549cc9524b999a578e737d015d8709d021f9d0d13bea47"}, + {file = "typing_inspection-0.4.5-py3-none-any.whl", hash = "sha256:bc210535442b39e1bf2805e0c7a17dfd6a4ace760c84c7f7d16245d23a6b1c39"}, + {file = "typing_inspection-0.4.5.tar.gz", hash = "sha256:7f16c411e7930dc79596d42ab44672a3fe5f60eb34b781a1647e7872363120c7"}, ] [package.dependencies] diff --git a/pyproject.toml b/pyproject.toml index 07edeb1b..0f84b46d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ license-files = ["LICENSE"] [tool.poetry] name = "deepgram-sdk" -version = "7.18.0" +version = "7.18.1" description = "" readme = "README.md" authors = [] diff --git a/src/deepgram/__init__.py b/src/deepgram/__init__.py index 86e0445a..ab7daf3c 100644 --- a/src/deepgram/__init__.py +++ b/src/deepgram/__init__.py @@ -135,6 +135,7 @@ ListenV1ProfanityFilter, ListenV1Punctuate, ListenV1Redact, + ListenV1RedactUsage, ListenV1Replace, ListenV1RequestFile, ListenV1Response, @@ -169,6 +170,7 @@ ListenV1VadEvents, ListenV1Version, ListenV2ConfigureNumerals, + ListenV2ConfigureRedactUsage, ListenV2EagerEotThreshold, ListenV2Encoding, ListenV2EotThreshold, @@ -180,6 +182,7 @@ ListenV2Numerals, ListenV2ProfanityFilter, ListenV2Redact, + ListenV2RedactUsage, ListenV2SampleRate, ListenV2Tag, OpenAiSpeakProvider, @@ -231,6 +234,7 @@ SpeakV2Expressivity, SpeakV2MipOptOut, SpeakV2Model, + SpeakV2NormalizeVolume, SpeakV2Response, SpeakV2SampleRate, SpeakV2Speed, @@ -661,6 +665,7 @@ "ListenV1ProfanityFilter": ".types", "ListenV1Punctuate": ".types", "ListenV1Redact": ".types", + "ListenV1RedactUsage": ".types", "ListenV1Replace": ".types", "ListenV1RequestFile": ".types", "ListenV1Response": ".types", @@ -719,6 +724,7 @@ "ListenV1VadEvents": ".types", "ListenV1Version": ".types", "ListenV2ConfigureNumerals": ".types", + "ListenV2ConfigureRedactUsage": ".types", "ListenV2EagerEotThreshold": ".types", "ListenV2Encoding": ".types", "ListenV2EotThreshold": ".types", @@ -732,6 +738,7 @@ "ListenV2Numerals": ".types", "ListenV2ProfanityFilter": ".types", "ListenV2Redact": ".types", + "ListenV2RedactUsage": ".types", "ListenV2SampleRate": ".types", "ListenV2Tag": ".types", "OpenAiSpeakProvider": ".types", @@ -818,6 +825,7 @@ "SpeakV2Expressivity": ".types", "SpeakV2MipOptOut": ".types", "SpeakV2Model": ".types", + "SpeakV2NormalizeVolume": ".types", "SpeakV2Response": ".types", "SpeakV2SampleRate": ".types", "SpeakV2Speed": ".types", @@ -880,38 +888,6 @@ "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) @@ -1156,6 +1132,7 @@ def __dir__(): "ListenV1ProfanityFilter", "ListenV1Punctuate", "ListenV1Redact", + "ListenV1RedactUsage", "ListenV1Replace", "ListenV1RequestFile", "ListenV1Response", @@ -1214,6 +1191,7 @@ def __dir__(): "ListenV1VadEvents", "ListenV1Version", "ListenV2ConfigureNumerals", + "ListenV2ConfigureRedactUsage", "ListenV2EagerEotThreshold", "ListenV2Encoding", "ListenV2EotThreshold", @@ -1227,6 +1205,7 @@ def __dir__(): "ListenV2Numerals", "ListenV2ProfanityFilter", "ListenV2Redact", + "ListenV2RedactUsage", "ListenV2SampleRate", "ListenV2Tag", "OpenAiSpeakProvider", @@ -1313,6 +1292,7 @@ def __dir__(): "SpeakV2Expressivity", "SpeakV2MipOptOut", "SpeakV2Model", + "SpeakV2NormalizeVolume", "SpeakV2Response", "SpeakV2SampleRate", "SpeakV2Speed", @@ -1374,35 +1354,3 @@ def __dir__(): "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 b/src/deepgram/agent/__init__.py index 23f670de..a9248312 100644 --- a/src/deepgram/agent/__init__.py +++ b/src/deepgram/agent/__init__.py @@ -293,40 +293,6 @@ "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) @@ -492,37 +458,3 @@ def __dir__(): "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 b/src/deepgram/agent/v1/__init__.py index 205d398c..f58a4a70 100644 --- a/src/deepgram/agent/v1/__init__.py +++ b/src/deepgram/agent/v1/__init__.py @@ -295,40 +295,6 @@ "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) @@ -494,37 +460,3 @@ def __dir__(): "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 b/src/deepgram/agent/v1/requests/__init__.py index 766d9807..f57784b8 100644 --- a/src/deepgram/agent/v1/requests/__init__.py +++ b/src/deepgram/agent/v1/requests/__init__.py @@ -20,8 +20,6 @@ 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 @@ -151,24 +149,6 @@ "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) @@ -259,21 +239,3 @@ def __dir__(): "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 b/src/deepgram/agent/v1/requests/agent_v1conversation_text.py index 059f094a..ee6f97cf 100644 --- a/src/deepgram/agent/v1/requests/agent_v1conversation_text.py +++ b/src/deepgram/agent/v1/requests/agent_v1conversation_text.py @@ -23,7 +23,7 @@ class AgentV1ConversationTextParams(typing_extensions.TypedDict): The actual statement that was spoken """ - conversational_behavior: typing_extensions.NotRequired[AgentV1ConversationTextConversationalBehavior] + conversational_behavior: 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 """ diff --git a/src/deepgram/agent/v1/requests/agent_v1inject_dynamic_agent_message.py b/src/deepgram/agent/v1/requests/agent_v1inject_dynamic_agent_message.py index 1d912428..c6d114de 100644 --- a/src/deepgram/agent/v1/requests/agent_v1inject_dynamic_agent_message.py +++ b/src/deepgram/agent/v1/requests/agent_v1inject_dynamic_agent_message.py @@ -20,7 +20,7 @@ class AgentV1InjectDynamicAgentMessageParams(typing_extensions.TypedDict): 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 b/src/deepgram/agent/v1/requests/agent_v1settings.py index 5ada0975..2f748dcd 100644 --- a/src/deepgram/agent/v1/requests/agent_v1settings.py +++ b/src/deepgram/agent/v1/requests/agent_v1settings.py @@ -4,7 +4,6 @@ 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 @@ -28,4 +27,4 @@ class AgentV1SettingsParams(typing_extensions.TypedDict): """ audio: AgentV1SettingsAudioParams - agent: typing.Union[AgentV1SettingsAgentParams, AgentV1SettingsAgentContextParams, str] + agent: AgentV1SettingsAgentParams diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent.py index 4a2bcf8c..0da4b0f3 100644 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent.py +++ b/src/deepgram/agent/v1/requests/agent_v1settings_agent.py @@ -1,18 +1,7 @@ # 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 +import typing +from .agent_v1settings_agent_context import AgentV1SettingsAgentContextParams -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] +AgentV1SettingsAgentParams = typing.Union[AgentV1SettingsAgentContextParams, str] diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py index 19503b6f..3dbb6e72 100644 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py +++ b/src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py @@ -1,12 +1,9 @@ # 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 @@ -17,7 +14,6 @@ class AgentV1SettingsAgentContextParams(typing_extensions.TypedDict): 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 diff --git a/src/deepgram/agent/v1/socket_client.py b/src/deepgram/agent/v1/socket_client.py index ef56cc79..35ebd833 100644 --- a/src/deepgram/agent/v1/socket_client.py +++ b/src/deepgram/agent/v1/socket_client.py @@ -3,7 +3,9 @@ import json import logging import typing +from json.decoder import JSONDecodeError +import websockets import websockets.sync.connection as websockets_sync_connection from ...core.events import EventEmitterMixin, EventType from ...core.unchecked_base_model import construct_type @@ -48,17 +50,6 @@ 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, @@ -84,7 +75,6 @@ def _sanitize_numeric_types(obj: typing.Any) -> typing.Any: AgentV1Warning, AgentV1History, bytes, - typing.Dict[str, typing.Any], ] @@ -131,7 +121,7 @@ async def start_listening(self): ) continue await self._emit_async(EventType.MESSAGE, parsed) - except Exception as exc: + except (websockets.WebSocketException, JSONDecodeError) as exc: await self._emit_async(EventType.ERROR, exc) finally: await self._emit_async(EventType.CLOSE, None) @@ -199,12 +189,12 @@ async def send_function_call_response(self, message: AgentV1SendFunctionCallResp """ await self._send_model(message) - async def send_keep_alive(self, message: typing.Optional[AgentV1KeepAlive] = None) -> None: + async def send_keep_alive(self, message: AgentV1KeepAlive) -> 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")) + await self._send_model(message) async def send_update_prompt(self, message: AgentV1UpdatePrompt) -> None: """ @@ -213,12 +203,12 @@ async def send_update_prompt(self, message: AgentV1UpdatePrompt) -> None: """ await self._send_model(message) - async def send_force_end_turn(self, message: typing.Optional[AgentV1ForceEndTurn] = None) -> None: + async def send_force_end_turn(self, message: AgentV1ForceEndTurn) -> 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")) + await self._send_model(message) async def send_custom_to_think_provider(self, message: AgentV1CustomToThinkProvider) -> None: """ @@ -227,10 +217,6 @@ async def send_custom_to_think_provider(self, message: AgentV1CustomToThinkProvi """ 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. @@ -264,7 +250,7 @@ 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())) + await self._send(data.dict()) class V1SocketClient(EventEmitterMixin): @@ -310,7 +296,7 @@ def start_listening(self): ) continue self._emit(EventType.MESSAGE, parsed) - except Exception as exc: + except (websockets.WebSocketException, JSONDecodeError) as exc: self._emit(EventType.ERROR, exc) finally: self._emit(EventType.CLOSE, None) @@ -378,12 +364,12 @@ def send_function_call_response(self, message: AgentV1SendFunctionCallResponse) """ self._send_model(message) - def send_keep_alive(self, message: typing.Optional[AgentV1KeepAlive] = None) -> None: + def send_keep_alive(self, message: AgentV1KeepAlive) -> None: """ Send a message to the websocket connection. The message will be sent as a AgentV1KeepAlive. """ - self._send_model(message or AgentV1KeepAlive(type="KeepAlive")) + self._send_model(message) def send_update_prompt(self, message: AgentV1UpdatePrompt) -> None: """ @@ -392,12 +378,12 @@ def send_update_prompt(self, message: AgentV1UpdatePrompt) -> None: """ self._send_model(message) - def send_force_end_turn(self, message: typing.Optional[AgentV1ForceEndTurn] = None) -> None: + def send_force_end_turn(self, message: AgentV1ForceEndTurn) -> None: """ Send a message to the websocket connection. The message will be sent as a AgentV1ForceEndTurn. """ - self._send_model(message or AgentV1ForceEndTurn(type="ForceEndTurn")) + self._send_model(message) def send_custom_to_think_provider(self, message: AgentV1CustomToThinkProvider) -> None: """ @@ -406,10 +392,6 @@ def send_custom_to_think_provider(self, message: 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. @@ -443,4 +425,4 @@ def _send_model(self, data: typing.Any) -> None: """ Send a Pydantic model to the websocket connection. """ - self._send(_sanitize_numeric_types(data.dict())) + self._send(data.dict()) diff --git a/src/deepgram/agent/v1/types/__init__.py b/src/deepgram/agent/v1/types/__init__.py index e6a3fdc7..232c2180 100644 --- a/src/deepgram/agent/v1/types/__init__.py +++ b/src/deepgram/agent/v1/types/__init__.py @@ -163,27 +163,6 @@ "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) @@ -282,24 +261,3 @@ def __dir__(): "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 b/src/deepgram/agent/v1/types/agent_v1conversation_text.py index eb33f9f0..1e85d656 100644 --- a/src/deepgram/agent/v1/types/agent_v1conversation_text.py +++ b/src/deepgram/agent/v1/types/agent_v1conversation_text.py @@ -25,9 +25,9 @@ class AgentV1ConversationText(UncheckedBaseModel): The actual statement that was spoken """ - conversational_behavior: AgentV1ConversationTextConversationalBehavior = pydantic.Field(default="default") + conversational_behavior: AgentV1ConversationTextConversationalBehavior = pydantic.Field() """ - 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. + 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.Optional[typing.List[str]] = pydantic.Field(default=None) diff --git a/src/deepgram/agent/v1/types/agent_v1inject_dynamic_agent_message.py b/src/deepgram/agent/v1/types/agent_v1inject_dynamic_agent_message.py index 471d6f61..aefd967d 100644 --- a/src/deepgram/agent/v1/types/agent_v1inject_dynamic_agent_message.py +++ b/src/deepgram/agent/v1/types/agent_v1inject_dynamic_agent_message.py @@ -22,7 +22,7 @@ class AgentV1InjectDynamicAgentMessage(UncheckedBaseModel): 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. diff --git a/src/deepgram/agent/v1/types/agent_v1settings.py b/src/deepgram/agent/v1/types/agent_v1settings.py index ff58da13..11601dfc 100644 --- a/src/deepgram/agent/v1/types/agent_v1settings.py +++ b/src/deepgram/agent/v1/types/agent_v1settings.py @@ -6,7 +6,6 @@ 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 @@ -30,7 +29,7 @@ class AgentV1Settings(UncheckedBaseModel): """ audio: AgentV1SettingsAudio - agent: typing.Union[AgentV1SettingsAgent, AgentV1SettingsAgentContext, str] + agent: AgentV1SettingsAgent if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent.py b/src/deepgram/agent/v1/types/agent_v1settings_agent.py index b55a8345..c1483c35 100644 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent.py +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent.py @@ -2,55 +2,6 @@ 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 +AgentV1SettingsAgent = typing.Union[AgentV1SettingsAgentContext, str] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_context.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_context.py index 6b74f1ee..d32ebcaa 100644 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_context.py +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent_context.py @@ -8,7 +8,6 @@ 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 @@ -38,29 +37,10 @@ class AgentV1SettingsAgentContext(UncheckedBaseModel): """ 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 b/src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py index d7f6670b..b806f202 100644 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py @@ -33,37 +33,15 @@ class AgentV1SettingsAgentContextListenProvider_V2(UncheckedBaseModel): 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 diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py index 1e7f78e5..d053b2b9 100644 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py @@ -33,37 +33,15 @@ class AgentV1SettingsAgentListenProvider_V2(UncheckedBaseModel): 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 diff --git a/src/deepgram/agent/v1/types/agent_v1update_listen_listen.py b/src/deepgram/agent/v1/types/agent_v1update_listen_listen.py index c60cb378..f345904c 100644 --- a/src/deepgram/agent/v1/types/agent_v1update_listen_listen.py +++ b/src/deepgram/agent/v1/types/agent_v1update_listen_listen.py @@ -5,34 +5,8 @@ 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): """ @@ -42,18 +16,9 @@ class AgentV1UpdateListenListen(UncheckedBaseModel): 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 diff --git a/src/deepgram/core/api_error.py b/src/deepgram/core/api_error.py index 2aa93914..6f850a60 100644 --- a/src/deepgram/core/api_error.py +++ b/src/deepgram/core/api_error.py @@ -2,8 +2,6 @@ from typing import Any, Dict, Optional -from .._secure_logging import redact_sensitive_headers - class ApiError(Exception): headers: Optional[Dict[str, str]] @@ -17,7 +15,7 @@ def __init__( status_code: Optional[int] = None, body: Any = None, ) -> None: - self.headers = redact_sensitive_headers(headers) + self.headers = headers self.status_code = status_code self.body = body diff --git a/src/deepgram/core/client_wrapper.py b/src/deepgram/core/client_wrapper.py index e9cc30c9..2ab7bb18 100644 --- a/src/deepgram/core/client_wrapper.py +++ b/src/deepgram/core/client_wrapper.py @@ -37,7 +37,7 @@ def get_headers(self) -> typing.Dict[str, str]: try: _sdk_version = _fern_importlib_metadata.version("deepgram-sdk") except _fern_importlib_metadata.PackageNotFoundError: - _sdk_version = "7.18.0" # x-release-please-version + _sdk_version = "7.18.1" headers: typing.Dict[str, str] = { "User-Agent": "deepgram-sdk/" + _sdk_version, diff --git a/src/deepgram/core/parse_error.py b/src/deepgram/core/parse_error.py index c510c0e8..4527c6a8 100644 --- a/src/deepgram/core/parse_error.py +++ b/src/deepgram/core/parse_error.py @@ -2,8 +2,6 @@ from typing import Any, Dict, Optional -from .._secure_logging import redact_sensitive_headers - class ParsingError(Exception): """ @@ -25,7 +23,7 @@ def __init__( body: Any = None, cause: Optional[Exception] = None, ) -> None: - self.headers = redact_sensitive_headers(headers) + self.headers = headers self.status_code = status_code self.body = body self.cause = cause diff --git a/src/deepgram/core/query_encoder.py b/src/deepgram/core/query_encoder.py index 58088258..3183001d 100644 --- a/src/deepgram/core/query_encoder.py +++ b/src/deepgram/core/query_encoder.py @@ -5,13 +5,6 @@ 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 = [] @@ -24,9 +17,9 @@ def traverse_query_dict(dict_flat: Dict[str, Any], key_prefix: Optional[str] = N if isinstance(arr_v, dict): result.extend(traverse_query_dict(arr_v, key)) else: - result.append((key, _coerce_query_value(arr_v))) + result.append((key, arr_v)) else: - result.append((key, _coerce_query_value(v))) + result.append((key, v)) return result @@ -48,11 +41,11 @@ def single_query_encoder(query_key: str, query_value: Any) -> List[Tuple[str, An encoded_values.extend(single_query_encoder(query_key, obj_dict)) else: - encoded_values.append((query_key, _coerce_query_value(value))) + encoded_values.append((query_key, value)) return encoded_values - return [(query_key, _coerce_query_value(query_value))] + return [(query_key, query_value)] def encode_query(query: Optional[Dict[str, Any]]) -> Optional[List[Tuple[str, Any]]]: diff --git a/src/deepgram/listen/__init__.py b/src/deepgram/listen/__init__.py index d2b6487e..79d16232 100644 --- a/src/deepgram/listen/__init__.py +++ b/src/deepgram/listen/__init__.py @@ -148,8 +148,6 @@ "v2": ".v2", } -_dynamic_imports["ListenV2CloseStreamType"] = ".v2" - def __getattr__(attr_name: str) -> typing.Any: module_name = _dynamic_imports.get(attr_name) @@ -242,5 +240,3 @@ def __dir__(): "v1", "v2", ] - -__all__.append("ListenV2CloseStreamType") diff --git a/src/deepgram/listen/v1/client.py b/src/deepgram/listen/v1/client.py index e44a0f87..21b1c0df 100644 --- a/src/deepgram/listen/v1/client.py +++ b/src/deepgram/listen/v1/client.py @@ -36,6 +36,7 @@ from ...types.listen_v1profanity_filter import ListenV1ProfanityFilter from ...types.listen_v1punctuate import ListenV1Punctuate from ...types.listen_v1redact import ListenV1Redact +from ...types.listen_v1redact_usage import ListenV1RedactUsage from ...types.listen_v1replace import ListenV1Replace from ...types.listen_v1sample_rate import ListenV1SampleRate from ...types.listen_v1search import ListenV1Search @@ -100,6 +101,7 @@ def connect( profanity_filter: typing.Optional[ListenV1ProfanityFilter] = None, punctuate: typing.Optional[ListenV1Punctuate] = None, redact: typing.Optional[ListenV1Redact] = None, + redact_usage: typing.Optional[ListenV1RedactUsage] = None, replace: typing.Optional[ListenV1Replace] = None, sample_rate: typing.Optional[ListenV1SampleRate] = None, search: typing.Optional[ListenV1Search] = None, @@ -163,6 +165,8 @@ def connect( redact : typing.Optional[ListenV1Redact] + redact_usage : typing.Optional[ListenV1RedactUsage] + replace : typing.Optional[ListenV1Replace] sample_rate : typing.Optional[ListenV1SampleRate] @@ -224,6 +228,7 @@ def connect( "profanity_filter": profanity_filter, "punctuate": punctuate, "redact": redact, + "redact_usage": redact_usage, "replace": replace, "sample_rate": sample_rate, "search": search, @@ -317,6 +322,7 @@ async def connect( profanity_filter: typing.Optional[ListenV1ProfanityFilter] = None, punctuate: typing.Optional[ListenV1Punctuate] = None, redact: typing.Optional[ListenV1Redact] = None, + redact_usage: typing.Optional[ListenV1RedactUsage] = None, replace: typing.Optional[ListenV1Replace] = None, sample_rate: typing.Optional[ListenV1SampleRate] = None, search: typing.Optional[ListenV1Search] = None, @@ -380,6 +386,8 @@ async def connect( redact : typing.Optional[ListenV1Redact] + redact_usage : typing.Optional[ListenV1RedactUsage] + replace : typing.Optional[ListenV1Replace] sample_rate : typing.Optional[ListenV1SampleRate] @@ -441,6 +449,7 @@ async def connect( "profanity_filter": profanity_filter, "punctuate": punctuate, "redact": redact, + "redact_usage": redact_usage, "replace": replace, "sample_rate": sample_rate, "search": search, diff --git a/src/deepgram/listen/v1/media/client.py b/src/deepgram/listen/v1/media/client.py index 54a142d0..4c792d50 100644 --- a/src/deepgram/listen/v1/media/client.py +++ b/src/deepgram/listen/v1/media/client.py @@ -69,6 +69,7 @@ def transcribe_url( profanity_filter: typing.Optional[bool] = None, punctuate: typing.Optional[bool] = None, redact: typing.Optional[str] = None, + redact_usage: typing.Optional[bool] = None, replace: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, search: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, smart_format: typing.Optional[bool] = None, @@ -182,6 +183,9 @@ def transcribe_url( redact : typing.Optional[str] Redaction removes sensitive information from your transcripts + redact_usage : typing.Optional[bool] + Replaces the values of user-supplied text parameters (`keyterm`, `keywords`, `replace`, `search`, `extra`, `custom_topic`, and `custom_intent`) with `[REDACTED]` in this request's usage records. Does not affect transcription, the response, `tag`, or `callback`. Independent of `mip_opt_out`. https://developers.deepgram.com/docs/redact-usage + replace : typing.Optional[typing.Union[str, typing.Sequence[str]]] Search for terms or phrases in submitted audio and replaces them @@ -255,6 +259,7 @@ def transcribe_url( profanity_filter=profanity_filter, punctuate=punctuate, redact=redact, + redact_usage=redact_usage, replace=replace, search=search, smart_format=smart_format, @@ -301,6 +306,7 @@ def transcribe_file( profanity_filter: typing.Optional[bool] = None, punctuate: typing.Optional[bool] = None, redact: typing.Optional[str] = None, + redact_usage: typing.Optional[bool] = None, replace: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, search: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, smart_format: typing.Optional[bool] = None, @@ -414,6 +420,9 @@ def transcribe_file( redact : typing.Optional[str] Redaction removes sensitive information from your transcripts + redact_usage : typing.Optional[bool] + Replaces the values of user-supplied text parameters (`keyterm`, `keywords`, `replace`, `search`, `extra`, `custom_topic`, and `custom_intent`) with `[REDACTED]` in this request's usage records. Does not affect transcription, the response, `tag`, or `callback`. Independent of `mip_opt_out`. https://developers.deepgram.com/docs/redact-usage + replace : typing.Optional[typing.Union[str, typing.Sequence[str]]] Search for terms or phrases in submitted audio and replaces them @@ -485,6 +494,7 @@ def transcribe_file( profanity_filter=profanity_filter, punctuate=punctuate, redact=redact, + redact_usage=redact_usage, replace=replace, search=search, smart_format=smart_format, @@ -547,6 +557,7 @@ async def transcribe_url( profanity_filter: typing.Optional[bool] = None, punctuate: typing.Optional[bool] = None, redact: typing.Optional[str] = None, + redact_usage: typing.Optional[bool] = None, replace: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, search: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, smart_format: typing.Optional[bool] = None, @@ -660,6 +671,9 @@ async def transcribe_url( redact : typing.Optional[str] Redaction removes sensitive information from your transcripts + redact_usage : typing.Optional[bool] + Replaces the values of user-supplied text parameters (`keyterm`, `keywords`, `replace`, `search`, `extra`, `custom_topic`, and `custom_intent`) with `[REDACTED]` in this request's usage records. Does not affect transcription, the response, `tag`, or `callback`. Independent of `mip_opt_out`. https://developers.deepgram.com/docs/redact-usage + replace : typing.Optional[typing.Union[str, typing.Sequence[str]]] Search for terms or phrases in submitted audio and replaces them @@ -741,6 +755,7 @@ async def main() -> None: profanity_filter=profanity_filter, punctuate=punctuate, redact=redact, + redact_usage=redact_usage, replace=replace, search=search, smart_format=smart_format, @@ -787,6 +802,7 @@ async def transcribe_file( profanity_filter: typing.Optional[bool] = None, punctuate: typing.Optional[bool] = None, redact: typing.Optional[str] = None, + redact_usage: typing.Optional[bool] = None, replace: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, search: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, smart_format: typing.Optional[bool] = None, @@ -900,6 +916,9 @@ async def transcribe_file( redact : typing.Optional[str] Redaction removes sensitive information from your transcripts + redact_usage : typing.Optional[bool] + Replaces the values of user-supplied text parameters (`keyterm`, `keywords`, `replace`, `search`, `extra`, `custom_topic`, and `custom_intent`) with `[REDACTED]` in this request's usage records. Does not affect transcription, the response, `tag`, or `callback`. Independent of `mip_opt_out`. https://developers.deepgram.com/docs/redact-usage + replace : typing.Optional[typing.Union[str, typing.Sequence[str]]] Search for terms or phrases in submitted audio and replaces them @@ -979,6 +998,7 @@ async def main() -> None: profanity_filter=profanity_filter, punctuate=punctuate, redact=redact, + redact_usage=redact_usage, replace=replace, search=search, smart_format=smart_format, diff --git a/src/deepgram/listen/v1/media/raw_client.py b/src/deepgram/listen/v1/media/raw_client.py index d351299f..063d3ab1 100644 --- a/src/deepgram/listen/v1/media/raw_client.py +++ b/src/deepgram/listen/v1/media/raw_client.py @@ -64,6 +64,7 @@ def transcribe_url( profanity_filter: typing.Optional[bool] = None, punctuate: typing.Optional[bool] = None, redact: typing.Optional[str] = None, + redact_usage: typing.Optional[bool] = None, replace: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, search: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, smart_format: typing.Optional[bool] = None, @@ -177,6 +178,9 @@ def transcribe_url( redact : typing.Optional[str] Redaction removes sensitive information from your transcripts + redact_usage : typing.Optional[bool] + Replaces the values of user-supplied text parameters (`keyterm`, `keywords`, `replace`, `search`, `extra`, `custom_topic`, and `custom_intent`) with `[REDACTED]` in this request's usage records. Does not affect transcription, the response, `tag`, or `callback`. Independent of `mip_opt_out`. https://developers.deepgram.com/docs/redact-usage + replace : typing.Optional[typing.Union[str, typing.Sequence[str]]] Search for terms or phrases in submitted audio and replaces them @@ -242,6 +246,7 @@ def transcribe_url( "profanity_filter": profanity_filter, "punctuate": punctuate, "redact": redact, + "redact_usage": redact_usage, "replace": replace, "search": search, "smart_format": smart_format, @@ -324,6 +329,7 @@ def transcribe_file( profanity_filter: typing.Optional[bool] = None, punctuate: typing.Optional[bool] = None, redact: typing.Optional[str] = None, + redact_usage: typing.Optional[bool] = None, replace: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, search: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, smart_format: typing.Optional[bool] = None, @@ -437,6 +443,9 @@ def transcribe_file( redact : typing.Optional[str] Redaction removes sensitive information from your transcripts + redact_usage : typing.Optional[bool] + Replaces the values of user-supplied text parameters (`keyterm`, `keywords`, `replace`, `search`, `extra`, `custom_topic`, and `custom_intent`) with `[REDACTED]` in this request's usage records. Does not affect transcription, the response, `tag`, or `callback`. Independent of `mip_opt_out`. https://developers.deepgram.com/docs/redact-usage + replace : typing.Optional[typing.Union[str, typing.Sequence[str]]] Search for terms or phrases in submitted audio and replaces them @@ -502,6 +511,7 @@ def transcribe_file( "profanity_filter": profanity_filter, "punctuate": punctuate, "redact": redact, + "redact_usage": redact_usage, "replace": replace, "search": search, "smart_format": smart_format, @@ -587,6 +597,7 @@ async def transcribe_url( profanity_filter: typing.Optional[bool] = None, punctuate: typing.Optional[bool] = None, redact: typing.Optional[str] = None, + redact_usage: typing.Optional[bool] = None, replace: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, search: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, smart_format: typing.Optional[bool] = None, @@ -700,6 +711,9 @@ async def transcribe_url( redact : typing.Optional[str] Redaction removes sensitive information from your transcripts + redact_usage : typing.Optional[bool] + Replaces the values of user-supplied text parameters (`keyterm`, `keywords`, `replace`, `search`, `extra`, `custom_topic`, and `custom_intent`) with `[REDACTED]` in this request's usage records. Does not affect transcription, the response, `tag`, or `callback`. Independent of `mip_opt_out`. https://developers.deepgram.com/docs/redact-usage + replace : typing.Optional[typing.Union[str, typing.Sequence[str]]] Search for terms or phrases in submitted audio and replaces them @@ -765,6 +779,7 @@ async def transcribe_url( "profanity_filter": profanity_filter, "punctuate": punctuate, "redact": redact, + "redact_usage": redact_usage, "replace": replace, "search": search, "smart_format": smart_format, @@ -847,6 +862,7 @@ async def transcribe_file( profanity_filter: typing.Optional[bool] = None, punctuate: typing.Optional[bool] = None, redact: typing.Optional[str] = None, + redact_usage: typing.Optional[bool] = None, replace: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, search: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, smart_format: typing.Optional[bool] = None, @@ -960,6 +976,9 @@ async def transcribe_file( redact : typing.Optional[str] Redaction removes sensitive information from your transcripts + redact_usage : typing.Optional[bool] + Replaces the values of user-supplied text parameters (`keyterm`, `keywords`, `replace`, `search`, `extra`, `custom_topic`, and `custom_intent`) with `[REDACTED]` in this request's usage records. Does not affect transcription, the response, `tag`, or `callback`. Independent of `mip_opt_out`. https://developers.deepgram.com/docs/redact-usage + replace : typing.Optional[typing.Union[str, typing.Sequence[str]]] Search for terms or phrases in submitted audio and replaces them @@ -1025,6 +1044,7 @@ async def transcribe_file( "profanity_filter": profanity_filter, "punctuate": punctuate, "redact": redact, + "redact_usage": redact_usage, "replace": replace, "search": search, "smart_format": smart_format, diff --git a/src/deepgram/listen/v1/raw_client.py b/src/deepgram/listen/v1/raw_client.py index 0a149858..3084228e 100644 --- a/src/deepgram/listen/v1/raw_client.py +++ b/src/deepgram/listen/v1/raw_client.py @@ -34,6 +34,7 @@ from ...types.listen_v1profanity_filter import ListenV1ProfanityFilter from ...types.listen_v1punctuate import ListenV1Punctuate from ...types.listen_v1redact import ListenV1Redact +from ...types.listen_v1redact_usage import ListenV1RedactUsage from ...types.listen_v1replace import ListenV1Replace from ...types.listen_v1sample_rate import ListenV1SampleRate from ...types.listen_v1search import ListenV1Search @@ -81,6 +82,7 @@ def connect( profanity_filter: typing.Optional[ListenV1ProfanityFilter] = None, punctuate: typing.Optional[ListenV1Punctuate] = None, redact: typing.Optional[ListenV1Redact] = None, + redact_usage: typing.Optional[ListenV1RedactUsage] = None, replace: typing.Optional[ListenV1Replace] = None, sample_rate: typing.Optional[ListenV1SampleRate] = None, search: typing.Optional[ListenV1Search] = None, @@ -144,6 +146,8 @@ def connect( redact : typing.Optional[ListenV1Redact] + redact_usage : typing.Optional[ListenV1RedactUsage] + replace : typing.Optional[ListenV1Replace] sample_rate : typing.Optional[ListenV1SampleRate] @@ -205,6 +209,7 @@ def connect( "profanity_filter": profanity_filter, "punctuate": punctuate, "redact": redact, + "redact_usage": redact_usage, "replace": replace, "sample_rate": sample_rate, "search": search, @@ -277,6 +282,7 @@ async def connect( profanity_filter: typing.Optional[ListenV1ProfanityFilter] = None, punctuate: typing.Optional[ListenV1Punctuate] = None, redact: typing.Optional[ListenV1Redact] = None, + redact_usage: typing.Optional[ListenV1RedactUsage] = None, replace: typing.Optional[ListenV1Replace] = None, sample_rate: typing.Optional[ListenV1SampleRate] = None, search: typing.Optional[ListenV1Search] = None, @@ -340,6 +346,8 @@ async def connect( redact : typing.Optional[ListenV1Redact] + redact_usage : typing.Optional[ListenV1RedactUsage] + replace : typing.Optional[ListenV1Replace] sample_rate : typing.Optional[ListenV1SampleRate] @@ -401,6 +409,7 @@ async def connect( "profanity_filter": profanity_filter, "punctuate": punctuate, "redact": redact, + "redact_usage": redact_usage, "replace": replace, "sample_rate": sample_rate, "search": search, diff --git a/src/deepgram/listen/v1/requests/listen_v1configure_failure.py b/src/deepgram/listen/v1/requests/listen_v1configure_failure.py index af007f39..410201ed 100644 --- a/src/deepgram/listen/v1/requests/listen_v1configure_failure.py +++ b/src/deepgram/listen/v1/requests/listen_v1configure_failure.py @@ -20,7 +20,7 @@ class ListenV1ConfigureFailureParams(typing_extensions.TypedDict): 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. diff --git a/src/deepgram/listen/v1/socket_client.py b/src/deepgram/listen/v1/socket_client.py index e9f508ba..5666ff3a 100644 --- a/src/deepgram/listen/v1/socket_client.py +++ b/src/deepgram/listen/v1/socket_client.py @@ -3,7 +3,9 @@ import json import logging import typing +from json.decoder import JSONDecodeError +import websockets import websockets.sync.connection as websockets_sync_connection from ...core.events import EventEmitterMixin, EventType from ...core.unchecked_base_model import construct_type @@ -26,7 +28,6 @@ _logger = logging.getLogger(__name__) V1SocketClientResponse = typing.Union[ - bytes, ListenV1ConfigureSuccess, ListenV1ConfigureFailure, ListenV1Results, @@ -34,7 +35,6 @@ ListenV1UtteranceEnd, ListenV1SpeechStarted, ListenV1Error, - typing.Dict[str, typing.Any], ] @@ -46,7 +46,7 @@ def __init__(self, *, websocket: WebSocketClientProtocol): async def __aiter__(self) -> typing.AsyncIterator[V1SocketClientResponse]: async for message in self._websocket: if isinstance(message, bytes): - yield message + yield message # type: ignore else: try: yield construct_type(type_=V1SocketClientResponse, object_=json.loads(message)) # type: ignore @@ -81,7 +81,7 @@ async def start_listening(self): ) continue await self._emit_async(EventType.MESSAGE, parsed) - except Exception as exc: + except (websockets.WebSocketException, JSONDecodeError) as exc: await self._emit_async(EventType.ERROR, exc) finally: await self._emit_async(EventType.CLOSE, None) @@ -93,26 +93,26 @@ async def send_media(self, message: bytes) -> None: """ await self._send(message) - async def send_finalize(self, message: typing.Optional[ListenV1Finalize] = None) -> None: + async def send_finalize(self, message: ListenV1Finalize) -> 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")) + await self._send_model(message) - async def send_close_stream(self, message: typing.Optional[ListenV1CloseStream] = None) -> None: + async def send_close_stream(self, message: ListenV1CloseStream) -> 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")) + await self._send_model(message) - async def send_keep_alive(self, message: typing.Optional[ListenV1KeepAlive] = None) -> None: + async def send_keep_alive(self, message: ListenV1KeepAlive) -> 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")) + await self._send_model(message) async def send_configure(self, message: ListenV1Configure) -> None: """ @@ -127,7 +127,7 @@ async def recv(self) -> V1SocketClientResponse: """ data = await self._websocket.recv() if isinstance(data, bytes): - return data + return data # type: ignore json_data = json.loads(data) try: return construct_type(type_=V1SocketClientResponse, object_=json_data) # type: ignore @@ -158,7 +158,7 @@ def __init__(self, *, websocket: websockets_sync_connection.Connection): def __iter__(self) -> typing.Iterator[V1SocketClientResponse]: for message in self._websocket: if isinstance(message, bytes): - yield message + yield message # type: ignore else: try: yield construct_type(type_=V1SocketClientResponse, object_=json.loads(message)) # type: ignore @@ -193,7 +193,7 @@ def start_listening(self): ) continue self._emit(EventType.MESSAGE, parsed) - except Exception as exc: + except (websockets.WebSocketException, JSONDecodeError) as exc: self._emit(EventType.ERROR, exc) finally: self._emit(EventType.CLOSE, None) @@ -205,26 +205,26 @@ def send_media(self, message: bytes) -> None: """ self._send(message) - def send_finalize(self, message: typing.Optional[ListenV1Finalize] = None) -> None: + def send_finalize(self, message: ListenV1Finalize) -> None: """ Send a message to the websocket connection. The message will be sent as a ListenV1Finalize. """ - self._send_model(message or ListenV1Finalize(type="Finalize")) + self._send_model(message) - def send_close_stream(self, message: typing.Optional[ListenV1CloseStream] = None) -> None: + def send_close_stream(self, message: ListenV1CloseStream) -> None: """ Send a message to the websocket connection. The message will be sent as a ListenV1CloseStream. """ - self._send_model(message or ListenV1CloseStream(type="CloseStream")) + self._send_model(message) - def send_keep_alive(self, message: typing.Optional[ListenV1KeepAlive] = None) -> None: + def send_keep_alive(self, message: ListenV1KeepAlive) -> None: """ Send a message to the websocket connection. The message will be sent as a ListenV1KeepAlive. """ - self._send_model(message or ListenV1KeepAlive(type="KeepAlive")) + self._send_model(message) def send_configure(self, message: ListenV1Configure) -> None: """ @@ -239,7 +239,7 @@ def recv(self) -> V1SocketClientResponse: """ data = self._websocket.recv() if isinstance(data, bytes): - return data + return data # type: ignore json_data = json.loads(data) try: return construct_type(type_=V1SocketClientResponse, object_=json_data) # type: ignore diff --git a/src/deepgram/listen/v1/types/listen_v1configure_failure.py b/src/deepgram/listen/v1/types/listen_v1configure_failure.py index 859a834c..7352f3df 100644 --- a/src/deepgram/listen/v1/types/listen_v1configure_failure.py +++ b/src/deepgram/listen/v1/types/listen_v1configure_failure.py @@ -22,7 +22,7 @@ class ListenV1ConfigureFailure(UncheckedBaseModel): 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. diff --git a/src/deepgram/listen/v2/__init__.py b/src/deepgram/listen/v2/__init__.py index 7585b5ab..8dea11db 100644 --- a/src/deepgram/listen/v2/__init__.py +++ b/src/deepgram/listen/v2/__init__.py @@ -63,8 +63,6 @@ "ListenV2WarningParams": ".requests", } -_dynamic_imports["ListenV2CloseStreamType"] = ".types" - def __getattr__(attr_name: str) -> typing.Any: module_name = _dynamic_imports.get(attr_name) @@ -114,5 +112,3 @@ def __dir__(): "ListenV2Warning", "ListenV2WarningParams", ] - -__all__.append("ListenV2CloseStreamType") diff --git a/src/deepgram/listen/v2/client.py b/src/deepgram/listen/v2/client.py index b76e41be..28e0736f 100644 --- a/src/deepgram/listen/v2/client.py +++ b/src/deepgram/listen/v2/client.py @@ -24,6 +24,7 @@ from ...types.listen_v2numerals import ListenV2Numerals from ...types.listen_v2profanity_filter import ListenV2ProfanityFilter from ...types.listen_v2redact import ListenV2Redact +from ...types.listen_v2redact_usage import ListenV2RedactUsage from ...types.listen_v2sample_rate import ListenV2SampleRate from ...types.listen_v2tag import ListenV2Tag from .raw_client import AsyncRawV2Client, RawV2Client @@ -65,6 +66,7 @@ def connect( profanity_filter: typing.Optional[ListenV2ProfanityFilter] = None, numerals: typing.Optional[ListenV2Numerals] = None, redact: typing.Optional[ListenV2Redact] = None, + redact_usage: typing.Optional[ListenV2RedactUsage] = None, mip_opt_out: typing.Optional[ListenV2MipOptOut] = None, tag: typing.Optional[ListenV2Tag] = None, authorization: typing.Optional[str] = None, @@ -98,6 +100,8 @@ def connect( redact : typing.Optional[ListenV2Redact] + redact_usage : typing.Optional[ListenV2RedactUsage] + mip_opt_out : typing.Optional[ListenV2MipOptOut] tag : typing.Optional[ListenV2Tag] @@ -142,6 +146,7 @@ def connect( "profanity_filter": profanity_filter, "numerals": numerals, "redact": redact, + "redact_usage": redact_usage, "mip_opt_out": mip_opt_out, "tag": tag, **( @@ -208,6 +213,7 @@ async def connect( profanity_filter: typing.Optional[ListenV2ProfanityFilter] = None, numerals: typing.Optional[ListenV2Numerals] = None, redact: typing.Optional[ListenV2Redact] = None, + redact_usage: typing.Optional[ListenV2RedactUsage] = None, mip_opt_out: typing.Optional[ListenV2MipOptOut] = None, tag: typing.Optional[ListenV2Tag] = None, authorization: typing.Optional[str] = None, @@ -241,6 +247,8 @@ async def connect( redact : typing.Optional[ListenV2Redact] + redact_usage : typing.Optional[ListenV2RedactUsage] + mip_opt_out : typing.Optional[ListenV2MipOptOut] tag : typing.Optional[ListenV2Tag] @@ -285,6 +293,7 @@ async def connect( "profanity_filter": profanity_filter, "numerals": numerals, "redact": redact, + "redact_usage": redact_usage, "mip_opt_out": mip_opt_out, "tag": tag, **( diff --git a/src/deepgram/listen/v2/raw_client.py b/src/deepgram/listen/v2/raw_client.py index f5160709..12a659f8 100644 --- a/src/deepgram/listen/v2/raw_client.py +++ b/src/deepgram/listen/v2/raw_client.py @@ -24,6 +24,7 @@ from ...types.listen_v2numerals import ListenV2Numerals from ...types.listen_v2profanity_filter import ListenV2ProfanityFilter from ...types.listen_v2redact import ListenV2Redact +from ...types.listen_v2redact_usage import ListenV2RedactUsage from ...types.listen_v2sample_rate import ListenV2SampleRate from ...types.listen_v2tag import ListenV2Tag from .socket_client import AsyncV2SocketClient, V2SocketClient @@ -53,6 +54,7 @@ def connect( profanity_filter: typing.Optional[ListenV2ProfanityFilter] = None, numerals: typing.Optional[ListenV2Numerals] = None, redact: typing.Optional[ListenV2Redact] = None, + redact_usage: typing.Optional[ListenV2RedactUsage] = None, mip_opt_out: typing.Optional[ListenV2MipOptOut] = None, tag: typing.Optional[ListenV2Tag] = None, authorization: typing.Optional[str] = None, @@ -86,6 +88,8 @@ def connect( redact : typing.Optional[ListenV2Redact] + redact_usage : typing.Optional[ListenV2RedactUsage] + mip_opt_out : typing.Optional[ListenV2MipOptOut] tag : typing.Optional[ListenV2Tag] @@ -130,6 +134,7 @@ def connect( "profanity_filter": profanity_filter, "numerals": numerals, "redact": redact, + "redact_usage": redact_usage, "mip_opt_out": mip_opt_out, "tag": tag, **( @@ -185,6 +190,7 @@ async def connect( profanity_filter: typing.Optional[ListenV2ProfanityFilter] = None, numerals: typing.Optional[ListenV2Numerals] = None, redact: typing.Optional[ListenV2Redact] = None, + redact_usage: typing.Optional[ListenV2RedactUsage] = None, mip_opt_out: typing.Optional[ListenV2MipOptOut] = None, tag: typing.Optional[ListenV2Tag] = None, authorization: typing.Optional[str] = None, @@ -218,6 +224,8 @@ async def connect( redact : typing.Optional[ListenV2Redact] + redact_usage : typing.Optional[ListenV2RedactUsage] + mip_opt_out : typing.Optional[ListenV2MipOptOut] tag : typing.Optional[ListenV2Tag] @@ -262,6 +270,7 @@ async def connect( "profanity_filter": profanity_filter, "numerals": numerals, "redact": redact, + "redact_usage": redact_usage, "mip_opt_out": mip_opt_out, "tag": tag, **( diff --git a/src/deepgram/listen/v2/requests/listen_v2configure.py b/src/deepgram/listen/v2/requests/listen_v2configure.py index d169e307..579d7ecf 100644 --- a/src/deepgram/listen/v2/requests/listen_v2configure.py +++ b/src/deepgram/listen/v2/requests/listen_v2configure.py @@ -5,6 +5,7 @@ import typing_extensions from ....requests.listen_v2keyterm import ListenV2KeytermParams from ....types.listen_v2configure_numerals import ListenV2ConfigureNumerals +from ....types.listen_v2configure_redact_usage import ListenV2ConfigureRedactUsage from .listen_v2configure_thresholds import ListenV2ConfigureThresholdsParams @@ -29,3 +30,4 @@ class ListenV2ConfigureParams(typing_extensions.TypedDict): """ numerals: typing_extensions.NotRequired[ListenV2ConfigureNumerals] + redact_usage: typing_extensions.NotRequired[ListenV2ConfigureRedactUsage] diff --git a/src/deepgram/listen/v2/requests/listen_v2configure_success.py b/src/deepgram/listen/v2/requests/listen_v2configure_success.py index b875582c..fbb0e0fd 100644 --- a/src/deepgram/listen/v2/requests/listen_v2configure_success.py +++ b/src/deepgram/listen/v2/requests/listen_v2configure_success.py @@ -36,6 +36,11 @@ class ListenV2ConfigureSuccessParams(typing_extensions.TypedDict): Whether numeral formatting is enabled for transcripts Flux STT sends after it processes the update. """ + redact_usage: typing_extensions.NotRequired[bool] + """ + Whether usage redaction is on for this connection. + """ + sequence_id: int """ Starts at `0` and increments for each message the server sends diff --git a/src/deepgram/listen/v2/socket_client.py b/src/deepgram/listen/v2/socket_client.py index 6b15d6fd..e60bd78a 100644 --- a/src/deepgram/listen/v2/socket_client.py +++ b/src/deepgram/listen/v2/socket_client.py @@ -3,7 +3,9 @@ import json import logging import typing +from json.decoder import JSONDecodeError +import websockets import websockets.sync.connection as websockets_sync_connection from ...core.events import EventEmitterMixin, EventType from ...core.unchecked_base_model import construct_type @@ -24,14 +26,12 @@ _logger = logging.getLogger(__name__) V2SocketClientResponse = typing.Union[ - bytes, ListenV2Connected, ListenV2TurnInfo, ListenV2ConfigureSuccess, ListenV2ConfigureFailure, ListenV2Warning, ListenV2FatalError, - typing.Dict[str, typing.Any], ] @@ -43,7 +43,7 @@ def __init__(self, *, websocket: WebSocketClientProtocol): async def __aiter__(self) -> typing.AsyncIterator[V2SocketClientResponse]: async for message in self._websocket: if isinstance(message, bytes): - yield message + yield message # type: ignore else: try: yield construct_type(type_=V2SocketClientResponse, object_=json.loads(message)) # type: ignore @@ -78,7 +78,7 @@ async def start_listening(self): ) continue await self._emit_async(EventType.MESSAGE, parsed) - except Exception as exc: + except (websockets.WebSocketException, JSONDecodeError) as exc: await self._emit_async(EventType.ERROR, exc) finally: await self._emit_async(EventType.CLOSE, None) @@ -90,29 +90,26 @@ async def send_media(self, message: bytes) -> None: """ await self._send(message) - async def send_close_stream(self, message: typing.Optional[ListenV2CloseStream] = None) -> None: + async def send_close_stream(self, message: ListenV2CloseStream) -> 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")) + await self._send_model(message) - async def send_force_end_turn(self, message: typing.Optional[ListenV2ForceEndTurn] = None) -> None: + async def send_force_end_turn(self, message: ListenV2ForceEndTurn) -> 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")) + await self._send_model(message) - async def send_configure(self, message: typing.Union[ListenV2Configure, typing.Dict[str, typing.Any]]) -> None: + async def send_configure(self, message: ListenV2Configure) -> 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) + await self._send_model(message) async def recv(self) -> V2SocketClientResponse: """ @@ -120,7 +117,7 @@ async def recv(self) -> V2SocketClientResponse: """ data = await self._websocket.recv() if isinstance(data, bytes): - return data + return data # type: ignore json_data = json.loads(data) try: return construct_type(type_=V2SocketClientResponse, object_=json_data) # type: ignore @@ -151,7 +148,7 @@ def __init__(self, *, websocket: websockets_sync_connection.Connection): def __iter__(self) -> typing.Iterator[V2SocketClientResponse]: for message in self._websocket: if isinstance(message, bytes): - yield message + yield message # type: ignore else: try: yield construct_type(type_=V2SocketClientResponse, object_=json.loads(message)) # type: ignore @@ -186,7 +183,7 @@ def start_listening(self): ) continue self._emit(EventType.MESSAGE, parsed) - except Exception as exc: + except (websockets.WebSocketException, JSONDecodeError) as exc: self._emit(EventType.ERROR, exc) finally: self._emit(EventType.CLOSE, None) @@ -198,29 +195,26 @@ def send_media(self, message: bytes) -> None: """ self._send(message) - def send_close_stream(self, message: typing.Optional[ListenV2CloseStream] = None) -> None: + def send_close_stream(self, message: ListenV2CloseStream) -> None: """ Send a message to the websocket connection. The message will be sent as a ListenV2CloseStream. """ - self._send_model(message or ListenV2CloseStream(type="CloseStream")) + self._send_model(message) - def send_force_end_turn(self, message: typing.Optional[ListenV2ForceEndTurn] = None) -> None: + def send_force_end_turn(self, message: ListenV2ForceEndTurn) -> None: """ Send a message to the websocket connection. The message will be sent as a ListenV2ForceEndTurn. """ - self._send_model(message or ListenV2ForceEndTurn(type="ForceEndTurn")) + self._send_model(message) - def send_configure(self, message: typing.Union[ListenV2Configure, typing.Dict[str, typing.Any]]) -> None: + def send_configure(self, message: ListenV2Configure) -> 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) + self._send_model(message) def recv(self) -> V2SocketClientResponse: """ @@ -228,7 +222,7 @@ def recv(self) -> V2SocketClientResponse: """ data = self._websocket.recv() if isinstance(data, bytes): - return data + return data # type: ignore json_data = json.loads(data) try: return construct_type(type_=V2SocketClientResponse, object_=json_data) # type: ignore diff --git a/src/deepgram/listen/v2/types/__init__.py b/src/deepgram/listen/v2/types/__init__.py index 8ec84d29..7f4ffc34 100644 --- a/src/deepgram/listen/v2/types/__init__.py +++ b/src/deepgram/listen/v2/types/__init__.py @@ -35,8 +35,6 @@ "ListenV2Warning": ".listen_v2warning", } -_dynamic_imports["ListenV2CloseStreamType"] = ".listen_v2close_stream_type" - def __getattr__(attr_name: str) -> typing.Any: module_name = _dynamic_imports.get(attr_name) @@ -74,5 +72,3 @@ def __dir__(): "ListenV2TurnInfoWordsItem", "ListenV2Warning", ] - -__all__.append("ListenV2CloseStreamType") diff --git a/src/deepgram/listen/v2/types/listen_v2configure.py b/src/deepgram/listen/v2/types/listen_v2configure.py index 487ed99c..7e3dfd96 100644 --- a/src/deepgram/listen/v2/types/listen_v2configure.py +++ b/src/deepgram/listen/v2/types/listen_v2configure.py @@ -6,6 +6,7 @@ from ....core.pydantic_utilities import IS_PYDANTIC_V2 from ....core.unchecked_base_model import UncheckedBaseModel from ....types.listen_v2configure_numerals import ListenV2ConfigureNumerals +from ....types.listen_v2configure_redact_usage import ListenV2ConfigureRedactUsage from ....types.listen_v2keyterm import ListenV2Keyterm from .listen_v2configure_thresholds import ListenV2ConfigureThresholds @@ -31,6 +32,7 @@ class ListenV2Configure(UncheckedBaseModel): """ numerals: typing.Optional[ListenV2ConfigureNumerals] = None + redact_usage: typing.Optional[ListenV2ConfigureRedactUsage] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/src/deepgram/listen/v2/types/listen_v2configure_failure.py b/src/deepgram/listen/v2/types/listen_v2configure_failure.py index 1daf8af6..7b3772d6 100644 --- a/src/deepgram/listen/v2/types/listen_v2configure_failure.py +++ b/src/deepgram/listen/v2/types/listen_v2configure_failure.py @@ -4,10 +4,10 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 -from ._dict_compat import ListenV2ResponseDictCompatModel +from ....core.unchecked_base_model import UncheckedBaseModel -class ListenV2ConfigureFailure(ListenV2ResponseDictCompatModel): +class ListenV2ConfigureFailure(UncheckedBaseModel): type: typing.Literal["ConfigureFailure"] = pydantic.Field(default="ConfigureFailure") """ Message type identifier diff --git a/src/deepgram/listen/v2/types/listen_v2configure_success.py b/src/deepgram/listen/v2/types/listen_v2configure_success.py index cf7c1c80..d04cce1b 100644 --- a/src/deepgram/listen/v2/types/listen_v2configure_success.py +++ b/src/deepgram/listen/v2/types/listen_v2configure_success.py @@ -4,13 +4,13 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel 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): +class ListenV2ConfigureSuccess(UncheckedBaseModel): type: typing.Literal["ConfigureSuccess"] = pydantic.Field(default="ConfigureSuccess") """ Message type identifier @@ -38,6 +38,11 @@ class ListenV2ConfigureSuccess(ListenV2ResponseDictCompatModel): 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 diff --git a/src/deepgram/listen/v2/types/listen_v2configure_success_thresholds.py b/src/deepgram/listen/v2/types/listen_v2configure_success_thresholds.py index e0353ec9..6c719233 100644 --- a/src/deepgram/listen/v2/types/listen_v2configure_success_thresholds.py +++ b/src/deepgram/listen/v2/types/listen_v2configure_success_thresholds.py @@ -4,13 +4,13 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel 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): +class ListenV2ConfigureSuccessThresholds(UncheckedBaseModel): """ Updates each parameter, if it is supplied. If a particular threshold parameter is not supplied, the configuration continues using the currently configured value. diff --git a/src/deepgram/listen/v2/types/listen_v2connected.py b/src/deepgram/listen/v2/types/listen_v2connected.py index b253d86c..cefc0236 100644 --- a/src/deepgram/listen/v2/types/listen_v2connected.py +++ b/src/deepgram/listen/v2/types/listen_v2connected.py @@ -4,10 +4,10 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 -from ._dict_compat import ListenV2ResponseDictCompatModel +from ....core.unchecked_base_model import UncheckedBaseModel -class ListenV2Connected(ListenV2ResponseDictCompatModel): +class ListenV2Connected(UncheckedBaseModel): type: typing.Literal["Connected"] = pydantic.Field(default="Connected") """ Message type identifier diff --git a/src/deepgram/listen/v2/types/listen_v2fatal_error.py b/src/deepgram/listen/v2/types/listen_v2fatal_error.py index 2202c82e..c5106f07 100644 --- a/src/deepgram/listen/v2/types/listen_v2fatal_error.py +++ b/src/deepgram/listen/v2/types/listen_v2fatal_error.py @@ -4,10 +4,10 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 -from ._dict_compat import ListenV2ResponseDictCompatModel +from ....core.unchecked_base_model import UncheckedBaseModel -class ListenV2FatalError(ListenV2ResponseDictCompatModel): +class ListenV2FatalError(UncheckedBaseModel): type: typing.Literal["Error"] = pydantic.Field(default="Error") """ Message type identifier diff --git a/src/deepgram/listen/v2/types/listen_v2turn_info.py b/src/deepgram/listen/v2/types/listen_v2turn_info.py index 969d6d0c..d87a1032 100644 --- a/src/deepgram/listen/v2/types/listen_v2turn_info.py +++ b/src/deepgram/listen/v2/types/listen_v2turn_info.py @@ -4,12 +4,12 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 -from ._dict_compat import ListenV2ResponseDictCompatModel +from ....core.unchecked_base_model import UncheckedBaseModel from .listen_v2turn_info_event import ListenV2TurnInfoEvent from .listen_v2turn_info_words_item import ListenV2TurnInfoWordsItem -class ListenV2TurnInfo(ListenV2ResponseDictCompatModel): +class ListenV2TurnInfo(UncheckedBaseModel): """ Describes the current turn and latest state of the turn """ diff --git a/src/deepgram/listen/v2/types/listen_v2turn_info_words_item.py b/src/deepgram/listen/v2/types/listen_v2turn_info_words_item.py index 88240cd9..07ada673 100644 --- a/src/deepgram/listen/v2/types/listen_v2turn_info_words_item.py +++ b/src/deepgram/listen/v2/types/listen_v2turn_info_words_item.py @@ -4,10 +4,10 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 -from ._dict_compat import ListenV2ResponseDictCompatModel +from ....core.unchecked_base_model import UncheckedBaseModel -class ListenV2TurnInfoWordsItem(ListenV2ResponseDictCompatModel): +class ListenV2TurnInfoWordsItem(UncheckedBaseModel): word: str = pydantic.Field() """ The individual punctuated, properly-cased word from the transcript diff --git a/src/deepgram/listen/v2/types/listen_v2warning.py b/src/deepgram/listen/v2/types/listen_v2warning.py index 19bfe19a..c392cd25 100644 --- a/src/deepgram/listen/v2/types/listen_v2warning.py +++ b/src/deepgram/listen/v2/types/listen_v2warning.py @@ -4,10 +4,10 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 -from ._dict_compat import ListenV2ResponseDictCompatModel +from ....core.unchecked_base_model import UncheckedBaseModel -class ListenV2Warning(ListenV2ResponseDictCompatModel): +class ListenV2Warning(UncheckedBaseModel): type: typing.Literal["Warning"] = pydantic.Field(default="Warning") """ Message type identifier diff --git a/src/deepgram/requests/__init__.py b/src/deepgram/requests/__init__.py index beb2e2db..bacbf9df 100644 --- a/src/deepgram/requests/__init__.py +++ b/src/deepgram/requests/__init__.py @@ -389,22 +389,6 @@ "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) @@ -600,19 +584,3 @@ def __dir__(): "UsageV1ResponseParams", "UsageV1ResponseResolutionParams", ] - -__all__.extend( - [ - "SharedIntentsResultsParams", - "SharedIntentsResultsIntentsParams", - "SharedIntentsResultsIntentsSegmentsItemParams", - "SharedIntentsResultsIntentsSegmentsItemIntentsItemParams", - "SharedTopicsResultsParams", - "SharedTopicsResultsTopicsParams", - "SharedTopicsResultsTopicsSegmentsItemParams", - "SharedTopicsResultsTopicsSegmentsItemTopicsItemParams", - "CartesiaSpeakProviderVoiceParams", - "CreateKeyV1RequestOneParams", - "DeepgramListenProviderV2LanguageHintParams", - ] -) diff --git a/src/deepgram/requests/shared_intents.py b/src/deepgram/requests/shared_intents.py index 8f699d26..7a618c13 100644 --- a/src/deepgram/requests/shared_intents.py +++ b/src/deepgram/requests/shared_intents.py @@ -3,7 +3,6 @@ import typing import typing_extensions -from .shared_intents_results import SharedIntentsResultsParams from .shared_intents_segments_item import SharedIntentsSegmentsItemParams @@ -13,4 +12,3 @@ class SharedIntentsParams(typing_extensions.TypedDict): """ segments: typing_extensions.NotRequired[typing.Sequence[SharedIntentsSegmentsItemParams]] - results: typing_extensions.NotRequired[SharedIntentsResultsParams] diff --git a/src/deepgram/requests/shared_topics.py b/src/deepgram/requests/shared_topics.py index 88c0816d..4965005e 100644 --- a/src/deepgram/requests/shared_topics.py +++ b/src/deepgram/requests/shared_topics.py @@ -3,7 +3,6 @@ import typing import typing_extensions -from .shared_topics_results import SharedTopicsResultsParams from .shared_topics_segments_item import SharedTopicsSegmentsItemParams @@ -13,4 +12,3 @@ class SharedTopicsParams(typing_extensions.TypedDict): """ segments: typing_extensions.NotRequired[typing.Sequence[SharedTopicsSegmentsItemParams]] - results: typing_extensions.NotRequired[SharedTopicsResultsParams] diff --git a/src/deepgram/speak/v1/socket_client.py b/src/deepgram/speak/v1/socket_client.py index f268acb4..5de6cd20 100644 --- a/src/deepgram/speak/v1/socket_client.py +++ b/src/deepgram/speak/v1/socket_client.py @@ -3,7 +3,9 @@ import json import logging import typing +from json.decoder import JSONDecodeError +import websockets import websockets.sync.connection as websockets_sync_connection from ...core.events import EventEmitterMixin, EventType from ...core.unchecked_base_model import construct_type @@ -22,9 +24,7 @@ from websockets import WebSocketClientProtocol # type: ignore _logger = logging.getLogger(__name__) -V1SocketClientResponse = typing.Union[ - bytes, SpeakV1Metadata, SpeakV1Flushed, SpeakV1Cleared, SpeakV1Warning, typing.Dict[str, typing.Any] -] +V1SocketClientResponse = typing.Union[bytes, SpeakV1Metadata, SpeakV1Flushed, SpeakV1Cleared, SpeakV1Warning] class AsyncV1SocketClient(EventEmitterMixin): @@ -70,7 +70,7 @@ async def start_listening(self): ) continue await self._emit_async(EventType.MESSAGE, parsed) - except Exception as exc: + except (websockets.WebSocketException, JSONDecodeError) as exc: await self._emit_async(EventType.ERROR, exc) finally: await self._emit_async(EventType.CLOSE, None) @@ -82,26 +82,26 @@ async def send_text(self, message: SpeakV1Text) -> None: """ await self._send_model(message) - async def send_flush(self, message: typing.Optional[SpeakV1Flush] = None) -> None: + async def send_flush(self, message: SpeakV1Flush) -> 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")) + await self._send_model(message) - async def send_clear(self, message: typing.Optional[SpeakV1Clear] = None) -> None: + async def send_clear(self, message: SpeakV1Clear) -> 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")) + await self._send_model(message) - async def send_close(self, message: typing.Optional[SpeakV1Close] = None) -> None: + async def send_close(self, message: SpeakV1Close) -> 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")) + await self._send_model(message) async def recv(self) -> V1SocketClientResponse: """ @@ -175,7 +175,7 @@ def start_listening(self): ) continue self._emit(EventType.MESSAGE, parsed) - except Exception as exc: + except (websockets.WebSocketException, JSONDecodeError) as exc: self._emit(EventType.ERROR, exc) finally: self._emit(EventType.CLOSE, None) @@ -187,26 +187,26 @@ def send_text(self, message: SpeakV1Text) -> None: """ self._send_model(message) - def send_flush(self, message: typing.Optional[SpeakV1Flush] = None) -> None: + def send_flush(self, message: SpeakV1Flush) -> None: """ Send a message to the websocket connection. The message will be sent as a SpeakV1Flush. """ - self._send_model(message or SpeakV1Flush(type="Flush")) + self._send_model(message) - def send_clear(self, message: typing.Optional[SpeakV1Clear] = None) -> None: + def send_clear(self, message: SpeakV1Clear) -> None: """ Send a message to the websocket connection. The message will be sent as a SpeakV1Clear. """ - self._send_model(message or SpeakV1Clear(type="Clear")) + self._send_model(message) - def send_close(self, message: typing.Optional[SpeakV1Close] = None) -> None: + def send_close(self, message: SpeakV1Close) -> None: """ Send a message to the websocket connection. The message will be sent as a SpeakV1Close. """ - self._send_model(message or SpeakV1Close(type="Close")) + self._send_model(message) def recv(self) -> V1SocketClientResponse: """ diff --git a/src/deepgram/speak/v2/audio/client.py b/src/deepgram/speak/v2/audio/client.py index f1c4abb7..ee5dabc3 100644 --- a/src/deepgram/speak/v2/audio/client.py +++ b/src/deepgram/speak/v2/audio/client.py @@ -41,6 +41,7 @@ def generate( container: typing.Optional[AudioGenerateRequestContainer] = None, encoding: typing.Optional[AudioGenerateRequestEncoding] = None, expressivity: typing.Optional[int] = None, + normalize_volume: typing.Optional[bool] = None, sample_rate: typing.Optional[int] = None, speed: typing.Optional[float] = None, priority: typing.Optional[typing.Literal["low"]] = None, @@ -81,6 +82,9 @@ def generate( expressivity : typing.Optional[int] Expressive range of the generated speech, on a calm-to-animated axis. Accepted values: `-2`, `-1`, `0`, `1`, `2`. `0` (the default) is the voice's tuned delivery and the production-validated setting, with `-2` the calm end of the range and `2` the animated end. Supported on all Flux voices; applies to the whole request. Beta: behavior may change in future model versions, and non-default values increase the risk of hallucinations and pronunciation errors; audition before shipping. An invalid value is rejected with a `400` — `EXPRESSIVITY_OUT_OF_RANGE` for a value outside the range, `EXPRESSIVITY_INCREMENT_INVALID` for a fractional value. See [Expressivity](/docs/tts-expressivity). + normalize_volume : typing.Optional[bool] + Normalizes the loudness of the generated speech to a consistent level across voices and requests. On by default; set to `false` to opt out. Peak limiting is applied either way. + sample_rate : typing.Optional[int] Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable @@ -121,6 +125,7 @@ def generate( container=container, encoding=encoding, expressivity=expressivity, + normalize_volume=normalize_volume, sample_rate=sample_rate, speed=speed, priority=priority, @@ -157,6 +162,7 @@ async def generate( container: typing.Optional[AudioGenerateRequestContainer] = None, encoding: typing.Optional[AudioGenerateRequestEncoding] = None, expressivity: typing.Optional[int] = None, + normalize_volume: typing.Optional[bool] = None, sample_rate: typing.Optional[int] = None, speed: typing.Optional[float] = None, priority: typing.Optional[typing.Literal["low"]] = None, @@ -197,6 +203,9 @@ async def generate( expressivity : typing.Optional[int] Expressive range of the generated speech, on a calm-to-animated axis. Accepted values: `-2`, `-1`, `0`, `1`, `2`. `0` (the default) is the voice's tuned delivery and the production-validated setting, with `-2` the calm end of the range and `2` the animated end. Supported on all Flux voices; applies to the whole request. Beta: behavior may change in future model versions, and non-default values increase the risk of hallucinations and pronunciation errors; audition before shipping. An invalid value is rejected with a `400` — `EXPRESSIVITY_OUT_OF_RANGE` for a value outside the range, `EXPRESSIVITY_INCREMENT_INVALID` for a fractional value. See [Expressivity](/docs/tts-expressivity). + normalize_volume : typing.Optional[bool] + Normalizes the loudness of the generated speech to a consistent level across voices and requests. On by default; set to `false` to opt out. Peak limiting is applied either way. + sample_rate : typing.Optional[int] Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable @@ -245,6 +254,7 @@ async def main() -> None: container=container, encoding=encoding, expressivity=expressivity, + normalize_volume=normalize_volume, sample_rate=sample_rate, speed=speed, priority=priority, diff --git a/src/deepgram/speak/v2/audio/raw_client.py b/src/deepgram/speak/v2/audio/raw_client.py index a297f814..95ca5fcc 100644 --- a/src/deepgram/speak/v2/audio/raw_client.py +++ b/src/deepgram/speak/v2/audio/raw_client.py @@ -38,6 +38,7 @@ def generate( container: typing.Optional[AudioGenerateRequestContainer] = None, encoding: typing.Optional[AudioGenerateRequestEncoding] = None, expressivity: typing.Optional[int] = None, + normalize_volume: typing.Optional[bool] = None, sample_rate: typing.Optional[int] = None, speed: typing.Optional[float] = None, priority: typing.Optional[typing.Literal["low"]] = None, @@ -78,6 +79,9 @@ def generate( expressivity : typing.Optional[int] Expressive range of the generated speech, on a calm-to-animated axis. Accepted values: `-2`, `-1`, `0`, `1`, `2`. `0` (the default) is the voice's tuned delivery and the production-validated setting, with `-2` the calm end of the range and `2` the animated end. Supported on all Flux voices; applies to the whole request. Beta: behavior may change in future model versions, and non-default values increase the risk of hallucinations and pronunciation errors; audition before shipping. An invalid value is rejected with a `400` — `EXPRESSIVITY_OUT_OF_RANGE` for a value outside the range, `EXPRESSIVITY_INCREMENT_INVALID` for a fractional value. See [Expressivity](/docs/tts-expressivity). + normalize_volume : typing.Optional[bool] + Normalizes the loudness of the generated speech to a consistent level across voices and requests. On by default; set to `false` to opt out. Peak limiting is applied either way. + sample_rate : typing.Optional[int] Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable @@ -109,6 +113,7 @@ def generate( "encoding": encoding, "expressivity": expressivity, "model": model, + "normalize_volume": normalize_volume, "sample_rate": sample_rate, "speed": speed, "priority": priority, @@ -177,6 +182,7 @@ async def generate( container: typing.Optional[AudioGenerateRequestContainer] = None, encoding: typing.Optional[AudioGenerateRequestEncoding] = None, expressivity: typing.Optional[int] = None, + normalize_volume: typing.Optional[bool] = None, sample_rate: typing.Optional[int] = None, speed: typing.Optional[float] = None, priority: typing.Optional[typing.Literal["low"]] = None, @@ -217,6 +223,9 @@ async def generate( expressivity : typing.Optional[int] Expressive range of the generated speech, on a calm-to-animated axis. Accepted values: `-2`, `-1`, `0`, `1`, `2`. `0` (the default) is the voice's tuned delivery and the production-validated setting, with `-2` the calm end of the range and `2` the animated end. Supported on all Flux voices; applies to the whole request. Beta: behavior may change in future model versions, and non-default values increase the risk of hallucinations and pronunciation errors; audition before shipping. An invalid value is rejected with a `400` — `EXPRESSIVITY_OUT_OF_RANGE` for a value outside the range, `EXPRESSIVITY_INCREMENT_INVALID` for a fractional value. See [Expressivity](/docs/tts-expressivity). + normalize_volume : typing.Optional[bool] + Normalizes the loudness of the generated speech to a consistent level across voices and requests. On by default; set to `false` to opt out. Peak limiting is applied either way. + sample_rate : typing.Optional[int] Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable @@ -248,6 +257,7 @@ async def generate( "encoding": encoding, "expressivity": expressivity, "model": model, + "normalize_volume": normalize_volume, "sample_rate": sample_rate, "speed": speed, "priority": priority, diff --git a/src/deepgram/speak/v2/client.py b/src/deepgram/speak/v2/client.py index 904a5b18..4045503c 100644 --- a/src/deepgram/speak/v2/client.py +++ b/src/deepgram/speak/v2/client.py @@ -18,6 +18,7 @@ from ...types.speak_v2expressivity import SpeakV2Expressivity from ...types.speak_v2mip_opt_out import SpeakV2MipOptOut from ...types.speak_v2model import SpeakV2Model +from ...types.speak_v2normalize_volume import SpeakV2NormalizeVolume from ...types.speak_v2sample_rate import SpeakV2SampleRate from ...types.speak_v2speed import SpeakV2Speed from ...types.speak_v2tag import SpeakV2Tag @@ -59,6 +60,7 @@ def connect( sample_rate: typing.Optional[SpeakV2SampleRate] = None, speed: typing.Optional[SpeakV2Speed] = None, expressivity: typing.Optional[SpeakV2Expressivity] = None, + normalize_volume: typing.Optional[SpeakV2NormalizeVolume] = None, mip_opt_out: typing.Optional[SpeakV2MipOptOut] = None, tag: typing.Optional[SpeakV2Tag] = None, authorization: typing.Optional[str] = None, @@ -81,6 +83,8 @@ def connect( expressivity : typing.Optional[SpeakV2Expressivity] + normalize_volume : typing.Optional[SpeakV2NormalizeVolume] + mip_opt_out : typing.Optional[SpeakV2MipOptOut] tag : typing.Optional[SpeakV2Tag] @@ -107,6 +111,7 @@ def connect( "sample_rate": sample_rate, "speed": speed, "expressivity": expressivity, + "normalize_volume": normalize_volume, "mip_opt_out": mip_opt_out, "tag": tag, **( @@ -177,6 +182,7 @@ async def connect( sample_rate: typing.Optional[SpeakV2SampleRate] = None, speed: typing.Optional[SpeakV2Speed] = None, expressivity: typing.Optional[SpeakV2Expressivity] = None, + normalize_volume: typing.Optional[SpeakV2NormalizeVolume] = None, mip_opt_out: typing.Optional[SpeakV2MipOptOut] = None, tag: typing.Optional[SpeakV2Tag] = None, authorization: typing.Optional[str] = None, @@ -199,6 +205,8 @@ async def connect( expressivity : typing.Optional[SpeakV2Expressivity] + normalize_volume : typing.Optional[SpeakV2NormalizeVolume] + mip_opt_out : typing.Optional[SpeakV2MipOptOut] tag : typing.Optional[SpeakV2Tag] @@ -225,6 +233,7 @@ async def connect( "sample_rate": sample_rate, "speed": speed, "expressivity": expressivity, + "normalize_volume": normalize_volume, "mip_opt_out": mip_opt_out, "tag": tag, **( diff --git a/src/deepgram/speak/v2/raw_client.py b/src/deepgram/speak/v2/raw_client.py index 7aa71788..150858a2 100644 --- a/src/deepgram/speak/v2/raw_client.py +++ b/src/deepgram/speak/v2/raw_client.py @@ -16,6 +16,7 @@ from ...types.speak_v2expressivity import SpeakV2Expressivity from ...types.speak_v2mip_opt_out import SpeakV2MipOptOut from ...types.speak_v2model import SpeakV2Model +from ...types.speak_v2normalize_volume import SpeakV2NormalizeVolume from ...types.speak_v2sample_rate import SpeakV2SampleRate from ...types.speak_v2speed import SpeakV2Speed from ...types.speak_v2tag import SpeakV2Tag @@ -40,6 +41,7 @@ def connect( sample_rate: typing.Optional[SpeakV2SampleRate] = None, speed: typing.Optional[SpeakV2Speed] = None, expressivity: typing.Optional[SpeakV2Expressivity] = None, + normalize_volume: typing.Optional[SpeakV2NormalizeVolume] = None, mip_opt_out: typing.Optional[SpeakV2MipOptOut] = None, tag: typing.Optional[SpeakV2Tag] = None, authorization: typing.Optional[str] = None, @@ -62,6 +64,8 @@ def connect( expressivity : typing.Optional[SpeakV2Expressivity] + normalize_volume : typing.Optional[SpeakV2NormalizeVolume] + mip_opt_out : typing.Optional[SpeakV2MipOptOut] tag : typing.Optional[SpeakV2Tag] @@ -88,6 +92,7 @@ def connect( "sample_rate": sample_rate, "speed": speed, "expressivity": expressivity, + "normalize_volume": normalize_volume, "mip_opt_out": mip_opt_out, "tag": tag, **( @@ -137,6 +142,7 @@ async def connect( sample_rate: typing.Optional[SpeakV2SampleRate] = None, speed: typing.Optional[SpeakV2Speed] = None, expressivity: typing.Optional[SpeakV2Expressivity] = None, + normalize_volume: typing.Optional[SpeakV2NormalizeVolume] = None, mip_opt_out: typing.Optional[SpeakV2MipOptOut] = None, tag: typing.Optional[SpeakV2Tag] = None, authorization: typing.Optional[str] = None, @@ -159,6 +165,8 @@ async def connect( expressivity : typing.Optional[SpeakV2Expressivity] + normalize_volume : typing.Optional[SpeakV2NormalizeVolume] + mip_opt_out : typing.Optional[SpeakV2MipOptOut] tag : typing.Optional[SpeakV2Tag] @@ -185,6 +193,7 @@ async def connect( "sample_rate": sample_rate, "speed": speed, "expressivity": expressivity, + "normalize_volume": normalize_volume, "mip_opt_out": mip_opt_out, "tag": tag, **( diff --git a/src/deepgram/speak/v2/requests/speak_v2warning.py b/src/deepgram/speak/v2/requests/speak_v2warning.py index 6686af44..e16df4d6 100644 --- a/src/deepgram/speak/v2/requests/speak_v2warning.py +++ b/src/deepgram/speak/v2/requests/speak_v2warning.py @@ -14,13 +14,13 @@ class SpeakV2WarningParams(typing_extensions.TypedDict): 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). """ diff --git a/src/deepgram/speak/v2/socket_client.py b/src/deepgram/speak/v2/socket_client.py index 57c5f8ab..9e91bfff 100644 --- a/src/deepgram/speak/v2/socket_client.py +++ b/src/deepgram/speak/v2/socket_client.py @@ -3,7 +3,9 @@ import json import logging import typing +from json.decoder import JSONDecodeError +import websockets import websockets.sync.connection as websockets_sync_connection from ...core.events import EventEmitterMixin, EventType from ...core.unchecked_base_model import construct_type @@ -41,7 +43,6 @@ SpeakV2ConfigureFailure, SpeakV2Warning, SpeakV2Error, - typing.Dict[str, typing.Any], ] @@ -88,7 +89,7 @@ async def start_listening(self): ) continue await self._emit_async(EventType.MESSAGE, parsed) - except Exception as exc: + except (websockets.WebSocketException, JSONDecodeError) as exc: await self._emit_async(EventType.ERROR, exc) finally: await self._emit_async(EventType.CLOSE, None) @@ -100,19 +101,19 @@ async def send_speak(self, message: SpeakV2Speak) -> None: """ await self._send_model(message) - async def send_flush(self, message: typing.Optional[SpeakV2Flush] = None) -> None: + async def send_flush(self, message: SpeakV2Flush) -> 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")) + await self._send_model(message) - async def send_interrupt(self, message: typing.Optional[SpeakV2Interrupt] = None) -> None: + async def send_interrupt(self, message: SpeakV2Interrupt) -> 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")) + await self._send_model(message) async def send_configure(self, message: SpeakV2Configure) -> None: """ @@ -121,12 +122,12 @@ async def send_configure(self, message: SpeakV2Configure) -> None: """ await self._send_model(message) - async def send_close(self, message: typing.Optional[SpeakV2Close] = None) -> None: + async def send_close(self, message: SpeakV2Close) -> 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")) + await self._send_model(message) async def recv(self) -> V2SocketClientResponse: """ @@ -200,7 +201,7 @@ def start_listening(self): ) continue self._emit(EventType.MESSAGE, parsed) - except Exception as exc: + except (websockets.WebSocketException, JSONDecodeError) as exc: self._emit(EventType.ERROR, exc) finally: self._emit(EventType.CLOSE, None) @@ -212,19 +213,19 @@ def send_speak(self, message: SpeakV2Speak) -> None: """ self._send_model(message) - def send_flush(self, message: typing.Optional[SpeakV2Flush] = None) -> None: + def send_flush(self, message: SpeakV2Flush) -> None: """ Send a message to the websocket connection. The message will be sent as a SpeakV2Flush. """ - self._send_model(message or SpeakV2Flush(type="Flush")) + self._send_model(message) - def send_interrupt(self, message: typing.Optional[SpeakV2Interrupt] = None) -> None: + def send_interrupt(self, message: SpeakV2Interrupt) -> None: """ Send a message to the websocket connection. The message will be sent as a SpeakV2Interrupt. """ - self._send_model(message or SpeakV2Interrupt(type="Interrupt")) + self._send_model(message) def send_configure(self, message: SpeakV2Configure) -> None: """ @@ -233,12 +234,12 @@ def send_configure(self, message: SpeakV2Configure) -> None: """ self._send_model(message) - def send_close(self, message: typing.Optional[SpeakV2Close] = None) -> None: + def send_close(self, message: SpeakV2Close) -> None: """ Send a message to the websocket connection. The message will be sent as a SpeakV2Close. """ - self._send_model(message or SpeakV2Close(type="Close")) + self._send_model(message) def recv(self) -> V2SocketClientResponse: """ diff --git a/src/deepgram/speak/v2/types/speak_v2warning.py b/src/deepgram/speak/v2/types/speak_v2warning.py index ac771641..e142f323 100644 --- a/src/deepgram/speak/v2/types/speak_v2warning.py +++ b/src/deepgram/speak/v2/types/speak_v2warning.py @@ -16,13 +16,13 @@ class SpeakV2Warning(UncheckedBaseModel): 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). """ diff --git a/src/deepgram/types/__init__.py b/src/deepgram/types/__init__.py index d3c52c67..45da478e 100644 --- a/src/deepgram/types/__init__.py +++ b/src/deepgram/types/__init__.py @@ -148,6 +148,7 @@ 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 @@ -200,6 +201,7 @@ 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 @@ -211,6 +213,7 @@ 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 .open_ai_speak_provider import OpenAiSpeakProvider @@ -264,6 +267,7 @@ 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 @@ -423,6 +427,7 @@ "ListenV1ProfanityFilter": ".listen_v1profanity_filter", "ListenV1Punctuate": ".listen_v1punctuate", "ListenV1Redact": ".listen_v1redact", + "ListenV1RedactUsage": ".listen_v1redact_usage", "ListenV1Replace": ".listen_v1replace", "ListenV1RequestFile": ".listen_v1request_file", "ListenV1Response": ".listen_v1response", @@ -457,6 +462,7 @@ "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", @@ -468,6 +474,7 @@ "ListenV2Numerals": ".listen_v2numerals", "ListenV2ProfanityFilter": ".listen_v2profanity_filter", "ListenV2Redact": ".listen_v2redact", + "ListenV2RedactUsage": ".listen_v2redact_usage", "ListenV2SampleRate": ".listen_v2sample_rate", "ListenV2Tag": ".listen_v2tag", "OpenAiSpeakProvider": ".open_ai_speak_provider", @@ -519,6 +526,7 @@ "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", @@ -549,28 +557,6 @@ "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) @@ -722,6 +708,7 @@ def __dir__(): "ListenV1ProfanityFilter", "ListenV1Punctuate", "ListenV1Redact", + "ListenV1RedactUsage", "ListenV1Replace", "ListenV1RequestFile", "ListenV1Response", @@ -756,6 +743,7 @@ def __dir__(): "ListenV1VadEvents", "ListenV1Version", "ListenV2ConfigureNumerals", + "ListenV2ConfigureRedactUsage", "ListenV2EagerEotThreshold", "ListenV2Encoding", "ListenV2EotThreshold", @@ -767,6 +755,7 @@ def __dir__(): "ListenV2Numerals", "ListenV2ProfanityFilter", "ListenV2Redact", + "ListenV2RedactUsage", "ListenV2SampleRate", "ListenV2Tag", "OpenAiSpeakProvider", @@ -818,6 +807,7 @@ def __dir__(): "SpeakV2Expressivity", "SpeakV2MipOptOut", "SpeakV2Model", + "SpeakV2NormalizeVolume", "SpeakV2Response", "SpeakV2SampleRate", "SpeakV2Speed", @@ -847,25 +837,3 @@ def __dir__(): "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 b/src/deepgram/types/deepgram.py index 994f7a2c..ec242762 100644 --- a/src/deepgram/types/deepgram.py +++ b/src/deepgram/types/deepgram.py @@ -29,7 +29,7 @@ class Deepgram(UncheckedBaseModel): 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) + expressivity: typing.Optional[int] = 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). """ diff --git a/src/deepgram/types/deepgram_listen_provider_v2.py b/src/deepgram/types/deepgram_listen_provider_v2.py index c974e7fa..f7a155fb 100644 --- a/src/deepgram/types/deepgram_listen_provider_v2.py +++ b/src/deepgram/types/deepgram_listen_provider_v2.py @@ -28,12 +28,6 @@ class DeepgramListenProviderV2(UncheckedBaseModel): 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. @@ -55,30 +49,9 @@ class DeepgramListenProviderV2(UncheckedBaseModel): """ 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 diff --git a/src/deepgram/types/deepgram_model.py b/src/deepgram/types/deepgram_model.py index 71402f99..b7e21f85 100644 --- a/src/deepgram/types/deepgram_model.py +++ b/src/deepgram/types/deepgram_model.py @@ -103,6 +103,236 @@ "flux-tanner-en", "flux-wade-en", "flux-wes-en", + "flux-anouk-nl", + "flux-bram-nl", + "flux-fleur-nl", + "flux-irene-nl", + "flux-luuk-nl", + "flux-monique-nl", + "flux-ruben-nl", + "flux-sanne-nl", + "flux-yvonne-nl", + "flux-dirk-nl", + "flux-lotte-nl", + "flux-niels-nl", + "flux-veerle-nl", + "flux-arnaud-fr", + "flux-benoit-fr", + "flux-brigitte-fr", + "flux-camille-fr", + "flux-chloe-fr", + "flux-florian-fr", + "flux-julien-fr", + "flux-mathieu-fr", + "flux-pierre-fr", + "flux-thierry-fr", + "flux-veronique-fr", + "flux-yasmine-fr", + "flux-benjamin-de", + "flux-christian-de", + "flux-janine-de", + "flux-magdalena-de", + "flux-moritz-de", + "flux-nadine-de", + "flux-rolf-de", + "flux-sonja-de", + "flux-sven-de", + "flux-tobias-de", + "flux-verena-de", + "flux-leonie-de", + "flux-yannick-de", + "flux-ajay-hi", + "flux-anjali-hi", + "flux-arjun-hi", + "flux-divya-hi", + "flux-jyoti-hi", + "flux-nikhil-hi", + "flux-pallavi-hi", + "flux-prachi-hi", + "flux-rahul-hi", + "flux-rajesh-hi", + "flux-ritu-hi", + "flux-shreya-hi", + "flux-sunita-hi", + "flux-vikram-hi", + "flux-angela-it", + "flux-chiara-it", + "flux-federico-it", + "flux-giorgio-it", + "flux-matteo-it", + "flux-paola-it", + "flux-rocco-it", + "flux-sofia-it", + "flux-stefano-it", + "flux-vincenzo-it", + "flux-vito-it", + "flux-ayumi-ja", + "flux-hayato-ja", + "flux-nozomi-ja", + "flux-sayaka-ja", + "flux-bianca-pt", + "flux-bruno-pt", + "flux-claudia-pt", + "flux-leandro-pt", + "flux-marcia-pt", + "flux-mariana-pt", + "flux-marta-pt", + "flux-mateus-pt", + "flux-miguel-pt", + "flux-renato-pt", + "flux-roberto-pt", + "flux-rodrigo-pt", + "flux-artur-pt", + "flux-benedita-pt", + "flux-catarina-pt", + "flux-hugo-pt", + "flux-pedro-pt", + "flux-ricardo-pt", + "flux-andrei-ru", + "flux-kirill-ru", + "flux-maxim-ru", + "flux-mikhail-ru", + "flux-natalia-ru", + "flux-nikolai-ru", + "flux-olga-ru", + "flux-polina-ru", + "flux-vladimir-ru", + "flux-aina-es", + "flux-alfredo-es", + "flux-carmen-es", + "flux-cecilia-es", + "flux-duvan-es", + "flux-eduardo-es", + "flux-ernesto-es", + "flux-fernanda-es", + "flux-fiorella-es", + "flux-gustavo-es", + "flux-jaime-es", + "flux-martin-es", + "flux-mauricio-es", + "flux-patricia-es", + "flux-pilar-es", + "flux-rafael-es", + "flux-tomas-es", + "flux-valentina-es", + "flux-ysabel-es", + "flux-afsana-bn", + "flux-ishrat-bn", + "flux-mamun-bn", + "flux-sabbir-bn", + "flux-shuvo-bn", + "flux-sumaiya-bn", + "flux-desislava-bg", + "flux-gergana-bg", + "flux-jordi-ca", + "flux-judit-ca", + "flux-bo-zh", + "flux-haoran-zh", + "flux-jian-zh", + "flux-jie-zh", + "flux-lijuan-zh", + "flux-shufen-zh", + "flux-wenbo-zh", + "flux-wenjing-zh", + "flux-zhen-zh", + "flux-chiaying-zh", + "flux-kuanyu-zh", + "flux-yawen-zh", + "flux-yuting-zh", + "flux-manlok-zh", + "flux-dalibor-hr", + "flux-danijela-hr", + "flux-domagoj-hr", + "flux-jasna-hr", + "flux-josipa-hr", + "flux-mihaela-hr", + "flux-vedran-hr", + "flux-jakub-cs", + "flux-pernille-da", + "flux-rasmus-da", + "flux-rikke-da", + "flux-triin-et", + "flux-kirsi-fi", + "flux-teemu-fi", + "flux-kostas-el", + "flux-bhavna-gu", + "flux-hetal-gu", + "flux-jignesh-gu", + "flux-bence-hu", + "flux-eszter-hu", + "flux-kinga-hu", + "flux-tibor-hu", + "flux-dewi-id", + "flux-fajar-id", + "flux-fitri-id", + "flux-rizky-id", + "flux-teguh-id", + "flux-manjunath-kn", + "flux-eunji-ko", + "flux-hyunwoo-ko", + "flux-mikyung-ko", + "flux-minjun-ko", + "flux-soojin-ko", + "flux-sungmin-ko", + "flux-agnese-lv", + "flux-edgars-lv", + "flux-goda-lt", + "flux-neringa-lt", + "flux-haziq-ms", + "flux-izzah-ms", + "flux-pooja-mr", + "flux-pratik-mr", + "flux-sneha-mr", + "flux-erlend-no", + "flux-espen-no", + "flux-ida-no", + "flux-signe-no", + "flux-silje-no", + "flux-vegard-no", + "flux-bartosz-pl", + "flux-ewa-pl", + "flux-justyna-pl", + "flux-kacper-pl", + "flux-konrad-pl", + "flux-zuzanna-pl", + "flux-cosmin-ro", + "flux-ioana-ro", + "flux-dominika-sk", + "flux-juraj-sk", + "flux-gregor-sl", + "flux-katja-sl", + "flux-axel-sv", + "flux-charlotta-sv", + "flux-frida-sv", + "flux-ludvig-sv", + "flux-oskar-sv", + "flux-pontus-sv", + "flux-wilma-sv", + "flux-jerome-tl", + "flux-jomar-tl", + "flux-liezel-tl", + "flux-noel-tl", + "flux-trisha-tl", + "flux-gokul-ta", + "flux-kavya-ta", + "flux-sowmya-ta", + "flux-vinoth-ta", + "flux-pavan-te", + "flux-ravi-te", + "flux-sravani-te", + "flux-dilek-tr", + "flux-ecem-tr", + "flux-emre-tr", + "flux-gizem-tr", + "flux-mehmet-tr", + "flux-serkan-tr", + "flux-zeynep-tr", + "flux-denys-uk", + "flux-solomiya-uk", + "flux-ambreen-ur", + "flux-usman-ur", + "flux-hoa-vi", + "flux-minh-vi", ], typing.Any, ] diff --git a/src/deepgram/types/listen_v1redact_usage.py b/src/deepgram/types/listen_v1redact_usage.py new file mode 100644 index 00000000..eeb62265 --- /dev/null +++ b/src/deepgram/types/listen_v1redact_usage.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ListenV1RedactUsage = typing.Union[typing.Literal["true", "false"], typing.Any] diff --git a/src/deepgram/types/listen_v2configure_redact_usage.py b/src/deepgram/types/listen_v2configure_redact_usage.py new file mode 100644 index 00000000..e54d8bcc --- /dev/null +++ b/src/deepgram/types/listen_v2configure_redact_usage.py @@ -0,0 +1,6 @@ +# This file was auto-generated by Fern from our API Definition. + +ListenV2ConfigureRedactUsage = bool +""" +Set to `true` to redact keyterms sent in this and later Configure messages from this connection's usage records. Does not redact keyterms in the connection URL; set the `redact_usage` query parameter for that. Once on, it stays on for the rest of the connection; `false` has no effect. +""" diff --git a/src/deepgram/types/listen_v2redact_usage.py b/src/deepgram/types/listen_v2redact_usage.py new file mode 100644 index 00000000..001eee4d --- /dev/null +++ b/src/deepgram/types/listen_v2redact_usage.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ListenV2RedactUsage = typing.Union[typing.Literal["true", "false"], typing.Any] diff --git a/src/deepgram/types/shared_intents.py b/src/deepgram/types/shared_intents.py index 619a4eba..f03d4225 100644 --- a/src/deepgram/types/shared_intents.py +++ b/src/deepgram/types/shared_intents.py @@ -5,8 +5,6 @@ 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 @@ -17,44 +15,10 @@ class SharedIntents(UncheckedBaseModel): 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 diff --git a/src/deepgram/types/shared_topics.py b/src/deepgram/types/shared_topics.py index b2b00fa4..0f6a4a76 100644 --- a/src/deepgram/types/shared_topics.py +++ b/src/deepgram/types/shared_topics.py @@ -5,8 +5,6 @@ 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 @@ -17,44 +15,10 @@ class SharedTopics(UncheckedBaseModel): 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 diff --git a/src/deepgram/types/speak_settings_v1provider.py b/src/deepgram/types/speak_settings_v1provider.py index 3fbef168..305cdba8 100644 --- a/src/deepgram/types/speak_settings_v1provider.py +++ b/src/deepgram/types/speak_settings_v1provider.py @@ -24,7 +24,7 @@ class SpeakSettingsV1Provider_Deepgram(UncheckedBaseModel): version: typing.Optional[str] = None model: DeepgramModel speed: typing.Optional[float] = None - expressivity: typing.Optional[pydantic.StrictInt] = None + expressivity: typing.Optional[int] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/src/deepgram/types/speak_v2normalize_volume.py b/src/deepgram/types/speak_v2normalize_volume.py new file mode 100644 index 00000000..e24085b0 --- /dev/null +++ b/src/deepgram/types/speak_v2normalize_volume.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SpeakV2NormalizeVolume = typing.Union[typing.Literal["true", "false"], typing.Any] diff --git a/tests/wire/test_listen_v1_media.py b/tests/wire/test_listen_v1_media.py index 44dd3752..e4264985 100644 --- a/tests/wire/test_listen_v1_media.py +++ b/tests/wire/test_listen_v1_media.py @@ -9,95 +9,3 @@ def test_listen_v1_media_transcribe_url() -> None: 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", - 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", - "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 b/tests/wire/test_manage_v1_projects_keys.py index 4b7a8100..7976bf7d 100644 --- a/tests/wire/test_manage_v1_projects_keys.py +++ b/tests/wire/test_manage_v1_projects_keys.py @@ -1,7 +1,5 @@ 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""" @@ -25,14 +23,6 @@ def test_manage_v1_projects_keys_create() -> None: verify_request_count(test_id, "POST", "/v1/projects/project_id/keys", None, 1) -def test_manage_v1_projects_keys_create_with_old_request_alias() -> None: - test_id = "manage.v1.projects.keys.create.compat" - client = get_client(test_id) - request: CreateKeyV1RequestOneParams = {"key": "value"} - client.manage.v1.projects.keys.create(project_id="project_id", request=request) - verify_request_count(test_id, "POST", "/v1/projects/project_id/keys", None, 1) - - def test_manage_v1_projects_keys_get() -> None: """Test get endpoint with WireMock""" test_id = "manage.v1.projects.keys.get.0" diff --git a/tests/wire/test_manage_v1_projects_requests.py b/tests/wire/test_manage_v1_projects_requests.py index daccaba9..71a888c7 100644 --- a/tests/wire/test_manage_v1_projects_requests.py +++ b/tests/wire/test_manage_v1_projects_requests.py @@ -1,5 +1,3 @@ -import datetime - from .conftest import get_client, verify_request_count @@ -13,42 +11,6 @@ def test_manage_v1_projects_requests_list_() -> None: 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" From 29671f75493afbaab2ae37cdc88b1de62dbb7908 Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Thu, 12 Nov 2026 13:26:55 +0000 Subject: [PATCH 4/9] chore: re-apply manual patches after regen --- .fernignore | 110 +- .gitignore | 3 + .gitignore.bak | 8 - src/deepgram/__init__.py | 64 + src/deepgram/__init__.py.bak | 1408 ----------------- src/deepgram/agent/__init__.py | 68 + src/deepgram/agent/__init__.py.bak | 528 ------- src/deepgram/agent/v1/__init__.py | 68 + src/deepgram/agent/v1/__init__.py.bak | 530 ------- src/deepgram/agent/v1/requests/__init__.py | 38 + .../agent/v1/requests/__init__.py.bak | 279 ---- .../v1/requests/agent_v1conversation_text.py | 2 +- .../requests/agent_v1conversation_text.py.bak | 39 - .../agent_v1inject_dynamic_agent_message.py | 2 +- ...gent_v1inject_dynamic_agent_message.py.bak | 27 - .../agent/v1/requests/agent_v1settings.py | 3 +- .../agent/v1/requests/agent_v1settings.py.bak | 31 - .../v1/requests/agent_v1settings_agent.py | 17 +- .../v1/requests/agent_v1settings_agent.py.bak | 18 - .../agent_v1settings_agent_context.py | 4 + .../agent_v1settings_agent_context.py.bak | 37 - src/deepgram/agent/v1/socket_client.py | 47 +- src/deepgram/agent/v1/socket_client.py.bak | 446 ------ src/deepgram/agent/v1/types/__init__.py | 42 + src/deepgram/agent/v1/types/__init__.py.bak | 305 ---- .../v1/types/agent_v1conversation_text.py | 4 +- .../v1/types/agent_v1conversation_text.py.bak | 50 - .../agent_v1inject_dynamic_agent_message.py | 2 +- ...gent_v1inject_dynamic_agent_message.py.bak | 38 - .../agent/v1/types/agent_v1settings.py | 3 +- .../agent/v1/types/agent_v1settings.py.bak | 42 - .../agent/v1/types/agent_v1settings_agent.py | 53 +- .../v1/types/agent_v1settings_agent.py.bak | 56 - .../types/agent_v1settings_agent_context.py | 21 + .../agent_v1settings_agent_context.py.bak | 66 - ...1settings_agent_context_listen_provider.py | 23 + ...tings_agent_context_listen_provider.py.bak | 76 - .../agent_v1settings_agent_listen_provider.py | 23 + ...nt_v1settings_agent_listen_provider.py.bak | 76 - .../v1/types/agent_v1update_listen_listen.py | 36 + .../types/agent_v1update_listen_listen.py.bak | 60 - src/deepgram/core/api_error.py | 4 +- src/deepgram/core/api_error.py.bak | 25 - src/deepgram/core/client_wrapper.py | 2 +- src/deepgram/core/client_wrapper.py.bak | 146 -- src/deepgram/core/parse_error.py | 4 +- src/deepgram/core/parse_error.py.bak | 38 - src/deepgram/core/query_encoder.py | 15 +- src/deepgram/core/query_encoder.py.bak | 65 - src/deepgram/listen/__init__.py | 4 + src/deepgram/listen/__init__.py.bak | 246 --- .../v1/requests/listen_v1configure_failure.py | 2 +- .../listen_v1configure_failure.py.bak | 34 - src/deepgram/listen/v1/socket_client.py | 32 +- src/deepgram/listen/v1/socket_client.py.bak | 262 --- .../v1/types/listen_v1configure_failure.py | 2 +- .../types/listen_v1configure_failure.py.bak | 45 - src/deepgram/listen/v2/__init__.py | 4 + src/deepgram/listen/v2/__init__.py.bak | 118 -- src/deepgram/listen/v2/socket_client.py | 38 +- src/deepgram/listen/v2/socket_client.py.bak | 251 --- src/deepgram/listen/v2/types/__init__.py | 4 + src/deepgram/listen/v2/types/__init__.py.bak | 78 - .../v2/types/listen_v2configure_failure.py | 4 +- .../types/listen_v2configure_failure.py.bak | 45 - .../v2/types/listen_v2configure_success.py | 4 +- .../types/listen_v2configure_success.py.bak | 55 - .../listen_v2configure_success_thresholds.py | 4 +- ...sten_v2configure_success_thresholds.py.bak | 30 - .../listen/v2/types/listen_v2connected.py | 4 +- .../listen/v2/types/listen_v2connected.py.bak | 35 - .../listen/v2/types/listen_v2fatal_error.py | 4 +- .../v2/types/listen_v2fatal_error.py.bak | 40 - .../listen/v2/types/listen_v2turn_info.py | 4 +- .../listen/v2/types/listen_v2turn_info.py.bak | 102 -- .../v2/types/listen_v2turn_info_words_item.py | 4 +- .../listen_v2turn_info_words_item.py.bak | 38 - .../listen/v2/types/listen_v2warning.py | 4 +- .../listen/v2/types/listen_v2warning.py.bak | 45 - src/deepgram/requests/__init__.py | 32 + src/deepgram/requests/__init__.py.bak | 618 -------- src/deepgram/requests/shared_intents.py | 2 + src/deepgram/requests/shared_intents.py.bak | 16 - src/deepgram/requests/shared_topics.py | 2 + src/deepgram/requests/shared_topics.py.bak | 16 - src/deepgram/speak/v1/socket_client.py | 34 +- src/deepgram/speak/v1/socket_client.py.bak | 237 --- .../speak/v2/requests/speak_v2warning.py | 8 +- .../speak/v2/requests/speak_v2warning.py.bak | 30 - src/deepgram/speak/v2/socket_client.py | 31 +- src/deepgram/speak/v2/socket_client.py.bak | 269 ---- .../speak/v2/types/speak_v2warning.py | 8 +- .../speak/v2/types/speak_v2warning.py.bak | 41 - src/deepgram/types/__init__.py | 44 + src/deepgram/types/__init__.py.bak | 871 ---------- src/deepgram/types/deepgram.py | 2 +- src/deepgram/types/deepgram.py.bak | 44 - .../types/deepgram_listen_provider_v2.py | 28 + .../types/deepgram_listen_provider_v2.py.bak | 85 - src/deepgram/types/shared_intents.py | 37 + src/deepgram/types/shared_intents.py.bak | 61 - src/deepgram/types/shared_topics.py | 37 + src/deepgram/types/shared_topics.py.bak | 61 - .../types/speak_settings_v1provider.py | 2 +- .../types/speak_settings_v1provider.py.bak | 117 -- tests/wire/test_listen_v1_media.py | 92 ++ tests/wire/test_listen_v1_media.py.bak | 103 -- tests/wire/test_manage_v1_projects_keys.py | 10 + .../wire/test_manage_v1_projects_keys.py.bak | 59 - .../wire/test_manage_v1_projects_requests.py | 38 + .../test_manage_v1_projects_requests.py.bak | 66 - 111 files changed, 1003 insertions(+), 8692 deletions(-) delete mode 100644 .gitignore.bak delete mode 100644 src/deepgram/__init__.py.bak delete mode 100644 src/deepgram/agent/__init__.py.bak delete mode 100644 src/deepgram/agent/v1/__init__.py.bak delete mode 100644 src/deepgram/agent/v1/requests/__init__.py.bak delete mode 100644 src/deepgram/agent/v1/requests/agent_v1conversation_text.py.bak delete mode 100644 src/deepgram/agent/v1/requests/agent_v1inject_dynamic_agent_message.py.bak delete mode 100644 src/deepgram/agent/v1/requests/agent_v1settings.py.bak delete mode 100644 src/deepgram/agent/v1/requests/agent_v1settings_agent.py.bak delete mode 100644 src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py.bak delete mode 100644 src/deepgram/agent/v1/socket_client.py.bak delete mode 100644 src/deepgram/agent/v1/types/__init__.py.bak delete mode 100644 src/deepgram/agent/v1/types/agent_v1conversation_text.py.bak delete mode 100644 src/deepgram/agent/v1/types/agent_v1inject_dynamic_agent_message.py.bak delete mode 100644 src/deepgram/agent/v1/types/agent_v1settings.py.bak delete mode 100644 src/deepgram/agent/v1/types/agent_v1settings_agent.py.bak delete mode 100644 src/deepgram/agent/v1/types/agent_v1settings_agent_context.py.bak delete mode 100644 src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py.bak delete mode 100644 src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py.bak delete mode 100644 src/deepgram/agent/v1/types/agent_v1update_listen_listen.py.bak delete mode 100644 src/deepgram/core/api_error.py.bak delete mode 100644 src/deepgram/core/client_wrapper.py.bak delete mode 100644 src/deepgram/core/parse_error.py.bak delete mode 100644 src/deepgram/core/query_encoder.py.bak delete mode 100644 src/deepgram/listen/__init__.py.bak delete mode 100644 src/deepgram/listen/v1/requests/listen_v1configure_failure.py.bak delete mode 100644 src/deepgram/listen/v1/socket_client.py.bak delete mode 100644 src/deepgram/listen/v1/types/listen_v1configure_failure.py.bak delete mode 100644 src/deepgram/listen/v2/__init__.py.bak delete mode 100644 src/deepgram/listen/v2/socket_client.py.bak delete mode 100644 src/deepgram/listen/v2/types/__init__.py.bak delete mode 100644 src/deepgram/listen/v2/types/listen_v2configure_failure.py.bak delete mode 100644 src/deepgram/listen/v2/types/listen_v2configure_success.py.bak delete mode 100644 src/deepgram/listen/v2/types/listen_v2configure_success_thresholds.py.bak delete mode 100644 src/deepgram/listen/v2/types/listen_v2connected.py.bak delete mode 100644 src/deepgram/listen/v2/types/listen_v2fatal_error.py.bak delete mode 100644 src/deepgram/listen/v2/types/listen_v2turn_info.py.bak delete mode 100644 src/deepgram/listen/v2/types/listen_v2turn_info_words_item.py.bak delete mode 100644 src/deepgram/listen/v2/types/listen_v2warning.py.bak delete mode 100644 src/deepgram/requests/__init__.py.bak delete mode 100644 src/deepgram/requests/shared_intents.py.bak delete mode 100644 src/deepgram/requests/shared_topics.py.bak delete mode 100644 src/deepgram/speak/v1/socket_client.py.bak delete mode 100644 src/deepgram/speak/v2/requests/speak_v2warning.py.bak delete mode 100644 src/deepgram/speak/v2/socket_client.py.bak delete mode 100644 src/deepgram/speak/v2/types/speak_v2warning.py.bak delete mode 100644 src/deepgram/types/__init__.py.bak delete mode 100644 src/deepgram/types/deepgram.py.bak delete mode 100644 src/deepgram/types/deepgram_listen_provider_v2.py.bak delete mode 100644 src/deepgram/types/shared_intents.py.bak delete mode 100644 src/deepgram/types/shared_topics.py.bak delete mode 100644 src/deepgram/types/speak_settings_v1provider.py.bak delete mode 100644 tests/wire/test_listen_v1_media.py.bak delete mode 100644 tests/wire/test_manage_v1_projects_keys.py.bak delete mode 100644 tests/wire/test_manage_v1_projects_requests.py.bak diff --git a/.fernignore b/.fernignore index 1f8bc9fc..caea8da9 100644 --- a/.fernignore +++ b/.fernignore @@ -44,18 +44,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.bak -src/deepgram/types/shared_intents.py.bak -src/deepgram/requests/shared_topics.py.bak -src/deepgram/requests/shared_intents.py.bak +src/deepgram/types/shared_topics.py +src/deepgram/types/shared_intents.py +src/deepgram/requests/shared_topics.py +src/deepgram/requests/shared_intents.py # 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.bak -src/deepgram/agent/v1/requests/agent_v1conversation_text.py.bak +src/deepgram/agent/v1/types/agent_v1conversation_text.py +src/deepgram/agent/v1/requests/agent_v1conversation_text.py # WebSocket socket clients: # - except Exception broad catch (supports custom transports, generator narrows to WebSocketException) @@ -70,17 +70,17 @@ src/deepgram/agent/v1/requests/agent_v1conversation_text.py.bak # - 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.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 +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 # 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.bak -src/deepgram/types/deepgram.py.bak +src/deepgram/types/speak_settings_v1provider.py +src/deepgram/types/deepgram.py # Backward-compat patch: AgentV1SettingsAgentContext schema restructure as of # 2026-05-05. The new schema nests messages under .context.messages; this file @@ -88,12 +88,12 @@ src/deepgram/types/deepgram.py.bak # 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.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 +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 # 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. @@ -168,9 +168,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.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 +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 # Backward-compat patch for the 2026-07-31 AgentV1UpdateListen provider retype. The # generated `provider` field is now the required discriminated union @@ -179,7 +179,7 @@ src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py.ba # 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.bak +src/deepgram/agent/v1/types/agent_v1update_listen_listen.py # Hand-written compat shim recreating ListenV2CloseStreamType, which Fern removed in the # 2026-06-15 regen (docs #946). The original generated type wrongly allowed @@ -192,17 +192,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.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 +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 # listen __init__.py files re-export the ListenV2CloseStreamType shim above. -src/deepgram/listen/__init__.py.bak -src/deepgram/listen/v2/__init__.py.bak -src/deepgram/listen/v2/types/__init__.py.bak +src/deepgram/listen/__init__.py +src/deepgram/listen/v2/__init__.py +src/deepgram/listen/v2/types/__init__.py # Coerces Python bools to lowercase "true"/"false" before urlencode, which # otherwise stringifies via str() and produces "True"/"False" — rejected by @@ -219,40 +219,40 @@ src/deepgram/listen/v2/types/__init__.py.bak # 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.bak -src/deepgram/core/parse_error.py.bak +src/deepgram/core/api_error.py +src/deepgram/core/parse_error.py # Pydantic 2.14+ adapter annotations are now generated natively. -src/deepgram/core/query_encoder.py.bak +src/deepgram/core/query_encoder.py # 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.bak +src/deepgram/core/client_wrapper.py # Generated docstrings have a local whitespace cleanup. # [temporarily frozen — remove when Fern emits whitespace-clean docstrings] -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 +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 # 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.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 +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 # Hand-written custom tests tests/custom/test_agent_custom_think_provider.py @@ -295,14 +295,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.bak +tests/wire/test_manage_v1_projects_keys.py # 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.bak +tests/wire/test_manage_v1_projects_requests.py # 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 @@ -311,7 +311,7 @@ tests/wire/test_manage_v1_projects_requests.py.bak # 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.bak +tests/wire/test_listen_v1_media.py # Manual standalone tests tests/manual @@ -361,7 +361,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.bak +.gitignore # Folders to ignore .github diff --git a/.gitignore b/.gitignore index d2e4ca80..765eb109 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ __pycache__/ dist/ poetry.toml +.coverage +htmlcov/ +coverage.xml diff --git a/.gitignore.bak b/.gitignore.bak deleted file mode 100644 index 765eb109..00000000 --- a/.gitignore.bak +++ /dev/null @@ -1,8 +0,0 @@ -.mypy_cache/ -.ruff_cache/ -__pycache__/ -dist/ -poetry.toml -.coverage -htmlcov/ -coverage.xml diff --git a/src/deepgram/__init__.py b/src/deepgram/__init__.py index ab7daf3c..9fade4cd 100644 --- a/src/deepgram/__init__.py +++ b/src/deepgram/__init__.py @@ -888,6 +888,38 @@ "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) @@ -1354,3 +1386,35 @@ def __dir__(): "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/__init__.py.bak b/src/deepgram/__init__.py.bak deleted file mode 100644 index 86e0445a..00000000 --- a/src/deepgram/__init__.py.bak +++ /dev/null @@ -1,1408 +0,0 @@ -# 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, - 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, - ListenV2EagerEotThreshold, - ListenV2Encoding, - ListenV2EotThreshold, - ListenV2EotTimeoutMs, - ListenV2Keyterm, - ListenV2LanguageHint, - ListenV2MipOptOut, - ListenV2Model, - ListenV2Numerals, - ListenV2ProfanityFilter, - ListenV2Redact, - ListenV2SampleRate, - ListenV2Tag, - 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, - SpeakV2Response, - SpeakV2SampleRate, - SpeakV2Speed, - SpeakV2SpeedValue, - SpeakV2Tag, - ThinkLiveSettingsV1, - ThinkSettingsV1, - ThinkSettingsV1ContextLength, - ThinkSettingsV1Endpoint, - ThinkSettingsV1FunctionsItem, - ThinkSettingsV1FunctionsItemEndpoint, - ThinkSettingsV1Provider, - ThinkSettingsV1Provider_Anthropic, - ThinkSettingsV1Provider_AwsBedrock, - ThinkSettingsV1Provider_Deepgram, - ThinkSettingsV1Provider_Google, - ThinkSettingsV1Provider_Groq, - 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, - 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_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", - "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", - "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", - "ListenV2SampleRate": ".types", - "ListenV2Tag": ".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", - "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_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", - "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", - "ListenV2EagerEotThreshold", - "ListenV2Encoding", - "ListenV2EotThreshold", - "ListenV2EotTimeoutMs", - "ListenV2Keyterm", - "ListenV2KeytermParams", - "ListenV2LanguageHint", - "ListenV2LanguageHintParams", - "ListenV2MipOptOut", - "ListenV2Model", - "ListenV2Numerals", - "ListenV2ProfanityFilter", - "ListenV2Redact", - "ListenV2SampleRate", - "ListenV2Tag", - "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", - "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_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 b/src/deepgram/agent/__init__.py index a9248312..23f670de 100644 --- a/src/deepgram/agent/__init__.py +++ b/src/deepgram/agent/__init__.py @@ -293,6 +293,40 @@ "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) @@ -458,3 +492,37 @@ def __dir__(): "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/__init__.py.bak b/src/deepgram/agent/__init__.py.bak deleted file mode 100644 index 23f670de..00000000 --- a/src/deepgram/agent/__init__.py.bak +++ /dev/null @@ -1,528 +0,0 @@ -# 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 b/src/deepgram/agent/v1/__init__.py index f58a4a70..205d398c 100644 --- a/src/deepgram/agent/v1/__init__.py +++ b/src/deepgram/agent/v1/__init__.py @@ -295,6 +295,40 @@ "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) @@ -460,3 +494,37 @@ def __dir__(): "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/__init__.py.bak b/src/deepgram/agent/v1/__init__.py.bak deleted file mode 100644 index 205d398c..00000000 --- a/src/deepgram/agent/v1/__init__.py.bak +++ /dev/null @@ -1,530 +0,0 @@ -# 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 b/src/deepgram/agent/v1/requests/__init__.py index f57784b8..766d9807 100644 --- a/src/deepgram/agent/v1/requests/__init__.py +++ b/src/deepgram/agent/v1/requests/__init__.py @@ -20,6 +20,8 @@ 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 @@ -149,6 +151,24 @@ "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) @@ -239,3 +259,21 @@ def __dir__(): "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/__init__.py.bak b/src/deepgram/agent/v1/requests/__init__.py.bak deleted file mode 100644 index 766d9807..00000000 --- a/src/deepgram/agent/v1/requests/__init__.py.bak +++ /dev/null @@ -1,279 +0,0 @@ -# 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 b/src/deepgram/agent/v1/requests/agent_v1conversation_text.py index ee6f97cf..059f094a 100644 --- a/src/deepgram/agent/v1/requests/agent_v1conversation_text.py +++ b/src/deepgram/agent/v1/requests/agent_v1conversation_text.py @@ -23,7 +23,7 @@ class AgentV1ConversationTextParams(typing_extensions.TypedDict): The actual statement that was spoken """ - conversational_behavior: AgentV1ConversationTextConversationalBehavior + 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 """ diff --git a/src/deepgram/agent/v1/requests/agent_v1conversation_text.py.bak b/src/deepgram/agent/v1/requests/agent_v1conversation_text.py.bak deleted file mode 100644 index 059f094a..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1conversation_text.py.bak +++ /dev/null @@ -1,39 +0,0 @@ -# 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 b/src/deepgram/agent/v1/requests/agent_v1inject_dynamic_agent_message.py index c6d114de..1d912428 100644 --- a/src/deepgram/agent/v1/requests/agent_v1inject_dynamic_agent_message.py +++ b/src/deepgram/agent/v1/requests/agent_v1inject_dynamic_agent_message.py @@ -20,7 +20,7 @@ class AgentV1InjectDynamicAgentMessageParams(typing_extensions.TypedDict): 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_v1inject_dynamic_agent_message.py.bak b/src/deepgram/agent/v1/requests/agent_v1inject_dynamic_agent_message.py.bak deleted file mode 100644 index 1d912428..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1inject_dynamic_agent_message.py.bak +++ /dev/null @@ -1,27 +0,0 @@ -# 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 b/src/deepgram/agent/v1/requests/agent_v1settings.py index 2f748dcd..5ada0975 100644 --- a/src/deepgram/agent/v1/requests/agent_v1settings.py +++ b/src/deepgram/agent/v1/requests/agent_v1settings.py @@ -4,6 +4,7 @@ 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 @@ -27,4 +28,4 @@ class AgentV1SettingsParams(typing_extensions.TypedDict): """ audio: AgentV1SettingsAudioParams - agent: AgentV1SettingsAgentParams + agent: typing.Union[AgentV1SettingsAgentParams, AgentV1SettingsAgentContextParams, str] diff --git a/src/deepgram/agent/v1/requests/agent_v1settings.py.bak b/src/deepgram/agent/v1/requests/agent_v1settings.py.bak deleted file mode 100644 index 5ada0975..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings.py.bak +++ /dev/null @@ -1,31 +0,0 @@ -# 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 b/src/deepgram/agent/v1/requests/agent_v1settings_agent.py index 0da4b0f3..4a2bcf8c 100644 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent.py +++ b/src/deepgram/agent/v1/requests/agent_v1settings_agent.py @@ -1,7 +1,18 @@ # 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 import AgentV1SettingsAgentContextParams +from .agent_v1settings_agent_listen import AgentV1SettingsAgentListenParams +from .agent_v1settings_agent_speak import AgentV1SettingsAgentSpeakParams +from .agent_v1settings_agent_think import AgentV1SettingsAgentThinkParams + -AgentV1SettingsAgentParams = typing.Union[AgentV1SettingsAgentContextParams, str] +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.py.bak b/src/deepgram/agent/v1/requests/agent_v1settings_agent.py.bak deleted file mode 100644 index 4a2bcf8c..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent.py.bak +++ /dev/null @@ -1,18 +0,0 @@ -# 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 b/src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py index 3dbb6e72..19503b6f 100644 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py +++ b/src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py @@ -1,9 +1,12 @@ # 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 @@ -14,6 +17,7 @@ class AgentV1SettingsAgentContextParams(typing_extensions.TypedDict): 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 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 deleted file mode 100644 index 19503b6f..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py.bak +++ /dev/null @@ -1,37 +0,0 @@ -# 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 b/src/deepgram/agent/v1/socket_client.py index 35ebd833..44ffcaed 100644 --- a/src/deepgram/agent/v1/socket_client.py +++ b/src/deepgram/agent/v1/socket_client.py @@ -3,9 +3,7 @@ import json import logging import typing -from json.decoder import JSONDecodeError -import websockets import websockets.sync.connection as websockets_sync_connection from ...core.events import EventEmitterMixin, EventType from ...core.unchecked_base_model import construct_type @@ -50,6 +48,18 @@ 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, @@ -75,6 +85,7 @@ AgentV1Warning, AgentV1History, bytes, + typing.Dict[str, typing.Any], ] @@ -121,7 +132,7 @@ async def start_listening(self): ) continue await self._emit_async(EventType.MESSAGE, parsed) - except (websockets.WebSocketException, JSONDecodeError) as exc: + except Exception as exc: await self._emit_async(EventType.ERROR, exc) finally: await self._emit_async(EventType.CLOSE, None) @@ -189,12 +200,12 @@ async def send_function_call_response(self, message: AgentV1SendFunctionCallResp """ await self._send_model(message) - async def send_keep_alive(self, message: AgentV1KeepAlive) -> None: + 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) + await self._send_model(message or AgentV1KeepAlive(type="KeepAlive")) async def send_update_prompt(self, message: AgentV1UpdatePrompt) -> None: """ @@ -203,12 +214,12 @@ async def send_update_prompt(self, message: AgentV1UpdatePrompt) -> None: """ await self._send_model(message) - async def send_force_end_turn(self, message: AgentV1ForceEndTurn) -> None: + 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) + await self._send_model(message or AgentV1ForceEndTurn(type="ForceEndTurn")) async def send_custom_to_think_provider(self, message: AgentV1CustomToThinkProvider) -> None: """ @@ -217,6 +228,10 @@ async def send_custom_to_think_provider(self, message: AgentV1CustomToThinkProvi """ 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. @@ -250,7 +265,7 @@ async def _send_model(self, data: typing.Any) -> None: """ Send a Pydantic model to the websocket connection. """ - await self._send(data.dict()) + await self._send(_sanitize_numeric_types(data.dict())) class V1SocketClient(EventEmitterMixin): @@ -296,7 +311,7 @@ def start_listening(self): ) continue self._emit(EventType.MESSAGE, parsed) - except (websockets.WebSocketException, JSONDecodeError) as exc: + except Exception as exc: self._emit(EventType.ERROR, exc) finally: self._emit(EventType.CLOSE, None) @@ -364,12 +379,12 @@ def send_function_call_response(self, message: AgentV1SendFunctionCallResponse) """ self._send_model(message) - def send_keep_alive(self, message: AgentV1KeepAlive) -> None: + 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) + self._send_model(message or AgentV1KeepAlive(type="KeepAlive")) def send_update_prompt(self, message: AgentV1UpdatePrompt) -> None: """ @@ -378,12 +393,12 @@ def send_update_prompt(self, message: AgentV1UpdatePrompt) -> None: """ self._send_model(message) - def send_force_end_turn(self, message: AgentV1ForceEndTurn) -> None: + 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) + self._send_model(message or AgentV1ForceEndTurn(type="ForceEndTurn")) def send_custom_to_think_provider(self, message: AgentV1CustomToThinkProvider) -> None: """ @@ -392,6 +407,10 @@ def send_custom_to_think_provider(self, message: 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. @@ -425,4 +444,4 @@ def _send_model(self, data: typing.Any) -> None: """ Send a Pydantic model to the websocket connection. """ - self._send(data.dict()) + self._send(_sanitize_numeric_types(data.dict())) diff --git a/src/deepgram/agent/v1/socket_client.py.bak b/src/deepgram/agent/v1/socket_client.py.bak deleted file mode 100644 index ef56cc79..00000000 --- a/src/deepgram/agent/v1/socket_client.py.bak +++ /dev/null @@ -1,446 +0,0 @@ -# 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 b/src/deepgram/agent/v1/types/__init__.py index 232c2180..e6a3fdc7 100644 --- a/src/deepgram/agent/v1/types/__init__.py +++ b/src/deepgram/agent/v1/types/__init__.py @@ -163,6 +163,27 @@ "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) @@ -261,3 +282,24 @@ def __dir__(): "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/__init__.py.bak b/src/deepgram/agent/v1/types/__init__.py.bak deleted file mode 100644 index e6a3fdc7..00000000 --- a/src/deepgram/agent/v1/types/__init__.py.bak +++ /dev/null @@ -1,305 +0,0 @@ -# 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 b/src/deepgram/agent/v1/types/agent_v1conversation_text.py index 1e85d656..eb33f9f0 100644 --- a/src/deepgram/agent/v1/types/agent_v1conversation_text.py +++ b/src/deepgram/agent/v1/types/agent_v1conversation_text.py @@ -25,9 +25,9 @@ class AgentV1ConversationText(UncheckedBaseModel): The actual statement that was spoken """ - conversational_behavior: AgentV1ConversationTextConversationalBehavior = pydantic.Field() + 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 + 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) diff --git a/src/deepgram/agent/v1/types/agent_v1conversation_text.py.bak b/src/deepgram/agent/v1/types/agent_v1conversation_text.py.bak deleted file mode 100644 index eb33f9f0..00000000 --- a/src/deepgram/agent/v1/types/agent_v1conversation_text.py.bak +++ /dev/null @@ -1,50 +0,0 @@ -# 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 b/src/deepgram/agent/v1/types/agent_v1inject_dynamic_agent_message.py index aefd967d..471d6f61 100644 --- a/src/deepgram/agent/v1/types/agent_v1inject_dynamic_agent_message.py +++ b/src/deepgram/agent/v1/types/agent_v1inject_dynamic_agent_message.py @@ -22,7 +22,7 @@ class AgentV1InjectDynamicAgentMessage(UncheckedBaseModel): 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. 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 deleted file mode 100644 index 471d6f61..00000000 --- a/src/deepgram/agent/v1/types/agent_v1inject_dynamic_agent_message.py.bak +++ /dev/null @@ -1,38 +0,0 @@ -# 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 b/src/deepgram/agent/v1/types/agent_v1settings.py index 11601dfc..ff58da13 100644 --- a/src/deepgram/agent/v1/types/agent_v1settings.py +++ b/src/deepgram/agent/v1/types/agent_v1settings.py @@ -6,6 +6,7 @@ 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 @@ -29,7 +30,7 @@ class AgentV1Settings(UncheckedBaseModel): """ audio: AgentV1SettingsAudio - agent: AgentV1SettingsAgent + 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 diff --git a/src/deepgram/agent/v1/types/agent_v1settings.py.bak b/src/deepgram/agent/v1/types/agent_v1settings.py.bak deleted file mode 100644 index ff58da13..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings.py.bak +++ /dev/null @@ -1,42 +0,0 @@ -# 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 b/src/deepgram/agent/v1/types/agent_v1settings_agent.py index c1483c35..1a4d67fd 100644 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent.py +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent.py @@ -2,6 +2,57 @@ 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 -AgentV1SettingsAgent = typing.Union[AgentV1SettingsAgentContext, str] + +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.py.bak b/src/deepgram/agent/v1/types/agent_v1settings_agent.py.bak deleted file mode 100644 index b55a8345..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent.py.bak +++ /dev/null @@ -1,56 +0,0 @@ -# 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 b/src/deepgram/agent/v1/types/agent_v1settings_agent_context.py index d32ebcaa..181472b4 100644 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_context.py +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent_context.py @@ -8,6 +8,7 @@ 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 @@ -37,10 +38,30 @@ class AgentV1SettingsAgentContext(UncheckedBaseModel): """ 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.py.bak b/src/deepgram/agent/v1/types/agent_v1settings_agent_context.py.bak deleted file mode 100644 index 6b74f1ee..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_context.py.bak +++ /dev/null @@ -1,66 +0,0 @@ -# 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 b/src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py index b806f202..222c18a3 100644 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py @@ -33,15 +33,38 @@ class AgentV1SettingsAgentContextListenProvider_V2(UncheckedBaseModel): 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 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 deleted file mode 100644 index d7f6670b..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py.bak +++ /dev/null @@ -1,76 +0,0 @@ -# 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 b/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py index d053b2b9..d225e261 100644 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py @@ -33,15 +33,38 @@ class AgentV1SettingsAgentListenProvider_V2(UncheckedBaseModel): 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 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 deleted file mode 100644 index 1e7f78e5..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py.bak +++ /dev/null @@ -1,76 +0,0 @@ -# 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 b/src/deepgram/agent/v1/types/agent_v1update_listen_listen.py index f345904c..d7ed4fab 100644 --- a/src/deepgram/agent/v1/types/agent_v1update_listen_listen.py +++ b/src/deepgram/agent/v1/types/agent_v1update_listen_listen.py @@ -5,8 +5,34 @@ 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): """ @@ -16,9 +42,19 @@ class AgentV1UpdateListenListen(UncheckedBaseModel): 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 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 deleted file mode 100644 index c60cb378..00000000 --- a/src/deepgram/agent/v1/types/agent_v1update_listen_listen.py.bak +++ /dev/null @@ -1,60 +0,0 @@ -# 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 b/src/deepgram/core/api_error.py index 6f850a60..2aa93914 100644 --- a/src/deepgram/core/api_error.py +++ b/src/deepgram/core/api_error.py @@ -2,6 +2,8 @@ from typing import Any, Dict, Optional +from .._secure_logging import redact_sensitive_headers + class ApiError(Exception): headers: Optional[Dict[str, str]] @@ -15,7 +17,7 @@ def __init__( status_code: Optional[int] = None, body: Any = None, ) -> None: - self.headers = headers + self.headers = redact_sensitive_headers(headers) self.status_code = status_code self.body = body diff --git a/src/deepgram/core/api_error.py.bak b/src/deepgram/core/api_error.py.bak deleted file mode 100644 index 2aa93914..00000000 --- a/src/deepgram/core/api_error.py.bak +++ /dev/null @@ -1,25 +0,0 @@ -# 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 b/src/deepgram/core/client_wrapper.py index 2ab7bb18..e9cc30c9 100644 --- a/src/deepgram/core/client_wrapper.py +++ b/src/deepgram/core/client_wrapper.py @@ -37,7 +37,7 @@ def get_headers(self) -> typing.Dict[str, str]: try: _sdk_version = _fern_importlib_metadata.version("deepgram-sdk") except _fern_importlib_metadata.PackageNotFoundError: - _sdk_version = "7.18.1" + _sdk_version = "7.18.0" # x-release-please-version headers: typing.Dict[str, str] = { "User-Agent": "deepgram-sdk/" + _sdk_version, diff --git a/src/deepgram/core/client_wrapper.py.bak b/src/deepgram/core/client_wrapper.py.bak deleted file mode 100644 index e9cc30c9..00000000 --- a/src/deepgram/core/client_wrapper.py.bak +++ /dev/null @@ -1,146 +0,0 @@ -# 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.18.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 b/src/deepgram/core/parse_error.py index 4527c6a8..c510c0e8 100644 --- a/src/deepgram/core/parse_error.py +++ b/src/deepgram/core/parse_error.py @@ -2,6 +2,8 @@ from typing import Any, Dict, Optional +from .._secure_logging import redact_sensitive_headers + class ParsingError(Exception): """ @@ -23,7 +25,7 @@ def __init__( body: Any = None, cause: Optional[Exception] = None, ) -> None: - self.headers = headers + self.headers = redact_sensitive_headers(headers) self.status_code = status_code self.body = body self.cause = cause diff --git a/src/deepgram/core/parse_error.py.bak b/src/deepgram/core/parse_error.py.bak deleted file mode 100644 index c510c0e8..00000000 --- a/src/deepgram/core/parse_error.py.bak +++ /dev/null @@ -1,38 +0,0 @@ -# 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 b/src/deepgram/core/query_encoder.py index 3183001d..58088258 100644 --- a/src/deepgram/core/query_encoder.py +++ b/src/deepgram/core/query_encoder.py @@ -5,6 +5,13 @@ 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 = [] @@ -17,9 +24,9 @@ def traverse_query_dict(dict_flat: Dict[str, Any], key_prefix: Optional[str] = N if isinstance(arr_v, dict): result.extend(traverse_query_dict(arr_v, key)) else: - result.append((key, arr_v)) + result.append((key, _coerce_query_value(arr_v))) else: - result.append((key, v)) + result.append((key, _coerce_query_value(v))) return result @@ -41,11 +48,11 @@ def single_query_encoder(query_key: str, query_value: Any) -> List[Tuple[str, An encoded_values.extend(single_query_encoder(query_key, obj_dict)) else: - encoded_values.append((query_key, value)) + encoded_values.append((query_key, _coerce_query_value(value))) return encoded_values - return [(query_key, query_value)] + return [(query_key, _coerce_query_value(query_value))] def encode_query(query: Optional[Dict[str, Any]]) -> Optional[List[Tuple[str, Any]]]: diff --git a/src/deepgram/core/query_encoder.py.bak b/src/deepgram/core/query_encoder.py.bak deleted file mode 100644 index 58088258..00000000 --- a/src/deepgram/core/query_encoder.py.bak +++ /dev/null @@ -1,65 +0,0 @@ -# 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 b/src/deepgram/listen/__init__.py index 79d16232..d2b6487e 100644 --- a/src/deepgram/listen/__init__.py +++ b/src/deepgram/listen/__init__.py @@ -148,6 +148,8 @@ "v2": ".v2", } +_dynamic_imports["ListenV2CloseStreamType"] = ".v2" + def __getattr__(attr_name: str) -> typing.Any: module_name = _dynamic_imports.get(attr_name) @@ -240,3 +242,5 @@ def __dir__(): "v1", "v2", ] + +__all__.append("ListenV2CloseStreamType") diff --git a/src/deepgram/listen/__init__.py.bak b/src/deepgram/listen/__init__.py.bak deleted file mode 100644 index d2b6487e..00000000 --- a/src/deepgram/listen/__init__.py.bak +++ /dev/null @@ -1,246 +0,0 @@ -# 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 b/src/deepgram/listen/v1/requests/listen_v1configure_failure.py index 410201ed..af007f39 100644 --- a/src/deepgram/listen/v1/requests/listen_v1configure_failure.py +++ b/src/deepgram/listen/v1/requests/listen_v1configure_failure.py @@ -20,7 +20,7 @@ class ListenV1ConfigureFailureParams(typing_extensions.TypedDict): 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. diff --git a/src/deepgram/listen/v1/requests/listen_v1configure_failure.py.bak b/src/deepgram/listen/v1/requests/listen_v1configure_failure.py.bak deleted file mode 100644 index af007f39..00000000 --- a/src/deepgram/listen/v1/requests/listen_v1configure_failure.py.bak +++ /dev/null @@ -1,34 +0,0 @@ -# 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 b/src/deepgram/listen/v1/socket_client.py index 5666ff3a..20d466f4 100644 --- a/src/deepgram/listen/v1/socket_client.py +++ b/src/deepgram/listen/v1/socket_client.py @@ -3,9 +3,7 @@ import json import logging import typing -from json.decoder import JSONDecodeError -import websockets import websockets.sync.connection as websockets_sync_connection from ...core.events import EventEmitterMixin, EventType from ...core.unchecked_base_model import construct_type @@ -28,6 +26,7 @@ _logger = logging.getLogger(__name__) V1SocketClientResponse = typing.Union[ + bytes, ListenV1ConfigureSuccess, ListenV1ConfigureFailure, ListenV1Results, @@ -35,6 +34,7 @@ ListenV1UtteranceEnd, ListenV1SpeechStarted, ListenV1Error, + typing.Dict[str, typing.Any], ] @@ -81,7 +81,7 @@ async def start_listening(self): ) continue await self._emit_async(EventType.MESSAGE, parsed) - except (websockets.WebSocketException, JSONDecodeError) as exc: + except Exception as exc: await self._emit_async(EventType.ERROR, exc) finally: await self._emit_async(EventType.CLOSE, None) @@ -93,26 +93,26 @@ async def send_media(self, message: bytes) -> None: """ await self._send(message) - async def send_finalize(self, message: ListenV1Finalize) -> None: + 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) + await self._send_model(message or ListenV1Finalize(type="Finalize")) - async def send_close_stream(self, message: ListenV1CloseStream) -> None: + 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) + await self._send_model(message or ListenV1CloseStream(type="CloseStream")) - async def send_keep_alive(self, message: ListenV1KeepAlive) -> None: + 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) + await self._send_model(message or ListenV1KeepAlive(type="KeepAlive")) async def send_configure(self, message: ListenV1Configure) -> None: """ @@ -193,7 +193,7 @@ def start_listening(self): ) continue self._emit(EventType.MESSAGE, parsed) - except (websockets.WebSocketException, JSONDecodeError) as exc: + except Exception as exc: self._emit(EventType.ERROR, exc) finally: self._emit(EventType.CLOSE, None) @@ -205,26 +205,26 @@ def send_media(self, message: bytes) -> None: """ self._send(message) - def send_finalize(self, message: ListenV1Finalize) -> None: + 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) + self._send_model(message or ListenV1Finalize(type="Finalize")) - def send_close_stream(self, message: ListenV1CloseStream) -> None: + 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) + self._send_model(message or ListenV1CloseStream(type="CloseStream")) - def send_keep_alive(self, message: ListenV1KeepAlive) -> None: + 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) + self._send_model(message or ListenV1KeepAlive(type="KeepAlive")) def send_configure(self, message: ListenV1Configure) -> None: """ diff --git a/src/deepgram/listen/v1/socket_client.py.bak b/src/deepgram/listen/v1/socket_client.py.bak deleted file mode 100644 index e9f508ba..00000000 --- a/src/deepgram/listen/v1/socket_client.py.bak +++ /dev/null @@ -1,262 +0,0 @@ -# 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 - 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 - 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 - 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 - 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 b/src/deepgram/listen/v1/types/listen_v1configure_failure.py index 7352f3df..859a834c 100644 --- a/src/deepgram/listen/v1/types/listen_v1configure_failure.py +++ b/src/deepgram/listen/v1/types/listen_v1configure_failure.py @@ -22,7 +22,7 @@ class ListenV1ConfigureFailure(UncheckedBaseModel): 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. diff --git a/src/deepgram/listen/v1/types/listen_v1configure_failure.py.bak b/src/deepgram/listen/v1/types/listen_v1configure_failure.py.bak deleted file mode 100644 index 859a834c..00000000 --- a/src/deepgram/listen/v1/types/listen_v1configure_failure.py.bak +++ /dev/null @@ -1,45 +0,0 @@ -# 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 b/src/deepgram/listen/v2/__init__.py index 8dea11db..7585b5ab 100644 --- a/src/deepgram/listen/v2/__init__.py +++ b/src/deepgram/listen/v2/__init__.py @@ -63,6 +63,8 @@ "ListenV2WarningParams": ".requests", } +_dynamic_imports["ListenV2CloseStreamType"] = ".types" + def __getattr__(attr_name: str) -> typing.Any: module_name = _dynamic_imports.get(attr_name) @@ -112,3 +114,5 @@ def __dir__(): "ListenV2Warning", "ListenV2WarningParams", ] + +__all__.append("ListenV2CloseStreamType") diff --git a/src/deepgram/listen/v2/__init__.py.bak b/src/deepgram/listen/v2/__init__.py.bak deleted file mode 100644 index 7585b5ab..00000000 --- a/src/deepgram/listen/v2/__init__.py.bak +++ /dev/null @@ -1,118 +0,0 @@ -# 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 b/src/deepgram/listen/v2/socket_client.py index e60bd78a..4295e44c 100644 --- a/src/deepgram/listen/v2/socket_client.py +++ b/src/deepgram/listen/v2/socket_client.py @@ -3,9 +3,7 @@ import json import logging import typing -from json.decoder import JSONDecodeError -import websockets import websockets.sync.connection as websockets_sync_connection from ...core.events import EventEmitterMixin, EventType from ...core.unchecked_base_model import construct_type @@ -26,12 +24,14 @@ _logger = logging.getLogger(__name__) V2SocketClientResponse = typing.Union[ + bytes, ListenV2Connected, ListenV2TurnInfo, ListenV2ConfigureSuccess, ListenV2ConfigureFailure, ListenV2Warning, ListenV2FatalError, + typing.Dict[str, typing.Any], ] @@ -78,7 +78,7 @@ async def start_listening(self): ) continue await self._emit_async(EventType.MESSAGE, parsed) - except (websockets.WebSocketException, JSONDecodeError) as exc: + except Exception as exc: await self._emit_async(EventType.ERROR, exc) finally: await self._emit_async(EventType.CLOSE, None) @@ -90,26 +90,29 @@ async def send_media(self, message: bytes) -> None: """ await self._send(message) - async def send_close_stream(self, message: ListenV2CloseStream) -> None: + 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) + await self._send_model(message or ListenV2CloseStream(type="CloseStream")) - async def send_force_end_turn(self, message: ListenV2ForceEndTurn) -> None: + 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) + await self._send_model(message or ListenV2ForceEndTurn(type="ForceEndTurn")) - async def send_configure(self, message: ListenV2Configure) -> None: + 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. """ - await self._send_model(message) + if isinstance(message, dict): + await self._send(message) + else: + await self._send_model(message) async def recv(self) -> V2SocketClientResponse: """ @@ -183,7 +186,7 @@ def start_listening(self): ) continue self._emit(EventType.MESSAGE, parsed) - except (websockets.WebSocketException, JSONDecodeError) as exc: + except Exception as exc: self._emit(EventType.ERROR, exc) finally: self._emit(EventType.CLOSE, None) @@ -195,26 +198,29 @@ def send_media(self, message: bytes) -> None: """ self._send(message) - def send_close_stream(self, message: ListenV2CloseStream) -> None: + 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) + self._send_model(message or ListenV2CloseStream(type="CloseStream")) - def send_force_end_turn(self, message: ListenV2ForceEndTurn) -> None: + 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) + self._send_model(message or ListenV2ForceEndTurn(type="ForceEndTurn")) - def send_configure(self, message: ListenV2Configure) -> None: + 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. """ - self._send_model(message) + if isinstance(message, dict): + self._send(message) + else: + self._send_model(message) def recv(self) -> V2SocketClientResponse: """ diff --git a/src/deepgram/listen/v2/socket_client.py.bak b/src/deepgram/listen/v2/socket_client.py.bak deleted file mode 100644 index 6b15d6fd..00000000 --- a/src/deepgram/listen/v2/socket_client.py.bak +++ /dev/null @@ -1,251 +0,0 @@ -# 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 - 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 - 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 - 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 - 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 b/src/deepgram/listen/v2/types/__init__.py index 7f4ffc34..8ec84d29 100644 --- a/src/deepgram/listen/v2/types/__init__.py +++ b/src/deepgram/listen/v2/types/__init__.py @@ -35,6 +35,8 @@ "ListenV2Warning": ".listen_v2warning", } +_dynamic_imports["ListenV2CloseStreamType"] = ".listen_v2close_stream_type" + def __getattr__(attr_name: str) -> typing.Any: module_name = _dynamic_imports.get(attr_name) @@ -72,3 +74,5 @@ def __dir__(): "ListenV2TurnInfoWordsItem", "ListenV2Warning", ] + +__all__.append("ListenV2CloseStreamType") diff --git a/src/deepgram/listen/v2/types/__init__.py.bak b/src/deepgram/listen/v2/types/__init__.py.bak deleted file mode 100644 index 8ec84d29..00000000 --- a/src/deepgram/listen/v2/types/__init__.py.bak +++ /dev/null @@ -1,78 +0,0 @@ -# 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 b/src/deepgram/listen/v2/types/listen_v2configure_failure.py index 7b3772d6..1daf8af6 100644 --- a/src/deepgram/listen/v2/types/listen_v2configure_failure.py +++ b/src/deepgram/listen/v2/types/listen_v2configure_failure.py @@ -4,10 +4,10 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 -from ....core.unchecked_base_model import UncheckedBaseModel +from ._dict_compat import ListenV2ResponseDictCompatModel -class ListenV2ConfigureFailure(UncheckedBaseModel): +class ListenV2ConfigureFailure(ListenV2ResponseDictCompatModel): type: typing.Literal["ConfigureFailure"] = pydantic.Field(default="ConfigureFailure") """ Message type identifier diff --git a/src/deepgram/listen/v2/types/listen_v2configure_failure.py.bak b/src/deepgram/listen/v2/types/listen_v2configure_failure.py.bak deleted file mode 100644 index 1daf8af6..00000000 --- a/src/deepgram/listen/v2/types/listen_v2configure_failure.py.bak +++ /dev/null @@ -1,45 +0,0 @@ -# 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 b/src/deepgram/listen/v2/types/listen_v2configure_success.py index d04cce1b..0faaec9d 100644 --- a/src/deepgram/listen/v2/types/listen_v2configure_success.py +++ b/src/deepgram/listen/v2/types/listen_v2configure_success.py @@ -4,13 +4,13 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 -from ....core.unchecked_base_model import UncheckedBaseModel 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(UncheckedBaseModel): +class ListenV2ConfigureSuccess(ListenV2ResponseDictCompatModel): type: typing.Literal["ConfigureSuccess"] = pydantic.Field(default="ConfigureSuccess") """ Message type identifier diff --git a/src/deepgram/listen/v2/types/listen_v2configure_success.py.bak b/src/deepgram/listen/v2/types/listen_v2configure_success.py.bak deleted file mode 100644 index cf7c1c80..00000000 --- a/src/deepgram/listen/v2/types/listen_v2configure_success.py.bak +++ /dev/null @@ -1,55 +0,0 @@ -# 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. - """ - - 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 b/src/deepgram/listen/v2/types/listen_v2configure_success_thresholds.py index 6c719233..e0353ec9 100644 --- a/src/deepgram/listen/v2/types/listen_v2configure_success_thresholds.py +++ b/src/deepgram/listen/v2/types/listen_v2configure_success_thresholds.py @@ -4,13 +4,13 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 -from ....core.unchecked_base_model import UncheckedBaseModel 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(UncheckedBaseModel): +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. 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 deleted file mode 100644 index e0353ec9..00000000 --- a/src/deepgram/listen/v2/types/listen_v2configure_success_thresholds.py.bak +++ /dev/null @@ -1,30 +0,0 @@ -# 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 b/src/deepgram/listen/v2/types/listen_v2connected.py index cefc0236..b253d86c 100644 --- a/src/deepgram/listen/v2/types/listen_v2connected.py +++ b/src/deepgram/listen/v2/types/listen_v2connected.py @@ -4,10 +4,10 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 -from ....core.unchecked_base_model import UncheckedBaseModel +from ._dict_compat import ListenV2ResponseDictCompatModel -class ListenV2Connected(UncheckedBaseModel): +class ListenV2Connected(ListenV2ResponseDictCompatModel): type: typing.Literal["Connected"] = pydantic.Field(default="Connected") """ Message type identifier diff --git a/src/deepgram/listen/v2/types/listen_v2connected.py.bak b/src/deepgram/listen/v2/types/listen_v2connected.py.bak deleted file mode 100644 index b253d86c..00000000 --- a/src/deepgram/listen/v2/types/listen_v2connected.py.bak +++ /dev/null @@ -1,35 +0,0 @@ -# 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 b/src/deepgram/listen/v2/types/listen_v2fatal_error.py index c5106f07..2202c82e 100644 --- a/src/deepgram/listen/v2/types/listen_v2fatal_error.py +++ b/src/deepgram/listen/v2/types/listen_v2fatal_error.py @@ -4,10 +4,10 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 -from ....core.unchecked_base_model import UncheckedBaseModel +from ._dict_compat import ListenV2ResponseDictCompatModel -class ListenV2FatalError(UncheckedBaseModel): +class ListenV2FatalError(ListenV2ResponseDictCompatModel): type: typing.Literal["Error"] = pydantic.Field(default="Error") """ Message type identifier diff --git a/src/deepgram/listen/v2/types/listen_v2fatal_error.py.bak b/src/deepgram/listen/v2/types/listen_v2fatal_error.py.bak deleted file mode 100644 index 2202c82e..00000000 --- a/src/deepgram/listen/v2/types/listen_v2fatal_error.py.bak +++ /dev/null @@ -1,40 +0,0 @@ -# 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 b/src/deepgram/listen/v2/types/listen_v2turn_info.py index d87a1032..969d6d0c 100644 --- a/src/deepgram/listen/v2/types/listen_v2turn_info.py +++ b/src/deepgram/listen/v2/types/listen_v2turn_info.py @@ -4,12 +4,12 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 -from ....core.unchecked_base_model import UncheckedBaseModel +from ._dict_compat import ListenV2ResponseDictCompatModel from .listen_v2turn_info_event import ListenV2TurnInfoEvent from .listen_v2turn_info_words_item import ListenV2TurnInfoWordsItem -class ListenV2TurnInfo(UncheckedBaseModel): +class ListenV2TurnInfo(ListenV2ResponseDictCompatModel): """ Describes the current turn and latest state of the turn """ diff --git a/src/deepgram/listen/v2/types/listen_v2turn_info.py.bak b/src/deepgram/listen/v2/types/listen_v2turn_info.py.bak deleted file mode 100644 index 969d6d0c..00000000 --- a/src/deepgram/listen/v2/types/listen_v2turn_info.py.bak +++ /dev/null @@ -1,102 +0,0 @@ -# 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 b/src/deepgram/listen/v2/types/listen_v2turn_info_words_item.py index 07ada673..88240cd9 100644 --- a/src/deepgram/listen/v2/types/listen_v2turn_info_words_item.py +++ b/src/deepgram/listen/v2/types/listen_v2turn_info_words_item.py @@ -4,10 +4,10 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 -from ....core.unchecked_base_model import UncheckedBaseModel +from ._dict_compat import ListenV2ResponseDictCompatModel -class ListenV2TurnInfoWordsItem(UncheckedBaseModel): +class ListenV2TurnInfoWordsItem(ListenV2ResponseDictCompatModel): word: str = pydantic.Field() """ The individual punctuated, properly-cased word from the transcript 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 deleted file mode 100644 index 88240cd9..00000000 --- a/src/deepgram/listen/v2/types/listen_v2turn_info_words_item.py.bak +++ /dev/null @@ -1,38 +0,0 @@ -# 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 b/src/deepgram/listen/v2/types/listen_v2warning.py index c392cd25..19bfe19a 100644 --- a/src/deepgram/listen/v2/types/listen_v2warning.py +++ b/src/deepgram/listen/v2/types/listen_v2warning.py @@ -4,10 +4,10 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 -from ....core.unchecked_base_model import UncheckedBaseModel +from ._dict_compat import ListenV2ResponseDictCompatModel -class ListenV2Warning(UncheckedBaseModel): +class ListenV2Warning(ListenV2ResponseDictCompatModel): type: typing.Literal["Warning"] = pydantic.Field(default="Warning") """ Message type identifier diff --git a/src/deepgram/listen/v2/types/listen_v2warning.py.bak b/src/deepgram/listen/v2/types/listen_v2warning.py.bak deleted file mode 100644 index 19bfe19a..00000000 --- a/src/deepgram/listen/v2/types/listen_v2warning.py.bak +++ /dev/null @@ -1,45 +0,0 @@ -# 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/requests/__init__.py b/src/deepgram/requests/__init__.py index bacbf9df..beb2e2db 100644 --- a/src/deepgram/requests/__init__.py +++ b/src/deepgram/requests/__init__.py @@ -389,6 +389,22 @@ "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) @@ -584,3 +600,19 @@ def __dir__(): "UsageV1ResponseParams", "UsageV1ResponseResolutionParams", ] + +__all__.extend( + [ + "SharedIntentsResultsParams", + "SharedIntentsResultsIntentsParams", + "SharedIntentsResultsIntentsSegmentsItemParams", + "SharedIntentsResultsIntentsSegmentsItemIntentsItemParams", + "SharedTopicsResultsParams", + "SharedTopicsResultsTopicsParams", + "SharedTopicsResultsTopicsSegmentsItemParams", + "SharedTopicsResultsTopicsSegmentsItemTopicsItemParams", + "CartesiaSpeakProviderVoiceParams", + "CreateKeyV1RequestOneParams", + "DeepgramListenProviderV2LanguageHintParams", + ] +) diff --git a/src/deepgram/requests/__init__.py.bak b/src/deepgram/requests/__init__.py.bak deleted file mode 100644 index beb2e2db..00000000 --- a/src/deepgram/requests/__init__.py.bak +++ /dev/null @@ -1,618 +0,0 @@ -# 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 .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_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", - "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_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", - "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_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 b/src/deepgram/requests/shared_intents.py index 7a618c13..8f699d26 100644 --- a/src/deepgram/requests/shared_intents.py +++ b/src/deepgram/requests/shared_intents.py @@ -3,6 +3,7 @@ import typing import typing_extensions +from .shared_intents_results import SharedIntentsResultsParams from .shared_intents_segments_item import SharedIntentsSegmentsItemParams @@ -12,3 +13,4 @@ class SharedIntentsParams(typing_extensions.TypedDict): """ segments: typing_extensions.NotRequired[typing.Sequence[SharedIntentsSegmentsItemParams]] + results: typing_extensions.NotRequired[SharedIntentsResultsParams] diff --git a/src/deepgram/requests/shared_intents.py.bak b/src/deepgram/requests/shared_intents.py.bak deleted file mode 100644 index 8f699d26..00000000 --- a/src/deepgram/requests/shared_intents.py.bak +++ /dev/null @@ -1,16 +0,0 @@ -# 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 b/src/deepgram/requests/shared_topics.py index 4965005e..88c0816d 100644 --- a/src/deepgram/requests/shared_topics.py +++ b/src/deepgram/requests/shared_topics.py @@ -3,6 +3,7 @@ import typing import typing_extensions +from .shared_topics_results import SharedTopicsResultsParams from .shared_topics_segments_item import SharedTopicsSegmentsItemParams @@ -12,3 +13,4 @@ class SharedTopicsParams(typing_extensions.TypedDict): """ segments: typing_extensions.NotRequired[typing.Sequence[SharedTopicsSegmentsItemParams]] + results: typing_extensions.NotRequired[SharedTopicsResultsParams] diff --git a/src/deepgram/requests/shared_topics.py.bak b/src/deepgram/requests/shared_topics.py.bak deleted file mode 100644 index 88c0816d..00000000 --- a/src/deepgram/requests/shared_topics.py.bak +++ /dev/null @@ -1,16 +0,0 @@ -# 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 b/src/deepgram/speak/v1/socket_client.py index 5de6cd20..f268acb4 100644 --- a/src/deepgram/speak/v1/socket_client.py +++ b/src/deepgram/speak/v1/socket_client.py @@ -3,9 +3,7 @@ import json import logging import typing -from json.decoder import JSONDecodeError -import websockets import websockets.sync.connection as websockets_sync_connection from ...core.events import EventEmitterMixin, EventType from ...core.unchecked_base_model import construct_type @@ -24,7 +22,9 @@ from websockets import WebSocketClientProtocol # type: ignore _logger = logging.getLogger(__name__) -V1SocketClientResponse = typing.Union[bytes, SpeakV1Metadata, SpeakV1Flushed, SpeakV1Cleared, SpeakV1Warning] +V1SocketClientResponse = typing.Union[ + bytes, SpeakV1Metadata, SpeakV1Flushed, SpeakV1Cleared, SpeakV1Warning, typing.Dict[str, typing.Any] +] class AsyncV1SocketClient(EventEmitterMixin): @@ -70,7 +70,7 @@ async def start_listening(self): ) continue await self._emit_async(EventType.MESSAGE, parsed) - except (websockets.WebSocketException, JSONDecodeError) as exc: + except Exception as exc: await self._emit_async(EventType.ERROR, exc) finally: await self._emit_async(EventType.CLOSE, None) @@ -82,26 +82,26 @@ async def send_text(self, message: SpeakV1Text) -> None: """ await self._send_model(message) - async def send_flush(self, message: SpeakV1Flush) -> None: + 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) + await self._send_model(message or SpeakV1Flush(type="Flush")) - async def send_clear(self, message: SpeakV1Clear) -> None: + 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) + await self._send_model(message or SpeakV1Clear(type="Clear")) - async def send_close(self, message: SpeakV1Close) -> None: + 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) + await self._send_model(message or SpeakV1Close(type="Close")) async def recv(self) -> V1SocketClientResponse: """ @@ -175,7 +175,7 @@ def start_listening(self): ) continue self._emit(EventType.MESSAGE, parsed) - except (websockets.WebSocketException, JSONDecodeError) as exc: + except Exception as exc: self._emit(EventType.ERROR, exc) finally: self._emit(EventType.CLOSE, None) @@ -187,26 +187,26 @@ def send_text(self, message: SpeakV1Text) -> None: """ self._send_model(message) - def send_flush(self, message: SpeakV1Flush) -> None: + 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) + self._send_model(message or SpeakV1Flush(type="Flush")) - def send_clear(self, message: SpeakV1Clear) -> None: + 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) + self._send_model(message or SpeakV1Clear(type="Clear")) - def send_close(self, message: SpeakV1Close) -> None: + 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) + self._send_model(message or SpeakV1Close(type="Close")) def recv(self) -> V1SocketClientResponse: """ diff --git a/src/deepgram/speak/v1/socket_client.py.bak b/src/deepgram/speak/v1/socket_client.py.bak deleted file mode 100644 index f268acb4..00000000 --- a/src/deepgram/speak/v1/socket_client.py.bak +++ /dev/null @@ -1,237 +0,0 @@ -# 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 b/src/deepgram/speak/v2/requests/speak_v2warning.py index e16df4d6..6686af44 100644 --- a/src/deepgram/speak/v2/requests/speak_v2warning.py +++ b/src/deepgram/speak/v2/requests/speak_v2warning.py @@ -14,13 +14,13 @@ class SpeakV2WarningParams(typing_extensions.TypedDict): 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). """ diff --git a/src/deepgram/speak/v2/requests/speak_v2warning.py.bak b/src/deepgram/speak/v2/requests/speak_v2warning.py.bak deleted file mode 100644 index 6686af44..00000000 --- a/src/deepgram/speak/v2/requests/speak_v2warning.py.bak +++ /dev/null @@ -1,30 +0,0 @@ -# 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 b/src/deepgram/speak/v2/socket_client.py index 9e91bfff..57c5f8ab 100644 --- a/src/deepgram/speak/v2/socket_client.py +++ b/src/deepgram/speak/v2/socket_client.py @@ -3,9 +3,7 @@ import json import logging import typing -from json.decoder import JSONDecodeError -import websockets import websockets.sync.connection as websockets_sync_connection from ...core.events import EventEmitterMixin, EventType from ...core.unchecked_base_model import construct_type @@ -43,6 +41,7 @@ SpeakV2ConfigureFailure, SpeakV2Warning, SpeakV2Error, + typing.Dict[str, typing.Any], ] @@ -89,7 +88,7 @@ async def start_listening(self): ) continue await self._emit_async(EventType.MESSAGE, parsed) - except (websockets.WebSocketException, JSONDecodeError) as exc: + except Exception as exc: await self._emit_async(EventType.ERROR, exc) finally: await self._emit_async(EventType.CLOSE, None) @@ -101,19 +100,19 @@ async def send_speak(self, message: SpeakV2Speak) -> None: """ await self._send_model(message) - async def send_flush(self, message: SpeakV2Flush) -> None: + 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) + await self._send_model(message or SpeakV2Flush(type="Flush")) - async def send_interrupt(self, message: SpeakV2Interrupt) -> None: + 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) + await self._send_model(message or SpeakV2Interrupt(type="Interrupt")) async def send_configure(self, message: SpeakV2Configure) -> None: """ @@ -122,12 +121,12 @@ async def send_configure(self, message: SpeakV2Configure) -> None: """ await self._send_model(message) - async def send_close(self, message: SpeakV2Close) -> None: + 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) + await self._send_model(message or SpeakV2Close(type="Close")) async def recv(self) -> V2SocketClientResponse: """ @@ -201,7 +200,7 @@ def start_listening(self): ) continue self._emit(EventType.MESSAGE, parsed) - except (websockets.WebSocketException, JSONDecodeError) as exc: + except Exception as exc: self._emit(EventType.ERROR, exc) finally: self._emit(EventType.CLOSE, None) @@ -213,19 +212,19 @@ def send_speak(self, message: SpeakV2Speak) -> None: """ self._send_model(message) - def send_flush(self, message: SpeakV2Flush) -> None: + 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) + self._send_model(message or SpeakV2Flush(type="Flush")) - def send_interrupt(self, message: SpeakV2Interrupt) -> None: + 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) + self._send_model(message or SpeakV2Interrupt(type="Interrupt")) def send_configure(self, message: SpeakV2Configure) -> None: """ @@ -234,12 +233,12 @@ def send_configure(self, message: SpeakV2Configure) -> None: """ self._send_model(message) - def send_close(self, message: SpeakV2Close) -> None: + 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) + self._send_model(message or SpeakV2Close(type="Close")) def recv(self) -> V2SocketClientResponse: """ diff --git a/src/deepgram/speak/v2/socket_client.py.bak b/src/deepgram/speak/v2/socket_client.py.bak deleted file mode 100644 index 57c5f8ab..00000000 --- a/src/deepgram/speak/v2/socket_client.py.bak +++ /dev/null @@ -1,269 +0,0 @@ -# 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 b/src/deepgram/speak/v2/types/speak_v2warning.py index e142f323..ac771641 100644 --- a/src/deepgram/speak/v2/types/speak_v2warning.py +++ b/src/deepgram/speak/v2/types/speak_v2warning.py @@ -16,13 +16,13 @@ class SpeakV2Warning(UncheckedBaseModel): 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). """ diff --git a/src/deepgram/speak/v2/types/speak_v2warning.py.bak b/src/deepgram/speak/v2/types/speak_v2warning.py.bak deleted file mode 100644 index ac771641..00000000 --- a/src/deepgram/speak/v2/types/speak_v2warning.py.bak +++ /dev/null @@ -1,41 +0,0 @@ -# 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 b/src/deepgram/types/__init__.py index 45da478e..3c76081d 100644 --- a/src/deepgram/types/__init__.py +++ b/src/deepgram/types/__init__.py @@ -557,6 +557,28 @@ "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) @@ -837,3 +859,25 @@ def __dir__(): "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/__init__.py.bak b/src/deepgram/types/__init__.py.bak deleted file mode 100644 index d3c52c67..00000000 --- a/src/deepgram/types/__init__.py.bak +++ /dev/null @@ -1,871 +0,0 @@ -# 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_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_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_v2sample_rate import ListenV2SampleRate - from .listen_v2tag import ListenV2Tag - 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_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_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", - "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", - "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", - "ListenV2SampleRate": ".listen_v2sample_rate", - "ListenV2Tag": ".listen_v2tag", - "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", - "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_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", - "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", - "ListenV2EagerEotThreshold", - "ListenV2Encoding", - "ListenV2EotThreshold", - "ListenV2EotTimeoutMs", - "ListenV2Keyterm", - "ListenV2LanguageHint", - "ListenV2MipOptOut", - "ListenV2Model", - "ListenV2Numerals", - "ListenV2ProfanityFilter", - "ListenV2Redact", - "ListenV2SampleRate", - "ListenV2Tag", - "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", - "SpeakV2Response", - "SpeakV2SampleRate", - "SpeakV2Speed", - "SpeakV2SpeedValue", - "SpeakV2Tag", - "ThinkLiveSettingsV1", - "ThinkSettingsV1", - "ThinkSettingsV1ContextLength", - "ThinkSettingsV1Endpoint", - "ThinkSettingsV1FunctionsItem", - "ThinkSettingsV1FunctionsItemEndpoint", - "ThinkSettingsV1Provider", - "ThinkSettingsV1Provider_Anthropic", - "ThinkSettingsV1Provider_AwsBedrock", - "ThinkSettingsV1Provider_Deepgram", - "ThinkSettingsV1Provider_Google", - "ThinkSettingsV1Provider_Groq", - "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 b/src/deepgram/types/deepgram.py index ec242762..994f7a2c 100644 --- a/src/deepgram/types/deepgram.py +++ b/src/deepgram/types/deepgram.py @@ -29,7 +29,7 @@ class Deepgram(UncheckedBaseModel): 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[int] = pydantic.Field(default=None) + 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). """ diff --git a/src/deepgram/types/deepgram.py.bak b/src/deepgram/types/deepgram.py.bak deleted file mode 100644 index 994f7a2c..00000000 --- a/src/deepgram/types/deepgram.py.bak +++ /dev/null @@ -1,44 +0,0 @@ -# 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 b/src/deepgram/types/deepgram_listen_provider_v2.py index f7a155fb..d24729a0 100644 --- a/src/deepgram/types/deepgram_listen_provider_v2.py +++ b/src/deepgram/types/deepgram_listen_provider_v2.py @@ -28,6 +28,12 @@ class DeepgramListenProviderV2(UncheckedBaseModel): 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. @@ -49,9 +55,31 @@ class DeepgramListenProviderV2(UncheckedBaseModel): """ 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 diff --git a/src/deepgram/types/deepgram_listen_provider_v2.py.bak b/src/deepgram/types/deepgram_listen_provider_v2.py.bak deleted file mode 100644 index c974e7fa..00000000 --- a/src/deepgram/types/deepgram_listen_provider_v2.py.bak +++ /dev/null @@ -1,85 +0,0 @@ -# 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 b/src/deepgram/types/shared_intents.py index f03d4225..ad991bcf 100644 --- a/src/deepgram/types/shared_intents.py +++ b/src/deepgram/types/shared_intents.py @@ -5,6 +5,8 @@ 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 @@ -15,10 +17,45 @@ class SharedIntents(UncheckedBaseModel): 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 diff --git a/src/deepgram/types/shared_intents.py.bak b/src/deepgram/types/shared_intents.py.bak deleted file mode 100644 index 619a4eba..00000000 --- a/src/deepgram/types/shared_intents.py.bak +++ /dev/null @@ -1,61 +0,0 @@ -# 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 b/src/deepgram/types/shared_topics.py index 0f6a4a76..4f26c3b7 100644 --- a/src/deepgram/types/shared_topics.py +++ b/src/deepgram/types/shared_topics.py @@ -5,6 +5,8 @@ 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 @@ -15,10 +17,45 @@ class SharedTopics(UncheckedBaseModel): 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 diff --git a/src/deepgram/types/shared_topics.py.bak b/src/deepgram/types/shared_topics.py.bak deleted file mode 100644 index b2b00fa4..00000000 --- a/src/deepgram/types/shared_topics.py.bak +++ /dev/null @@ -1,61 +0,0 @@ -# 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 b/src/deepgram/types/speak_settings_v1provider.py index 305cdba8..3fbef168 100644 --- a/src/deepgram/types/speak_settings_v1provider.py +++ b/src/deepgram/types/speak_settings_v1provider.py @@ -24,7 +24,7 @@ class SpeakSettingsV1Provider_Deepgram(UncheckedBaseModel): version: typing.Optional[str] = None model: DeepgramModel speed: typing.Optional[float] = None - expressivity: typing.Optional[int] = 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 diff --git a/src/deepgram/types/speak_settings_v1provider.py.bak b/src/deepgram/types/speak_settings_v1provider.py.bak deleted file mode 100644 index 3fbef168..00000000 --- a/src/deepgram/types/speak_settings_v1provider.py.bak +++ /dev/null @@ -1,117 +0,0 @@ -# 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 b/tests/wire/test_listen_v1_media.py index e4264985..44dd3752 100644 --- a/tests/wire/test_listen_v1_media.py +++ b/tests/wire/test_listen_v1_media.py @@ -9,3 +9,95 @@ def test_listen_v1_media_transcribe_url() -> None: 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", + 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", + "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_listen_v1_media.py.bak b/tests/wire/test_listen_v1_media.py.bak deleted file mode 100644 index 44dd3752..00000000 --- a/tests/wire/test_listen_v1_media.py.bak +++ /dev/null @@ -1,103 +0,0 @@ -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", - 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", - "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 b/tests/wire/test_manage_v1_projects_keys.py index 7976bf7d..4b7a8100 100644 --- a/tests/wire/test_manage_v1_projects_keys.py +++ b/tests/wire/test_manage_v1_projects_keys.py @@ -1,5 +1,7 @@ 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""" @@ -23,6 +25,14 @@ def test_manage_v1_projects_keys_create() -> None: verify_request_count(test_id, "POST", "/v1/projects/project_id/keys", None, 1) +def test_manage_v1_projects_keys_create_with_old_request_alias() -> None: + test_id = "manage.v1.projects.keys.create.compat" + client = get_client(test_id) + request: CreateKeyV1RequestOneParams = {"key": "value"} + client.manage.v1.projects.keys.create(project_id="project_id", request=request) + verify_request_count(test_id, "POST", "/v1/projects/project_id/keys", None, 1) + + def test_manage_v1_projects_keys_get() -> None: """Test get endpoint with WireMock""" test_id = "manage.v1.projects.keys.get.0" diff --git a/tests/wire/test_manage_v1_projects_keys.py.bak b/tests/wire/test_manage_v1_projects_keys.py.bak deleted file mode 100644 index 4b7a8100..00000000 --- a/tests/wire/test_manage_v1_projects_keys.py.bak +++ /dev/null @@ -1,59 +0,0 @@ -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="project_id", - request={"key": "value"}, - ) - verify_request_count(test_id, "POST", "/v1/projects/project_id/keys", None, 1) - - -def test_manage_v1_projects_keys_create_with_old_request_alias() -> None: - test_id = "manage.v1.projects.keys.create.compat" - client = get_client(test_id) - request: CreateKeyV1RequestOneParams = {"key": "value"} - client.manage.v1.projects.keys.create(project_id="project_id", request=request) - verify_request_count(test_id, "POST", "/v1/projects/project_id/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 b/tests/wire/test_manage_v1_projects_requests.py index 71a888c7..daccaba9 100644 --- a/tests/wire/test_manage_v1_projects_requests.py +++ b/tests/wire/test_manage_v1_projects_requests.py @@ -1,3 +1,5 @@ +import datetime + from .conftest import get_client, verify_request_count @@ -11,6 +13,42 @@ def test_manage_v1_projects_requests_list_() -> None: 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" diff --git a/tests/wire/test_manage_v1_projects_requests.py.bak b/tests/wire/test_manage_v1_projects_requests.py.bak deleted file mode 100644 index daccaba9..00000000 --- a/tests/wire/test_manage_v1_projects_requests.py.bak +++ /dev/null @@ -1,66 +0,0 @@ -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, - ) From 8ba65e09e4b73987aa4a1b5e055de14fd410d365 Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Thu, 12 Nov 2026 13:30:12 +0000 Subject: [PATCH 5/9] test: cover regenerated usage controls --- tests/custom/test_listen_v2_connect_wire.py | 4 +++ tests/custom/test_model_dict_compat.py | 2 ++ tests/custom/test_speak_v2_connect_wire.py | 4 +++ tests/custom/test_speak_v2_coverage.py | 8 +++-- .../test_websocket_streaming_coverage.py | 31 +++++++++++++++++++ tests/wire/test_listen_v1_media.py | 2 ++ 6 files changed, 49 insertions(+), 2 deletions(-) diff --git a/tests/custom/test_listen_v2_connect_wire.py b/tests/custom/test_listen_v2_connect_wire.py index c08e30f9..4567330e 100644 --- a/tests/custom/test_listen_v2_connect_wire.py +++ b/tests/custom/test_listen_v2_connect_wire.py @@ -82,11 +82,13 @@ def test_sync_connect_serializes_redact(): with DeepgramClient(api_key="test_api_key").listen.v2.connect( model="flux-general-en", redact="aggressive_numbers", + redact_usage="true", ): pass _, query = _path_and_query(capture.url) assert query["redact"] == ["aggressive_numbers"] + assert query["redact_usage"] == ["true"] async def test_async_connect_serializes_redact(): @@ -95,11 +97,13 @@ async def test_async_connect_serializes_redact(): async with AsyncDeepgramClient(api_key="test_api_key").listen.v2.connect( model="flux-general-en", redact="numbers", + redact_usage="false", ): pass _, query = _path_and_query(capture.url) assert query["redact"] == ["numbers"] + assert query["redact_usage"] == ["false"] def test_sync_connect_omits_numerals_when_absent(): diff --git a/tests/custom/test_model_dict_compat.py b/tests/custom/test_model_dict_compat.py index 770c0947..3f6f9e0c 100644 --- a/tests/custom/test_model_dict_compat.py +++ b/tests/custom/test_model_dict_compat.py @@ -107,12 +107,14 @@ def test_listen_v2_generated_warning_and_configure_fields_remain_typed_and_subsc thresholds=ListenV2ConfigureSuccessThresholds(eot_threshold=0.7), keyterms=[], numerals=True, + redact_usage=True, sequence_id=5, ) assert warning["code"] == "NOTICE" assert failure["description"] == "invalid setting" assert success["numerals"] is True + assert success["redact_usage"] is True def test_unrelated_models_do_not_gain_subscript_access() -> None: diff --git a/tests/custom/test_speak_v2_connect_wire.py b/tests/custom/test_speak_v2_connect_wire.py index 2cdddb84..ddb343e8 100644 --- a/tests/custom/test_speak_v2_connect_wire.py +++ b/tests/custom/test_speak_v2_connect_wire.py @@ -65,6 +65,7 @@ def test_sync_connect_targets_v2_speak_and_serializes_query(): model="flux-alexis-en", encoding="linear16", sample_rate="24000", + normalize_volume="true", mip_opt_out=True, ): pass @@ -74,6 +75,7 @@ def test_sync_connect_targets_v2_speak_and_serializes_query(): assert query["model"] == ["flux-alexis-en"] assert query["encoding"] == ["linear16"] assert query["sample_rate"] == ["24000"] + assert query["normalize_volume"] == ["true"] # The load-bearing assertion: Python True must serialize as "true", not "True". assert query["mip_opt_out"] == ["true"] @@ -83,6 +85,7 @@ async def test_async_connect_targets_v2_speak_and_serializes_query(): with patch.object(speak_v2_client, "websockets_client_connect", capture): async with AsyncDeepgramClient(api_key="test_api_key").speak.v2.connect( model="flux-alexis-en", + normalize_volume="false", mip_opt_out=True, ): pass @@ -90,4 +93,5 @@ async def test_async_connect_targets_v2_speak_and_serializes_query(): path, query = _path_and_query(capture.url) assert path == "/v2/speak" assert query["model"] == ["flux-alexis-en"] + assert query["normalize_volume"] == ["false"] assert query["mip_opt_out"] == ["true"] diff --git a/tests/custom/test_speak_v2_coverage.py b/tests/custom/test_speak_v2_coverage.py index a711fef4..6aa17121 100644 --- a/tests/custom/test_speak_v2_coverage.py +++ b/tests/custom/test_speak_v2_coverage.py @@ -103,22 +103,26 @@ def test_sync_serializes_speed_and_expressivity(self) -> None: with respx.mock: route = respx.route(host=HOST).mock(return_value=httpx.Response(200, content=b"audio-bytes")) list( - _sync_client().speak.v2.audio.generate(model="flux-alexis-en", text="hello", speed=1.05, expressivity=2) + _sync_client().speak.v2.audio.generate( + model="flux-alexis-en", text="hello", speed=1.05, expressivity=2, normalize_volume=True + ) ) assert route.called assert route.calls.last.request.url.params["speed"] == "1.05" assert route.calls.last.request.url.params["expressivity"] == "2" + assert route.calls.last.request.url.params["normalize_volume"] == "true" async def test_async_serializes_speed_and_expressivity(self) -> None: with respx.mock: route = respx.route(host=HOST).mock(return_value=httpx.Response(200, content=b"audio-bytes")) async for _ in _async_client().speak.v2.audio.generate( - model="flux-alexis-en", text="hello", speed=1.05, expressivity=2 + model="flux-alexis-en", text="hello", speed=1.05, expressivity=2, normalize_volume=False ): pass assert route.called assert route.calls.last.request.url.params["speed"] == "1.05" assert route.calls.last.request.url.params["expressivity"] == "2" + assert route.calls.last.request.url.params["normalize_volume"] == "false" def test_with_raw_response_accessor(self) -> None: assert isinstance( diff --git a/tests/custom/test_websocket_streaming_coverage.py b/tests/custom/test_websocket_streaming_coverage.py index 132df1d5..cbd2e946 100644 --- a/tests/custom/test_websocket_streaming_coverage.py +++ b/tests/custom/test_websocket_streaming_coverage.py @@ -24,6 +24,7 @@ import respx import websockets.sync.client as websockets_sync_client +import deepgram.listen.v1.client as listen_v1_client from deepgram import AsyncDeepgramClient, DeepgramClient from deepgram.core.api_error import ApiError from deepgram.core.events import EventType @@ -144,6 +145,36 @@ def _make_invalid_status(code: int) -> InvalidWebSocketStatus: _WS_IDS = [e[0] for e in WS_ENDPOINTS] +def test_listen_v1_connect_serializes_redact_usage(monkeypatch: pytest.MonkeyPatch) -> None: + captured_urls: typing.List[str] = [] + + def _connect(url: str, **_kwargs: typing.Any) -> _FakeSyncConnectCM: + captured_urls.append(url) + return _FakeSyncConnectCM(_FakeSyncWS()) + + monkeypatch.setattr(websockets_sync_client, "connect", _connect) + with _sync_client().listen.v1.connect(model="nova-3", redact_usage="true"): + pass + + query = urllib.parse.parse_qs(urllib.parse.urlsplit(captured_urls[0]).query) + assert query["redact_usage"] == ["true"] + + +async def test_async_listen_v1_connect_serializes_redact_usage(monkeypatch: pytest.MonkeyPatch) -> None: + captured_urls: typing.List[str] = [] + + def _connect(url: str, **_kwargs: typing.Any) -> _FakeAsyncConnectCM: + captured_urls.append(url) + return _FakeAsyncConnectCM(_FakeAsyncWS()) + + monkeypatch.setattr(listen_v1_client, "websockets_client_connect", _connect) + async with _async_client().listen.v1.connect(model="nova-3", redact_usage="false"): + pass + + query = urllib.parse.parse_qs(urllib.parse.urlsplit(captured_urls[0]).query) + assert query["redact_usage"] == ["false"] + + def _async_connect_modules(leaf: str) -> typing.List[str]: """The two modules that import ``websockets_client_connect`` for an endpoint.""" return [f"deepgram.{leaf}.client", f"deepgram.{leaf}.raw_client"] diff --git a/tests/wire/test_listen_v1_media.py b/tests/wire/test_listen_v1_media.py index 44dd3752..9998a387 100644 --- a/tests/wire/test_listen_v1_media.py +++ b/tests/wire/test_listen_v1_media.py @@ -46,6 +46,7 @@ def test_listen_v1_media_transcribe_url_serializes_all_query_params() -> None: profanity_filter=True, punctuate=True, redact="redact", + redact_usage=True, replace=["replace"], search=["search"], smart_format=True, @@ -91,6 +92,7 @@ def test_listen_v1_media_transcribe_url_serializes_all_query_params() -> None: "profanity_filter": "true", "punctuate": "true", "redact": "redact", + "redact_usage": "true", "replace": "replace", "search": "search", "smart_format": "true", From 07bc79800279185f41efd6dea52100b2f44dd096 Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Thu, 12 Nov 2026 13:45:36 +0000 Subject: [PATCH 6/9] chore: defer release version bump --- .fern/metadata.json | 4 ++-- pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.fern/metadata.json b/.fern/metadata.json index 6b7c695a..78962908 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -24,5 +24,5 @@ "originGitCommit": "229defd4c32f220af07902c24efca5e94b4c47a4", "originGitCommitIsDirty": true, "invokedBy": "manual", - "sdkVersion": "7.18.1" -} \ No newline at end of file + "sdkVersion": "7.18.0" +} diff --git a/pyproject.toml b/pyproject.toml index 0f84b46d..07edeb1b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ license-files = ["LICENSE"] [tool.poetry] name = "deepgram-sdk" -version = "7.18.1" +version = "7.18.0" description = "" readme = "README.md" authors = [] From b9ff6717ae644ac88c9e92284849c8eeaa887016 Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Thu, 12 Nov 2026 13:59:05 +0000 Subject: [PATCH 7/9] test: cover raw websocket regeneration controls --- tests/custom/test_listen_v2_connect_wire.py | 27 +++++++++++++++++++ tests/custom/test_speak_v2_connect_wire.py | 27 +++++++++++++++++++ .../test_websocket_streaming_coverage.py | 16 ++++++++--- 3 files changed, 66 insertions(+), 4 deletions(-) diff --git a/tests/custom/test_listen_v2_connect_wire.py b/tests/custom/test_listen_v2_connect_wire.py index 4567330e..d8609f79 100644 --- a/tests/custom/test_listen_v2_connect_wire.py +++ b/tests/custom/test_listen_v2_connect_wire.py @@ -23,6 +23,7 @@ from unittest.mock import patch import deepgram.listen.v2.client as listen_v2_client +import deepgram.listen.v2.raw_client as listen_v2_raw_client from deepgram import AsyncDeepgramClient, DeepgramClient @@ -106,6 +107,32 @@ async def test_async_connect_serializes_redact(): assert query["redact_usage"] == ["false"] +def test_sync_raw_connect_serializes_redact_usage(): + capture = _CaptureConnect() + with patch.object(listen_v2_raw_client.websockets_sync_client, "connect", capture): + with DeepgramClient(api_key="test_api_key").listen.v2.with_raw_response.connect( + model="flux-general-en", + redact_usage="true", + ): + pass + + _, query = _path_and_query(capture.url) + assert query["redact_usage"] == ["true"] + + +async def test_async_raw_connect_serializes_redact_usage(): + capture = _CaptureConnect() + with patch.object(listen_v2_raw_client, "websockets_client_connect", capture): + async with AsyncDeepgramClient(api_key="test_api_key").listen.v2.with_raw_response.connect( + model="flux-general-en", + redact_usage="false", + ): + pass + + _, query = _path_and_query(capture.url) + assert query["redact_usage"] == ["false"] + + def test_sync_connect_omits_numerals_when_absent(): capture = _CaptureConnect() with patch.object(listen_v2_client.websockets_sync_client, "connect", capture): diff --git a/tests/custom/test_speak_v2_connect_wire.py b/tests/custom/test_speak_v2_connect_wire.py index ddb343e8..0dc44b9c 100644 --- a/tests/custom/test_speak_v2_connect_wire.py +++ b/tests/custom/test_speak_v2_connect_wire.py @@ -23,6 +23,7 @@ from unittest.mock import patch import deepgram.speak.v2.client as speak_v2_client +import deepgram.speak.v2.raw_client as speak_v2_raw_client from deepgram import AsyncDeepgramClient, DeepgramClient @@ -95,3 +96,29 @@ async def test_async_connect_targets_v2_speak_and_serializes_query(): assert query["model"] == ["flux-alexis-en"] assert query["normalize_volume"] == ["false"] assert query["mip_opt_out"] == ["true"] + + +def test_sync_raw_connect_serializes_normalize_volume(): + capture = _CaptureConnect() + with patch.object(speak_v2_raw_client.websockets_sync_client, "connect", capture): + with DeepgramClient(api_key="test_api_key").speak.v2.with_raw_response.connect( + model="flux-alexis-en", + normalize_volume="true", + ): + pass + + _, query = _path_and_query(capture.url) + assert query["normalize_volume"] == ["true"] + + +async def test_async_raw_connect_serializes_normalize_volume(): + capture = _CaptureConnect() + with patch.object(speak_v2_raw_client, "websockets_client_connect", capture): + async with AsyncDeepgramClient(api_key="test_api_key").speak.v2.with_raw_response.connect( + model="flux-alexis-en", + normalize_volume="false", + ): + pass + + _, query = _path_and_query(capture.url) + assert query["normalize_volume"] == ["false"] diff --git a/tests/custom/test_websocket_streaming_coverage.py b/tests/custom/test_websocket_streaming_coverage.py index cbd2e946..63b4e1e2 100644 --- a/tests/custom/test_websocket_streaming_coverage.py +++ b/tests/custom/test_websocket_streaming_coverage.py @@ -25,6 +25,7 @@ import websockets.sync.client as websockets_sync_client import deepgram.listen.v1.client as listen_v1_client +import deepgram.listen.v1.raw_client as listen_v1_raw_client from deepgram import AsyncDeepgramClient, DeepgramClient from deepgram.core.api_error import ApiError from deepgram.core.events import EventType @@ -155,9 +156,12 @@ def _connect(url: str, **_kwargs: typing.Any) -> _FakeSyncConnectCM: monkeypatch.setattr(websockets_sync_client, "connect", _connect) with _sync_client().listen.v1.connect(model="nova-3", redact_usage="true"): pass + with _sync_client().listen.v1.with_raw_response.connect(model="nova-3", redact_usage="true"): + pass - query = urllib.parse.parse_qs(urllib.parse.urlsplit(captured_urls[0]).query) - assert query["redact_usage"] == ["true"] + for url in captured_urls: + query = urllib.parse.parse_qs(urllib.parse.urlsplit(url).query) + assert query["redact_usage"] == ["true"] async def test_async_listen_v1_connect_serializes_redact_usage(monkeypatch: pytest.MonkeyPatch) -> None: @@ -168,11 +172,15 @@ def _connect(url: str, **_kwargs: typing.Any) -> _FakeAsyncConnectCM: return _FakeAsyncConnectCM(_FakeAsyncWS()) monkeypatch.setattr(listen_v1_client, "websockets_client_connect", _connect) + monkeypatch.setattr(listen_v1_raw_client, "websockets_client_connect", _connect) async with _async_client().listen.v1.connect(model="nova-3", redact_usage="false"): pass + async with _async_client().listen.v1.with_raw_response.connect(model="nova-3", redact_usage="false"): + pass - query = urllib.parse.parse_qs(urllib.parse.urlsplit(captured_urls[0]).query) - assert query["redact_usage"] == ["false"] + for url in captured_urls: + query = urllib.parse.parse_qs(urllib.parse.urlsplit(url).query) + assert query["redact_usage"] == ["false"] def _async_connect_modules(leaf: str) -> typing.List[str]: From 0ce149ea6dbf5ed02dc2cb125bef3fc9850e9b0c Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Thu, 12 Nov 2026 14:09:43 +0000 Subject: [PATCH 8/9] test: cover generated control paths --- tests/custom/test_http_endpoints_coverage.py | 38 +++++++++++++++++++ tests/custom/test_listen_v2_connect_wire.py | 6 ++- tests/custom/test_model_dict_compat.py | 34 +++++++++++++++++ tests/custom/test_socket_client_shims.py | 10 +++++ tests/custom/test_speak_v2_connect_wire.py | 6 ++- tests/custom/test_speak_v2_coverage.py | 20 ++++++++++ .../test_websocket_streaming_coverage.py | 4 ++ 7 files changed, 114 insertions(+), 4 deletions(-) diff --git a/tests/custom/test_http_endpoints_coverage.py b/tests/custom/test_http_endpoints_coverage.py index 388af553..d67e024a 100644 --- a/tests/custom/test_http_endpoints_coverage.py +++ b/tests/custom/test_http_endpoints_coverage.py @@ -241,6 +241,44 @@ async def test_listen_v1_media_serializes_language_hints_async( assert query["language_hint"] == expected_hints +@pytest.mark.parametrize("method", ["transcribe_url", "transcribe_file"]) +@pytest.mark.parametrize("raw", [False, True], ids=["public", "raw"]) +def test_listen_v1_media_serializes_redact_usage_sync(method: str, raw: bool) -> None: + with respx.mock: + route = respx.post(f"{BASE}/v1/listen").mock(return_value=httpx.Response(200, json={})) + media = _sync_client().listen.v1.media.with_raw_response if raw else _sync_client().listen.v1.media + kwargs: typing.Dict[str, typing.Any] = {"redact_usage": True} + kwargs["url" if method == "transcribe_url" else "request"] = ( + "https://example.com/a.wav" if method == "transcribe_url" else b"audio-bytes" + ) + + getattr(media, method)(**kwargs) + + assert route.called + assert route.calls.last.request.method == "POST" + assert route.calls.last.request.url.path == "/v1/listen" + assert route.calls.last.request.url.params["redact_usage"] == "true" + + +@pytest.mark.parametrize("method", ["transcribe_url", "transcribe_file"]) +@pytest.mark.parametrize("raw", [False, True], ids=["public", "raw"]) +async def test_listen_v1_media_serializes_redact_usage_async(method: str, raw: bool) -> None: + with respx.mock: + route = respx.post(f"{BASE}/v1/listen").mock(return_value=httpx.Response(200, json={})) + media = _async_client().listen.v1.media.with_raw_response if raw else _async_client().listen.v1.media + kwargs: typing.Dict[str, typing.Any] = {"redact_usage": True} + kwargs["url" if method == "transcribe_url" else "request"] = ( + "https://example.com/a.wav" if method == "transcribe_url" else b"audio-bytes" + ) + + await getattr(media, method)(**kwargs) + + assert route.called + assert route.calls.last.request.method == "POST" + assert route.calls.last.request.url.path == "/v1/listen" + assert route.calls.last.request.url.params["redact_usage"] == "true" + + def _walk_subclients(obj: typing.Any, depth: int = 0, seen: typing.Optional[set] = None) -> int: """Touch every nested sub-client property to cover their lazy-init accessors.""" seen = seen if seen is not None else set() diff --git a/tests/custom/test_listen_v2_connect_wire.py b/tests/custom/test_listen_v2_connect_wire.py index d8609f79..e71e8c4b 100644 --- a/tests/custom/test_listen_v2_connect_wire.py +++ b/tests/custom/test_listen_v2_connect_wire.py @@ -116,7 +116,8 @@ def test_sync_raw_connect_serializes_redact_usage(): ): pass - _, query = _path_and_query(capture.url) + path, query = _path_and_query(capture.url) + assert path == "/v2/listen" assert query["redact_usage"] == ["true"] @@ -129,7 +130,8 @@ async def test_async_raw_connect_serializes_redact_usage(): ): pass - _, query = _path_and_query(capture.url) + path, query = _path_and_query(capture.url) + assert path == "/v2/listen" assert query["redact_usage"] == ["false"] diff --git a/tests/custom/test_model_dict_compat.py b/tests/custom/test_model_dict_compat.py index 3f6f9e0c..57d2a8de 100644 --- a/tests/custom/test_model_dict_compat.py +++ b/tests/custom/test_model_dict_compat.py @@ -47,6 +47,26 @@ async def recv(self) -> str: return json.dumps(TURN_INFO) +CONFIGURE_SUCCESS = { + "type": "ConfigureSuccess", + "request_id": "request-id", + "thresholds": {}, + "keyterms": [], + "redact_usage": True, + "sequence_id": 5, +} + + +class _ConfigureSuccessWebSocket: + def recv(self) -> str: + return json.dumps(CONFIGURE_SUCCESS) + + +class _AsyncConfigureSuccessWebSocket: + async def recv(self) -> str: + return json.dumps(CONFIGURE_SUCCESS) + + def _assert_attribute_and_subscript_access(message: object) -> None: assert isinstance(message, ListenV2TurnInfo) @@ -71,6 +91,20 @@ async def test_async_listen_v2_response_supports_both_access_styles() -> None: _assert_attribute_and_subscript_access(message) +def test_sync_configure_success_parses_redact_usage() -> None: + message = V2SocketClient(websocket=typing.cast(typing.Any, _ConfigureSuccessWebSocket())).recv() + assert isinstance(message, ListenV2ConfigureSuccess) + assert message.redact_usage is True + assert message["redact_usage"] is True + + +async def test_async_configure_success_parses_redact_usage() -> None: + message = await AsyncV2SocketClient(websocket=typing.cast(typing.Any, _AsyncConfigureSuccessWebSocket())).recv() + assert isinstance(message, ListenV2ConfigureSuccess) + assert message.redact_usage is True + assert message["redact_usage"] is True + + def test_all_listen_v2_response_models_support_subscript_access() -> None: configure_success = ListenV2ConfigureSuccess( type="ConfigureSuccess", diff --git a/tests/custom/test_socket_client_shims.py b/tests/custom/test_socket_client_shims.py index 7cdd1299..9cee319f 100644 --- a/tests/custom/test_socket_client_shims.py +++ b/tests/custom/test_socket_client_shims.py @@ -298,6 +298,11 @@ def test_typed_numerals_model_is_serialized_and_sent(self): V2SocketClient(websocket=ws).send_configure(ListenV2Configure(numerals=True)) assert _sent_json(ws) == {"type": "Configure", "numerals": True} + def test_typed_redact_usage_model_is_serialized_and_sent(self): + ws = _FakeWebSocket() + V2SocketClient(websocket=ws).send_configure(ListenV2Configure(redact_usage="true")) + assert _sent_json(ws) == {"type": "Configure", "redact_usage": True} + async def test_typed_model_is_serialized_and_sent_async(self): ws = _FakeAsyncWebSocket() await AsyncV2SocketClient(websocket=ws).send_configure(ListenV2Configure(language_hints=["en"])) @@ -305,6 +310,11 @@ async def test_typed_model_is_serialized_and_sent_async(self): assert sent["type"] == "Configure" assert sent["language_hints"] == ["en"] + async def test_typed_redact_usage_model_is_serialized_and_sent_async(self): + ws = _FakeAsyncWebSocket() + await AsyncV2SocketClient(websocket=ws).send_configure(ListenV2Configure(redact_usage="false")) + assert _sent_json(ws) == {"type": "Configure", "redact_usage": False} + async def test_passthrough_dict_is_sent_verbatim_async(self): ws = _FakeAsyncWebSocket() body = {"type": "Configure", "language_hints": ["en", "es"]} diff --git a/tests/custom/test_speak_v2_connect_wire.py b/tests/custom/test_speak_v2_connect_wire.py index 0dc44b9c..590bdee0 100644 --- a/tests/custom/test_speak_v2_connect_wire.py +++ b/tests/custom/test_speak_v2_connect_wire.py @@ -107,7 +107,8 @@ def test_sync_raw_connect_serializes_normalize_volume(): ): pass - _, query = _path_and_query(capture.url) + path, query = _path_and_query(capture.url) + assert path == "/v2/speak" assert query["normalize_volume"] == ["true"] @@ -120,5 +121,6 @@ async def test_async_raw_connect_serializes_normalize_volume(): ): pass - _, query = _path_and_query(capture.url) + path, query = _path_and_query(capture.url) + assert path == "/v2/speak" assert query["normalize_volume"] == ["false"] diff --git a/tests/custom/test_speak_v2_coverage.py b/tests/custom/test_speak_v2_coverage.py index 6aa17121..ec0bc7c7 100644 --- a/tests/custom/test_speak_v2_coverage.py +++ b/tests/custom/test_speak_v2_coverage.py @@ -124,6 +124,26 @@ async def test_async_serializes_speed_and_expressivity(self) -> None: assert route.calls.last.request.url.params["expressivity"] == "2" assert route.calls.last.request.url.params["normalize_volume"] == "false" + def test_raw_sync_serializes_normalize_volume(self) -> None: + with respx.mock: + route = respx.post(f"{BASE}/v2/speak").mock(return_value=httpx.Response(200, content=b"audio-bytes")) + with _sync_client().speak.v2.audio.with_raw_response.generate( + model="flux-alexis-en", text="hello", normalize_volume=True + ) as response: + assert b"".join(response.data) == b"audio-bytes" + + assert route.calls.last.request.url.params["normalize_volume"] == "true" + + async def test_raw_async_serializes_normalize_volume(self) -> None: + with respx.mock: + route = respx.post(f"{BASE}/v2/speak").mock(return_value=httpx.Response(200, content=b"audio-bytes")) + async with _async_client().speak.v2.audio.with_raw_response.generate( + model="flux-alexis-en", text="hello", normalize_volume=False + ) as response: + assert b"".join([chunk async for chunk in response.data]) == b"audio-bytes" + + assert route.calls.last.request.url.params["normalize_volume"] == "false" + def test_with_raw_response_accessor(self) -> None: assert isinstance( _sync_client().speak.v2.audio.with_raw_response, diff --git a/tests/custom/test_websocket_streaming_coverage.py b/tests/custom/test_websocket_streaming_coverage.py index 63b4e1e2..4d440888 100644 --- a/tests/custom/test_websocket_streaming_coverage.py +++ b/tests/custom/test_websocket_streaming_coverage.py @@ -159,7 +159,9 @@ def _connect(url: str, **_kwargs: typing.Any) -> _FakeSyncConnectCM: with _sync_client().listen.v1.with_raw_response.connect(model="nova-3", redact_usage="true"): pass + assert len(captured_urls) == 2 for url in captured_urls: + assert urllib.parse.urlsplit(url).path == "/v1/listen" query = urllib.parse.parse_qs(urllib.parse.urlsplit(url).query) assert query["redact_usage"] == ["true"] @@ -178,7 +180,9 @@ def _connect(url: str, **_kwargs: typing.Any) -> _FakeAsyncConnectCM: async with _async_client().listen.v1.with_raw_response.connect(model="nova-3", redact_usage="false"): pass + assert len(captured_urls) == 2 for url in captured_urls: + assert urllib.parse.urlsplit(url).path == "/v1/listen" query = urllib.parse.parse_qs(urllib.parse.urlsplit(url).query) assert query["redact_usage"] == ["false"] From 549bc10317f7e9b7b75de2da2f3d0388bbf48a27 Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Thu, 12 Nov 2026 14:13:48 +0000 Subject: [PATCH 9/9] test: assert generated Speak V2 request target --- tests/custom/test_speak_v2_coverage.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/custom/test_speak_v2_coverage.py b/tests/custom/test_speak_v2_coverage.py index ec0bc7c7..4dfb11fa 100644 --- a/tests/custom/test_speak_v2_coverage.py +++ b/tests/custom/test_speak_v2_coverage.py @@ -101,25 +101,29 @@ async def test_async_streams_audio_bytes(self) -> None: def test_sync_serializes_speed_and_expressivity(self) -> None: with respx.mock: - route = respx.route(host=HOST).mock(return_value=httpx.Response(200, content=b"audio-bytes")) + route = respx.post(f"{BASE}/v2/speak").mock(return_value=httpx.Response(200, content=b"audio-bytes")) list( _sync_client().speak.v2.audio.generate( model="flux-alexis-en", text="hello", speed=1.05, expressivity=2, normalize_volume=True ) ) assert route.called + assert route.calls.last.request.method == "POST" + assert route.calls.last.request.url.path == "/v2/speak" assert route.calls.last.request.url.params["speed"] == "1.05" assert route.calls.last.request.url.params["expressivity"] == "2" assert route.calls.last.request.url.params["normalize_volume"] == "true" async def test_async_serializes_speed_and_expressivity(self) -> None: with respx.mock: - route = respx.route(host=HOST).mock(return_value=httpx.Response(200, content=b"audio-bytes")) + route = respx.post(f"{BASE}/v2/speak").mock(return_value=httpx.Response(200, content=b"audio-bytes")) async for _ in _async_client().speak.v2.audio.generate( model="flux-alexis-en", text="hello", speed=1.05, expressivity=2, normalize_volume=False ): pass assert route.called + assert route.calls.last.request.method == "POST" + assert route.calls.last.request.url.path == "/v2/speak" assert route.calls.last.request.url.params["speed"] == "1.05" assert route.calls.last.request.url.params["expressivity"] == "2" assert route.calls.last.request.url.params["normalize_volume"] == "false"