From 16035801a8d4fec0a632f716e4acf106777390f1 Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Thu, 3 Sep 2026 15:00:23 +0100 Subject: [PATCH 01/10] chore: initialize SDK regeneration branch From df731f72117170b887c582ef4a2357f24836cb43 Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Thu, 3 Sep 2026 15:02:45 +0100 Subject: [PATCH 02/10] chore: unfreeze files pending regen --- .fernignore | 80 +- .gitignore.bak | 8 + src/deepgram/__init__.py.bak | 1362 +++++++++++++++++ src/deepgram/agent/__init__.py.bak | 487 ++++++ src/deepgram/agent/v1/__init__.py.bak | 489 ++++++ .../agent/v1/requests/__init__.py.bak | 253 +++ .../agent/v1/requests/agent_v1settings.py.bak | 31 + .../v1/requests/agent_v1settings_agent.py.bak | 27 + .../agent_v1settings_agent_context.py.bak | 35 + src/deepgram/agent/v1/socket_client.py.bak | 379 +++++ src/deepgram/agent/v1/types/__init__.py.bak | 278 ++++ .../agent/v1/types/agent_v1settings.py.bak | 42 + .../v1/types/agent_v1settings_agent.py.bak | 66 + .../agent_v1settings_agent_context.py.bak | 73 + ...tings_agent_context_listen_provider.py.bak | 86 ++ ...nt_v1settings_agent_listen_provider.py.bak | 86 ++ .../types/agent_v1update_listen_listen.py.bak | 81 + src/deepgram/core/api_error.py.bak | 31 + src/deepgram/core/parse_error.py.bak | 40 + src/deepgram/core/query_encoder.py.bak | 66 + src/deepgram/listen/__init__.py.bak | 212 +++ src/deepgram/listen/v1/socket_client.py.bak | 234 +++ src/deepgram/listen/v2/__init__.py.bak | 111 ++ src/deepgram/listen/v2/socket_client.py.bak | 265 ++++ src/deepgram/listen/v2/types/__init__.py.bak | 74 + .../types/listen_v2configure_failure.py.bak | 35 + .../types/listen_v2configure_success.py.bak | 49 + ...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 + src/deepgram/requests/__init__.py.bak | 596 ++++++++ src/deepgram/speak/v1/socket_client.py.bak | 235 +++ src/deepgram/speak/v2/socket_client.py.bak | 268 ++++ src/deepgram/types/__init__.py.bak | 844 ++++++++++ .../types/deepgram_listen_provider_v2.py.bak | 96 ++ src/deepgram/types/speak_v2speed.py.bak | 15 + tests/wire/test_listen_v1_media.py.bak | 112 ++ .../wire/test_manage_v1_projects_keys.py.bak | 63 + .../test_manage_v1_projects_requests.py.bak | 74 + 41 files changed, 7488 insertions(+), 40 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_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_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/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/socket_client.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/requests/__init__.py.bak create mode 100644 src/deepgram/speak/v1/socket_client.py.bak create mode 100644 src/deepgram/speak/v2/socket_client.py.bak create mode 100644 src/deepgram/types/__init__.py.bak create mode 100644 src/deepgram/types/deepgram_listen_provider_v2.py.bak create mode 100644 src/deepgram/types/speak_v2speed.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 cc440e34..a54a2bb0 100644 --- a/.fernignore +++ b/.fernignore @@ -27,11 +27,11 @@ src/deepgram/listen/v2/types/_dict_compat.py # - listen/v2 send_configure: runtime tolerance for a raw dict alongside the # generated ListenV2Configure model # [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 # Backward-compat patch: AgentV1SettingsAgentContext schema restructure as of # 2026-05-05. The new schema nests messages under .context.messages; this file @@ -39,12 +39,12 @@ src/deepgram/speak/v2/socket_client.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. @@ -119,9 +119,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. Frozen so Fern won't strip the validator on regen. Remove the shim and unfreeze 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 @@ -130,7 +130,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 # Backward-compat patch for the 2026-08-18 regen SpeakV2Speed retype. The generator # changed this from `float` to `Union[Literal["0.85"..."1.15"], Any]` -- a string-literal @@ -139,7 +139,7 @@ src/deepgram/agent/v1/types/agent_v1update_listen_listen.py # `speak.v2.connect(speed=...)` param from numeric to string. Restored to `float` so the # connect param stays exactly what it was on main and consistent with Configure. Unfreeze # when the spec types the connect `speed` as a number. -src/deepgram/types/speak_v2speed.py +src/deepgram/types/speak_v2speed.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 @@ -153,17 +153,17 @@ src/deepgram/listen/v2/types/listen_v2close_stream_type.py # above shims. Fern would otherwise regenerate these and strip the legacy entries on # every regen. Frozen to preserve the public-import surface for renamed types/params. # Re-apply genuine new generator additions to these files manually after each regen. -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 @@ -180,23 +180,23 @@ 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 -src/deepgram/core/query_encoder.py +src/deepgram/core/query_encoder.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_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 # Hand-written custom tests tests/custom/test_api_error_redaction.py @@ -232,14 +232,14 @@ tests/custom/test_websocket_streaming_coverage.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 @@ -248,7 +248,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 @@ -298,7 +298,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..be1a85ec --- /dev/null +++ b/src/deepgram/__init__.py.bak @@ -0,0 +1,1362 @@ +# 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, + 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, + 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, + 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, + SharedIntentsResults, + SharedIntentsResultsIntents, + SharedIntentsResultsIntentsSegmentsItem, + SharedIntentsResultsIntentsSegmentsItemIntentsItem, + SharedSentiments, + SharedSentimentsAverage, + SharedSentimentsSegmentsItem, + SharedTopics, + SharedTopicsResults, + SharedTopicsResultsTopics, + SharedTopicsResultsTopicsSegmentsItem, + SharedTopicsResultsTopicsSegmentsItemTopicsItem, + 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, + ThinkSettingsV1, + ThinkSettingsV1ContextLength, + ThinkSettingsV1Endpoint, + ThinkSettingsV1FunctionsItem, + ThinkSettingsV1FunctionsItemEndpoint, + ThinkSettingsV1Provider, + ThinkSettingsV1Provider_Anthropic, + ThinkSettingsV1Provider_AwsBedrock, + 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, + 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, + 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, + SharedIntentsResultsIntentsParams, + SharedIntentsResultsIntentsSegmentsItemIntentsItemParams, + SharedIntentsResultsIntentsSegmentsItemParams, + SharedIntentsResultsParams, + SharedSentimentsAverageParams, + SharedSentimentsParams, + SharedSentimentsSegmentsItemParams, + SharedTopicsParams, + SharedTopicsResultsParams, + SharedTopicsResultsTopicsParams, + SharedTopicsResultsTopicsSegmentsItemParams, + SharedTopicsResultsTopicsSegmentsItemTopicsItemParams, + SpeakSettingsV1EndpointParams, + SpeakSettingsV1Params, + SpeakSettingsV1ProviderParams, + SpeakSettingsV1Provider_AwsPollyParams, + SpeakSettingsV1Provider_CartesiaParams, + SpeakSettingsV1Provider_DeepgramParams, + SpeakSettingsV1Provider_ElevenLabsParams, + SpeakSettingsV1Provider_OpenAiParams, + SpeakV2AcceptedResponseParams, + ThinkSettingsV1ContextLengthParams, + ThinkSettingsV1EndpointParams, + ThinkSettingsV1FunctionsItemEndpointParams, + ThinkSettingsV1FunctionsItemParams, + ThinkSettingsV1Params, + ThinkSettingsV1ProviderParams, + ThinkSettingsV1Provider_AnthropicParams, + ThinkSettingsV1Provider_AwsBedrockParams, + ThinkSettingsV1Provider_GoogleParams, + ThinkSettingsV1Provider_GroqParams, + ThinkSettingsV1Provider_OpenAiParams, + UpdateProjectMemberScopesV1ResponseParams, + UpdateProjectV1ResponseParams, + UsageBreakdownV1ResponseParams, + UsageBreakdownV1ResponseResolutionParams, + UsageBreakdownV1ResponseResultsItemGroupingParams, + UsageBreakdownV1ResponseResultsItemParams, + UsageFieldsV1ResponseModelsItemParams, + UsageFieldsV1ResponseParams, + UsageV1ResponseParams, + UsageV1ResponseResolutionParams, + ) + from .version import __version__ + from .types import AnthropicThinkProviderModel + from .types import CartesiaSpeakProviderModelId + from .types import CartesiaSpeakProviderVoice + from .requests import CartesiaSpeakProviderVoiceParams + from .types import CreateKeyV1RequestOne + from .types import DeepgramListenProviderV2LanguageHint + from .requests import DeepgramListenProviderV2LanguageHintParams + from .types import DeepgramSpeakProviderModel + from .types import GoogleThinkProviderModel + from .types import GoogleThinkProviderVersion + from .types import GroqThinkProviderReasoningMode +_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", + "AnthropicThinkProviderModel": ".types", + "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", + "CartesiaSpeakProviderModelId": ".types", + "CartesiaSpeakProviderVoice": ".types", + "CartesiaSpeakProviderVoiceParams": ".requests", + "CartesiaVoice": ".types", + "CartesiaVoiceParams": ".requests", + "CreateAgentConfigurationV1Response": ".types", + "CreateAgentConfigurationV1ResponseParams": ".requests", + "CreateKeyV1Request": ".types", + "CreateKeyV1RequestOne": ".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", + "DeepgramListenProviderV2LanguageHint": ".types", + "DeepgramListenProviderV2LanguageHintParams": ".requests", + "DeepgramListenProviderV2Params": ".requests", + "DeepgramModel": ".types", + "DeepgramParams": ".requests", + "DeepgramSpeakProviderModel": ".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", + "GoogleThinkProviderModel": ".types", + "GoogleThinkProviderVersion": ".types", + "GoogleVersion": ".types", + "GrantV1Response": ".types", + "GrantV1ResponseParams": ".requests", + "Groq": ".types", + "GroqParams": ".requests", + "GroqReasoningMode": ".types", + "GroqThinkProviderReasoningMode": ".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", + "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", + "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", + "SharedIntentsResults": ".types", + "SharedIntentsResultsIntents": ".types", + "SharedIntentsResultsIntentsParams": ".requests", + "SharedIntentsResultsIntentsSegmentsItem": ".types", + "SharedIntentsResultsIntentsSegmentsItemIntentsItem": ".types", + "SharedIntentsResultsIntentsSegmentsItemIntentsItemParams": ".requests", + "SharedIntentsResultsIntentsSegmentsItemParams": ".requests", + "SharedIntentsResultsParams": ".requests", + "SharedSentiments": ".types", + "SharedSentimentsAverage": ".types", + "SharedSentimentsAverageParams": ".requests", + "SharedSentimentsParams": ".requests", + "SharedSentimentsSegmentsItem": ".types", + "SharedSentimentsSegmentsItemParams": ".requests", + "SharedTopics": ".types", + "SharedTopicsParams": ".requests", + "SharedTopicsResults": ".types", + "SharedTopicsResultsParams": ".requests", + "SharedTopicsResultsTopics": ".types", + "SharedTopicsResultsTopicsParams": ".requests", + "SharedTopicsResultsTopicsSegmentsItem": ".types", + "SharedTopicsResultsTopicsSegmentsItemParams": ".requests", + "SharedTopicsResultsTopicsSegmentsItemTopicsItem": ".types", + "SharedTopicsResultsTopicsSegmentsItemTopicsItemParams": ".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", + "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_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", +} + + +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", + "AnthropicThinkProviderModel", + "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", + "CartesiaSpeakProviderModelId", + "CartesiaSpeakProviderVoice", + "CartesiaSpeakProviderVoiceParams", + "CartesiaVoice", + "CartesiaVoiceParams", + "CreateAgentConfigurationV1Response", + "CreateAgentConfigurationV1ResponseParams", + "CreateKeyV1Request", + "CreateKeyV1RequestOne", + "CreateKeyV1RequestParams", + "CreateKeyV1Response", + "CreateKeyV1ResponseParams", + "CreateProjectDistributionCredentialsV1Response", + "CreateProjectDistributionCredentialsV1ResponseDistributionCredentials", + "CreateProjectDistributionCredentialsV1ResponseDistributionCredentialsParams", + "CreateProjectDistributionCredentialsV1ResponseMember", + "CreateProjectDistributionCredentialsV1ResponseMemberParams", + "CreateProjectDistributionCredentialsV1ResponseParams", + "CreateProjectInviteV1Response", + "CreateProjectInviteV1ResponseParams", + "Deepgram", + "DeepgramClient", + "DeepgramClientEnvironment", + "DeepgramListenProviderV1", + "DeepgramListenProviderV1Params", + "DeepgramListenProviderV2", + "DeepgramListenProviderV2LanguageHint", + "DeepgramListenProviderV2LanguageHintParams", + "DeepgramListenProviderV2Params", + "DeepgramModel", + "DeepgramParams", + "DeepgramSpeakProviderModel", + "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", + "GoogleThinkProviderModel", + "GoogleThinkProviderVersion", + "GoogleVersion", + "GrantV1Response", + "GrantV1ResponseParams", + "Groq", + "GroqParams", + "GroqReasoningMode", + "GroqThinkProviderReasoningMode", + "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", + "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", + "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", + "SharedIntentsResults", + "SharedIntentsResultsIntents", + "SharedIntentsResultsIntentsParams", + "SharedIntentsResultsIntentsSegmentsItem", + "SharedIntentsResultsIntentsSegmentsItemIntentsItem", + "SharedIntentsResultsIntentsSegmentsItemIntentsItemParams", + "SharedIntentsResultsIntentsSegmentsItemParams", + "SharedIntentsResultsParams", + "SharedSentiments", + "SharedSentimentsAverage", + "SharedSentimentsAverageParams", + "SharedSentimentsParams", + "SharedSentimentsSegmentsItem", + "SharedSentimentsSegmentsItemParams", + "SharedTopics", + "SharedTopicsParams", + "SharedTopicsResults", + "SharedTopicsResultsParams", + "SharedTopicsResultsTopics", + "SharedTopicsResultsTopicsParams", + "SharedTopicsResultsTopicsSegmentsItem", + "SharedTopicsResultsTopicsSegmentsItemParams", + "SharedTopicsResultsTopicsSegmentsItemTopicsItem", + "SharedTopicsResultsTopicsSegmentsItemTopicsItemParams", + "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", + "ThinkSettingsV1", + "ThinkSettingsV1ContextLength", + "ThinkSettingsV1ContextLengthParams", + "ThinkSettingsV1Endpoint", + "ThinkSettingsV1EndpointParams", + "ThinkSettingsV1FunctionsItem", + "ThinkSettingsV1FunctionsItemEndpoint", + "ThinkSettingsV1FunctionsItemEndpointParams", + "ThinkSettingsV1FunctionsItemParams", + "ThinkSettingsV1Params", + "ThinkSettingsV1Provider", + "ThinkSettingsV1ProviderParams", + "ThinkSettingsV1Provider_Anthropic", + "ThinkSettingsV1Provider_AnthropicParams", + "ThinkSettingsV1Provider_AwsBedrock", + "ThinkSettingsV1Provider_AwsBedrockParams", + "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", +] diff --git a/src/deepgram/agent/__init__.py.bak b/src/deepgram/agent/__init__.py.bak new file mode 100644 index 00000000..11be1460 --- /dev/null +++ b/src/deepgram/agent/__init__.py.bak @@ -0,0 +1,487 @@ +# 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, + AgentV1ConversationTextParams, + AgentV1ConversationTextRole, + AgentV1Error, + AgentV1ErrorParams, + AgentV1FunctionCallRequest, + AgentV1FunctionCallRequestFunctionsItem, + AgentV1FunctionCallRequestFunctionsItemParams, + AgentV1FunctionCallRequestParams, + AgentV1History, + AgentV1HistoryParams, + AgentV1InjectAgentMessage, + AgentV1InjectAgentMessageBehavior, + AgentV1InjectAgentMessageParams, + 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, + AgentV1ThinkUpdated, + AgentV1ThinkUpdatedParams, + AgentV1UpdateListen, + AgentV1UpdateListenListen, + AgentV1UpdateListenListenParams, + AgentV1UpdateListenListenProvider, + AgentV1UpdateListenListenProviderParams, + AgentV1UpdateListenListenProvider_V1, + AgentV1UpdateListenListenProvider_V1Params, + AgentV1UpdateListenListenProvider_V2, + AgentV1UpdateListenListenProvider_V2Params, + AgentV1UpdateListenParams, + AgentV1UpdatePrompt, + AgentV1UpdatePromptParams, + AgentV1UpdateSpeak, + AgentV1UpdateSpeakParams, + AgentV1UpdateSpeakSpeak, + AgentV1UpdateSpeakSpeakParams, + AgentV1UpdateThink, + AgentV1UpdateThinkParams, + AgentV1UpdateThinkThink, + AgentV1UpdateThinkThinkParams, + AgentV1UserStartedSpeaking, + AgentV1UserStartedSpeakingParams, + AgentV1Warning, + AgentV1WarningParams, + AgentV1Welcome, + AgentV1WelcomeParams, + ConversationHistoryMessage, + ConversationHistoryMessageParams, + ConversationHistoryMessageRole, + FunctionCallHistoryMessage, + FunctionCallHistoryMessageFunctionCallsItem, + FunctionCallHistoryMessageFunctionCallsItemParams, + FunctionCallHistoryMessageParams, + ) + from .v1 import AgentV1HistoryContent + from .v1 import AgentV1HistoryContentParams + from .v1 import AgentV1HistoryContentRole + from .v1 import AgentV1HistoryFunctionCalls + from .v1 import AgentV1HistoryFunctionCallsFunctionCallsItem + from .v1 import AgentV1HistoryFunctionCallsFunctionCallsItemParams + from .v1 import AgentV1HistoryFunctionCallsParams + from .v1 import AgentV1SettingsAgentContextContextMessagesItemContentRole + from .v1 import AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem + from .v1 import AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams + from .v1 import AgentV1SettingsAgentContextListenProviderV1 + from .v1 import AgentV1SettingsAgentContextListenProviderV1Params + from .v1 import AgentV1SettingsAgentContextListenProviderV2 + from .v1 import AgentV1SettingsAgentContextListenProviderV2LanguageHint + from .v1 import AgentV1SettingsAgentContextListenProviderV2LanguageHintParams + from .v1 import AgentV1SettingsAgentContextListenProviderV2Params + from .v1 import AgentV1SettingsAgentContextMessagesItem + from .v1 import AgentV1SettingsAgentContextMessagesItemContent + from .v1 import AgentV1SettingsAgentContextMessagesItemContentParams + from .v1 import AgentV1SettingsAgentContextMessagesItemContentRole + from .v1 import AgentV1SettingsAgentContextMessagesItemFunctionCalls + from .v1 import AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem + from .v1 import AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams + from .v1 import AgentV1SettingsAgentContextMessagesItemFunctionCallsParams + from .v1 import AgentV1SettingsAgentContextMessagesItemParams + from .v1 import AgentV1SettingsAgentListenProviderV1 + from .v1 import AgentV1SettingsAgentListenProviderV1Params + from .v1 import AgentV1SettingsAgentListenProviderV2 + from .v1 import AgentV1SettingsAgentListenProviderV2Params +_dynamic_imports: typing.Dict[str, str] = { + "AgentV1AgentAudioDone": ".v1", + "AgentV1AgentAudioDoneParams": ".v1", + "AgentV1AgentStartedSpeaking": ".v1", + "AgentV1AgentStartedSpeakingParams": ".v1", + "AgentV1AgentThinking": ".v1", + "AgentV1AgentThinkingParams": ".v1", + "AgentV1ConversationText": ".v1", + "AgentV1ConversationTextParams": ".v1", + "AgentV1ConversationTextRole": ".v1", + "AgentV1Error": ".v1", + "AgentV1ErrorParams": ".v1", + "AgentV1FunctionCallRequest": ".v1", + "AgentV1FunctionCallRequestFunctionsItem": ".v1", + "AgentV1FunctionCallRequestFunctionsItemParams": ".v1", + "AgentV1FunctionCallRequestParams": ".v1", + "AgentV1History": ".v1", + "AgentV1HistoryContent": ".v1", + "AgentV1HistoryContentParams": ".v1", + "AgentV1HistoryContentRole": ".v1", + "AgentV1HistoryFunctionCalls": ".v1", + "AgentV1HistoryFunctionCallsFunctionCallsItem": ".v1", + "AgentV1HistoryFunctionCallsFunctionCallsItemParams": ".v1", + "AgentV1HistoryFunctionCallsParams": ".v1", + "AgentV1HistoryParams": ".v1", + "AgentV1InjectAgentMessage": ".v1", + "AgentV1InjectAgentMessageBehavior": ".v1", + "AgentV1InjectAgentMessageParams": ".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", + "AgentV1SettingsAgentContextContextMessagesItemContentRole": ".v1", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem": ".v1", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams": ".v1", + "AgentV1SettingsAgentContextContextMessagesItemParams": ".v1", + "AgentV1SettingsAgentContextContextParams": ".v1", + "AgentV1SettingsAgentContextListen": ".v1", + "AgentV1SettingsAgentContextListenParams": ".v1", + "AgentV1SettingsAgentContextListenProvider": ".v1", + "AgentV1SettingsAgentContextListenProviderParams": ".v1", + "AgentV1SettingsAgentContextListenProviderV1": ".v1", + "AgentV1SettingsAgentContextListenProviderV1Params": ".v1", + "AgentV1SettingsAgentContextListenProviderV2": ".v1", + "AgentV1SettingsAgentContextListenProviderV2LanguageHint": ".v1", + "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams": ".v1", + "AgentV1SettingsAgentContextListenProviderV2Params": ".v1", + "AgentV1SettingsAgentContextListenProvider_V1": ".v1", + "AgentV1SettingsAgentContextListenProvider_V1Params": ".v1", + "AgentV1SettingsAgentContextListenProvider_V2": ".v1", + "AgentV1SettingsAgentContextListenProvider_V2Params": ".v1", + "AgentV1SettingsAgentContextMessagesItem": ".v1", + "AgentV1SettingsAgentContextMessagesItemContent": ".v1", + "AgentV1SettingsAgentContextMessagesItemContentParams": ".v1", + "AgentV1SettingsAgentContextMessagesItemContentRole": ".v1", + "AgentV1SettingsAgentContextMessagesItemFunctionCalls": ".v1", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem": ".v1", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams": ".v1", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams": ".v1", + "AgentV1SettingsAgentContextMessagesItemParams": ".v1", + "AgentV1SettingsAgentContextParams": ".v1", + "AgentV1SettingsAgentContextSpeak": ".v1", + "AgentV1SettingsAgentContextSpeakParams": ".v1", + "AgentV1SettingsAgentContextThink": ".v1", + "AgentV1SettingsAgentContextThinkParams": ".v1", + "AgentV1SettingsAgentListen": ".v1", + "AgentV1SettingsAgentListenParams": ".v1", + "AgentV1SettingsAgentListenProvider": ".v1", + "AgentV1SettingsAgentListenProviderParams": ".v1", + "AgentV1SettingsAgentListenProviderV1": ".v1", + "AgentV1SettingsAgentListenProviderV1Params": ".v1", + "AgentV1SettingsAgentListenProviderV2": ".v1", + "AgentV1SettingsAgentListenProviderV2Params": ".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", + "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", + "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", +} + + +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", + "AgentV1ConversationTextParams", + "AgentV1ConversationTextRole", + "AgentV1Error", + "AgentV1ErrorParams", + "AgentV1FunctionCallRequest", + "AgentV1FunctionCallRequestFunctionsItem", + "AgentV1FunctionCallRequestFunctionsItemParams", + "AgentV1FunctionCallRequestParams", + "AgentV1History", + "AgentV1HistoryContent", + "AgentV1HistoryContentParams", + "AgentV1HistoryContentRole", + "AgentV1HistoryFunctionCalls", + "AgentV1HistoryFunctionCallsFunctionCallsItem", + "AgentV1HistoryFunctionCallsFunctionCallsItemParams", + "AgentV1HistoryFunctionCallsParams", + "AgentV1HistoryParams", + "AgentV1InjectAgentMessage", + "AgentV1InjectAgentMessageBehavior", + "AgentV1InjectAgentMessageParams", + "AgentV1InjectUserMessage", + "AgentV1InjectUserMessageParams", + "AgentV1InjectionRefused", + "AgentV1InjectionRefusedParams", + "AgentV1KeepAlive", + "AgentV1KeepAliveParams", + "AgentV1LatencyReport", + "AgentV1LatencyReportParams", + "AgentV1ListenUpdated", + "AgentV1ListenUpdatedParams", + "AgentV1PromptUpdated", + "AgentV1PromptUpdatedParams", + "AgentV1ReceiveFunctionCallResponse", + "AgentV1ReceiveFunctionCallResponseParams", + "AgentV1SendFunctionCallResponse", + "AgentV1SendFunctionCallResponseParams", + "AgentV1Settings", + "AgentV1SettingsAgent", + "AgentV1SettingsAgentContext", + "AgentV1SettingsAgentContextContext", + "AgentV1SettingsAgentContextContextMessagesItem", + "AgentV1SettingsAgentContextContextMessagesItemContentRole", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams", + "AgentV1SettingsAgentContextContextMessagesItemParams", + "AgentV1SettingsAgentContextContextParams", + "AgentV1SettingsAgentContextListen", + "AgentV1SettingsAgentContextListenParams", + "AgentV1SettingsAgentContextListenProvider", + "AgentV1SettingsAgentContextListenProviderParams", + "AgentV1SettingsAgentContextListenProviderV1", + "AgentV1SettingsAgentContextListenProviderV1Params", + "AgentV1SettingsAgentContextListenProviderV2", + "AgentV1SettingsAgentContextListenProviderV2LanguageHint", + "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams", + "AgentV1SettingsAgentContextListenProviderV2Params", + "AgentV1SettingsAgentContextListenProvider_V1", + "AgentV1SettingsAgentContextListenProvider_V1Params", + "AgentV1SettingsAgentContextListenProvider_V2", + "AgentV1SettingsAgentContextListenProvider_V2Params", + "AgentV1SettingsAgentContextMessagesItem", + "AgentV1SettingsAgentContextMessagesItemContent", + "AgentV1SettingsAgentContextMessagesItemContentParams", + "AgentV1SettingsAgentContextMessagesItemContentRole", + "AgentV1SettingsAgentContextMessagesItemFunctionCalls", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams", + "AgentV1SettingsAgentContextMessagesItemParams", + "AgentV1SettingsAgentContextParams", + "AgentV1SettingsAgentContextSpeak", + "AgentV1SettingsAgentContextSpeakParams", + "AgentV1SettingsAgentContextThink", + "AgentV1SettingsAgentContextThinkParams", + "AgentV1SettingsAgentListen", + "AgentV1SettingsAgentListenParams", + "AgentV1SettingsAgentListenProvider", + "AgentV1SettingsAgentListenProviderParams", + "AgentV1SettingsAgentListenProviderV1", + "AgentV1SettingsAgentListenProviderV1Params", + "AgentV1SettingsAgentListenProviderV2", + "AgentV1SettingsAgentListenProviderV2Params", + "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", + "AgentV1ThinkUpdated", + "AgentV1ThinkUpdatedParams", + "AgentV1UpdateListen", + "AgentV1UpdateListenListen", + "AgentV1UpdateListenListenParams", + "AgentV1UpdateListenListenProvider", + "AgentV1UpdateListenListenProviderParams", + "AgentV1UpdateListenListenProvider_V1", + "AgentV1UpdateListenListenProvider_V1Params", + "AgentV1UpdateListenListenProvider_V2", + "AgentV1UpdateListenListenProvider_V2Params", + "AgentV1UpdateListenParams", + "AgentV1UpdatePrompt", + "AgentV1UpdatePromptParams", + "AgentV1UpdateSpeak", + "AgentV1UpdateSpeakParams", + "AgentV1UpdateSpeakSpeak", + "AgentV1UpdateSpeakSpeakParams", + "AgentV1UpdateThink", + "AgentV1UpdateThinkParams", + "AgentV1UpdateThinkThink", + "AgentV1UpdateThinkThinkParams", + "AgentV1UserStartedSpeaking", + "AgentV1UserStartedSpeakingParams", + "AgentV1Warning", + "AgentV1WarningParams", + "AgentV1Welcome", + "AgentV1WelcomeParams", + "ConversationHistoryMessage", + "ConversationHistoryMessageParams", + "ConversationHistoryMessageRole", + "FunctionCallHistoryMessage", + "FunctionCallHistoryMessageFunctionCallsItem", + "FunctionCallHistoryMessageFunctionCallsItemParams", + "FunctionCallHistoryMessageParams", + "v1", +] diff --git a/src/deepgram/agent/v1/__init__.py.bak b/src/deepgram/agent/v1/__init__.py.bak new file mode 100644 index 00000000..59444380 --- /dev/null +++ b/src/deepgram/agent/v1/__init__.py.bak @@ -0,0 +1,489 @@ +# 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, + AgentV1ConversationTextRole, + AgentV1Error, + AgentV1FunctionCallRequest, + AgentV1FunctionCallRequestFunctionsItem, + AgentV1History, + AgentV1InjectAgentMessage, + AgentV1InjectAgentMessageBehavior, + 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, + AgentV1ThinkUpdated, + AgentV1UpdateListen, + AgentV1UpdateListenListen, + AgentV1UpdateListenListenProvider, + AgentV1UpdateListenListenProvider_V1, + AgentV1UpdateListenListenProvider_V2, + AgentV1UpdatePrompt, + AgentV1UpdateSpeak, + AgentV1UpdateSpeakSpeak, + AgentV1UpdateThink, + AgentV1UpdateThinkThink, + AgentV1UserStartedSpeaking, + AgentV1Warning, + AgentV1Welcome, + ConversationHistoryMessage, + ConversationHistoryMessageRole, + FunctionCallHistoryMessage, + FunctionCallHistoryMessageFunctionCallsItem, + ) + from . import settings + from .requests import ( + AgentV1AgentAudioDoneParams, + AgentV1AgentStartedSpeakingParams, + AgentV1AgentThinkingParams, + AgentV1ConversationTextParams, + AgentV1ErrorParams, + AgentV1FunctionCallRequestFunctionsItemParams, + AgentV1FunctionCallRequestParams, + AgentV1HistoryParams, + AgentV1InjectAgentMessageParams, + 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, + AgentV1ThinkUpdatedParams, + AgentV1UpdateListenListenParams, + AgentV1UpdateListenListenProviderParams, + AgentV1UpdateListenListenProvider_V1Params, + AgentV1UpdateListenListenProvider_V2Params, + AgentV1UpdateListenParams, + AgentV1UpdatePromptParams, + AgentV1UpdateSpeakParams, + AgentV1UpdateSpeakSpeakParams, + AgentV1UpdateThinkParams, + AgentV1UpdateThinkThinkParams, + AgentV1UserStartedSpeakingParams, + AgentV1WarningParams, + AgentV1WelcomeParams, + ConversationHistoryMessageParams, + FunctionCallHistoryMessageFunctionCallsItemParams, + FunctionCallHistoryMessageParams, + ) + from .types import AgentV1HistoryContent + from .requests import AgentV1HistoryContentParams + from .types import AgentV1HistoryContentRole + from .types import AgentV1HistoryFunctionCalls + from .types import AgentV1HistoryFunctionCallsFunctionCallsItem + from .requests import AgentV1HistoryFunctionCallsFunctionCallsItemParams + from .requests import AgentV1HistoryFunctionCallsParams + from .types import AgentV1SettingsAgentContextContextMessagesItemContentRole + from .types import AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem + from .requests import AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams + from .types import AgentV1SettingsAgentContextListenProviderV1 + from .requests import AgentV1SettingsAgentContextListenProviderV1Params + from .types import AgentV1SettingsAgentContextListenProviderV2 + from .types import AgentV1SettingsAgentContextListenProviderV2LanguageHint + from .requests import AgentV1SettingsAgentContextListenProviderV2LanguageHintParams + from .requests import AgentV1SettingsAgentContextListenProviderV2Params + from .types import AgentV1SettingsAgentContextMessagesItem + from .types import AgentV1SettingsAgentContextMessagesItemContent + from .requests import AgentV1SettingsAgentContextMessagesItemContentParams + from .types import AgentV1SettingsAgentContextMessagesItemContentRole + from .types import AgentV1SettingsAgentContextMessagesItemFunctionCalls + from .types import AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem + from .requests import AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams + from .requests import AgentV1SettingsAgentContextMessagesItemFunctionCallsParams + from .requests import AgentV1SettingsAgentContextMessagesItemParams + from .types import AgentV1SettingsAgentListenProviderV1 + from .requests import AgentV1SettingsAgentListenProviderV1Params + from .types import AgentV1SettingsAgentListenProviderV2 + from .requests import AgentV1SettingsAgentListenProviderV2Params +_dynamic_imports: typing.Dict[str, str] = { + "AgentV1AgentAudioDone": ".types", + "AgentV1AgentAudioDoneParams": ".requests", + "AgentV1AgentStartedSpeaking": ".types", + "AgentV1AgentStartedSpeakingParams": ".requests", + "AgentV1AgentThinking": ".types", + "AgentV1AgentThinkingParams": ".requests", + "AgentV1ConversationText": ".types", + "AgentV1ConversationTextParams": ".requests", + "AgentV1ConversationTextRole": ".types", + "AgentV1Error": ".types", + "AgentV1ErrorParams": ".requests", + "AgentV1FunctionCallRequest": ".types", + "AgentV1FunctionCallRequestFunctionsItem": ".types", + "AgentV1FunctionCallRequestFunctionsItemParams": ".requests", + "AgentV1FunctionCallRequestParams": ".requests", + "AgentV1History": ".types", + "AgentV1HistoryContent": ".types", + "AgentV1HistoryContentParams": ".requests", + "AgentV1HistoryContentRole": ".types", + "AgentV1HistoryFunctionCalls": ".types", + "AgentV1HistoryFunctionCallsFunctionCallsItem": ".types", + "AgentV1HistoryFunctionCallsFunctionCallsItemParams": ".requests", + "AgentV1HistoryFunctionCallsParams": ".requests", + "AgentV1HistoryParams": ".requests", + "AgentV1InjectAgentMessage": ".types", + "AgentV1InjectAgentMessageBehavior": ".types", + "AgentV1InjectAgentMessageParams": ".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", + "AgentV1SettingsAgentContextContextMessagesItemContentRole": ".types", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem": ".types", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams": ".requests", + "AgentV1SettingsAgentContextContextMessagesItemParams": ".requests", + "AgentV1SettingsAgentContextContextParams": ".requests", + "AgentV1SettingsAgentContextListen": ".types", + "AgentV1SettingsAgentContextListenParams": ".requests", + "AgentV1SettingsAgentContextListenProvider": ".types", + "AgentV1SettingsAgentContextListenProviderParams": ".requests", + "AgentV1SettingsAgentContextListenProviderV1": ".types", + "AgentV1SettingsAgentContextListenProviderV1Params": ".requests", + "AgentV1SettingsAgentContextListenProviderV2": ".types", + "AgentV1SettingsAgentContextListenProviderV2LanguageHint": ".types", + "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams": ".requests", + "AgentV1SettingsAgentContextListenProviderV2Params": ".requests", + "AgentV1SettingsAgentContextListenProvider_V1": ".types", + "AgentV1SettingsAgentContextListenProvider_V1Params": ".requests", + "AgentV1SettingsAgentContextListenProvider_V2": ".types", + "AgentV1SettingsAgentContextListenProvider_V2Params": ".requests", + "AgentV1SettingsAgentContextMessagesItem": ".types", + "AgentV1SettingsAgentContextMessagesItemContent": ".types", + "AgentV1SettingsAgentContextMessagesItemContentParams": ".requests", + "AgentV1SettingsAgentContextMessagesItemContentRole": ".types", + "AgentV1SettingsAgentContextMessagesItemFunctionCalls": ".types", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem": ".types", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams": ".requests", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams": ".requests", + "AgentV1SettingsAgentContextMessagesItemParams": ".requests", + "AgentV1SettingsAgentContextParams": ".requests", + "AgentV1SettingsAgentContextSpeak": ".types", + "AgentV1SettingsAgentContextSpeakParams": ".requests", + "AgentV1SettingsAgentContextThink": ".types", + "AgentV1SettingsAgentContextThinkParams": ".requests", + "AgentV1SettingsAgentListen": ".types", + "AgentV1SettingsAgentListenParams": ".requests", + "AgentV1SettingsAgentListenProvider": ".types", + "AgentV1SettingsAgentListenProviderParams": ".requests", + "AgentV1SettingsAgentListenProviderV1": ".types", + "AgentV1SettingsAgentListenProviderV1Params": ".requests", + "AgentV1SettingsAgentListenProviderV2": ".types", + "AgentV1SettingsAgentListenProviderV2Params": ".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", + "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", + "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", +} + + +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", + "AgentV1ConversationTextParams", + "AgentV1ConversationTextRole", + "AgentV1Error", + "AgentV1ErrorParams", + "AgentV1FunctionCallRequest", + "AgentV1FunctionCallRequestFunctionsItem", + "AgentV1FunctionCallRequestFunctionsItemParams", + "AgentV1FunctionCallRequestParams", + "AgentV1History", + "AgentV1HistoryContent", + "AgentV1HistoryContentParams", + "AgentV1HistoryContentRole", + "AgentV1HistoryFunctionCalls", + "AgentV1HistoryFunctionCallsFunctionCallsItem", + "AgentV1HistoryFunctionCallsFunctionCallsItemParams", + "AgentV1HistoryFunctionCallsParams", + "AgentV1HistoryParams", + "AgentV1InjectAgentMessage", + "AgentV1InjectAgentMessageBehavior", + "AgentV1InjectAgentMessageParams", + "AgentV1InjectUserMessage", + "AgentV1InjectUserMessageParams", + "AgentV1InjectionRefused", + "AgentV1InjectionRefusedParams", + "AgentV1KeepAlive", + "AgentV1KeepAliveParams", + "AgentV1LatencyReport", + "AgentV1LatencyReportParams", + "AgentV1ListenUpdated", + "AgentV1ListenUpdatedParams", + "AgentV1PromptUpdated", + "AgentV1PromptUpdatedParams", + "AgentV1ReceiveFunctionCallResponse", + "AgentV1ReceiveFunctionCallResponseParams", + "AgentV1SendFunctionCallResponse", + "AgentV1SendFunctionCallResponseParams", + "AgentV1Settings", + "AgentV1SettingsAgent", + "AgentV1SettingsAgentContext", + "AgentV1SettingsAgentContextContext", + "AgentV1SettingsAgentContextContextMessagesItem", + "AgentV1SettingsAgentContextContextMessagesItemContentRole", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams", + "AgentV1SettingsAgentContextContextMessagesItemParams", + "AgentV1SettingsAgentContextContextParams", + "AgentV1SettingsAgentContextListen", + "AgentV1SettingsAgentContextListenParams", + "AgentV1SettingsAgentContextListenProvider", + "AgentV1SettingsAgentContextListenProviderParams", + "AgentV1SettingsAgentContextListenProviderV1", + "AgentV1SettingsAgentContextListenProviderV1Params", + "AgentV1SettingsAgentContextListenProviderV2", + "AgentV1SettingsAgentContextListenProviderV2LanguageHint", + "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams", + "AgentV1SettingsAgentContextListenProviderV2Params", + "AgentV1SettingsAgentContextListenProvider_V1", + "AgentV1SettingsAgentContextListenProvider_V1Params", + "AgentV1SettingsAgentContextListenProvider_V2", + "AgentV1SettingsAgentContextListenProvider_V2Params", + "AgentV1SettingsAgentContextMessagesItem", + "AgentV1SettingsAgentContextMessagesItemContent", + "AgentV1SettingsAgentContextMessagesItemContentParams", + "AgentV1SettingsAgentContextMessagesItemContentRole", + "AgentV1SettingsAgentContextMessagesItemFunctionCalls", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams", + "AgentV1SettingsAgentContextMessagesItemParams", + "AgentV1SettingsAgentContextParams", + "AgentV1SettingsAgentContextSpeak", + "AgentV1SettingsAgentContextSpeakParams", + "AgentV1SettingsAgentContextThink", + "AgentV1SettingsAgentContextThinkParams", + "AgentV1SettingsAgentListen", + "AgentV1SettingsAgentListenParams", + "AgentV1SettingsAgentListenProvider", + "AgentV1SettingsAgentListenProviderParams", + "AgentV1SettingsAgentListenProviderV1", + "AgentV1SettingsAgentListenProviderV1Params", + "AgentV1SettingsAgentListenProviderV2", + "AgentV1SettingsAgentListenProviderV2Params", + "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", + "AgentV1ThinkUpdated", + "AgentV1ThinkUpdatedParams", + "AgentV1UpdateListen", + "AgentV1UpdateListenListen", + "AgentV1UpdateListenListenParams", + "AgentV1UpdateListenListenProvider", + "AgentV1UpdateListenListenProviderParams", + "AgentV1UpdateListenListenProvider_V1", + "AgentV1UpdateListenListenProvider_V1Params", + "AgentV1UpdateListenListenProvider_V2", + "AgentV1UpdateListenListenProvider_V2Params", + "AgentV1UpdateListenParams", + "AgentV1UpdatePrompt", + "AgentV1UpdatePromptParams", + "AgentV1UpdateSpeak", + "AgentV1UpdateSpeakParams", + "AgentV1UpdateSpeakSpeak", + "AgentV1UpdateSpeakSpeakParams", + "AgentV1UpdateThink", + "AgentV1UpdateThinkParams", + "AgentV1UpdateThinkThink", + "AgentV1UpdateThinkThinkParams", + "AgentV1UserStartedSpeaking", + "AgentV1UserStartedSpeakingParams", + "AgentV1Warning", + "AgentV1WarningParams", + "AgentV1Welcome", + "AgentV1WelcomeParams", + "ConversationHistoryMessage", + "ConversationHistoryMessageParams", + "ConversationHistoryMessageRole", + "FunctionCallHistoryMessage", + "FunctionCallHistoryMessageFunctionCallsItem", + "FunctionCallHistoryMessageFunctionCallsItemParams", + "FunctionCallHistoryMessageParams", + "settings", +] 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..387bc379 --- /dev/null +++ b/src/deepgram/agent/v1/requests/__init__.py.bak @@ -0,0 +1,253 @@ +# 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_v1error import AgentV1ErrorParams + from .agent_v1function_call_request import AgentV1FunctionCallRequestParams + from .agent_v1function_call_request_functions_item import AgentV1FunctionCallRequestFunctionsItemParams + from .agent_v1history import AgentV1HistoryParams + from .agent_v1inject_agent_message import AgentV1InjectAgentMessageParams + 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_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_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 + from .agent_v1history_content import AgentV1HistoryContentParams + from .agent_v1history_function_calls_function_calls_item import AgentV1HistoryFunctionCallsFunctionCallsItemParams + from .agent_v1history_function_calls import AgentV1HistoryFunctionCallsParams + from .agent_v1settings_agent_context_context_messages_item_function_calls_function_calls_item import AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams + from .agent_v1settings_agent_context_listen_provider_v1 import AgentV1SettingsAgentContextListenProviderV1Params + from .agent_v1settings_agent_context_listen_provider_v2language_hint import AgentV1SettingsAgentContextListenProviderV2LanguageHintParams + from .agent_v1settings_agent_context_listen_provider_v2 import AgentV1SettingsAgentContextListenProviderV2Params + from .agent_v1settings_agent_context_messages_item_content import AgentV1SettingsAgentContextMessagesItemContentParams + from .agent_v1settings_agent_context_messages_item_function_calls_function_calls_item import AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams + from .agent_v1settings_agent_context_messages_item_function_calls import AgentV1SettingsAgentContextMessagesItemFunctionCallsParams + from .agent_v1settings_agent_context_messages_item import AgentV1SettingsAgentContextMessagesItemParams + from .agent_v1settings_agent_listen_provider_v1 import AgentV1SettingsAgentListenProviderV1Params + from .agent_v1settings_agent_listen_provider_v2 import AgentV1SettingsAgentListenProviderV2Params +_dynamic_imports: typing.Dict[str, str] = { + "AgentV1AgentAudioDoneParams": ".agent_v1agent_audio_done", + "AgentV1AgentStartedSpeakingParams": ".agent_v1agent_started_speaking", + "AgentV1AgentThinkingParams": ".agent_v1agent_thinking", + "AgentV1ConversationTextParams": ".agent_v1conversation_text", + "AgentV1ErrorParams": ".agent_v1error", + "AgentV1FunctionCallRequestFunctionsItemParams": ".agent_v1function_call_request_functions_item", + "AgentV1FunctionCallRequestParams": ".agent_v1function_call_request", + "AgentV1HistoryContentParams": ".agent_v1history_content", + "AgentV1HistoryFunctionCallsFunctionCallsItemParams": ".agent_v1history_function_calls_function_calls_item", + "AgentV1HistoryFunctionCallsParams": ".agent_v1history_function_calls", + "AgentV1HistoryParams": ".agent_v1history", + "AgentV1InjectAgentMessageParams": ".agent_v1inject_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", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams": ".agent_v1settings_agent_context_context_messages_item_function_calls_function_calls_item", + "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", + "AgentV1SettingsAgentContextListenProviderV1Params": ".agent_v1settings_agent_context_listen_provider_v1", + "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams": ".agent_v1settings_agent_context_listen_provider_v2language_hint", + "AgentV1SettingsAgentContextListenProviderV2Params": ".agent_v1settings_agent_context_listen_provider_v2", + "AgentV1SettingsAgentContextListenProvider_V1Params": ".agent_v1settings_agent_context_listen_provider", + "AgentV1SettingsAgentContextListenProvider_V2Params": ".agent_v1settings_agent_context_listen_provider", + "AgentV1SettingsAgentContextMessagesItemContentParams": ".agent_v1settings_agent_context_messages_item_content", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams": ".agent_v1settings_agent_context_messages_item_function_calls_function_calls_item", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams": ".agent_v1settings_agent_context_messages_item_function_calls", + "AgentV1SettingsAgentContextMessagesItemParams": ".agent_v1settings_agent_context_messages_item", + "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", + "AgentV1SettingsAgentListenProviderV1Params": ".agent_v1settings_agent_listen_provider_v1", + "AgentV1SettingsAgentListenProviderV2Params": ".agent_v1settings_agent_listen_provider_v2", + "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", + "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", + "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", +} + + +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", + "AgentV1ErrorParams", + "AgentV1FunctionCallRequestFunctionsItemParams", + "AgentV1FunctionCallRequestParams", + "AgentV1HistoryContentParams", + "AgentV1HistoryFunctionCallsFunctionCallsItemParams", + "AgentV1HistoryFunctionCallsParams", + "AgentV1HistoryParams", + "AgentV1InjectAgentMessageParams", + "AgentV1InjectUserMessageParams", + "AgentV1InjectionRefusedParams", + "AgentV1KeepAliveParams", + "AgentV1LatencyReportParams", + "AgentV1ListenUpdatedParams", + "AgentV1PromptUpdatedParams", + "AgentV1ReceiveFunctionCallResponseParams", + "AgentV1SendFunctionCallResponseParams", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams", + "AgentV1SettingsAgentContextContextMessagesItemParams", + "AgentV1SettingsAgentContextContextParams", + "AgentV1SettingsAgentContextListenParams", + "AgentV1SettingsAgentContextListenProviderParams", + "AgentV1SettingsAgentContextListenProviderV1Params", + "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams", + "AgentV1SettingsAgentContextListenProviderV2Params", + "AgentV1SettingsAgentContextListenProvider_V1Params", + "AgentV1SettingsAgentContextListenProvider_V2Params", + "AgentV1SettingsAgentContextMessagesItemContentParams", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams", + "AgentV1SettingsAgentContextMessagesItemParams", + "AgentV1SettingsAgentContextParams", + "AgentV1SettingsAgentContextSpeakParams", + "AgentV1SettingsAgentContextThinkParams", + "AgentV1SettingsAgentListenParams", + "AgentV1SettingsAgentListenProviderParams", + "AgentV1SettingsAgentListenProviderV1Params", + "AgentV1SettingsAgentListenProviderV2Params", + "AgentV1SettingsAgentListenProvider_V1Params", + "AgentV1SettingsAgentListenProvider_V2Params", + "AgentV1SettingsAgentParams", + "AgentV1SettingsAgentSpeakParams", + "AgentV1SettingsAgentThinkParams", + "AgentV1SettingsAppliedParams", + "AgentV1SettingsAudioInputParams", + "AgentV1SettingsAudioOutputParams", + "AgentV1SettingsAudioParams", + "AgentV1SettingsFlagsParams", + "AgentV1SettingsParams", + "AgentV1SpeakUpdatedParams", + "AgentV1ThinkUpdatedParams", + "AgentV1UpdateListenListenParams", + "AgentV1UpdateListenListenProviderParams", + "AgentV1UpdateListenListenProvider_V1Params", + "AgentV1UpdateListenListenProvider_V2Params", + "AgentV1UpdateListenParams", + "AgentV1UpdatePromptParams", + "AgentV1UpdateSpeakParams", + "AgentV1UpdateSpeakSpeakParams", + "AgentV1UpdateThinkParams", + "AgentV1UpdateThinkThinkParams", + "AgentV1UserStartedSpeakingParams", + "AgentV1WarningParams", + "AgentV1WelcomeParams", + "ConversationHistoryMessageParams", + "FunctionCallHistoryMessageFunctionCallsItemParams", + "FunctionCallHistoryMessageParams", +] 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..01bffc21 --- /dev/null +++ b/src/deepgram/agent/v1/requests/agent_v1settings_agent.py.bak @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing_extensions +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] + """ + Deprecated. Use `listen.provider.language` and `speak.provider.language` fields instead. + """ + + context: typing_extensions.NotRequired[AgentV1SettingsAgentContextParams] + """ + Conversation context including the history of messages and function calls + """ + + listen: typing_extensions.NotRequired[AgentV1SettingsAgentListenParams] + think: typing_extensions.NotRequired[AgentV1SettingsAgentThinkParams] + speak: typing_extensions.NotRequired[AgentV1SettingsAgentSpeakParams] + greeting: typing_extensions.NotRequired[str] + """ + Optional message that agent will speak at the start + """ 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..b399ef99 --- /dev/null +++ b/src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py.bak @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import typing_extensions +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]] + """ + Deprecated. Conversation history as a list of messages and function calls. + """ + + 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] + 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..70616b09 --- /dev/null +++ b/src/deepgram/agent/v1/socket_client.py.bak @@ -0,0 +1,379 @@ +# 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_v1error import AgentV1Error +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_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_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_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: + """ + Recursively convert float values that are whole numbers to int. + + Workaround for Fern-generated models that type integer API fields + (like sample_rate) as float, causing JSON serialization to produce + values like 44100.0 instead of 44100. The Deepgram API rejects + float representations of integer fields. + + See: https://github.com/deepgram/internal-api-specs/issues/205 + """ + if isinstance(obj, dict): + return {k: _sanitize_numeric_types(v) for k, v in obj.items()} + elif isinstance(obj, list): + return [_sanitize_numeric_types(item) for item in obj] + elif isinstance(obj, float) and obj.is_integer(): + return int(obj) + return obj + + +_logger = logging.getLogger(__name__) +V1SocketClientResponse = typing.Union[ + AgentV1ListenUpdated, + AgentV1ThinkUpdated, + AgentV1ReceiveFunctionCallResponse, + AgentV1PromptUpdated, + AgentV1SpeakUpdated, + AgentV1InjectionRefused, + AgentV1Welcome, + AgentV1SettingsApplied, + AgentV1ConversationText, + AgentV1UserStartedSpeaking, + AgentV1AgentThinking, + AgentV1LatencyReport, + AgentV1FunctionCallRequest, + AgentV1AgentStartedSpeaking, + AgentV1AgentAudioDone, + AgentV1Error, + AgentV1Warning, + AgentV1History, + bytes, +] + + +class AsyncV1SocketClient(EventEmitterMixin): + def __init__(self, *, websocket: WebSocketClientProtocol): + super().__init__() + self._websocket = websocket + + async def __aiter__(self): + 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_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_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_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_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): + 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_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_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_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_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..7c6e20c6 --- /dev/null +++ b/src/deepgram/agent/v1/types/__init__.py.bak @@ -0,0 +1,278 @@ +# 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_role import AgentV1ConversationTextRole + from .agent_v1error import AgentV1Error + 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_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_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_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 + from .agent_v1history_content import AgentV1HistoryContent + from .agent_v1history_content_role import AgentV1HistoryContentRole + from .agent_v1history_function_calls import AgentV1HistoryFunctionCalls + from .agent_v1history_function_calls_function_calls_item import AgentV1HistoryFunctionCallsFunctionCallsItem + from .agent_v1settings_agent_context_context_messages_item_content_role import AgentV1SettingsAgentContextContextMessagesItemContentRole + from .agent_v1settings_agent_context_context_messages_item_function_calls_function_calls_item import AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem + from .agent_v1settings_agent_context_listen_provider_v1 import AgentV1SettingsAgentContextListenProviderV1 + from .agent_v1settings_agent_context_listen_provider_v2 import AgentV1SettingsAgentContextListenProviderV2 + from .agent_v1settings_agent_context_listen_provider_v2language_hint import AgentV1SettingsAgentContextListenProviderV2LanguageHint + from .agent_v1settings_agent_context_messages_item import AgentV1SettingsAgentContextMessagesItem + from .agent_v1settings_agent_context_messages_item_content import AgentV1SettingsAgentContextMessagesItemContent + from .agent_v1settings_agent_context_messages_item_content_role import AgentV1SettingsAgentContextMessagesItemContentRole + from .agent_v1settings_agent_context_messages_item_function_calls import AgentV1SettingsAgentContextMessagesItemFunctionCalls + from .agent_v1settings_agent_context_messages_item_function_calls_function_calls_item import AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem + from .agent_v1settings_agent_listen_provider_v1 import AgentV1SettingsAgentListenProviderV1 + from .agent_v1settings_agent_listen_provider_v2 import AgentV1SettingsAgentListenProviderV2 +_dynamic_imports: typing.Dict[str, str] = { + "AgentV1AgentAudioDone": ".agent_v1agent_audio_done", + "AgentV1AgentStartedSpeaking": ".agent_v1agent_started_speaking", + "AgentV1AgentThinking": ".agent_v1agent_thinking", + "AgentV1ConversationText": ".agent_v1conversation_text", + "AgentV1ConversationTextRole": ".agent_v1conversation_text_role", + "AgentV1Error": ".agent_v1error", + "AgentV1FunctionCallRequest": ".agent_v1function_call_request", + "AgentV1FunctionCallRequestFunctionsItem": ".agent_v1function_call_request_functions_item", + "AgentV1History": ".agent_v1history", + "AgentV1HistoryContent": ".agent_v1history_content", + "AgentV1HistoryContentRole": ".agent_v1history_content_role", + "AgentV1HistoryFunctionCalls": ".agent_v1history_function_calls", + "AgentV1HistoryFunctionCallsFunctionCallsItem": ".agent_v1history_function_calls_function_calls_item", + "AgentV1InjectAgentMessage": ".agent_v1inject_agent_message", + "AgentV1InjectAgentMessageBehavior": ".agent_v1inject_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", + "AgentV1SettingsAgentContextContextMessagesItemContentRole": ".agent_v1settings_agent_context_context_messages_item_content_role", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem": ".agent_v1settings_agent_context_context_messages_item_function_calls_function_calls_item", + "AgentV1SettingsAgentContextListen": ".agent_v1settings_agent_context_listen", + "AgentV1SettingsAgentContextListenProvider": ".agent_v1settings_agent_context_listen_provider", + "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", + "AgentV1SettingsAgentContextListenProvider_V1": ".agent_v1settings_agent_context_listen_provider", + "AgentV1SettingsAgentContextListenProvider_V2": ".agent_v1settings_agent_context_listen_provider", + "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", + "AgentV1SettingsAgentContextSpeak": ".agent_v1settings_agent_context_speak", + "AgentV1SettingsAgentContextThink": ".agent_v1settings_agent_context_think", + "AgentV1SettingsAgentListen": ".agent_v1settings_agent_listen", + "AgentV1SettingsAgentListenProvider": ".agent_v1settings_agent_listen_provider", + "AgentV1SettingsAgentListenProviderV1": ".agent_v1settings_agent_listen_provider_v1", + "AgentV1SettingsAgentListenProviderV2": ".agent_v1settings_agent_listen_provider_v2", + "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", + "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", + "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", +} + + +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", + "AgentV1ConversationTextRole", + "AgentV1Error", + "AgentV1FunctionCallRequest", + "AgentV1FunctionCallRequestFunctionsItem", + "AgentV1History", + "AgentV1HistoryContent", + "AgentV1HistoryContentRole", + "AgentV1HistoryFunctionCalls", + "AgentV1HistoryFunctionCallsFunctionCallsItem", + "AgentV1InjectAgentMessage", + "AgentV1InjectAgentMessageBehavior", + "AgentV1InjectUserMessage", + "AgentV1InjectionRefused", + "AgentV1KeepAlive", + "AgentV1LatencyReport", + "AgentV1ListenUpdated", + "AgentV1PromptUpdated", + "AgentV1ReceiveFunctionCallResponse", + "AgentV1SendFunctionCallResponse", + "AgentV1Settings", + "AgentV1SettingsAgent", + "AgentV1SettingsAgentContext", + "AgentV1SettingsAgentContextContext", + "AgentV1SettingsAgentContextContextMessagesItem", + "AgentV1SettingsAgentContextContextMessagesItemContentRole", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem", + "AgentV1SettingsAgentContextListen", + "AgentV1SettingsAgentContextListenProvider", + "AgentV1SettingsAgentContextListenProviderV1", + "AgentV1SettingsAgentContextListenProviderV2", + "AgentV1SettingsAgentContextListenProviderV2LanguageHint", + "AgentV1SettingsAgentContextListenProvider_V1", + "AgentV1SettingsAgentContextListenProvider_V2", + "AgentV1SettingsAgentContextMessagesItem", + "AgentV1SettingsAgentContextMessagesItemContent", + "AgentV1SettingsAgentContextMessagesItemContentRole", + "AgentV1SettingsAgentContextMessagesItemFunctionCalls", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem", + "AgentV1SettingsAgentContextSpeak", + "AgentV1SettingsAgentContextThink", + "AgentV1SettingsAgentListen", + "AgentV1SettingsAgentListenProvider", + "AgentV1SettingsAgentListenProviderV1", + "AgentV1SettingsAgentListenProviderV2", + "AgentV1SettingsAgentListenProvider_V1", + "AgentV1SettingsAgentListenProvider_V2", + "AgentV1SettingsAgentSpeak", + "AgentV1SettingsAgentThink", + "AgentV1SettingsApplied", + "AgentV1SettingsAudio", + "AgentV1SettingsAudioInput", + "AgentV1SettingsAudioInputEncoding", + "AgentV1SettingsAudioOutput", + "AgentV1SettingsAudioOutputContainer", + "AgentV1SettingsAudioOutputEncoding", + "AgentV1SettingsFlags", + "AgentV1SpeakUpdated", + "AgentV1ThinkUpdated", + "AgentV1UpdateListen", + "AgentV1UpdateListenListen", + "AgentV1UpdateListenListenProvider", + "AgentV1UpdateListenListenProvider_V1", + "AgentV1UpdateListenListenProvider_V2", + "AgentV1UpdatePrompt", + "AgentV1UpdateSpeak", + "AgentV1UpdateSpeakSpeak", + "AgentV1UpdateThink", + "AgentV1UpdateThinkThink", + "AgentV1UserStartedSpeaking", + "AgentV1Warning", + "AgentV1Welcome", + "ConversationHistoryMessage", + "ConversationHistoryMessageRole", + "FunctionCallHistoryMessage", + "FunctionCallHistoryMessageFunctionCallsItem", +] 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..0335ad2c --- /dev/null +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent.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 .agent_v1settings_agent_context import AgentV1SettingsAgentContext +from .agent_v1settings_agent_listen import AgentV1SettingsAgentListen + + +class AgentV1SettingsAgent(AgentV1SettingsAgentContext): + # Backward-compat: before the 2026-05-05 schema restructure this public name + # was the top-level agent settings model. Keep it callable and translate the + # legacy nested `context=AgentV1SettingsAgentContext(messages=[...])` shape + # into the current `context={"messages": [...]}` payload. + 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.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.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..776a2936 --- /dev/null +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent_context.py.bak @@ -0,0 +1,73 @@ +# 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_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] = None + speak: typing.Optional[AgentV1SettingsAgentContextSpeak] = None + greeting: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional message that agent will speak at the start + """ + + # Backward-compat: pre-2026-05-05 callers passed `messages=[...]` directly on + # AgentV1SettingsAgentContext. The schema now nests that list under + # `context.messages`. Translate the legacy kwarg into the new shape so old + # call sites keep producing the correct wire payload. + 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) + messages = values.pop("messages") + values["context"] = {"messages": messages} + return values + else: + + @pydantic.root_validator(pre=True) # type: ignore[deprecated] + def _migrate_legacy_messages_to_context( # type: ignore[no-redef] + cls, values: typing.Any + ) -> typing.Any: + if isinstance(values, dict) and "messages" in values and "context" not in values: + values = dict(values) + messages = values.pop("messages") + values["context"] = {"messages": messages} + return values + + @property + def messages(self) -> typing.Optional[typing.List[AgentV1SettingsAgentContextMessagesItem]]: + if self.context is None: + return None + return self.context.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/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..13d6739a --- /dev/null +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py.bak @@ -0,0 +1,86 @@ +# 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 + + # Backward-compat: the public field was historically named `language_hint` + # and accepted a string or a list. The API field is `language_hints` (a + # list). Translate the legacy kwarg so existing callers keep working, and + # drop the dead singular key so it is not rejected by the API + # (deny_unknown_fields). Hand-maintained. + 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): + return values + if "language_hint" in 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 + 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): + return values + if "language_hint" in 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 + + 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 + + +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..9bc63301 --- /dev/null +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py.bak @@ -0,0 +1,86 @@ +# 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 + + # Backward-compat: the public field was historically named `language_hint` + # and accepted a string or a list. The API field is `language_hints` (a + # list). Translate the legacy kwarg so existing callers keep working, and + # drop the dead singular key so it is not rejected by the API + # (deny_unknown_fields). Hand-maintained. + 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): + return values + if "language_hint" in 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 + 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): + return values + if "language_hint" in 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 + + 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 + + +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..62273600 --- /dev/null +++ b/src/deepgram/agent/v1/types/agent_v1update_listen_listen.py.bak @@ -0,0 +1,81 @@ +# 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 + +# Fields that exist only on the v1 (Listen V1) provider shape. Used to infer the +# intended version of a legacy unversioned dict from its own keys, rather than +# blanket-stamping "v2" onto a dict that is clearly describing a v1 provider. +_V1_ONLY_KEYS = frozenset({"language", "smart_format"}) + + +def _coerce_legacy_update_listen_provider(values: typing.Any) -> typing.Any: + # Backward-compat: before the 2026-07-31 regen the provider field was a bare + # DeepgramListenProviderV2. The regen replaced it with the versioned + # AgentV1UpdateListenListenProvider union (discriminant="version"). Coerce a + # legacy Deepgram provider (or a dict lacking the version discriminant) into + # the new shape so existing callers keep producing the correct wire payload. + 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: + # Route the dict through the same shim model the instance branches + # use, so its own `model_validator(mode="before")` runs. That is what + # remaps a deprecated `language_hint=` to `language_hints` and drops + # the singular key -- the API uses deny_unknown_fields, so leaving it + # in is a hard rejection. Going through the model keeps ONE remap + # implementation instead of duplicating it here. + coerced = provider_cls(**provider).dict() + except Exception: + # A malformed dict (e.g. missing the required `model`) makes the + # model constructor raise. Pre-regen this path passed the dict + # through untouched, so fall back to that rather than turning a + # compat shim into a new source of exceptions. + 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) + 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) + + 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/core/api_error.py.bak b/src/deepgram/core/api_error.py.bak new file mode 100644 index 00000000..a24abadc --- /dev/null +++ b/src/deepgram/core/api_error.py.bak @@ -0,0 +1,31 @@ +# 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: + # Mask credential headers at construction, not just in __str__. The + # websocket connect paths raise with the full request headers, so an + # unredacted Authorization would otherwise reach anywhere this exception + # goes: str(e), a traceback, a log aggregator, or an error tracker (which + # serialises attributes as well as the message). Non-sensitive headers are + # kept -- dg-request-id is the main reason to look at them at all. + 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/parse_error.py.bak b/src/deepgram/core/parse_error.py.bak new file mode 100644 index 00000000..bfa3a2f7 --- /dev/null +++ b/src/deepgram/core/parse_error.py.bak @@ -0,0 +1,40 @@ +# 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: + # See the note in core/api_error.py: credential headers are masked at + # construction so they cannot reach a log, traceback, or error tracker. + 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..6b81f9bc --- /dev/null +++ b/src/deepgram/core/query_encoder.py.bak @@ -0,0 +1,66 @@ +# 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 stringifies bools via str(), producing "True"/"False"; + # APIs (including Deepgram's websocket endpoints) expect lowercase. + 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..54752b7b --- /dev/null +++ b/src/deepgram/listen/__init__.py.bak @@ -0,0 +1,212 @@ +# 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, + 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, + ) + from .v2 import ListenV2CloseStreamType +_dynamic_imports: typing.Dict[str, str] = { + "DiarizeModel": ".v1", + "ListenV1CloseStream": ".v1", + "ListenV1CloseStreamParams": ".v1", + "ListenV1CloseStreamType": ".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", + "ListenV2CloseStreamType": ".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", + "v1": ".v1", + "v2": ".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", + "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", + "ListenV2CloseStreamType", + "ListenV2Configure", + "ListenV2ConfigureFailure", + "ListenV2ConfigureFailureParams", + "ListenV2ConfigureParams", + "ListenV2ConfigureSuccess", + "ListenV2ConfigureSuccessParams", + "ListenV2ConfigureSuccessThresholds", + "ListenV2ConfigureSuccessThresholdsParams", + "ListenV2ConfigureThresholds", + "ListenV2ConfigureThresholdsParams", + "ListenV2Connected", + "ListenV2ConnectedParams", + "ListenV2FatalError", + "ListenV2FatalErrorParams", + "ListenV2ForceEndTurn", + "ListenV2ForceEndTurnParams", + "ListenV2TurnInfo", + "ListenV2TurnInfoEvent", + "ListenV2TurnInfoParams", + "ListenV2TurnInfoWordsItem", + "ListenV2TurnInfoWordsItemParams", + "v1", + "v2", +] 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..5954d116 --- /dev/null +++ b/src/deepgram/listen/v1/socket_client.py.bak @@ -0,0 +1,234 @@ +# 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_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[ListenV1Results, ListenV1Metadata, ListenV1UtteranceEnd, ListenV1SpeechStarted] + + +class AsyncV1SocketClient(EventEmitterMixin): + def __init__(self, *, websocket: WebSocketClientProtocol): + super().__init__() + self._websocket = websocket + + async def __aiter__(self): + 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 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): + 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 recv(self) -> V1SocketClientResponse: + """ + Receive a message from the websocket connection. + """ + data = self._websocket.recv() + if isinstance(data, bytes): + return data # type: ignore + json_data = json.loads(data) + try: + return construct_type(type_=V1SocketClientResponse, object_=json_data) # type: ignore + except Exception: + _logger.warning("Skipping unknown WebSocket message; update your SDK version to support new message types.") + return json_data # type: ignore + + def _send(self, data: typing.Any) -> None: + """ + Send a message to the websocket connection. + """ + if isinstance(data, dict): + data = json.dumps(data) + self._websocket.send(data) + + def _send_model(self, data: typing.Any) -> None: + """ + Send a Pydantic model to the websocket connection. + """ + self._send(data.dict()) diff --git a/src/deepgram/listen/v2/__init__.py.bak b/src/deepgram/listen/v2/__init__.py.bak new file mode 100644 index 00000000..ebb5f4a9 --- /dev/null +++ b/src/deepgram/listen/v2/__init__.py.bak @@ -0,0 +1,111 @@ +# 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, + ) + from .requests import ( + ListenV2CloseStreamParams, + ListenV2ConfigureFailureParams, + ListenV2ConfigureParams, + ListenV2ConfigureSuccessParams, + ListenV2ConfigureSuccessThresholdsParams, + ListenV2ConfigureThresholdsParams, + ListenV2ConnectedParams, + ListenV2FatalErrorParams, + ListenV2ForceEndTurnParams, + ListenV2TurnInfoParams, + ListenV2TurnInfoWordsItemParams, + ) + from .types import ListenV2CloseStreamType +_dynamic_imports: typing.Dict[str, str] = { + "ListenV2CloseStream": ".types", + "ListenV2CloseStreamParams": ".requests", + "ListenV2CloseStreamType": ".types", + "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", +} + + +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", + "ListenV2CloseStreamType", + "ListenV2Configure", + "ListenV2ConfigureFailure", + "ListenV2ConfigureFailureParams", + "ListenV2ConfigureParams", + "ListenV2ConfigureSuccess", + "ListenV2ConfigureSuccessParams", + "ListenV2ConfigureSuccessThresholds", + "ListenV2ConfigureSuccessThresholdsParams", + "ListenV2ConfigureThresholds", + "ListenV2ConfigureThresholdsParams", + "ListenV2Connected", + "ListenV2ConnectedParams", + "ListenV2FatalError", + "ListenV2FatalErrorParams", + "ListenV2ForceEndTurn", + "ListenV2ForceEndTurnParams", + "ListenV2TurnInfo", + "ListenV2TurnInfoEvent", + "ListenV2TurnInfoParams", + "ListenV2TurnInfoWordsItem", + "ListenV2TurnInfoWordsItemParams", +] 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..b441bbb0 --- /dev/null +++ b/src/deepgram/listen/v2/socket_client.py.bak @@ -0,0 +1,265 @@ +# 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 + +try: + from websockets.legacy.client import WebSocketClientProtocol # type: ignore +except ImportError: + from websockets import WebSocketClientProtocol # type: ignore + +_logger = logging.getLogger(__name__) +V2SocketClientResponse = typing.Union[ + ListenV2Connected, ListenV2TurnInfo, ListenV2ConfigureSuccess, ListenV2ConfigureFailure, ListenV2FatalError +] + + +class AsyncV2SocketClient(EventEmitterMixin): + def __init__(self, *, websocket: WebSocketClientProtocol): + super().__init__() + self._websocket = websocket + + async def __aiter__(self): + 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. + + Ends the current turn immediately, whatever the end-of-turn confidence. The + resulting ``TurnInfo`` carries ``trigger="manual"``, and the connection stays open + for the next turn. + + Requires server-side enablement. On a deployment without it the server replies + ``UNPARSABLE_CLIENT_MESSAGE`` ("The ForceEndTurn message is not enabled on this + deployment.") and **closes the connection**, so guard against that path until the + feature is confirmed live for the deployment you target. + """ + 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. A raw dict is also + accepted and sent verbatim for back-compat with pre-typed-model callers. + """ + if isinstance(message, dict): + await self._send(message) + else: + await self._send_model(message) + + async def recv(self) -> V2SocketClientResponse: + """ + Receive a message from the websocket connection. + """ + data = await self._websocket.recv() + if isinstance(data, bytes): + return data # type: ignore + json_data = json.loads(data) + try: + return construct_type(type_=V2SocketClientResponse, object_=json_data) # type: ignore + except Exception: + _logger.warning("Skipping unknown WebSocket message; update your SDK version to support new message types.") + return json_data # type: ignore + + async def _send(self, data: typing.Any) -> None: + """ + Send a message to the websocket connection. + """ + if isinstance(data, dict): + data = json.dumps(data) + await self._websocket.send(data) + + async def _send_model(self, data: typing.Any) -> None: + """ + Send a Pydantic model to the websocket connection. + """ + await self._send(data.dict()) + + +class V2SocketClient(EventEmitterMixin): + def __init__(self, *, websocket: websockets_sync_connection.Connection): + super().__init__() + self._websocket = websocket + + def __iter__(self): + 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. + + Ends the current turn immediately, whatever the end-of-turn confidence. The + resulting ``TurnInfo`` carries ``trigger="manual"``, and the connection stays open + for the next turn. + + Requires server-side enablement. On a deployment without it the server replies + ``UNPARSABLE_CLIENT_MESSAGE`` ("The ForceEndTurn message is not enabled on this + deployment.") and **closes the connection**, so guard against that path until the + feature is confirmed live for the deployment you target. + """ + 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. A raw dict is also + accepted and sent verbatim for back-compat with pre-typed-model callers. + """ + if isinstance(message, dict): + self._send(message) + else: + self._send_model(message) + + def recv(self) -> V2SocketClientResponse: + """ + Receive a message from the websocket connection. + """ + data = self._websocket.recv() + if isinstance(data, bytes): + return data # type: ignore + json_data = json.loads(data) + try: + return construct_type(type_=V2SocketClientResponse, object_=json_data) # type: ignore + except Exception: + _logger.warning("Skipping unknown WebSocket message; update your SDK version to support new message types.") + return json_data # type: ignore + + def _send(self, data: typing.Any) -> None: + """ + Send a message to the websocket connection. + """ + if isinstance(data, dict): + data = json.dumps(data) + self._websocket.send(data) + + def _send_model(self, data: typing.Any) -> None: + """ + Send a Pydantic model to the websocket connection. + """ + self._send(data.dict()) diff --git a/src/deepgram/listen/v2/types/__init__.py.bak b/src/deepgram/listen/v2/types/__init__.py.bak new file mode 100644 index 00000000..7f084d96 --- /dev/null +++ b/src/deepgram/listen/v2/types/__init__.py.bak @@ -0,0 +1,74 @@ +# 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_v2close_stream_type import ListenV2CloseStreamType +_dynamic_imports: typing.Dict[str, str] = { + "ListenV2CloseStream": ".listen_v2close_stream", + "ListenV2CloseStreamType": ".listen_v2close_stream_type", + "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", +} + + +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", + "ListenV2CloseStreamType", + "ListenV2Configure", + "ListenV2ConfigureFailure", + "ListenV2ConfigureSuccess", + "ListenV2ConfigureSuccessThresholds", + "ListenV2ConfigureThresholds", + "ListenV2Connected", + "ListenV2FatalError", + "ListenV2ForceEndTurn", + "ListenV2TurnInfo", + "ListenV2TurnInfoEvent", + "ListenV2TurnInfoWordsItem", +] 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..bf30e353 --- /dev/null +++ b/src/deepgram/listen/v2/types/listen_v2configure_failure.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 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. + """ + + 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..bde84d6f --- /dev/null +++ b/src/deepgram/listen/v2/types/listen_v2configure_success.py.bak @@ -0,0 +1,49 @@ +# 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_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. + """ + + 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/requests/__init__.py.bak b/src/deepgram/requests/__init__.py.bak new file mode 100644 index 00000000..e3de268f --- /dev/null +++ b/src/deepgram/requests/__init__.py.bak @@ -0,0 +1,596 @@ +# 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 .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_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_results import SharedIntentsResultsParams + from .shared_intents_results_intents import SharedIntentsResultsIntentsParams + from .shared_intents_results_intents_segments_item import SharedIntentsResultsIntentsSegmentsItemParams + from .shared_intents_results_intents_segments_item_intents_item import ( + SharedIntentsResultsIntentsSegmentsItemIntentsItemParams, + ) + 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_results import SharedTopicsResultsParams + from .shared_topics_results_topics import SharedTopicsResultsTopicsParams + from .shared_topics_results_topics_segments_item import SharedTopicsResultsTopicsSegmentsItemParams + from .shared_topics_results_topics_segments_item_topics_item import ( + SharedTopicsResultsTopicsSegmentsItemTopicsItemParams, + ) + 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_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_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 + from .cartesia_speak_provider_voice import CartesiaSpeakProviderVoiceParams + from .create_key_v1request_one import CreateKeyV1RequestOneParams + from .deepgram_listen_provider_v2language_hint import DeepgramListenProviderV2LanguageHintParams +_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", + "CartesiaSpeakProviderVoiceParams": ".cartesia_speak_provider_voice", + "CartesiaVoiceParams": ".cartesia_voice", + "CreateAgentConfigurationV1ResponseParams": ".create_agent_configuration_v1response", + "CreateKeyV1RequestOneParams": ".create_key_v1request_one", + "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", + "DeepgramListenProviderV2LanguageHintParams": ".deepgram_listen_provider_v2language_hint", + "DeepgramListenProviderV2Params": ".deepgram_listen_provider_v2", + "DeepgramParams": ".deepgram", + "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", + "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", + "SharedIntentsResultsIntentsParams": ".shared_intents_results_intents", + "SharedIntentsResultsIntentsSegmentsItemIntentsItemParams": ".shared_intents_results_intents_segments_item_intents_item", + "SharedIntentsResultsIntentsSegmentsItemParams": ".shared_intents_results_intents_segments_item", + "SharedIntentsResultsParams": ".shared_intents_results", + "SharedSentimentsAverageParams": ".shared_sentiments_average", + "SharedSentimentsParams": ".shared_sentiments", + "SharedSentimentsSegmentsItemParams": ".shared_sentiments_segments_item", + "SharedTopicsParams": ".shared_topics", + "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", + "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", + "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_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", +} + + +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", + "CartesiaSpeakProviderVoiceParams", + "CartesiaVoiceParams", + "CreateAgentConfigurationV1ResponseParams", + "CreateKeyV1RequestOneParams", + "CreateKeyV1RequestParams", + "CreateKeyV1ResponseParams", + "CreateProjectDistributionCredentialsV1ResponseDistributionCredentialsParams", + "CreateProjectDistributionCredentialsV1ResponseMemberParams", + "CreateProjectDistributionCredentialsV1ResponseParams", + "CreateProjectInviteV1ResponseParams", + "DeepgramListenProviderV1Params", + "DeepgramListenProviderV2LanguageHintParams", + "DeepgramListenProviderV2Params", + "DeepgramParams", + "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", + "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", + "SharedIntentsResultsIntentsParams", + "SharedIntentsResultsIntentsSegmentsItemIntentsItemParams", + "SharedIntentsResultsIntentsSegmentsItemParams", + "SharedIntentsResultsParams", + "SharedSentimentsAverageParams", + "SharedSentimentsParams", + "SharedSentimentsSegmentsItemParams", + "SharedTopicsParams", + "SharedTopicsResultsParams", + "SharedTopicsResultsTopicsParams", + "SharedTopicsResultsTopicsSegmentsItemParams", + "SharedTopicsResultsTopicsSegmentsItemTopicsItemParams", + "SpeakSettingsV1EndpointParams", + "SpeakSettingsV1Params", + "SpeakSettingsV1ProviderParams", + "SpeakSettingsV1Provider_AwsPollyParams", + "SpeakSettingsV1Provider_CartesiaParams", + "SpeakSettingsV1Provider_DeepgramParams", + "SpeakSettingsV1Provider_ElevenLabsParams", + "SpeakSettingsV1Provider_OpenAiParams", + "SpeakV2AcceptedResponseParams", + "ThinkSettingsV1ContextLengthParams", + "ThinkSettingsV1EndpointParams", + "ThinkSettingsV1FunctionsItemEndpointParams", + "ThinkSettingsV1FunctionsItemParams", + "ThinkSettingsV1Params", + "ThinkSettingsV1ProviderParams", + "ThinkSettingsV1Provider_AnthropicParams", + "ThinkSettingsV1Provider_AwsBedrockParams", + "ThinkSettingsV1Provider_GoogleParams", + "ThinkSettingsV1Provider_GroqParams", + "ThinkSettingsV1Provider_OpenAiParams", + "UpdateProjectMemberScopesV1ResponseParams", + "UpdateProjectV1ResponseParams", + "UsageBreakdownV1ResponseParams", + "UsageBreakdownV1ResponseResolutionParams", + "UsageBreakdownV1ResponseResultsItemGroupingParams", + "UsageBreakdownV1ResponseResultsItemParams", + "UsageFieldsV1ResponseModelsItemParams", + "UsageFieldsV1ResponseParams", + "UsageV1ResponseParams", + "UsageV1ResponseResolutionParams", +] 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..e3c28bb5 --- /dev/null +++ b/src/deepgram/speak/v1/socket_client.py.bak @@ -0,0 +1,235 @@ +# 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] + + +class AsyncV1SocketClient(EventEmitterMixin): + def __init__(self, *, websocket: WebSocketClientProtocol): + super().__init__() + self._websocket = websocket + + async def __aiter__(self): + 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_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): + 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_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/socket_client.py.bak b/src/deepgram/speak/v2/socket_client.py.bak new file mode 100644 index 00000000..c6729c32 --- /dev/null +++ b/src/deepgram/speak/v2/socket_client.py.bak @@ -0,0 +1,268 @@ +# 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, +] + + +class AsyncV2SocketClient(EventEmitterMixin): + def __init__(self, *, websocket: WebSocketClientProtocol): + super().__init__() + self._websocket = websocket + + async def __aiter__(self): + 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_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): + 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_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/types/__init__.py.bak b/src/deepgram/types/__init__.py.bak new file mode 100644 index 00000000..54b2869d --- /dev/null +++ b/src/deepgram/types/__init__.py.bak @@ -0,0 +1,844 @@ +# 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 .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_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_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_results import SharedIntentsResults + from .shared_intents_results_intents import SharedIntentsResultsIntents + from .shared_intents_results_intents_segments_item import SharedIntentsResultsIntentsSegmentsItem + from .shared_intents_results_intents_segments_item_intents_item import ( + SharedIntentsResultsIntentsSegmentsItemIntentsItem, + ) + 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_results import SharedTopicsResults + from .shared_topics_results_topics import SharedTopicsResultsTopics + from .shared_topics_results_topics_segments_item import SharedTopicsResultsTopicsSegmentsItem + from .shared_topics_results_topics_segments_item_topics_item import SharedTopicsResultsTopicsSegmentsItemTopicsItem + 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_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_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 + from .anthropic_think_provider_model import AnthropicThinkProviderModel + from .cartesia_speak_provider_model_id import CartesiaSpeakProviderModelId + from .cartesia_speak_provider_voice import CartesiaSpeakProviderVoice + from .create_key_v1request_one import CreateKeyV1RequestOne + from .deepgram_listen_provider_v2language_hint import DeepgramListenProviderV2LanguageHint + from .deepgram_speak_provider_model import DeepgramSpeakProviderModel + from .google_think_provider_model import GoogleThinkProviderModel + from .google_think_provider_version import GoogleThinkProviderVersion + from .groq_think_provider_reasoning_mode import GroqThinkProviderReasoningMode +_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", + "AnthropicThinkProviderModel": ".anthropic_think_provider_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", + "CartesiaSpeakProviderModelId": ".cartesia_speak_provider_model_id", + "CartesiaSpeakProviderVoice": ".cartesia_speak_provider_voice", + "CartesiaVoice": ".cartesia_voice", + "CreateAgentConfigurationV1Response": ".create_agent_configuration_v1response", + "CreateKeyV1Request": ".create_key_v1request", + "CreateKeyV1RequestOne": ".create_key_v1request_one", + "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", + "DeepgramListenProviderV2LanguageHint": ".deepgram_listen_provider_v2language_hint", + "DeepgramModel": ".deepgram_model", + "DeepgramSpeakProviderModel": ".deepgram_speak_provider_model", + "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", + "GoogleThinkProviderModel": ".google_think_provider_model", + "GoogleThinkProviderVersion": ".google_think_provider_version", + "GoogleVersion": ".google_version", + "GrantV1Response": ".grant_v1response", + "Groq": ".groq", + "GroqReasoningMode": ".groq_reasoning_mode", + "GroqThinkProviderReasoningMode": ".groq_think_provider_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", + "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", + "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", + "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", + "SharedSentiments": ".shared_sentiments", + "SharedSentimentsAverage": ".shared_sentiments_average", + "SharedSentimentsSegmentsItem": ".shared_sentiments_segments_item", + "SharedTopics": ".shared_topics", + "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", + "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", + "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_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", +} + + +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", + "AnthropicThinkProviderModel", + "AwsBedrockThinkProvider", + "AwsBedrockThinkProviderCredentials", + "AwsBedrockThinkProviderCredentialsType", + "AwsBedrockThinkProviderModel", + "AwsPollySpeakProvider", + "AwsPollySpeakProviderCredentials", + "AwsPollySpeakProviderCredentialsType", + "AwsPollySpeakProviderEngine", + "AwsPollySpeakProviderVoice", + "BillingBreakdownV1Response", + "BillingBreakdownV1ResponseResolution", + "BillingBreakdownV1ResponseResultsItem", + "BillingBreakdownV1ResponseResultsItemGrouping", + "Cartesia", + "CartesiaModelId", + "CartesiaSpeakProviderModelId", + "CartesiaSpeakProviderVoice", + "CartesiaVoice", + "CreateAgentConfigurationV1Response", + "CreateKeyV1Request", + "CreateKeyV1RequestOne", + "CreateKeyV1Response", + "CreateProjectDistributionCredentialsV1Response", + "CreateProjectDistributionCredentialsV1ResponseDistributionCredentials", + "CreateProjectDistributionCredentialsV1ResponseMember", + "CreateProjectInviteV1Response", + "Deepgram", + "DeepgramListenProviderV1", + "DeepgramListenProviderV2", + "DeepgramListenProviderV2LanguageHint", + "DeepgramModel", + "DeepgramSpeakProviderModel", + "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", + "GoogleThinkProviderModel", + "GoogleThinkProviderVersion", + "GoogleVersion", + "GrantV1Response", + "Groq", + "GroqReasoningMode", + "GroqThinkProviderReasoningMode", + "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", + "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", + "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", + "SharedIntentsResults", + "SharedIntentsResultsIntents", + "SharedIntentsResultsIntentsSegmentsItem", + "SharedIntentsResultsIntentsSegmentsItemIntentsItem", + "SharedSentiments", + "SharedSentimentsAverage", + "SharedSentimentsSegmentsItem", + "SharedTopics", + "SharedTopicsResults", + "SharedTopicsResultsTopics", + "SharedTopicsResultsTopicsSegmentsItem", + "SharedTopicsResultsTopicsSegmentsItemTopicsItem", + "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", + "ThinkSettingsV1", + "ThinkSettingsV1ContextLength", + "ThinkSettingsV1Endpoint", + "ThinkSettingsV1FunctionsItem", + "ThinkSettingsV1FunctionsItemEndpoint", + "ThinkSettingsV1Provider", + "ThinkSettingsV1Provider_Anthropic", + "ThinkSettingsV1Provider_AwsBedrock", + "ThinkSettingsV1Provider_Google", + "ThinkSettingsV1Provider_Groq", + "ThinkSettingsV1Provider_OpenAi", + "UpdateProjectMemberScopesV1Response", + "UpdateProjectV1Response", + "UsageBreakdownV1Response", + "UsageBreakdownV1ResponseResolution", + "UsageBreakdownV1ResponseResultsItem", + "UsageBreakdownV1ResponseResultsItemGrouping", + "UsageFieldsV1Response", + "UsageFieldsV1ResponseModelsItem", + "UsageV1Response", + "UsageV1ResponseResolution", +] 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..e55bf684 --- /dev/null +++ b/src/deepgram/types/deepgram_listen_provider_v2.py.bak @@ -0,0 +1,96 @@ +# 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 (str or list) for backward + compatibility and remapped to `language_hints` by the validator below; + `exclude=True` keeps it off the wire (the API rejects unknown fields). + """ + + eot_threshold: typing.Optional[float] = pydantic.Field(default=None) + """ + End-of-turn confidence required to finish a turn. Valid range: 0.5 - 0.9. Defaults to 0.7. + """ + + 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 + """ + + # Backward-compat: the public field was historically named `language_hint` + # and accepted a string or a list. The API field is `language_hints` (a + # list). Translate the legacy kwarg so existing callers keep working, and + # drop the dead singular key so it is not rejected by the API + # (deny_unknown_fields). Hand-maintained. + 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): + return values + if "language_hint" in 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 + 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): + return values + if "language_hint" in 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 + + 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/speak_v2speed.py.bak b/src/deepgram/types/speak_v2speed.py.bak new file mode 100644 index 00000000..b9e1e10c --- /dev/null +++ b/src/deepgram/types/speak_v2speed.py.bak @@ -0,0 +1,15 @@ +# This file was auto-generated by Fern from our API Definition. + +# Backward-compat patch (2026-08-18 regen): the generator retyped this from +# `float` to `Union[Literal["0.85"..."1.15"], Any]` -- a string-literal enum. +# That contradicts the actual API contract (a numeric speech-rate multiplier; +# see the sibling `SpeakV2SpeedValue = float` used by the Configure message) and +# silently changed the documented domain of the `speak.v2.connect(speed=...)` +# parameter from numeric to string. Only the `Any` fallback kept `speed=1.05` +# working. Restored to `float` so the connect param stays exactly what it was on +# `main`, mypy-precise (no reliance on `Any`), and consistent with the Configure +# message. Unfreeze when the spec types the connect `speed` as a number. +SpeakV2Speed = float +""" +Speech-rate multiplier. `1.0` is the model's nominal rate; lower is slower. Accepted values run `0.85` to `1.15` in `0.05` increments. A value outside that range is rejected with `SPEED_OUT_OF_RANGE`; a value inside it but off the `0.05` increment with `SPEED_INCREMENT_INVALID`. Models and languages without runtime speed control reject any value with `SPEED_NOT_SUPPORTED`. +""" 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..96a5bb28 --- /dev/null +++ b/tests/wire/test_listen_v1_media.py.bak @@ -0,0 +1,112 @@ +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: + """All 37 optional query params must reach the wire, with bools lowercased. + + The 2026-08-18 regen simplified the upstream spec *example* for this endpoint, + and Fern derives the wire test from that example -- so the generated test + dropped every query parameter, leaving their serialization unverified while + the client signature still forwards all 37. This restores that coverage; the + file is frozen in .fernignore so a future regen cannot silently drop it again. + + Same failure mode as tests/wire/test_manage_v1_projects_keys.py and + tests/wire/test_manage_v1_projects_requests.py, which are frozen for this reason. + """ + 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="language", + 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": "language", + "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..cf232369 --- /dev/null +++ b/tests/wire/test_manage_v1_projects_keys.py.bak @@ -0,0 +1,63 @@ +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 create endpoint with the legacy request alias""" + 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..acf577b0 --- /dev/null +++ b/tests/wire/test_manage_v1_projects_requests.py.bak @@ -0,0 +1,74 @@ +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: + """All ten optional query params must reach the wire, with datetime encoded as ISO-8601 Z. + + The 2026-08-11 regen simplified the upstream spec *example* for this endpoint, + and Fern derives the wire test from that example -- so the generated test + dropped every query parameter, leaving their serialization unverified while + the client signature still forwards all ten. This restores that coverage; the + file is frozen in .fernignore so a future regen cannot silently drop it again. + """ + 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 9c5e1ef32e3c5adbf752b36e9315f55ac7f39443 Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Thu, 3 Sep 2026 17:04:07 +0100 Subject: [PATCH 03/10] docs: use gh prefix for regeneration branches --- AGENTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index 2623ec6e..3e7b3310 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -87,7 +87,7 @@ Files Fern now owns outright, but that carry a caveat worth knowing before the n ### Prepare repo for regeneration -1. **Create a new branch** off `main` named `lo/sdk-gen-`. +1. **Create a new branch** off `main` named `gh/sdk-gen-`. 2. **Push the branch** and create a PR titled `chore: SDK regeneration ` (empty commit if needed). 3. **Read `.fernignore`** and classify each entry using the rules above. 4. **For each temporarily frozen file only:** From 0183cb6a151ce5cd0a8a452088b826362eadd9d6 Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Fri, 4 Sep 2026 11:07:36 +0000 Subject: [PATCH 04/10] SDK regeneration --- .fern/metadata.json | 4 +- .gitignore | 3 - poetry.lock | 502 +++++++++--------- pyproject.toml | 2 +- src/deepgram/__init__.py | 33 -- src/deepgram/agent/__init__.py | 93 +--- src/deepgram/agent/v1/__init__.py | 93 +--- src/deepgram/agent/v1/requests/__init__.py | 42 +- .../v1/requests/agent_v1force_end_turn.py | 12 + .../agent/v1/requests/agent_v1settings.py | 3 +- .../v1/requests/agent_v1settings_agent.py | 26 +- .../agent_v1settings_agent_context.py | 8 - src/deepgram/agent/v1/socket_client.py | 54 +- src/deepgram/agent/v1/types/__init__.py | 51 +- .../agent/v1/types/agent_v1force_end_turn.py | 23 + .../agent/v1/types/agent_v1settings.py | 3 +- .../agent/v1/types/agent_v1settings_agent.py | 61 +-- .../types/agent_v1settings_agent_context.py | 33 -- ...1settings_agent_context_listen_provider.py | 32 -- .../agent_v1settings_agent_listen_provider.py | 32 -- .../v1/types/agent_v1update_listen_listen.py | 56 -- src/deepgram/core/api_error.py | 10 +- src/deepgram/core/client_wrapper.py | 2 +- src/deepgram/core/parse_error.py | 6 +- src/deepgram/core/query_encoder.py | 16 +- src/deepgram/listen/__init__.py | 3 - src/deepgram/listen/v1/media/client.py | 8 +- src/deepgram/listen/v1/media/raw_client.py | 8 +- src/deepgram/listen/v1/socket_client.py | 30 +- src/deepgram/listen/v2/__init__.py | 3 - src/deepgram/listen/v2/socket_client.py | 62 +-- src/deepgram/listen/v2/types/__init__.py | 3 - .../v2/types/listen_v2configure_failure.py | 4 +- .../v2/types/listen_v2configure_success.py | 4 +- .../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 +- src/deepgram/requests/__init__.py | 9 - src/deepgram/requests/deepgram.py | 7 +- .../requests/deepgram_listen_provider_v2.py | 2 +- .../requests/speak_settings_v1provider.py | 1 + .../types/audio_generate_request_model.py | 1 - src/deepgram/speak/v1/socket_client.py | 30 +- src/deepgram/speak/v2/audio/client.py | 4 +- src/deepgram/speak/v2/audio/raw_client.py | 4 +- .../v2/requests/speak_v2configure_failure.py | 2 +- src/deepgram/speak/v2/socket_client.py | 30 +- .../v2/types/speak_v2configure_failure.py | 2 +- src/deepgram/types/__init__.py | 27 - src/deepgram/types/deepgram.py | 7 +- .../types/deepgram_listen_provider_v2.py | 40 +- src/deepgram/types/listen_v1keywords.py | 2 +- .../types/speak_settings_v1provider.py | 1 + src/deepgram/types/speak_v1model.py | 1 - src/deepgram/types/speak_v2speed.py | 11 +- src/deepgram/types/speak_v2speed_value.py | 2 +- tests/wire/test_listen_v1_media.py | 101 ---- tests/wire/test_manage_v1_projects_keys.py | 14 - .../wire/test_manage_v1_projects_requests.py | 46 -- 61 files changed, 458 insertions(+), 1231 deletions(-) create mode 100644 src/deepgram/agent/v1/requests/agent_v1force_end_turn.py create mode 100644 src/deepgram/agent/v1/types/agent_v1force_end_turn.py diff --git a/.fern/metadata.json b/.fern/metadata.json index 56f0c35f..ae7a5b31 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -21,8 +21,8 @@ "skip_validation": true } }, - "originGitCommit": "068de888501fcc3b792086aab45de975587b89e1", + "originGitCommit": "0825695d67503a2d95eda2ecb88672d7ee6aa4d6", "originGitCommitIsDirty": true, "invokedBy": "manual", - "sdkVersion": "7.8.1" + "sdkVersion": "7.8.2" } \ 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 2872a619..a0e797cf 100644 --- a/poetry.lock +++ b/poetry.lock @@ -188,20 +188,20 @@ files = [ [[package]] name = "anyio" -version = "4.14.2" +version = "4.15.0" description = "High-level concurrency and networking framework on top of asyncio or Trio" optional = false python-versions = ">=3.10" groups = ["main", "dev"] files = [ - {file = "anyio-4.14.2-py3-none-any.whl", hash = "sha256:9f505dda5ac9f0c8309b5e8bd445a8c2bf7246f3ce950121e45ea15bc41d1494"}, - {file = "anyio-4.14.2.tar.gz", hash = "sha256:cfa139f3ed1a23ee8f88a145ddb5ac7605b8bbfd8592baacd7ce3d8bb4313c7f"}, + {file = "anyio-4.15.0-py3-none-any.whl", hash = "sha256:7ecd9937369ffce8bba0b5ccb9b3a9507b101b0ed50256aecfbab27e6c2acb99"}, + {file = "anyio-4.15.0.tar.gz", hash = "sha256:b5c620ed540725e2579c31b17bb995b3bf02c9281c9cace04c7d186380bab85e"}, ] [package.dependencies] exceptiongroup = {version = ">=1.0.2", markers = "python_version < \"3.11\""} idna = ">=2.8" -typing_extensions = {version = ">=4.5", markers = "python_version < \"3.13\""} +typing_extensions = {version = ">=4.16.0", markers = "python_version < \"3.15\""} [package.extras] trio = ["trio (>=0.32.0)"] @@ -454,133 +454,133 @@ files = [ [[package]] name = "coverage" -version = "7.15.4" +version = "7.16.0" description = "Code coverage measurement for Python" optional = false python-versions = ">=3.10" groups = ["dev"] files = [ - {file = "coverage-7.15.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d0be6daac4cce6b8c8dc65886bae1b082ddbca4da8e5cbb5e15166acf253e264"}, - {file = "coverage-7.15.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:b24e078eabcd6a9caa8b0713f9bc1eeb310bcc960a29d45a3b4fcd4b16d5b11d"}, - {file = "coverage-7.15.4-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:cfe20cc8cf8821d4fe54f89106cbf06aa27f37b5bbe3535568065a81539b4150"}, - {file = "coverage-7.15.4-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:83cf06cdd687677742caff1a9134833b7a8b75f111519d2cb0e0ba1b9a851e15"}, - {file = "coverage-7.15.4-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:8fa4de68e2a752468ff14b4e15db7def689a71be759e826a31ccecbef69c5fd0"}, - {file = "coverage-7.15.4-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:4dff9daa47d83120c3ec38ce921214242944a832aa04e903e50b5b7ebac8972d"}, - {file = "coverage-7.15.4-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:a093fd37229918976f602aa07aa59e0973cde82186f220c8e197f721f5be0ce4"}, - {file = "coverage-7.15.4-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:317db01a2cb02552fd67e2b1cca77a4b528a2a277176c5e0bf2cecbb639d3f54"}, - {file = "coverage-7.15.4-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:8ee3838dcb656602c3b51e16aed9bfb0822f8d8d6d1c5966d32ec8c104be8e20"}, - {file = "coverage-7.15.4-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:425920379052ff1fe465268f3361d35804a241bbdd5a1b592c8cb60df4c52325"}, - {file = "coverage-7.15.4-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:69bb2400abef928e365ea7d4d9925169ada78ed2295546780002d4b65de3df88"}, - {file = "coverage-7.15.4-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:81661f82d302484e3119e7c80c519c02fa9bcc2a6b339baf67d67bc89c580f04"}, - {file = "coverage-7.15.4-cp310-cp310-win32.whl", hash = "sha256:cb476b2e828ecb71cb6b6a928d23fd20a7ddb501188022dae1c37499149cc338"}, - {file = "coverage-7.15.4-cp310-cp310-win_amd64.whl", hash = "sha256:3fc2130bf37df31852a8384f12601563a45a0024bccc6624f38355cba7a8d360"}, - {file = "coverage-7.15.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:bbac5abad70df71019988f83f26ac7092ff2642975def4429e98dc7585ef3490"}, - {file = "coverage-7.15.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:357a173465c7ce028d07a95cc2b63b5bf59f50ecdd5ad75c5cbb78ada984048e"}, - {file = "coverage-7.15.4-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:21b803935e2efc3acebe9697197a294fccf5dc4e5382bd6369542ff7a7d2a1d7"}, - {file = "coverage-7.15.4-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:7a2b580774a4786c1053157c0165e04476e03ff293993d7c148eee784a94bae6"}, - {file = "coverage-7.15.4-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a9464451c4efffe8d47ace5a540b10b0dc10e879066290f8600872b7f54a419d"}, - {file = "coverage-7.15.4-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:de602f34123c2f4af1c1869c6dbbbd60da6d5983bf01937367295d135cccbfce"}, - {file = "coverage-7.15.4-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:6879ded16a27f3eeca19b900c147e81616e7054db451471a611b2755ee5249f7"}, - {file = "coverage-7.15.4-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:986be58c3ab54aae8d3496a6225eea74f760fdbe739b38bd442c7e8d133aa53b"}, - {file = "coverage-7.15.4-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:c6103639613fe6c1e989082948419bc77a2d26b6c825c99d7fad25f7d3d87afc"}, - {file = "coverage-7.15.4-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:d3af93dddb5659276c63bc16ac6466ac2033a70ca816097bbc06345b8ccdf571"}, - {file = "coverage-7.15.4-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:b10075e5421d04265766a6d1dac809bbeb8a946fbb23c8f82c227409b2190719"}, - {file = "coverage-7.15.4-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:a67a9f78b2942d87ba8ce3059c642164d2aedd65337377fb52fe9803656bc5c7"}, - {file = "coverage-7.15.4-cp311-cp311-win32.whl", hash = "sha256:69484d1aca26e322e1c3ce03f09341e84524ababad2d7202161738d83cc9f82e"}, - {file = "coverage-7.15.4-cp311-cp311-win_amd64.whl", hash = "sha256:63fd6fcd1dd6e158f7eb78606e72933b3f6d01e7b747f99c6c12d764307a0fdc"}, - {file = "coverage-7.15.4-cp311-cp311-win_arm64.whl", hash = "sha256:ea82116c9893fa89e929b7f197ee5a1950a76e91cc5c85ba503fc02379d04890"}, - {file = "coverage-7.15.4-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:d4fedd1f7f428f9fe83b1ead5e7cc87a43427be31aadafbac3ac0636dc7abb22"}, - {file = "coverage-7.15.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:37e2f0cdf58e2e1fed4e4d5a8f8786ae2f7eb80b478016876667dc4a01d60a97"}, - {file = "coverage-7.15.4-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:fb55d0e70bb15f2e81477613627286581414693d74ac7963c93a790dd453ca9d"}, - {file = "coverage-7.15.4-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:899b9da30f3c6c336566e3707495bb23e8302d39d862f01fa78c48b99b9437e2"}, - {file = "coverage-7.15.4-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d15715e8c46552827e5e4f30a35575a2dbcad14454cf3284c54483946bd16931"}, - {file = "coverage-7.15.4-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:002a438859f7b430bc99afeaf01a6d187dad1d0dc907b64cdeffc632a5db8fd8"}, - {file = "coverage-7.15.4-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:e4193a04b518f7968f3099755f5509ee7cccc6dc2b92a6b14841934d22e222c9"}, - {file = "coverage-7.15.4-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e98dcc55d572b38e69d117da7e8e8efb8500f1f5eaf81ecd460a63220790b839"}, - {file = "coverage-7.15.4-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:af6c538498ce66c10d3fd541c2a8d5b03da5850355add34e6cba564210cb9e72"}, - {file = "coverage-7.15.4-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:1d10025d96ea89fc2f73714dbc4cbd433fe012c1ac9e23f895d7728b238b6e52"}, - {file = "coverage-7.15.4-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:d802e1947603162ded419bff83ac7489820355d2b856dfb09206574e3a37ac0c"}, - {file = "coverage-7.15.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:c2de40895718f91951b86712b4c5b694acaf9a0a49be13874896f599a1eed3f4"}, - {file = "coverage-7.15.4-cp312-cp312-win32.whl", hash = "sha256:5c3431b2161279b7db5c2a1aa58ae02e5cb8c3c42d93a5094be3f5537bd5b11b"}, - {file = "coverage-7.15.4-cp312-cp312-win_amd64.whl", hash = "sha256:6befeab5fb2b51c958ca4ac6c5d141a1e8240f4f76e46350f1911963deda49cd"}, - {file = "coverage-7.15.4-cp312-cp312-win_arm64.whl", hash = "sha256:67bc345491ab55b837277d76f5775d057e8c7f1ac44d890d8c2c82adde258c6f"}, - {file = "coverage-7.15.4-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:c705b28feb2775dc82a25f1d473a370bc37ff93f5177f4e29ce2425f560f6921"}, - {file = "coverage-7.15.4-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:3ff205ab5e3ecc670f6a4dd19d9cbf12ede53dd41cfc1e15716ec961ea6d314e"}, - {file = "coverage-7.15.4-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:5172326e861a38b48b48befca15e0f477a26b283337a33a739c8fed229934e36"}, - {file = "coverage-7.15.4-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:12b59c90084e3234fb11184886bf4a40f4f16a8c8f867be2e087b81f8e8868d4"}, - {file = "coverage-7.15.4-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:349062d66f00b40fa2c1c222438bad25fabf755631b5d82937fe985c8008615c"}, - {file = "coverage-7.15.4-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:4256ced708e598e05209bc1a8ab4074e04a51dba4c62fb45926a229af675ace7"}, - {file = "coverage-7.15.4-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:d80f974b20782d9612c8b4c9beeca867074c7cf4079d1419843fa25a26428b25"}, - {file = "coverage-7.15.4-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:2e179f19bfe1d31f8eeeaa12990194d761c4f62f0759661000bca6cd8729f40b"}, - {file = "coverage-7.15.4-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:8bc16bb47b7679670eceff71d78bfb7d6e5b143f6c2cd117487ec7c75e0d4b78"}, - {file = "coverage-7.15.4-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:1cd685005cd2c4200adfc14cf39a603b9320efab3f18a8f7f156d20c9cc3345f"}, - {file = "coverage-7.15.4-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:337399ad2c93b3acd2a937627dae8b3e86b66707cd3d3e856347999aadf1ef8d"}, - {file = "coverage-7.15.4-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:96e257121228ec5cd2bb919276e94ac11074471bc37d68dbae0e8308cce15fff"}, - {file = "coverage-7.15.4-cp313-cp313-win32.whl", hash = "sha256:c65a9e0dfc6143491879da4e13b5e30f8be192055de508d737fb14601edbd22c"}, - {file = "coverage-7.15.4-cp313-cp313-win_amd64.whl", hash = "sha256:2ff8f5e9b8f7a94f0c11c45631eee103dbcb7d63274edd12c56efe1be690b3b4"}, - {file = "coverage-7.15.4-cp313-cp313-win_arm64.whl", hash = "sha256:6e0a8a5083b096487d6cfced94cdd514d8f5db6f113610fb36c0620edb1028cf"}, - {file = "coverage-7.15.4-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:770e9325ab5ea6d56f77e59b29ecfe0ac20b57a82a601876f90494a4dda0386f"}, - {file = "coverage-7.15.4-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:d12b33a3a50a1676b7784dc8d00a0c6d66a9f2add4b85a041c19b6a7e53ef23c"}, - {file = "coverage-7.15.4-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:5669c8378ebde86f5def7a25d29586631b58acc27ffde04399f678f3dfc6e082"}, - {file = "coverage-7.15.4-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:ff97a14362eef486483ed44042ca2027ea257df6ff768e62358ee0c9776925ac"}, - {file = "coverage-7.15.4-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5a325e815318638aed1655d9c06e6d7c2d3d46c09231ce988070428a8762d734"}, - {file = "coverage-7.15.4-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:474223409d88eb20d2d6a0d37ea60e8647a65a90cc008dc1f0410af5f64f1e0d"}, - {file = "coverage-7.15.4-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:7f2f62ae3cd189dd2e13aece758c57b3eecbd27be070dbd4cbd10936049e5dbf"}, - {file = "coverage-7.15.4-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:39ece820e29e0a2ba34b3ecb3be83c27e997eed8926f2ba6fe7ce7a0bda5843b"}, - {file = "coverage-7.15.4-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:f21b56dcace11dfe013014201f577dcd592b2a9b72182d930361b47cf6f73f25"}, - {file = "coverage-7.15.4-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:93a3a0b662abcc10c73a47cbc72cd60f63618d6989fb2d1286e50eacd974f303"}, - {file = "coverage-7.15.4-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:141fae2cabf5569b782c10afc4c850ce10f618c13f8db54765cba99cc839da1f"}, - {file = "coverage-7.15.4-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:81294c7e6ab30c5f74c0353b11b2fd6320e72d9bee6ac73b357caa8b916323a5"}, - {file = "coverage-7.15.4-cp314-cp314-win32.whl", hash = "sha256:7bbd7d6418e0dab31a206af5203bd43ae36edb8e7fba1940b055d3e9249290d7"}, - {file = "coverage-7.15.4-cp314-cp314-win_amd64.whl", hash = "sha256:f0204ed122758782970526057093f448051a39db9d810d4e344bb87a3546f425"}, - {file = "coverage-7.15.4-cp314-cp314-win_arm64.whl", hash = "sha256:9e71e7bc71c686a123347ae47a0de33a175e797a85bb57b791492adf4eec8ed8"}, - {file = "coverage-7.15.4-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:7c922735321eef3f87c280a3d39afff6b646723a2880b862cda4ac7a093b8aa8"}, - {file = "coverage-7.15.4-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:f41c17c4668a655ce96d090d8d5ffdc24ef64b5a02f9753884d08483e8a4a41a"}, - {file = "coverage-7.15.4-cp314-cp314t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:46822e9b6ff1c6a72b518c162c44a8f45a61a1d609c51084bf5b16c023c5037b"}, - {file = "coverage-7.15.4-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:3d6f4955b73b5445271379a59e3792b0d978f42d4a01e0cf7a67d9c33a3bb0a5"}, - {file = "coverage-7.15.4-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:3fc9e047706fb4a9abb54f719d3aa643e80e5bb3818182c40aee01ac0f0247ba"}, - {file = "coverage-7.15.4-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:05e491d4f3165d62d4f5c8fd48dfeabf2ae8f42cbbd484319af33ea851b78982"}, - {file = "coverage-7.15.4-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:226c66e80ec0598d3b9b4874123df167ccca342aca8714f77cac6829688ee09c"}, - {file = "coverage-7.15.4-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:ac41cc14bebda0dbfb0628036b7f75706935c95bcc07fefe9a0f93614aa60a57"}, - {file = "coverage-7.15.4-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:8af623e5cd92080acddd02b38f2f406a2c3a0893c38950b211890361448fbf26"}, - {file = "coverage-7.15.4-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:07545711d4f0f32852a18f18ad11f76f0109909d09e78b9008b4cfc67e829429"}, - {file = "coverage-7.15.4-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:a0865421cfdc53654b342d515e5a233187590882d20b95752150e53f65460017"}, - {file = "coverage-7.15.4-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:460115e32ee40566476db5048f9bec1e842c127ad8e6f8be745aad3ac9cbc839"}, - {file = "coverage-7.15.4-cp314-cp314t-win32.whl", hash = "sha256:cbde877ef9dd7baf272b9bfef2b8a25edd45d9170fc326951dd20eb480335e85"}, - {file = "coverage-7.15.4-cp314-cp314t-win_amd64.whl", hash = "sha256:3da9e92d1c551fd7563833e9ade686efb0c4b7363ab7681a94283958c950bf5e"}, - {file = "coverage-7.15.4-cp314-cp314t-win_arm64.whl", hash = "sha256:3a54f5a0d85050c73a38f6793090ee83974531e67fe5e57a1da9bee11398aa5e"}, - {file = "coverage-7.15.4-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:2c9872e4d9dc5d3cf616bf4b382f5a00359305a5be666a3dd0b5cdb4e49597f9"}, - {file = "coverage-7.15.4-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:e101dbb4b9b72f0cddd8cdc8c9c5b47f456766f5e0ac82dbfb75e5c55409b78a"}, - {file = "coverage-7.15.4-cp315-cp315-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:7d1abebdb047729e852b9c77a00497dfbeb11eb3a117e037d7dbc3ac8e5f5c54"}, - {file = "coverage-7.15.4-cp315-cp315-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:d28a4a899354d0ea6214cc59b4fa19eefbce1b9ff1688ab579acf49e894bd3fb"}, - {file = "coverage-7.15.4-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ffb3c2aacea411cc7e1d27712490c11108e2de1d39019ae32915493a59a8b9ed"}, - {file = "coverage-7.15.4-cp315-cp315-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:a9447978a92f405d301123cfd39ff49895490efb769a758fe2734c7f631bf8ce"}, - {file = "coverage-7.15.4-cp315-cp315-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:050467a7983b8e2fe7dd41a78bb30c3e7f8c0b8cafda14b1c46f8b5e3cf2dd3c"}, - {file = "coverage-7.15.4-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:d003b7a5708ddad5c206c79607a6b92abb6fc13c57d99d8a4468cc03a2941ced"}, - {file = "coverage-7.15.4-cp315-cp315-musllinux_1_2_i686.whl", hash = "sha256:c38efe30fd74e5c19e9433f11fb1f5dc9c6522770971b7c6145bbaa413dc8800"}, - {file = "coverage-7.15.4-cp315-cp315-musllinux_1_2_ppc64le.whl", hash = "sha256:1f4f826d70f772ab8b0c052329580d7fe8b8abd191e4ce0c8f81aec6614665d3"}, - {file = "coverage-7.15.4-cp315-cp315-musllinux_1_2_riscv64.whl", hash = "sha256:4a4bf917c9953f57c957be31c1cd504e3bd2f34d4a352b9d391a3025336f6768"}, - {file = "coverage-7.15.4-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:1c9bf40ebef178a45192c75c4964760bb261b0e6ad725da5fc4c93f674f19753"}, - {file = "coverage-7.15.4-cp315-cp315-win32.whl", hash = "sha256:43619d04c3671792d2c4706ae8bf45e265dc87bbd4078189ef8b847ea1e74be2"}, - {file = "coverage-7.15.4-cp315-cp315-win_amd64.whl", hash = "sha256:be619439dbcd31a2eab10b32de9fff62c26ed4bab69dc32b8363fdaaa0882809"}, - {file = "coverage-7.15.4-cp315-cp315-win_arm64.whl", hash = "sha256:def597967dafc2e8d97c9097ea453c464e0bb8ed38f193a43070f10dc623bb6d"}, - {file = "coverage-7.15.4-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:c7dbc748ac8a1e3e59a2b28bea47675e6e778081dbbf081bde0d75def2fcbe1d"}, - {file = "coverage-7.15.4-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:2413074a5ecbb61a01a7888fc72db0ca324d13588c5b38bc0dd8564cdcdfea26"}, - {file = "coverage-7.15.4-cp315-cp315t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:4e6f6f632b7b2f714bf7a1346e8f97b650ee71f3c298aaad42a2ab60f0f07645"}, - {file = "coverage-7.15.4-cp315-cp315t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:8df457da2249d3c75ca2e5e835d59c725abfe92d27fdff6cd99eed85b51d5e9a"}, - {file = "coverage-7.15.4-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:050f66a08805acb5b8a23c6d4a517b1ecf82c08e81ed0e4bd727df065e5c6624"}, - {file = "coverage-7.15.4-cp315-cp315t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:1587fb771d1ccceef708fdde1e5af8c7ed24b486b61d13a321acb7d8145390aa"}, - {file = "coverage-7.15.4-cp315-cp315t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:8b4f1c3a69ca580f3fbd6b2046915f536d7f586874f25c1bb23add2a3c88d50f"}, - {file = "coverage-7.15.4-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:ffb58d7eff5b7f6ecc6fa21d6288ab7f968a212cb67d682c269c09b9eba3b66f"}, - {file = "coverage-7.15.4-cp315-cp315t-musllinux_1_2_i686.whl", hash = "sha256:d9df165544774574ee004b953023d1bebada1894a80b1052a43d798b0f676e67"}, - {file = "coverage-7.15.4-cp315-cp315t-musllinux_1_2_ppc64le.whl", hash = "sha256:f9de0a24a4079b53e523b5c5e2c5945ec251ab486652659955187cf255a259bc"}, - {file = "coverage-7.15.4-cp315-cp315t-musllinux_1_2_riscv64.whl", hash = "sha256:150089274bdc9f940628552cb92844e0223c987f1902ab8efe9f45a2ec758d88"}, - {file = "coverage-7.15.4-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:a58a94fed5da6997d258e8f7668c1e195fbd04a691d781b7558f1e468f9e68bc"}, - {file = "coverage-7.15.4-cp315-cp315t-win32.whl", hash = "sha256:ebd5a6d8466ff30836572f3ba2cae8a5e8f85029b1c6d5e2ed338dc472a5166a"}, - {file = "coverage-7.15.4-cp315-cp315t-win_amd64.whl", hash = "sha256:288bde2a2d7ab6b6c2d7252fcde8b524387f2d970bdba9658fc6f8bbcaef0f9b"}, - {file = "coverage-7.15.4-cp315-cp315t-win_arm64.whl", hash = "sha256:68be5e1de60ff13c9095bbec0e5a7fa45b33b101752215b91345ea1f61c4a278"}, - {file = "coverage-7.15.4-py3-none-any.whl", hash = "sha256:964730a1e9de9c0cf11be6a1a3c79ce419c34882842abd256086ba4698705e84"}, - {file = "coverage-7.15.4.tar.gz", hash = "sha256:0548198fff07ccf4faf469520bce1c2eceb1ce3e62891921138dec10907f9d00"}, + {file = "coverage-7.16.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:36aed4951aedf04cbe9465e76f8e71219980a52b73d07afe69746cba6ba7b97a"}, + {file = "coverage-7.16.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:cb953835dbfa6d641ac3943e0986bc680f8abbdc2985af15b46c54985347146a"}, + {file = "coverage-7.16.0-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:97051c4903689b1afedc2a354d6118223051e03588078b53048603bda9014577"}, + {file = "coverage-7.16.0-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:770d4244c423dcafb5c31db393f429fe952b1bba23bbff7cc3886f8133769ba5"}, + {file = "coverage-7.16.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:26e7de0cb87960c6c9b5cad760068dab767b2b49a3b9376e1992c1e2691a015e"}, + {file = "coverage-7.16.0-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:1c2c45ee1853668f0ea1a0ddff396421c9dc5ad25a56bfb94a895970c2d8e7c2"}, + {file = "coverage-7.16.0-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:e6b2b9599e7513b0a9c5bf0357f9f8deaa4c2c821025b0693d420e6602748981"}, + {file = "coverage-7.16.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:6fde65e0ea945920265dfe4a2108fc45eee2e2ea3d9c3073af6373ff9836aa71"}, + {file = "coverage-7.16.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:78103e79f9378cb0e43ddaa728629a373c070df903c5dfa98b63ba2cfb4e8c42"}, + {file = "coverage-7.16.0-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:e40e323711b485592354069b1c027ef879cc2d11657eac09a6e5ad0b49ab7406"}, + {file = "coverage-7.16.0-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:c94ef980f7b94d9dab9dac076d44ca706654cd51bad19734e029084adf528c8e"}, + {file = "coverage-7.16.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:b37ad5cbb77776f446e1b55b461eec2eef5c3e7130c72dc0e1447c3a9da2d199"}, + {file = "coverage-7.16.0-cp310-cp310-win32.whl", hash = "sha256:9421dde689e68d9fd2b6cd7d8c4498e79b5431467b6298517e3f3e60fdbe80a7"}, + {file = "coverage-7.16.0-cp310-cp310-win_amd64.whl", hash = "sha256:81d63b68b26304e3668edb103311c17fe13c2ed1c7fe973309819f27bf61c5b8"}, + {file = "coverage-7.16.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:22d8802827404be32f5a4d6ddc037f6fa0074b7d06702c0224cb598def8b665d"}, + {file = "coverage-7.16.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a739bf08cdca0fad51b73322e4fade0102dd87794e278450b5ee87ef827954db"}, + {file = "coverage-7.16.0-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:f99d12f8234c00b88b8077fedf288b25c77f746de312053b7db90fa756ecbdb3"}, + {file = "coverage-7.16.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:7cae7715afa51dd7c9c42e6603bb46daf424c3449fdf06519cc658aa8d46e2e4"}, + {file = "coverage-7.16.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:55957d350452017f523b9b03ffac078f9a214e23c04a3d0a674569203550c719"}, + {file = "coverage-7.16.0-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:b670bd5fa93d9b6855b2837217b45a90863118e2de5e9e033aebd46d07cd08d3"}, + {file = "coverage-7.16.0-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:fe5aa402d02318db2f41e471320b2ecca6085b8f595a034c037085732e49c04a"}, + {file = "coverage-7.16.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:fddd26ed9a2527a7e23f7e4c1fd0734c4a5b45f77b261da1c536b20a7d2e6f0c"}, + {file = "coverage-7.16.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:b2af58ecdcec37fe633d4865fccbc8c00d8aa3b31c099bcacb2720c9a0be6ab9"}, + {file = "coverage-7.16.0-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:a3cd34b9025d62180ce2b5dae8a985bfa6cb8c05ecd57fd34ffc1ff751b5a74d"}, + {file = "coverage-7.16.0-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:ebaf39dd13f8af65fe5f0316b81046228ef4d91d3c3766192b418753649896d6"}, + {file = "coverage-7.16.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:5dad64d9c17cb1983adef07998e6e2e1cf870a156f1ea80f81ce1970f4c545ce"}, + {file = "coverage-7.16.0-cp311-cp311-win32.whl", hash = "sha256:38b8e1e73750b8965d1154ed733f5303acd4e24ee2d5ee872bb1bfab744a31ce"}, + {file = "coverage-7.16.0-cp311-cp311-win_amd64.whl", hash = "sha256:cc12e5e32acdd62fe5895939695579560639853219288519685c75b7e968d63a"}, + {file = "coverage-7.16.0-cp311-cp311-win_arm64.whl", hash = "sha256:17fc3628f99812fec24f40092af34c1c73274d331babab3d1d768a75de650cf7"}, + {file = "coverage-7.16.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:d1c77c3579ac42798f8b7eed6d3dd258debacca32c8753fc8a1f6eaf1db644f5"}, + {file = "coverage-7.16.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:1f81cb1554c3712e41649ed5dc98656b50b958e4da12f0f5adb681ce3db92831"}, + {file = "coverage-7.16.0-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:6e701938ec9081d3e400a0c9a9a8ae0f7ca44214741daeac4454b1c6ef6dbd19"}, + {file = "coverage-7.16.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:719a3feb6220dd32ed932d4c3676d17fb8739e2643b29c0e7c3af400ff80ac44"}, + {file = "coverage-7.16.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:87771ecf986cff55e87413238cd5e4f54d949c2074bd6fc1657d26a56314ee24"}, + {file = "coverage-7.16.0-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:47d5e1fc0b321c8308a2aacee0497c435b08acaa629b7059798fdf6fc3006352"}, + {file = "coverage-7.16.0-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:01b18b8a6c9cec8d5f45550e2501426ed982cf2c35016b0acd2ba9b5d8b2fb06"}, + {file = "coverage-7.16.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:32c56b5b47c50635081445ac404dd08c2d591b9c837c22570aa9e182c3b42cd4"}, + {file = "coverage-7.16.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:6ad3bbad240ab937512156bc944fdee63ac4dd34a7558a3094548fd4c1150c02"}, + {file = "coverage-7.16.0-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:4c1f16d5555a195295d0dc9c902612270e3dfed6a11f3bf7bc470b7b6a79ed3c"}, + {file = "coverage-7.16.0-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:f6c9c21a8bf0d19788f3c5f3e020c90317a0a63ef60521b376003801e21250fb"}, + {file = "coverage-7.16.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:06f20145a9eb5bf1fd1dde3c0bc2af2e7c22135ab07ca6284d6ada7cc3904c4e"}, + {file = "coverage-7.16.0-cp312-cp312-win32.whl", hash = "sha256:916cf8d25c1ce148f7eceb1d45afc9724841200110adc4e53250391852debd91"}, + {file = "coverage-7.16.0-cp312-cp312-win_amd64.whl", hash = "sha256:78f8b56261d608be102c62edd3a60b66bcd0b581f3f86fdcabaf8b8d95adc950"}, + {file = "coverage-7.16.0-cp312-cp312-win_arm64.whl", hash = "sha256:577c2ac8c0036f6f8edd3a7783a9e67302b17771d1abf0fd2ed246e3158be51b"}, + {file = "coverage-7.16.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:1545c52ce756b8a97007f439a220297f1cd72a2cbbcdffccdf1c1f70e74f9a42"}, + {file = "coverage-7.16.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:0598aadae641f30a0796b75b45c0b9c5de8619bd5cfb251bb0cc254e86e6dd13"}, + {file = "coverage-7.16.0-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:4080ad6bad9f14690e6b2104f5e8d137ccc65a4b5427a36662090637d4bd16d5"}, + {file = "coverage-7.16.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:e9883a2f8206ce3af59117dc278e5d043fea06912bca3f199816129e5e2de354"}, + {file = "coverage-7.16.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:984e5430fc6f858385009e92549955157d79335b1f3e13e1031e0f89d1284261"}, + {file = "coverage-7.16.0-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:b1374099dd1ad0d31fbb6c95d00a56a3c5e85fb3343dca14fc12f78323a2b42a"}, + {file = "coverage-7.16.0-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:34d8686bce035c8465b318a8c2890e69ba14a00801a27f4eb6bdc97c23944d87"}, + {file = "coverage-7.16.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:857fceba6ff4b507ee0ad98798a33d544a8473df0c542bf04251ee4ed5ee6292"}, + {file = "coverage-7.16.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:bbf08d951abaa1ce89e28c998361d56b952413846b459cd017f116ad4c9adbfa"}, + {file = "coverage-7.16.0-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:1a03e78f53e4d2ab13adac19958a89322d1829913e5623d642627bf60b35da21"}, + {file = "coverage-7.16.0-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:dcd3dafcdd78305d27c59a1006b53a4990acb89e68d8fbe0992f4f83503c827f"}, + {file = "coverage-7.16.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:c1bcfe470a796fbea6234accd81d258a31574dc0b7bf569e16be757572c4de17"}, + {file = "coverage-7.16.0-cp313-cp313-win32.whl", hash = "sha256:1420370276f1694b663207b8245c3628aafb9624fe3cebf313a13d860e55ee67"}, + {file = "coverage-7.16.0-cp313-cp313-win_amd64.whl", hash = "sha256:496277c8d7beed695e02c7be53516a0152e4caef8738a0feab6a638546cce449"}, + {file = "coverage-7.16.0-cp313-cp313-win_arm64.whl", hash = "sha256:181c2906b9b3759955c1c33c51fbb91c754fbd0b82ea49e2c81061f5a052082c"}, + {file = "coverage-7.16.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:54b7fba6a74d010de34319a0419d5b65af8c00f539ad0b6f39fc6f342ab99697"}, + {file = "coverage-7.16.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:fa4ff0b3dd52208d2b30903022d5087f82000507b504753dfeee83e4f32d6883"}, + {file = "coverage-7.16.0-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:35a9676bf86097f790113ebd9fb67681804ef54d40941d2f10ba68c02239e575"}, + {file = "coverage-7.16.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:f98d438add63546745e5e847192e3e9ab897ed6f2ca96f8281e2f5a15958ae62"}, + {file = "coverage-7.16.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:151855767480be14db595cbc2040f6a4db965cdfeebd354d79b0256742b029e0"}, + {file = "coverage-7.16.0-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:183613f664718b340589d7f005c7e92b4b601cffd20a8a4117cfda3e983b080f"}, + {file = "coverage-7.16.0-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:785b114356c99c0dd5b3f57b9696cfd57b7704f4c53847df8dc88c6cc0d9bcb6"}, + {file = "coverage-7.16.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:30f5aee6d1d517abcdfd4f9cad027969ff79a1440a22da263f9514e31b5b66e9"}, + {file = "coverage-7.16.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:190ffa0f5af966254c249fb3aeaca2cef389785e3e287fd577d39e134d20f8a3"}, + {file = "coverage-7.16.0-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:0ccc37c00e1a5d30840902c54557e104d04aead872cedf6d2281c8725a467e06"}, + {file = "coverage-7.16.0-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:6c60cde430c0e7e3be612973af39b4cff90ec2e2defe7b2b701daea3a0ffff04"}, + {file = "coverage-7.16.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:c5297028c8df849a61b29129cadfe682f90b5b396f528eb319a57d7678eefdad"}, + {file = "coverage-7.16.0-cp314-cp314-win32.whl", hash = "sha256:136988df5bc5a48795d9c42c75c4bbda5d9a78e750a080c1233010edff93a1af"}, + {file = "coverage-7.16.0-cp314-cp314-win_amd64.whl", hash = "sha256:ce2ba5e9f1842fe09165825abfb3bc6b527c71a27bc2eb3a10f2284ced64506d"}, + {file = "coverage-7.16.0-cp314-cp314-win_arm64.whl", hash = "sha256:a89d07e48d9baead9a15599923a02f62c6df6c3d85aa84ef34be3c9fd6aeb91f"}, + {file = "coverage-7.16.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:6e2854b62601c89a63814ad5def3b90d99c6724cc4cb977f75b725e5fca4b1e3"}, + {file = "coverage-7.16.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:f093faf23df888518d273be6da65f0ec5a25b5d8b670231e4d87de07361042e7"}, + {file = "coverage-7.16.0-cp314-cp314t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:b7dbbbf6551eb94618e7bc76ab61cc2740a5b3d13294171bd6adb36e12346c3c"}, + {file = "coverage-7.16.0-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:51e7d0e311d2fba3915f971236cbdd4ad821fc7a23988221c0b33c964b0eba22"}, + {file = "coverage-7.16.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0bb04ee77e557d7476471969d35fbbfb5fc8a4152e9409aa5811780c36d9b23e"}, + {file = "coverage-7.16.0-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:c72c9b201dc0e8c2c8821d49858fd865010d08181bf877d2320971b6464ebfd5"}, + {file = "coverage-7.16.0-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:0fca700cae4635656668ba6e2b66a85aac9f2622d7b2bcf82e844c409eaa1313"}, + {file = "coverage-7.16.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:584896fb8b650e999e24ef57e9513e482c12f8e15a73ee9d4584e23c99465867"}, + {file = "coverage-7.16.0-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:949eae7e0f562b1518355aaef4b03523e49a6d3fea12aa3542d9e36c863f8267"}, + {file = "coverage-7.16.0-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:64f0611ee05364fc85cc3e5bc371804117a76fd337720e6017332fc7c534257a"}, + {file = "coverage-7.16.0-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:050a291b3cfe5e0df5999ef2fa5a7aff6e2db329f069d47eb63f02bde2e7e96b"}, + {file = "coverage-7.16.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:a336b1e2990a64f5c356a9b8380fb9c029d56c832b801255250c44d603271bfd"}, + {file = "coverage-7.16.0-cp314-cp314t-win32.whl", hash = "sha256:058631257350b31784ed43ceb808298b6f074edf4ebca4c7ce5082e6bf873a61"}, + {file = "coverage-7.16.0-cp314-cp314t-win_amd64.whl", hash = "sha256:ed35097438dfa980c1ec75bc83edf8acbe7a374d7007e571957a257fbd0e2fb3"}, + {file = "coverage-7.16.0-cp314-cp314t-win_arm64.whl", hash = "sha256:0466f4a5c0370461b7d8c7eb259d7d1db0b5756f13d66230b04d22a1d380ee11"}, + {file = "coverage-7.16.0-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:80d7d5d744a041f08637df743ac086204ec5acbcd8432a42b00b49e607358024"}, + {file = "coverage-7.16.0-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:c5feffce90c3d602e149de1c477578efc34dee5f069f9764cc15808ce01ee15c"}, + {file = "coverage-7.16.0-cp315-cp315-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:acadbf2f2a18d7f9c7f119ac798c00c540d7c79c93abd71ed648c87891303633"}, + {file = "coverage-7.16.0-cp315-cp315-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:4212cec9b42fd9929e70b462732fefd8b13406371871c82f3c14397499d6550b"}, + {file = "coverage-7.16.0-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1c5a43cc0ef101637ae920a9eed24cf0549ef815621eae68b3ad577ec5a7ad2f"}, + {file = "coverage-7.16.0-cp315-cp315-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:c76a9b50a344261fe4a9bd20c322b48d3913cc48e8c37f78c21a596008296e68"}, + {file = "coverage-7.16.0-cp315-cp315-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:80cf547379ad6b1878fd03b033b51188beab4b41824c96e7839e014a4cb947be"}, + {file = "coverage-7.16.0-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:4b1d09cb5d8dc2c7164450f5217e6f0717497de9c588806a0780d352abef904a"}, + {file = "coverage-7.16.0-cp315-cp315-musllinux_1_2_i686.whl", hash = "sha256:cd1e85abed2d2499c16664137ac802356316f92b4e2bf3c150bdf0c45f5dd9ae"}, + {file = "coverage-7.16.0-cp315-cp315-musllinux_1_2_ppc64le.whl", hash = "sha256:360967a6fd77794c167529eec2d16ff8e38216110619d23acc3fd466a1648bee"}, + {file = "coverage-7.16.0-cp315-cp315-musllinux_1_2_riscv64.whl", hash = "sha256:92cbc2bf4f7f67c79f1d3ca4fe8c50faddf48e852a3d07eaaf02dc014889832f"}, + {file = "coverage-7.16.0-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:cce4dc8528453128c6fae523b15f3887fbea1d4d7c9eb9639d3d4fdcbe570c73"}, + {file = "coverage-7.16.0-cp315-cp315-win32.whl", hash = "sha256:5205baea687133613dced668a3d0168ea1479349615bfc255849a7944988c889"}, + {file = "coverage-7.16.0-cp315-cp315-win_amd64.whl", hash = "sha256:4fcb5f07a9b7083bfb715115d27ce263ba2b5b89dddeee536b295ba0e3c2c627"}, + {file = "coverage-7.16.0-cp315-cp315-win_arm64.whl", hash = "sha256:d568a8adcec0eda42ec23e5e65dfb8c184fc255120f9e99b484f7c869d923fb9"}, + {file = "coverage-7.16.0-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:3e8037e8213adf882e9d7eedd2c5c557933ab0b9632c42d98fe98ec9bcdb4025"}, + {file = "coverage-7.16.0-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:289f2ed4d56eebf029b649e7dfc3c1153b111962a75e294cdd8e4a1598a04cc3"}, + {file = "coverage-7.16.0-cp315-cp315t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:9b83f6ac575530783771c8dcf05284f7c8b5b12f1e7cb226d63445aac4497a3a"}, + {file = "coverage-7.16.0-cp315-cp315t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:2c3ff6580f2dfc5bec34717b85b2e6cf5ec993b721e7bb58a794babd525a8178"}, + {file = "coverage-7.16.0-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:507596cee23e9968b1934fe86d799b76166541af0a293930918b1b48a5c84bd2"}, + {file = "coverage-7.16.0-cp315-cp315t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:edc2be98e6c55ccc5ff7832bb64f023a4b03dba39dfa84b850046cf08a8249b0"}, + {file = "coverage-7.16.0-cp315-cp315t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:9c0690994b84a15a53bdd39e0b2fdb539b22533820623eb86ba75b93760c645b"}, + {file = "coverage-7.16.0-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:de24c62bf798940a14674a47489a81b79915ec4134f556d5199830e065225dd0"}, + {file = "coverage-7.16.0-cp315-cp315t-musllinux_1_2_i686.whl", hash = "sha256:69474d81f198774c9d2937599ca5da04c9e1c5de5032da23c607ce4960ce360e"}, + {file = "coverage-7.16.0-cp315-cp315t-musllinux_1_2_ppc64le.whl", hash = "sha256:72a0795cc6d34acc2b03dfeabdc82b61b72087f2737018b56ac92c1cf5446c54"}, + {file = "coverage-7.16.0-cp315-cp315t-musllinux_1_2_riscv64.whl", hash = "sha256:d9a218d3f9c7d6916684ed5ba94f620661117a730e733cd6ef5e87accc5872eb"}, + {file = "coverage-7.16.0-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:49fa72ead28c8216f8916398a4f3c4669acb30a061822810ee20a727a1be2897"}, + {file = "coverage-7.16.0-cp315-cp315t-win32.whl", hash = "sha256:27461af9f3ed7d2cf2411eb083784f87055ebf42211789ae3a216c48609bc743"}, + {file = "coverage-7.16.0-cp315-cp315t-win_amd64.whl", hash = "sha256:c5612cc20ca76abc883e50269af47c1494b42958bb63dbb9aa79729a1ab5f7d3"}, + {file = "coverage-7.16.0-cp315-cp315t-win_arm64.whl", hash = "sha256:2ddaa9e2af4760a329d80008b7a3b4762fbb0dbcb169199360f9a5179c32f2dc"}, + {file = "coverage-7.16.0-py3-none-any.whl", hash = "sha256:245f7de6d023a5bba375dbec9f2e0869bfa26ac0cc639bbb7b4c814884000b73"}, + {file = "coverage-7.16.0.tar.gz", hash = "sha256:077f0964087883176ff6ab9b074694cae29f8c708273b13ca62c183c6ed716cd"}, ] [package.dependencies] @@ -1255,19 +1255,19 @@ files = [ [[package]] name = "pydantic" -version = "2.13.4" +version = "2.13.5" description = "Data validation using Python type hints" optional = false python-versions = ">=3.9" groups = ["main"] files = [ - {file = "pydantic-2.13.4-py3-none-any.whl", hash = "sha256:45a282cde31d808236fd7ea9d919b128653c8b38b393d1c4ab335c62924d9aba"}, - {file = "pydantic-2.13.4.tar.gz", hash = "sha256:c40756b57adaa8b1efeeced5c196f3f3b7c435f90e84ea7f443901bec8099ef6"}, + {file = "pydantic-2.13.5-py3-none-any.whl", hash = "sha256:346a034f080da3755d8e9cb5e00e8b07de1d39e4f6e2c87d8ab7cafa0b269a73"}, + {file = "pydantic-2.13.5.tar.gz", hash = "sha256:51a9c5f7b2f8e636f04c6cada605d9b6a3bf1348fdf945a3d8869b19bba0ee08"}, ] [package.dependencies] annotated-types = ">=0.6.0" -pydantic-core = "2.46.4" +pydantic-core = "2.46.5" typing-extensions = ">=4.14.1" typing-inspection = ">=0.4.2" @@ -1277,132 +1277,132 @@ timezone = ["tzdata ; python_version >= \"3.9\" and platform_system == \"Windows [[package]] name = "pydantic-core" -version = "2.46.4" +version = "2.46.5" description = "Core functionality for Pydantic validation and serialization" optional = false python-versions = ">=3.9" groups = ["main"] files = [ - {file = "pydantic_core-2.46.4-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:a396dcc17e5a0b164dbe026896245a4fa9ff402edca1dff0be3d53a517f74de4"}, - {file = "pydantic_core-2.46.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:da4b951fe36dc7c3a1ccb4e3cd1747c3542b8c9ceede8fc86cae054e764485f5"}, - {file = "pydantic_core-2.46.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bb63e0198ca18aad131c089b9204c23079c3afa95487e561f4c522d519e55aba"}, - {file = "pydantic_core-2.46.4-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f47286a97f0bc9b8859519809077b91b2cefe4ae47fcbf5e466a009c1c5d742b"}, - {file = "pydantic_core-2.46.4-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:905a0ed8ea6f2d61c1738835f99b699348d7857379083e5fc497fa0c967a407c"}, - {file = "pydantic_core-2.46.4-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ea793e075b70290d89d8142074262885d3f7da19634845135751bd6344f73b50"}, - {file = "pydantic_core-2.46.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:395aebd9183f9d112f569aeb5b2214d1a10a33bec8456447f7fbdfa51d38d4cd"}, - {file = "pydantic_core-2.46.4-cp310-cp310-manylinux_2_31_riscv64.whl", hash = "sha256:b078afbc25f3a1436c7a1d2cd3e322497ee99615ba97c563566fdf46aff1ee01"}, - {file = "pydantic_core-2.46.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f747929cf940cddb5b3668a390056ddd5ba2e5010615ea2dcf4f9c4f3ab8791d"}, - {file = "pydantic_core-2.46.4-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:daa27d92c36f24388fe3ad306b174781c747627f134452e4f128ea00ce1fe8c4"}, - {file = "pydantic_core-2.46.4-cp310-cp310-musllinux_1_1_armv7l.whl", hash = "sha256:19e51f073cd3df251856a8a4189fbdf1de4012c3ebacfb1884f94f1eb406079f"}, - {file = "pydantic_core-2.46.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:c1747f85cee84c26985853c6f3d9bd3e75da5212912443fa111c113b9c246f39"}, - {file = "pydantic_core-2.46.4-cp310-cp310-win32.whl", hash = "sha256:2f84c03c8607173d16b5a854ec68a2f9079ae03237a54fb506d13af47e1d018d"}, - {file = "pydantic_core-2.46.4-cp310-cp310-win_amd64.whl", hash = "sha256:8358a950c8909158e3df31538a7e4edc2d7265a7c54b47f0864d9e5bae9dcebf"}, - {file = "pydantic_core-2.46.4-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:0e96592440881c74a213e5ad528e2b24d3d4f940de2766bed9010ab1d9e51594"}, - {file = "pydantic_core-2.46.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:e0d65b8c354be7fb5f720c3caa8bc940bc2d20ce749c8e06135f07f8ed95dd7c"}, - {file = "pydantic_core-2.46.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7bfb192b3f4b9e8a89b6277b6ce787564f62cfd272055f6e685726b111dc7826"}, - {file = "pydantic_core-2.46.4-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:9037063db01f09b09e237c282b6792bd4da634b5402c4e7f0c61effed7701a04"}, - {file = "pydantic_core-2.46.4-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:fc010ab034c8c7452522748bf937df58020d256ccae0874463d1f4d01758af8e"}, - {file = "pydantic_core-2.46.4-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8c5dac79fa1614d1e06ca695109c6105923bd9c7d1d6c918d4e637b7e6b32fd3"}, - {file = "pydantic_core-2.46.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f9fa868638bf362d3d138ea55829cefb3d5f4b0d7f142234382a15e2485dbec4"}, - {file = "pydantic_core-2.46.4-cp311-cp311-manylinux_2_31_riscv64.whl", hash = "sha256:17299feefe090f2caa5b8e37222bb5f663e4935a8bfa6931d4102e5df1a9f398"}, - {file = "pydantic_core-2.46.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:4c63ebc82684aa89d9a3bcbd13d515b3be44250dc68dd3bd81526c1cb31286c3"}, - {file = "pydantic_core-2.46.4-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:aaa2a54443eff1950ba5ddc6b6ccda0d9c84a364276a62f969bdf2a390650848"}, - {file = "pydantic_core-2.46.4-cp311-cp311-musllinux_1_1_armv7l.whl", hash = "sha256:18e5ceec2ab67e6d5f1a9085e5a24c9c4e2ac4545730bfe668680bca05e555f3"}, - {file = "pydantic_core-2.46.4-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:a0f62d0a58f4e7da165457e995725421e0064f2255d8eccebc49f41bbc23b109"}, - {file = "pydantic_core-2.46.4-cp311-cp311-win32.whl", hash = "sha256:041bde0a48fd37cf71cab1c9d56d3e8625a3793fef1f7dd232b3ff37e978ecda"}, - {file = "pydantic_core-2.46.4-cp311-cp311-win_amd64.whl", hash = "sha256:6f2eeda33a839975441c86a4119e1383c50b47faf0cbb5176985565c6bb02c33"}, - {file = "pydantic_core-2.46.4-cp311-cp311-win_arm64.whl", hash = "sha256:14f4c5d6db102bd796a627bbb3a17b4cf4574b9ae861d8b7c9a9661c6dd3362d"}, - {file = "pydantic_core-2.46.4-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:3245406455a5d98187ec35530fd772b1d799b26667980872c8d4614991e2c4a2"}, - {file = "pydantic_core-2.46.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:962ccbab7b642487b1d8b7df90ef677e03134cf1fd8880bf698649b22a69371f"}, - {file = "pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8233f2947cf85404441fd7e0085f53b10c93e0ee78611099b5c7237e36aacbf7"}, - {file = "pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:3a233125ac121aa3ffba9a2b59edfc4a985a76092dc8279586ab4b71390875e7"}, - {file = "pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5b712b53160b79a5850310b912a5ef8e57e56947c8ad690c227f5c9d7e561712"}, - {file = "pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9401557acd873c3a7f3eb9383edef8ac4968f9510e340f4808d427e75667e7b4"}, - {file = "pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:926c9541b14b12b1681dca8a0b75feb510b06c6341b70a8e500c2fdcff837cce"}, - {file = "pydantic_core-2.46.4-cp312-cp312-manylinux_2_31_riscv64.whl", hash = "sha256:56cb4851bcaf3d117eddcef4fe66afd750a50274b0da8e22be256d10e5611987"}, - {file = "pydantic_core-2.46.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:c68fcd102d71ea85c5b2dfac3f4f8476eff42a9e078fd5faefff6d145063536b"}, - {file = "pydantic_core-2.46.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:b2f69dec1725e79a012d920df1707de5caf7ed5e08f3be4435e25803efc47458"}, - {file = "pydantic_core-2.46.4-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:8d0820e8192167f80d88d64038e609c31452eeca865b4e1d9950a27a4609b00b"}, - {file = "pydantic_core-2.46.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:fbdb89b3e1c94a30cc5edfce477c6e6a5dc4d8f84665b455c27582f211a1c72c"}, - {file = "pydantic_core-2.46.4-cp312-cp312-win32.whl", hash = "sha256:9aa768456404a8bf48a4406685ac2bec8e72b62c69313734fa3b73cf33b3a894"}, - {file = "pydantic_core-2.46.4-cp312-cp312-win_amd64.whl", hash = "sha256:e9c26f834c65f5752f3f06cb08cb86a913ceb7274d0db6e267808a708b46bc89"}, - {file = "pydantic_core-2.46.4-cp312-cp312-win_arm64.whl", hash = "sha256:4fc73cb559bdb54b1134a706a2802a4cddd27a0633f5abb7e53056268751ac6a"}, - {file = "pydantic_core-2.46.4-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:5d5902252db0d3cedf8d4a1bc68f70eeb430f7e4c7104c8c476753519b423008"}, - {file = "pydantic_core-2.46.4-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:c94f0688e7b8d0a67abf40e57a7eaaecd17cc9586706a31b76c031f63df052b4"}, - {file = "pydantic_core-2.46.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f027324c56cd5406ca49c124b0db10e56c69064fec039acc571c29020cc87c76"}, - {file = "pydantic_core-2.46.4-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e739fee756ba1010f8bcccb534252e85a35fe45ae92c295a06059ce58b74ccd3"}, - {file = "pydantic_core-2.46.4-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9d56801be94b86a9da183e5f3766e6310752b99ff647e38b09a9500d88e46e76"}, - {file = "pydantic_core-2.46.4-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2412e734dcb48da14d4e4006b82b46b74f2518b8a26ee7e58c6844a6cd6d03c4"}, - {file = "pydantic_core-2.46.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9551187363ffc0de2a00b2e47c25aeaeb1020b69b668762966df15fc5659dd5a"}, - {file = "pydantic_core-2.46.4-cp313-cp313-manylinux_2_31_riscv64.whl", hash = "sha256:0186750b482eefa11d7f435892b09c5c606193ef3375bcf94aa00ae6bfb66262"}, - {file = "pydantic_core-2.46.4-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:5855698a4856556d86e8e6cd8434bc3ac0314ee8e12089ae0e143f64c6256e4e"}, - {file = "pydantic_core-2.46.4-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:cbaf13819775b7f769bf4a1f066cb6df7a28d4480081a589828ef190226881cd"}, - {file = "pydantic_core-2.46.4-cp313-cp313-musllinux_1_1_armv7l.whl", hash = "sha256:633147d34cf4550417f12e2b1a0383973bdf5cdfde212cb09e9a581cf10820be"}, - {file = "pydantic_core-2.46.4-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:82cf5301172168103724d49a1444d3378cb20cdee30b116a1bd6031236298a5d"}, - {file = "pydantic_core-2.46.4-cp313-cp313-win32.whl", hash = "sha256:9fa8ae11da9e2b3126c6426f147e0fba88d96d65921799bb30c6abd1cb2c97fb"}, - {file = "pydantic_core-2.46.4-cp313-cp313-win_amd64.whl", hash = "sha256:6b3ace8194b0e5204818c92802dcdca7fc6d88aabbb799d7c795540d9cd6d292"}, - {file = "pydantic_core-2.46.4-cp313-cp313-win_arm64.whl", hash = "sha256:184c081504d17f1c1066e430e117142b2c77d9448a97f7b65c6ac9fd9aee238d"}, - {file = "pydantic_core-2.46.4-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:428e04521a40150c85216fc8b85e8d39fece235a9cf5e383761238c7fa9b96fb"}, - {file = "pydantic_core-2.46.4-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:23ace664830ee0bfe014a0c7bc248b1f7f25ed7ad103852c317624a1083af462"}, - {file = "pydantic_core-2.46.4-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ce5c1d2a8b27468f433ca974829c44060b8097eedc39933e3c206a90ee49c4a9"}, - {file = "pydantic_core-2.46.4-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:7283d57845ecf5a163403eb0702dfc220cc4fbdd18919cb5ccea4f95ee1cdab4"}, - {file = "pydantic_core-2.46.4-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8daafc69c93ee8a0204506a3b6b30f586ef54028f52aeeeb5c4cfc5184fd5914"}, - {file = "pydantic_core-2.46.4-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cd2213145bcc2ba85884d0ac63d222fece9209678f77b9b4d76f054c561adb28"}, - {file = "pydantic_core-2.46.4-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7a5f930472650a82629163023e630d160863fce524c616f4e5186e5de9d9a49b"}, - {file = "pydantic_core-2.46.4-cp314-cp314-manylinux_2_31_riscv64.whl", hash = "sha256:c1b3f518abeca3aa13c712fd202306e145abf59a18b094a6bafb2d2bbf59192c"}, - {file = "pydantic_core-2.46.4-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:1a7dd0b3ee80d90150e3495a3a13ac34dbcbfd4f012996a6a1d8900e91b5c0fb"}, - {file = "pydantic_core-2.46.4-cp314-cp314-musllinux_1_1_aarch64.whl", hash = "sha256:3fb702cd90b0446a3a1c5e470bfa0dd23c0233b676a9099ddcc964fa6ca13898"}, - {file = "pydantic_core-2.46.4-cp314-cp314-musllinux_1_1_armv7l.whl", hash = "sha256:b8458003118a712e66286df6a707db01c52c0f52f7db8e4a38f0da1d3b94fc4e"}, - {file = "pydantic_core-2.46.4-cp314-cp314-musllinux_1_1_x86_64.whl", hash = "sha256:372429a130e469c9cd698925ce5fc50940b7a1336b0d82038e63d5bbc4edc519"}, - {file = "pydantic_core-2.46.4-cp314-cp314-win32.whl", hash = "sha256:85bb3611ff1802f3ee7fdd7dbff26b56f343fb432d57a4728fdd49b6ef35e2f4"}, - {file = "pydantic_core-2.46.4-cp314-cp314-win_amd64.whl", hash = "sha256:811ff8e9c313ab425368bcbb36e5c4ebd7108c2bbf4e4089cfbb0b01eff63fac"}, - {file = "pydantic_core-2.46.4-cp314-cp314-win_arm64.whl", hash = "sha256:bfec22eab3c8cc2ceec0248aec886624116dc079afa027ecc8ad4a7e62010f8a"}, - {file = "pydantic_core-2.46.4-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:af8244b2bef6aaad6d92cda81372de7f8c8d36c9f0c3ea36e827c60e7d9467a0"}, - {file = "pydantic_core-2.46.4-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:5a4330cdbc57162e4b3aa303f588ba752257694c9c9be3e7ebb11b4aca659b5d"}, - {file = "pydantic_core-2.46.4-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:29c61fc04a3d840155ff08e475a04809278972fe6aef51e2720554e96367e34b"}, - {file = "pydantic_core-2.46.4-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:c50f2528cf200c5eed56faf3f4e22fcd5f38c157a8b78576e6ba3168ec35f000"}, - {file = "pydantic_core-2.46.4-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0cbe8b01f948de4286c74cdd6c667aceb38f5c1e26f0693b3983d9d74887c65e"}, - {file = "pydantic_core-2.46.4-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:617d7e2ca7dcb8c5cf6bcb8c59b8832c94b36196bbf1cbd1bfb56ed341905edd"}, - {file = "pydantic_core-2.46.4-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7027560ee92211647d0d34e3f7cd6f50da56399d26a9c8ad0da286d3869a53f3"}, - {file = "pydantic_core-2.46.4-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:f99626688942fb746e545232e7726926f3be91b5975f8b55327665fafda991c7"}, - {file = "pydantic_core-2.46.4-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:fc3e9034a63de20e15e8ade85358bc6efc614008cab72898b4b4952bea0509ff"}, - {file = "pydantic_core-2.46.4-cp314-cp314t-musllinux_1_1_aarch64.whl", hash = "sha256:97e7cf2be5c77b7d1a9713a05605d49460d02c6078d38d8bef3cbe323c548424"}, - {file = "pydantic_core-2.46.4-cp314-cp314t-musllinux_1_1_armv7l.whl", hash = "sha256:3bf92c5d0e00fefaab325a4d27828fe6b6e2a21848686b5b60d2d9eeb09d76c6"}, - {file = "pydantic_core-2.46.4-cp314-cp314t-musllinux_1_1_x86_64.whl", hash = "sha256:3ecbc122d18468d06ca279dc26a8c2e2d5acb10943bb35e36ae92096dc3b5565"}, - {file = "pydantic_core-2.46.4-cp314-cp314t-win32.whl", hash = "sha256:e846ae7835bf0703ae43f534ab79a867146dadd59dc9ca5c8b53d5c8f7c9ef02"}, - {file = "pydantic_core-2.46.4-cp314-cp314t-win_amd64.whl", hash = "sha256:2108ba5c1c1eca18030634489dc544844144ee36357f2f9f780b93e7ddbb44b5"}, - {file = "pydantic_core-2.46.4-cp314-cp314t-win_arm64.whl", hash = "sha256:4fcbe087dbc2068af7eda3aa87634eba216dbda64d1ae73c8684b621d33f6596"}, - {file = "pydantic_core-2.46.4-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:fd8b3d9fd264be37976686c7f65cd52a83f5e84f4bfd2adf9c1d469676bbb6ae"}, - {file = "pydantic_core-2.46.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:9f444c499b3eefd3a92e348059471ea0c3a6e303d9c1cec09fa748fd9f895201"}, - {file = "pydantic_core-2.46.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3447661d99f75a3683a4cf5c87da72f2161964611864dbbeac7fbb118bb4bfc0"}, - {file = "pydantic_core-2.46.4-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:8b9bab013d1c7a79d3501ff86d0bc9c31bf587db4551677b96bec07df78c6b15"}, - {file = "pydantic_core-2.46.4-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d995260fdf4e1db774581b4900e0f832abe3c7c84996726bbc161b19c8f29e76"}, - {file = "pydantic_core-2.46.4-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f13a646d65d09fbf1bc6b3a9635d30095c8e7e5cc419ff35ecc563c5fd04cd49"}, - {file = "pydantic_core-2.46.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:432c179df7874eeb73307aad2df0755e1ae0efa61ff0ea89b93e194411ae3928"}, - {file = "pydantic_core-2.46.4-cp39-cp39-manylinux_2_31_riscv64.whl", hash = "sha256:e68b7a074f65a2fd746c52a7ce6142ab7006074ac269ace0c25cd8ba171f8066"}, - {file = "pydantic_core-2.46.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:4a05d69cba51d852c5c3e92758653245a50c0b646ced0cf05bd793ed592839d6"}, - {file = "pydantic_core-2.46.4-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:228ee9bae8bef5b1e97ec58302f80357c37199e0d0a99174e138d28e6957b9d9"}, - {file = "pydantic_core-2.46.4-cp39-cp39-musllinux_1_1_armv7l.whl", hash = "sha256:10e17cbb10a330363733efc4d7c4d0dd827ac0909b8f6a6542298fed1ea62f29"}, - {file = "pydantic_core-2.46.4-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:91a06d2e259ecfbd8c901d70c3c507900458498142b3026a296b7de4d1322cc9"}, - {file = "pydantic_core-2.46.4-cp39-cp39-win32.whl", hash = "sha256:d80ee3d731373b24cebbc10d689ca4ee1875caf0d5703a245db18efd4dd37fc1"}, - {file = "pydantic_core-2.46.4-cp39-cp39-win_amd64.whl", hash = "sha256:3be77f45df024d789a672ae34f8b06fb346c4f9f46ea714956660ea4862e89ac"}, - {file = "pydantic_core-2.46.4-graalpy311-graalpy242_311_native-macosx_10_12_x86_64.whl", hash = "sha256:14d4edf427bdcf950a8a02d7cb44a08614388dd6e1bdcbf4f67504fa7887da9c"}, - {file = "pydantic_core-2.46.4-graalpy311-graalpy242_311_native-macosx_11_0_arm64.whl", hash = "sha256:0ce40cd7b21210e99342afafbd4d0f76d784eb5b1d60f3bdc566be4983c6c73b"}, - {file = "pydantic_core-2.46.4-graalpy311-graalpy242_311_native-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:90884113d8b48f760e9587002789ddd741e76ab9f89518cd1e43b1f1a52ec44b"}, - {file = "pydantic_core-2.46.4-graalpy311-graalpy242_311_native-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:66ce7632c22d837c95301830e111ad0128a32b8207533b60896a96c4915192ea"}, - {file = "pydantic_core-2.46.4-graalpy312-graalpy250_312_native-macosx_10_12_x86_64.whl", hash = "sha256:1d8ba486450b14f3b1d63bc521d410ec7565e52f887b9fb671791886436a42f7"}, - {file = "pydantic_core-2.46.4-graalpy312-graalpy250_312_native-macosx_11_0_arm64.whl", hash = "sha256:3009f12e4e90b7f88b4f9adb1b0c4a3d58fe7820f3238c190047209d148026df"}, - {file = "pydantic_core-2.46.4-graalpy312-graalpy250_312_native-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ad785e92e6dc634c21555edc8bd6b64957ab844541bcb96a1366c202951ae526"}, - {file = "pydantic_core-2.46.4-graalpy312-graalpy250_312_native-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:00c603d540afdd6b80eb39f078f33ebd46211f02f33e34a32d9f053bba711de0"}, - {file = "pydantic_core-2.46.4-pp311-pypy311_pp73-macosx_10_12_x86_64.whl", hash = "sha256:0c563b08bca408dc7f65f700633d8442fffb2421fc47b8101377e9fd65051ff0"}, - {file = "pydantic_core-2.46.4-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:db06ffe51636ffe9ca531fe9023dd64bdd794be8754cb5df57c5498ae5b518a7"}, - {file = "pydantic_core-2.46.4-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:133878133d271ade3d41d1bfb2a45ec38dbdbda40bc065921c6b04e4630127e2"}, - {file = "pydantic_core-2.46.4-pp311-pypy311_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:9bc519fbf2b7578398853d815009ae5e4d4603d12f4e3f91da8c06852d3da3e9"}, - {file = "pydantic_core-2.46.4-pp311-pypy311_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:c7a7bd4e39e8e4c12c39cd480356842b6a8a06e41b23a55a5e3e191718838ddf"}, - {file = "pydantic_core-2.46.4-pp311-pypy311_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:d396ec2b979760aaf3218e76c24e65bd0aca24983298653b3a9d7a45f9e47b30"}, - {file = "pydantic_core-2.46.4-pp311-pypy311_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:86e1a4418c6cd97d60c95c71164158eaf7324fae7b0923264016baa993eba6fc"}, - {file = "pydantic_core-2.46.4-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:d51026d73fcfd93610abc7b27789c26b313920fcfb20e27462d74a7f8b06e983"}, - {file = "pydantic_core-2.46.4.tar.gz", hash = "sha256:62f875393d7f270851f20523dd2e29f082bcc82292d66db2b64ea71f64b6e1c1"}, + {file = "pydantic_core-2.46.5-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:657b40d6240c0a7b6a64b30f22d1e3aa631c7e846c621b0c0f6d1d75e2e15ea6"}, + {file = "pydantic_core-2.46.5-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:ecb42011e12ee19cafbc312887cbf3546959fe02fbad44f272d4be5baa997615"}, + {file = "pydantic_core-2.46.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4dedce55295becb61921e386b99d4f2706045306e7fa52249a33004c837379fb"}, + {file = "pydantic_core-2.46.5-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:9f47b8a949e60f027f0aa0a6f6c7b7e9c55cbf4380d10b344e282fa4e7ab1e1b"}, + {file = "pydantic_core-2.46.5-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:200aa3dc9f8d54f0754f43247c0bad0999fdcfbfd2488384dd44f37279271fe6"}, + {file = "pydantic_core-2.46.5-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6d30e1a4f138b8951063e9a394752a9179b51da288ffa507b1e659222f4c1793"}, + {file = "pydantic_core-2.46.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:850a08d167dde16db8702c274f320c7be9d7da6f6dff2b58b18f9e815bd94f5b"}, + {file = "pydantic_core-2.46.5-cp310-cp310-manylinux_2_31_riscv64.whl", hash = "sha256:c3471e5c4a949c26ec00a77f01df59096aa9495877de76fd60a980f8ee6be461"}, + {file = "pydantic_core-2.46.5-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:3a3e26b6a8274211bddee2d0e4d0d42778f17a34510f49d2ec44b58abfc41736"}, + {file = "pydantic_core-2.46.5-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:fc5d783bd4a2387e97b8a2d5ec781cfb92b3d893bf82370548e99db5915935d3"}, + {file = "pydantic_core-2.46.5-cp310-cp310-musllinux_1_1_armv7l.whl", hash = "sha256:356c8368cbc321050b169595683a2e1d63413b1e0e2868b330af9fc14c616d3f"}, + {file = "pydantic_core-2.46.5-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:eb7d8d0e5886a89a55d2eef490e272fa965a9d57c6b29a5b5088a7997ec2cad1"}, + {file = "pydantic_core-2.46.5-cp310-cp310-win32.whl", hash = "sha256:4d44cf99ddebf875f9b68cc267aa684c99b7b44fe63ee1cac4ec163807290069"}, + {file = "pydantic_core-2.46.5-cp310-cp310-win_amd64.whl", hash = "sha256:1e5aad1220a1192c42341c8fd4a8686657e73ab2a920c970bdc4de334fe3193d"}, + {file = "pydantic_core-2.46.5-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:a1dee1b804ff4d11c663636cf15d2ea47e9f79cd56c033fb1cbf08924842a48f"}, + {file = "pydantic_core-2.46.5-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:d625a186a65201c23a9e3b8ed9c47e90a026e03256608cc91851c6709096844f"}, + {file = "pydantic_core-2.46.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4f8507560a9284e1370bb048ed4282012fbef4e8d109875b95e884d228552061"}, + {file = "pydantic_core-2.46.5-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5f93c5fe914d75fbec9a49209b00da5f08e9e467d69da2b1510c81940cfd10be"}, + {file = "pydantic_core-2.46.5-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:aca6c767f552b21b10f774aeac128e828eafb796adfa1b666a18bf6321453c3a"}, + {file = "pydantic_core-2.46.5-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:701b2e04b560eeb4bddf7a25ab8ca476176e34fdbd9a0e18196f0d12d4685f0b"}, + {file = "pydantic_core-2.46.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:49776eab08766a08dfff7012f8b422dcd7e25e43b316eedf0477c24fcfa84b7c"}, + {file = "pydantic_core-2.46.5-cp311-cp311-manylinux_2_31_riscv64.whl", hash = "sha256:a2468d93d181667a7abd66e1b64bb9f76f361b0fef8faddf687456453576f5ee"}, + {file = "pydantic_core-2.46.5-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:53feb344243bb9510a9dec7bf3cf1b64d88a98af5dc7872a5160465f8b198c8e"}, + {file = "pydantic_core-2.46.5-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:cd5214352ae68f3b5e9af7768bdc5253695ee069675db3480518420b3be881f2"}, + {file = "pydantic_core-2.46.5-cp311-cp311-musllinux_1_1_armv7l.whl", hash = "sha256:9432f3598db432cb51c5b37fdbf29a60fcccc79e30d37a05022776a6bc4ab689"}, + {file = "pydantic_core-2.46.5-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:8feeac04b5794e513e710af2f9c87d49f31a6dc47967bb264a1fed61a8989bec"}, + {file = "pydantic_core-2.46.5-cp311-cp311-win32.whl", hash = "sha256:892a881d5f68c2b9ea304b7a6c2c60d9343df578a311b0f86b94bc8f1ffe8129"}, + {file = "pydantic_core-2.46.5-cp311-cp311-win_amd64.whl", hash = "sha256:40375c2d05acec10323e45dfe2077ac44bc74659008614af5069034e2cfc781c"}, + {file = "pydantic_core-2.46.5-cp311-cp311-win_arm64.whl", hash = "sha256:28a6a556cd3b6066bea827857f9d9cce027c96f776e512f544a581f9e42161f8"}, + {file = "pydantic_core-2.46.5-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:b9fe6fb92520e3fd61f2e49000b6911b188824f089b75973ea06d6267f0b476d"}, + {file = "pydantic_core-2.46.5-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a39ac25a9a2fa4072efdb429833c4a4c8009a51ff9eea3eeae131713cd27991e"}, + {file = "pydantic_core-2.46.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4fdc8b93a41521988916eeaa271173fcca7fa0803d62f87675aac8dcec1c8e29"}, + {file = "pydantic_core-2.46.5-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:b98134087d9de723658d17a42c7d0da8d6e2ef08015dee7dc93889047315f5e4"}, + {file = "pydantic_core-2.46.5-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e652ab17569c94bff5475520f907b7148b8c24036a8ebbe5cf7cf7493d28579a"}, + {file = "pydantic_core-2.46.5-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d925f3d9afd05a8c0fb3a1031463a8d59ebe5e2afad297e29c78be19e13b4e62"}, + {file = "pydantic_core-2.46.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0fc5be0abd4a407e200d844b404e33639a554e7bd0d448e7b9ae181be4789ac2"}, + {file = "pydantic_core-2.46.5-cp312-cp312-manylinux_2_31_riscv64.whl", hash = "sha256:816ff0a6550ffc06c098ccd2e0698600f9aa7da192a79eaa6f9af504a35db869"}, + {file = "pydantic_core-2.46.5-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:c7ea57fc63aa7da93a1bd2d644e6577befae10c52c4e36377635eea1056a74f5"}, + {file = "pydantic_core-2.46.5-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:efd62a42486f1bda5d24cb4f63d15a3c7768375fe83d36f9417b4ad7a2fb20b3"}, + {file = "pydantic_core-2.46.5-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:2bc9419666990c06d7397831f2126a1ecc3594aaa3ff7de5bf2d066802f4e07b"}, + {file = "pydantic_core-2.46.5-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:18a09e1e1011b462f2e32774f25859ef1223d5c2b0546a633cf56654710721e0"}, + {file = "pydantic_core-2.46.5-cp312-cp312-win32.whl", hash = "sha256:5cb482e9e84c851f4e623fe4acc1ced89168cf1fe18f7089db4548c8f5bbb65b"}, + {file = "pydantic_core-2.46.5-cp312-cp312-win_amd64.whl", hash = "sha256:5e81740c09e310f5aa5cbd3e434a01c154d4bef93241c7877b39f211d2b78ba8"}, + {file = "pydantic_core-2.46.5-cp312-cp312-win_arm64.whl", hash = "sha256:f7b0ec93a2893de856652154d73b7ba622f26fa97726487dcac373de5f4c6084"}, + {file = "pydantic_core-2.46.5-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:b7ca9034437b6022f941f4857459562ee00a560b97e7cce8a0ec5a74fc6766e0"}, + {file = "pydantic_core-2.46.5-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:f332f0e72a5a0400141f830744e141bf9f97917878dbe968669e8a7fefea78ff"}, + {file = "pydantic_core-2.46.5-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:193375f3548919d3f0b60936ca113ada3e38f264f91b9b8e0508efaad57be931"}, + {file = "pydantic_core-2.46.5-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:79bdfa52f843137045b2d081cc05c120ba6665d29b7559c2c47690906f39279f"}, + {file = "pydantic_core-2.46.5-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:24922243639cbdac66c75fcb6fd6495a9cb52b213d62f9a0d16f0310b1ff8038"}, + {file = "pydantic_core-2.46.5-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c76fe65e607be28c7fd4d56fc3c42b1583aa058ce3408b7ad0fd540171d31f9f"}, + {file = "pydantic_core-2.46.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6f7b393a8b3da82f5c1fc0751e6d01ac6c55b93c18226a60bdfba4a724efafd1"}, + {file = "pydantic_core-2.46.5-cp313-cp313-manylinux_2_31_riscv64.whl", hash = "sha256:7ac031912d54f3d83ef3b3eb98dfabc1608802e2202263d25957eeed40b94761"}, + {file = "pydantic_core-2.46.5-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:837b396ca3d7b74091ca623f6cbd8351bd42d670a79c2683e79fb089f06a2de5"}, + {file = "pydantic_core-2.46.5-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:5ee239d575f80b08eca11f6e20f90c4c695de7825c67eefe6091fbf20dda648e"}, + {file = "pydantic_core-2.46.5-cp313-cp313-musllinux_1_1_armv7l.whl", hash = "sha256:e80675d75ae2cd14372cb65cad5400d9347a3d3f6c13000183f22dfd027283ed"}, + {file = "pydantic_core-2.46.5-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:9c4b71f10dd532fb7a5cbc8f58707779e64f03a258c2bf8bfbaecfcd9970b519"}, + {file = "pydantic_core-2.46.5-cp313-cp313-win32.whl", hash = "sha256:97bf8de4d541598c94a59344eeb988a94c08ff76b5723c41f6567ec18c7892ea"}, + {file = "pydantic_core-2.46.5-cp313-cp313-win_amd64.whl", hash = "sha256:15f4a94963c95accac15b7b657bb177d3ad82bb90b0d0526d9a9b85079925db5"}, + {file = "pydantic_core-2.46.5-cp313-cp313-win_arm64.whl", hash = "sha256:d22a945598fb91236b4dd793a6e42e4f3dd7740bb5aace5ebd7d4c08d13bb575"}, + {file = "pydantic_core-2.46.5-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:c1c43ad4339643d70ebb8124e1305a7dab423001eff58bb41a0f731adbc98355"}, + {file = "pydantic_core-2.46.5-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:1a353f84de772f423b5ffb11d7ae352fbbef0f446f3c0b0af0f8236d7233606e"}, + {file = "pydantic_core-2.46.5-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5086029a57366b8cf81b130a43908738095c270c21a8d7f0e8bdfdb89718e2f3"}, + {file = "pydantic_core-2.46.5-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:46c25dda9d092a06c08db76ffe0a197107904d0dfac653f7d5306bbcd6d6119c"}, + {file = "pydantic_core-2.46.5-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:37ea7b83c935e5b0d68c9449b82651accf78a10828b2c02b2f2d9e9496446c21"}, + {file = "pydantic_core-2.46.5-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e64e88d5585bea9ce95861079de72006c7fa6d3df4e3a3b65ba31eb979c15c9f"}, + {file = "pydantic_core-2.46.5-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:54d510bac3ee52247af28ed4bb18a1e799f040ac60fd2bf5ccd4c92f1fbe786f"}, + {file = "pydantic_core-2.46.5-cp314-cp314-manylinux_2_31_riscv64.whl", hash = "sha256:a2a5e1d0ff29adddc9f6d6821a66302e4493f8ca898b715b6b1182c2c201ea0a"}, + {file = "pydantic_core-2.46.5-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:03b9666e41e35d8909852ba191a0607520f81b74eaf12ccf8737005dbb313821"}, + {file = "pydantic_core-2.46.5-cp314-cp314-musllinux_1_1_aarch64.whl", hash = "sha256:a91c17edf6eea2402cb5457b4c89e99bc5ed1004aa34c4adf1d4258c1a5c22c2"}, + {file = "pydantic_core-2.46.5-cp314-cp314-musllinux_1_1_armv7l.whl", hash = "sha256:b49924c73a235e969511bf2aabdff3beebf9820931f646c80274d5d780010c47"}, + {file = "pydantic_core-2.46.5-cp314-cp314-musllinux_1_1_x86_64.whl", hash = "sha256:2cbd9a5eff05e51c447c34dfa4632145b26b09120cf04bd0c871e44c1a5e1c9a"}, + {file = "pydantic_core-2.46.5-cp314-cp314-win32.whl", hash = "sha256:2d5d76654becf5efd62c9e51c3756c67b49498b0c9a40884934c40807adbd074"}, + {file = "pydantic_core-2.46.5-cp314-cp314-win_amd64.whl", hash = "sha256:fa10ef4112775900e7a0661068635eb67b2ab824fbde764de6e0e21982a93db0"}, + {file = "pydantic_core-2.46.5-cp314-cp314-win_arm64.whl", hash = "sha256:045ab3b6d308439e32b81cc173bba5b9018bc6ed896afd0c65b3b009b1699af5"}, + {file = "pydantic_core-2.46.5-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:8816f3d218beb4b787de5c9759c259b8fa61f9dec42dc7811f320a33771778b7"}, + {file = "pydantic_core-2.46.5-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:bce57638e08ac148e5778cce7feb968307a727d66f8e2274a543d0cf0c9ad6a3"}, + {file = "pydantic_core-2.46.5-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:976e1128455aa595ea04c79ccfedff1aaeab96ee013fcc916bed120c4f0ad94f"}, + {file = "pydantic_core-2.46.5-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e7b891faeedeafba41b2983e5001a81b6a915b69544c7e7570d1989ce1c36ac7"}, + {file = "pydantic_core-2.46.5-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5f194189415698233dd1114a093a9b56e61e2c57e11b469be3b0506f46f0771c"}, + {file = "pydantic_core-2.46.5-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:82a36973cf8a2ef5406f4fe2edbf8ed0c99629535d959e0b100c76a32535a111"}, + {file = "pydantic_core-2.46.5-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cdbb78909f52b981d3b2d56b97328d71eb0b974c36bd77c920123a7ebb192829"}, + {file = "pydantic_core-2.46.5-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:52e24eacdb536cade636aa90fb851835222becff8484b7001fdc78cb0290f2aa"}, + {file = "pydantic_core-2.46.5-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:37ae34309d7bd8c0d61ab839668058f2a7962ea1fc51d105d2db228fe0618034"}, + {file = "pydantic_core-2.46.5-cp314-cp314t-musllinux_1_1_aarch64.whl", hash = "sha256:0cdbada856a1c69a7624a64d3d9aefe79300bd6ef827b43a4f265010b9b55184"}, + {file = "pydantic_core-2.46.5-cp314-cp314t-musllinux_1_1_armv7l.whl", hash = "sha256:545f26c504b27c3758439a5e6d9349931f0a04f855668d5fe323c89e82300a38"}, + {file = "pydantic_core-2.46.5-cp314-cp314t-musllinux_1_1_x86_64.whl", hash = "sha256:ff218293c9c806138dca139765e3b067621be52bcd93cdc14c7711be7ddc90a9"}, + {file = "pydantic_core-2.46.5-cp314-cp314t-win32.whl", hash = "sha256:97cf3eb53a8cccacf9d46686a0926186c9bfb5574f2ed66d3639d5fe117cd3a9"}, + {file = "pydantic_core-2.46.5-cp314-cp314t-win_amd64.whl", hash = "sha256:d2f9fc07a8042a8f95925b35c4f04f469707c981fc33245b6ca187cf5d2dd290"}, + {file = "pydantic_core-2.46.5-cp314-cp314t-win_arm64.whl", hash = "sha256:acf8a67ba51f4ca9ddbd0e6b3000a65ac51ab734661778b3e7ba64d99a710f2f"}, + {file = "pydantic_core-2.46.5-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:c583b927a8838dab890706a6fa7573fbb8b70e24000ef9f7238e2d6f6435a5ed"}, + {file = "pydantic_core-2.46.5-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:cdc8b74ecc48c0cb1e9607a05ec4e9e88db60a19ffcc9a1d5f9088ede40c8dc0"}, + {file = "pydantic_core-2.46.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8b10e3e8fd7ddc2bd915848a2768e44c15b22936f1cc54c462ad1164deb02655"}, + {file = "pydantic_core-2.46.5-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f077d0b97ab11fa7dcc633fca53515f290bca8a8a633e966d5b6d1879d9ed01a"}, + {file = "pydantic_core-2.46.5-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7b0fc826b16c55e561e5d2a0c5c77b051ba1d92808118c4e4b5390f5e0cf191d"}, + {file = "pydantic_core-2.46.5-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ef3fbbf161dc9351a2fe0422e51b129f9e97e42385bd0320b309c15f7d287dd8"}, + {file = "pydantic_core-2.46.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:978e7b97d4824b5be09c69fb70507cbde3b0323fc147332ca40a94d9a6a0ebbf"}, + {file = "pydantic_core-2.46.5-cp39-cp39-manylinux_2_31_riscv64.whl", hash = "sha256:9b68938dd5b0c783d88ff8e2dcc69451b5eb936fe212d516b21b9d5567f6d464"}, + {file = "pydantic_core-2.46.5-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:771cf63ae0b1b50dd22e5f3e3549fab5f3f4ff1635d352a9e1a97fe01c7b2e64"}, + {file = "pydantic_core-2.46.5-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:7c6be839a5a8312626b32029a415644a0846b420bc8b52b95b28cd92da162168"}, + {file = "pydantic_core-2.46.5-cp39-cp39-musllinux_1_1_armv7l.whl", hash = "sha256:895395f8918627b04efb1ad2a4cf605387143300ba03304cd1dfa6d03f5e095e"}, + {file = "pydantic_core-2.46.5-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:fc8515076c11f3cfdf4fb142dcca0fe384b1230a3b5415458ac84f3e0903ec13"}, + {file = "pydantic_core-2.46.5-cp39-cp39-win32.whl", hash = "sha256:3d2652072b2d774947ba5cf78a9e59644ac62ee572daf6dd2e1dfe905e15b2b7"}, + {file = "pydantic_core-2.46.5-cp39-cp39-win_amd64.whl", hash = "sha256:3aa166e99c4f2985407fb8714aebede877ecb5455cf321b606adca926d30d5a0"}, + {file = "pydantic_core-2.46.5-graalpy311-graalpy242_311_native-macosx_10_12_x86_64.whl", hash = "sha256:c14ad3bdc85ee7f318742c457ca3968a92126d144b15721c759033bfb06296c2"}, + {file = "pydantic_core-2.46.5-graalpy311-graalpy242_311_native-macosx_11_0_arm64.whl", hash = "sha256:0bddb4020d8f04175865ccd17eff3040874fc11fb593f424edb452653b4b947c"}, + {file = "pydantic_core-2.46.5-graalpy311-graalpy242_311_native-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2471fd51c61c610e1dcf7de44d7299283661654d11264ab4802b303368d69c47"}, + {file = "pydantic_core-2.46.5-graalpy311-graalpy242_311_native-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b10ec717381bdbfafef34607824db4c91de69ff085e4fca3b2af91b4fa17e68a"}, + {file = "pydantic_core-2.46.5-graalpy312-graalpy250_312_native-macosx_10_12_x86_64.whl", hash = "sha256:013d6f3483d81e02e7c328831808f336c8596ee33b4bd4026b9ffb1e960b8942"}, + {file = "pydantic_core-2.46.5-graalpy312-graalpy250_312_native-macosx_11_0_arm64.whl", hash = "sha256:e9c134bb666dd54b778b9fc0d2b50cbb7f979b9e3716f26a88c9ab3b6fc1dd0f"}, + {file = "pydantic_core-2.46.5-graalpy312-graalpy250_312_native-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:347ec774390c87326a2e4929d58d3f7e8763a104d5d35f4cd595a4c952366433"}, + {file = "pydantic_core-2.46.5-graalpy312-graalpy250_312_native-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8e24d8f05fa2d28513d94e877e9c75ad66175376209b3977f916e240e623193c"}, + {file = "pydantic_core-2.46.5-pp311-pypy311_pp73-macosx_10_12_x86_64.whl", hash = "sha256:ab4b66edffb32d9e951efb3814bd104b8367a7501b81b955cacb5726d897389f"}, + {file = "pydantic_core-2.46.5-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:337639ba62a11acde6ef3aeb08c8ea755f8ef1fe5e513356c0f36a2b0d7568b0"}, + {file = "pydantic_core-2.46.5-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:413a717a410d0c817ef5b786a059415550b3794e1d0c2abffd9efb93a3d9f7b4"}, + {file = "pydantic_core-2.46.5-pp311-pypy311_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:1e449def1945a462c464331254e5a44fca7c3b4f9aedf59ec2f50f8066dd8e25"}, + {file = "pydantic_core-2.46.5-pp311-pypy311_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:a445486499897b88a7d6c310c88ed64dd37b1b59bfd7ae9107490bbb362f47d6"}, + {file = "pydantic_core-2.46.5-pp311-pypy311_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:2d330aaba8621b1edcec8ae2c4050f63b84ccf6d98723a8f212e9684713abf0e"}, + {file = "pydantic_core-2.46.5-pp311-pypy311_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:b6acfb46a814762367fb7ba0828b0a17d441b92ce249a0e007474c9072662dda"}, + {file = "pydantic_core-2.46.5-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:d0a24b40877af2de4950252be9d21eaf7fb07660f3c2cae1f56c6b599ada5266"}, + {file = "pydantic_core-2.46.5.tar.gz", hash = "sha256:10416c15b8839ecc4ef4d0885da76da6fd0f67333a0eb8aff6d93c4b8f2910fc"}, ] [package.dependencies] diff --git a/pyproject.toml b/pyproject.toml index f9a980d7..4082a9dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ dynamic = ["version"] [tool.poetry] name = "deepgram-sdk" -version = "7.8.1" +version = "7.8.2" description = "" readme = "README.md" authors = [] diff --git a/src/deepgram/__init__.py b/src/deepgram/__init__.py index be1a85ec..e857eead 100644 --- a/src/deepgram/__init__.py +++ b/src/deepgram/__init__.py @@ -434,17 +434,6 @@ UsageV1ResponseResolutionParams, ) from .version import __version__ - from .types import AnthropicThinkProviderModel - from .types import CartesiaSpeakProviderModelId - from .types import CartesiaSpeakProviderVoice - from .requests import CartesiaSpeakProviderVoiceParams - from .types import CreateKeyV1RequestOne - from .types import DeepgramListenProviderV2LanguageHint - from .requests import DeepgramListenProviderV2LanguageHintParams - from .types import DeepgramSpeakProviderModel - from .types import GoogleThinkProviderModel - from .types import GoogleThinkProviderVersion - from .types import GroqThinkProviderReasoningMode _dynamic_imports: typing.Dict[str, str] = { "AgentConfigurationV1": ".types", "AgentConfigurationV1Params": ".requests", @@ -470,7 +459,6 @@ "Anthropic": ".types", "AnthropicModel": ".types", "AnthropicParams": ".requests", - "AnthropicThinkProviderModel": ".types", "AsyncDeepgramClient": ".client", "AwsBedrockThinkProvider": ".types", "AwsBedrockThinkProviderCredentials": ".types", @@ -497,15 +485,11 @@ "Cartesia": ".types", "CartesiaModelId": ".types", "CartesiaParams": ".requests", - "CartesiaSpeakProviderModelId": ".types", - "CartesiaSpeakProviderVoice": ".types", - "CartesiaSpeakProviderVoiceParams": ".requests", "CartesiaVoice": ".types", "CartesiaVoiceParams": ".requests", "CreateAgentConfigurationV1Response": ".types", "CreateAgentConfigurationV1ResponseParams": ".requests", "CreateKeyV1Request": ".types", - "CreateKeyV1RequestOne": ".types", "CreateKeyV1RequestParams": ".requests", "CreateKeyV1Response": ".types", "CreateKeyV1ResponseParams": ".requests", @@ -523,12 +507,9 @@ "DeepgramListenProviderV1": ".types", "DeepgramListenProviderV1Params": ".requests", "DeepgramListenProviderV2": ".types", - "DeepgramListenProviderV2LanguageHint": ".types", - "DeepgramListenProviderV2LanguageHintParams": ".requests", "DeepgramListenProviderV2Params": ".requests", "DeepgramModel": ".types", "DeepgramParams": ".requests", - "DeepgramSpeakProviderModel": ".types", "DefaultAioHttpClient": "._default_clients", "DefaultAsyncHttpxClient": "._default_clients", "DeleteAgentConfigurationV1Response": ".types", @@ -582,15 +563,12 @@ "Google": ".types", "GoogleModel": ".types", "GoogleParams": ".requests", - "GoogleThinkProviderModel": ".types", - "GoogleThinkProviderVersion": ".types", "GoogleVersion": ".types", "GrantV1Response": ".types", "GrantV1ResponseParams": ".requests", "Groq": ".types", "GroqParams": ".requests", "GroqReasoningMode": ".types", - "GroqThinkProviderReasoningMode": ".types", "LeaveProjectV1Response": ".types", "LeaveProjectV1ResponseParams": ".requests", "ListAgentConfigurationsV1Response": ".types", @@ -939,7 +917,6 @@ def __dir__(): "Anthropic", "AnthropicModel", "AnthropicParams", - "AnthropicThinkProviderModel", "AsyncDeepgramClient", "AwsBedrockThinkProvider", "AwsBedrockThinkProviderCredentials", @@ -966,15 +943,11 @@ def __dir__(): "Cartesia", "CartesiaModelId", "CartesiaParams", - "CartesiaSpeakProviderModelId", - "CartesiaSpeakProviderVoice", - "CartesiaSpeakProviderVoiceParams", "CartesiaVoice", "CartesiaVoiceParams", "CreateAgentConfigurationV1Response", "CreateAgentConfigurationV1ResponseParams", "CreateKeyV1Request", - "CreateKeyV1RequestOne", "CreateKeyV1RequestParams", "CreateKeyV1Response", "CreateKeyV1ResponseParams", @@ -992,12 +965,9 @@ def __dir__(): "DeepgramListenProviderV1", "DeepgramListenProviderV1Params", "DeepgramListenProviderV2", - "DeepgramListenProviderV2LanguageHint", - "DeepgramListenProviderV2LanguageHintParams", "DeepgramListenProviderV2Params", "DeepgramModel", "DeepgramParams", - "DeepgramSpeakProviderModel", "DefaultAioHttpClient", "DefaultAsyncHttpxClient", "DeleteAgentConfigurationV1Response", @@ -1051,15 +1021,12 @@ def __dir__(): "Google", "GoogleModel", "GoogleParams", - "GoogleThinkProviderModel", - "GoogleThinkProviderVersion", "GoogleVersion", "GrantV1Response", "GrantV1ResponseParams", "Groq", "GroqParams", "GroqReasoningMode", - "GroqThinkProviderReasoningMode", "LeaveProjectV1Response", "LeaveProjectV1ResponseParams", "ListAgentConfigurationsV1Response", diff --git a/src/deepgram/agent/__init__.py b/src/deepgram/agent/__init__.py index 11be1460..7cfeda7d 100644 --- a/src/deepgram/agent/__init__.py +++ b/src/deepgram/agent/__init__.py @@ -19,6 +19,8 @@ AgentV1ConversationTextRole, AgentV1Error, AgentV1ErrorParams, + AgentV1ForceEndTurn, + AgentV1ForceEndTurnParams, AgentV1FunctionCallRequest, AgentV1FunctionCallRequestFunctionsItem, AgentV1FunctionCallRequestFunctionsItemParams, @@ -129,35 +131,6 @@ FunctionCallHistoryMessageFunctionCallsItemParams, FunctionCallHistoryMessageParams, ) - from .v1 import AgentV1HistoryContent - from .v1 import AgentV1HistoryContentParams - from .v1 import AgentV1HistoryContentRole - from .v1 import AgentV1HistoryFunctionCalls - from .v1 import AgentV1HistoryFunctionCallsFunctionCallsItem - from .v1 import AgentV1HistoryFunctionCallsFunctionCallsItemParams - from .v1 import AgentV1HistoryFunctionCallsParams - from .v1 import AgentV1SettingsAgentContextContextMessagesItemContentRole - from .v1 import AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem - from .v1 import AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams - from .v1 import AgentV1SettingsAgentContextListenProviderV1 - from .v1 import AgentV1SettingsAgentContextListenProviderV1Params - from .v1 import AgentV1SettingsAgentContextListenProviderV2 - from .v1 import AgentV1SettingsAgentContextListenProviderV2LanguageHint - from .v1 import AgentV1SettingsAgentContextListenProviderV2LanguageHintParams - from .v1 import AgentV1SettingsAgentContextListenProviderV2Params - from .v1 import AgentV1SettingsAgentContextMessagesItem - from .v1 import AgentV1SettingsAgentContextMessagesItemContent - from .v1 import AgentV1SettingsAgentContextMessagesItemContentParams - from .v1 import AgentV1SettingsAgentContextMessagesItemContentRole - from .v1 import AgentV1SettingsAgentContextMessagesItemFunctionCalls - from .v1 import AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem - from .v1 import AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams - from .v1 import AgentV1SettingsAgentContextMessagesItemFunctionCallsParams - from .v1 import AgentV1SettingsAgentContextMessagesItemParams - from .v1 import AgentV1SettingsAgentListenProviderV1 - from .v1 import AgentV1SettingsAgentListenProviderV1Params - from .v1 import AgentV1SettingsAgentListenProviderV2 - from .v1 import AgentV1SettingsAgentListenProviderV2Params _dynamic_imports: typing.Dict[str, str] = { "AgentV1AgentAudioDone": ".v1", "AgentV1AgentAudioDoneParams": ".v1", @@ -170,18 +143,13 @@ "AgentV1ConversationTextRole": ".v1", "AgentV1Error": ".v1", "AgentV1ErrorParams": ".v1", + "AgentV1ForceEndTurn": ".v1", + "AgentV1ForceEndTurnParams": ".v1", "AgentV1FunctionCallRequest": ".v1", "AgentV1FunctionCallRequestFunctionsItem": ".v1", "AgentV1FunctionCallRequestFunctionsItemParams": ".v1", "AgentV1FunctionCallRequestParams": ".v1", "AgentV1History": ".v1", - "AgentV1HistoryContent": ".v1", - "AgentV1HistoryContentParams": ".v1", - "AgentV1HistoryContentRole": ".v1", - "AgentV1HistoryFunctionCalls": ".v1", - "AgentV1HistoryFunctionCallsFunctionCallsItem": ".v1", - "AgentV1HistoryFunctionCallsFunctionCallsItemParams": ".v1", - "AgentV1HistoryFunctionCallsParams": ".v1", "AgentV1HistoryParams": ".v1", "AgentV1InjectAgentMessage": ".v1", "AgentV1InjectAgentMessageBehavior": ".v1", @@ -207,34 +175,16 @@ "AgentV1SettingsAgentContext": ".v1", "AgentV1SettingsAgentContextContext": ".v1", "AgentV1SettingsAgentContextContextMessagesItem": ".v1", - "AgentV1SettingsAgentContextContextMessagesItemContentRole": ".v1", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem": ".v1", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams": ".v1", "AgentV1SettingsAgentContextContextMessagesItemParams": ".v1", "AgentV1SettingsAgentContextContextParams": ".v1", "AgentV1SettingsAgentContextListen": ".v1", "AgentV1SettingsAgentContextListenParams": ".v1", "AgentV1SettingsAgentContextListenProvider": ".v1", "AgentV1SettingsAgentContextListenProviderParams": ".v1", - "AgentV1SettingsAgentContextListenProviderV1": ".v1", - "AgentV1SettingsAgentContextListenProviderV1Params": ".v1", - "AgentV1SettingsAgentContextListenProviderV2": ".v1", - "AgentV1SettingsAgentContextListenProviderV2LanguageHint": ".v1", - "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams": ".v1", - "AgentV1SettingsAgentContextListenProviderV2Params": ".v1", "AgentV1SettingsAgentContextListenProvider_V1": ".v1", "AgentV1SettingsAgentContextListenProvider_V1Params": ".v1", "AgentV1SettingsAgentContextListenProvider_V2": ".v1", "AgentV1SettingsAgentContextListenProvider_V2Params": ".v1", - "AgentV1SettingsAgentContextMessagesItem": ".v1", - "AgentV1SettingsAgentContextMessagesItemContent": ".v1", - "AgentV1SettingsAgentContextMessagesItemContentParams": ".v1", - "AgentV1SettingsAgentContextMessagesItemContentRole": ".v1", - "AgentV1SettingsAgentContextMessagesItemFunctionCalls": ".v1", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem": ".v1", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams": ".v1", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams": ".v1", - "AgentV1SettingsAgentContextMessagesItemParams": ".v1", "AgentV1SettingsAgentContextParams": ".v1", "AgentV1SettingsAgentContextSpeak": ".v1", "AgentV1SettingsAgentContextSpeakParams": ".v1", @@ -244,10 +194,6 @@ "AgentV1SettingsAgentListenParams": ".v1", "AgentV1SettingsAgentListenProvider": ".v1", "AgentV1SettingsAgentListenProviderParams": ".v1", - "AgentV1SettingsAgentListenProviderV1": ".v1", - "AgentV1SettingsAgentListenProviderV1Params": ".v1", - "AgentV1SettingsAgentListenProviderV2": ".v1", - "AgentV1SettingsAgentListenProviderV2Params": ".v1", "AgentV1SettingsAgentListenProvider_V1": ".v1", "AgentV1SettingsAgentListenProvider_V1Params": ".v1", "AgentV1SettingsAgentListenProvider_V2": ".v1", @@ -345,18 +291,13 @@ def __dir__(): "AgentV1ConversationTextRole", "AgentV1Error", "AgentV1ErrorParams", + "AgentV1ForceEndTurn", + "AgentV1ForceEndTurnParams", "AgentV1FunctionCallRequest", "AgentV1FunctionCallRequestFunctionsItem", "AgentV1FunctionCallRequestFunctionsItemParams", "AgentV1FunctionCallRequestParams", "AgentV1History", - "AgentV1HistoryContent", - "AgentV1HistoryContentParams", - "AgentV1HistoryContentRole", - "AgentV1HistoryFunctionCalls", - "AgentV1HistoryFunctionCallsFunctionCallsItem", - "AgentV1HistoryFunctionCallsFunctionCallsItemParams", - "AgentV1HistoryFunctionCallsParams", "AgentV1HistoryParams", "AgentV1InjectAgentMessage", "AgentV1InjectAgentMessageBehavior", @@ -382,34 +323,16 @@ def __dir__(): "AgentV1SettingsAgentContext", "AgentV1SettingsAgentContextContext", "AgentV1SettingsAgentContextContextMessagesItem", - "AgentV1SettingsAgentContextContextMessagesItemContentRole", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams", "AgentV1SettingsAgentContextContextMessagesItemParams", "AgentV1SettingsAgentContextContextParams", "AgentV1SettingsAgentContextListen", "AgentV1SettingsAgentContextListenParams", "AgentV1SettingsAgentContextListenProvider", "AgentV1SettingsAgentContextListenProviderParams", - "AgentV1SettingsAgentContextListenProviderV1", - "AgentV1SettingsAgentContextListenProviderV1Params", - "AgentV1SettingsAgentContextListenProviderV2", - "AgentV1SettingsAgentContextListenProviderV2LanguageHint", - "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams", - "AgentV1SettingsAgentContextListenProviderV2Params", "AgentV1SettingsAgentContextListenProvider_V1", "AgentV1SettingsAgentContextListenProvider_V1Params", "AgentV1SettingsAgentContextListenProvider_V2", "AgentV1SettingsAgentContextListenProvider_V2Params", - "AgentV1SettingsAgentContextMessagesItem", - "AgentV1SettingsAgentContextMessagesItemContent", - "AgentV1SettingsAgentContextMessagesItemContentParams", - "AgentV1SettingsAgentContextMessagesItemContentRole", - "AgentV1SettingsAgentContextMessagesItemFunctionCalls", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams", - "AgentV1SettingsAgentContextMessagesItemParams", "AgentV1SettingsAgentContextParams", "AgentV1SettingsAgentContextSpeak", "AgentV1SettingsAgentContextSpeakParams", @@ -419,10 +342,6 @@ def __dir__(): "AgentV1SettingsAgentListenParams", "AgentV1SettingsAgentListenProvider", "AgentV1SettingsAgentListenProviderParams", - "AgentV1SettingsAgentListenProviderV1", - "AgentV1SettingsAgentListenProviderV1Params", - "AgentV1SettingsAgentListenProviderV2", - "AgentV1SettingsAgentListenProviderV2Params", "AgentV1SettingsAgentListenProvider_V1", "AgentV1SettingsAgentListenProvider_V1Params", "AgentV1SettingsAgentListenProvider_V2", diff --git a/src/deepgram/agent/v1/__init__.py b/src/deepgram/agent/v1/__init__.py index 59444380..06b0ad1c 100644 --- a/src/deepgram/agent/v1/__init__.py +++ b/src/deepgram/agent/v1/__init__.py @@ -13,6 +13,7 @@ AgentV1ConversationText, AgentV1ConversationTextRole, AgentV1Error, + AgentV1ForceEndTurn, AgentV1FunctionCallRequest, AgentV1FunctionCallRequestFunctionsItem, AgentV1History, @@ -78,6 +79,7 @@ AgentV1AgentThinkingParams, AgentV1ConversationTextParams, AgentV1ErrorParams, + AgentV1ForceEndTurnParams, AgentV1FunctionCallRequestFunctionsItemParams, AgentV1FunctionCallRequestParams, AgentV1HistoryParams, @@ -131,35 +133,6 @@ FunctionCallHistoryMessageFunctionCallsItemParams, FunctionCallHistoryMessageParams, ) - from .types import AgentV1HistoryContent - from .requests import AgentV1HistoryContentParams - from .types import AgentV1HistoryContentRole - from .types import AgentV1HistoryFunctionCalls - from .types import AgentV1HistoryFunctionCallsFunctionCallsItem - from .requests import AgentV1HistoryFunctionCallsFunctionCallsItemParams - from .requests import AgentV1HistoryFunctionCallsParams - from .types import AgentV1SettingsAgentContextContextMessagesItemContentRole - from .types import AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem - from .requests import AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams - from .types import AgentV1SettingsAgentContextListenProviderV1 - from .requests import AgentV1SettingsAgentContextListenProviderV1Params - from .types import AgentV1SettingsAgentContextListenProviderV2 - from .types import AgentV1SettingsAgentContextListenProviderV2LanguageHint - from .requests import AgentV1SettingsAgentContextListenProviderV2LanguageHintParams - from .requests import AgentV1SettingsAgentContextListenProviderV2Params - from .types import AgentV1SettingsAgentContextMessagesItem - from .types import AgentV1SettingsAgentContextMessagesItemContent - from .requests import AgentV1SettingsAgentContextMessagesItemContentParams - from .types import AgentV1SettingsAgentContextMessagesItemContentRole - from .types import AgentV1SettingsAgentContextMessagesItemFunctionCalls - from .types import AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem - from .requests import AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams - from .requests import AgentV1SettingsAgentContextMessagesItemFunctionCallsParams - from .requests import AgentV1SettingsAgentContextMessagesItemParams - from .types import AgentV1SettingsAgentListenProviderV1 - from .requests import AgentV1SettingsAgentListenProviderV1Params - from .types import AgentV1SettingsAgentListenProviderV2 - from .requests import AgentV1SettingsAgentListenProviderV2Params _dynamic_imports: typing.Dict[str, str] = { "AgentV1AgentAudioDone": ".types", "AgentV1AgentAudioDoneParams": ".requests", @@ -172,18 +145,13 @@ "AgentV1ConversationTextRole": ".types", "AgentV1Error": ".types", "AgentV1ErrorParams": ".requests", + "AgentV1ForceEndTurn": ".types", + "AgentV1ForceEndTurnParams": ".requests", "AgentV1FunctionCallRequest": ".types", "AgentV1FunctionCallRequestFunctionsItem": ".types", "AgentV1FunctionCallRequestFunctionsItemParams": ".requests", "AgentV1FunctionCallRequestParams": ".requests", "AgentV1History": ".types", - "AgentV1HistoryContent": ".types", - "AgentV1HistoryContentParams": ".requests", - "AgentV1HistoryContentRole": ".types", - "AgentV1HistoryFunctionCalls": ".types", - "AgentV1HistoryFunctionCallsFunctionCallsItem": ".types", - "AgentV1HistoryFunctionCallsFunctionCallsItemParams": ".requests", - "AgentV1HistoryFunctionCallsParams": ".requests", "AgentV1HistoryParams": ".requests", "AgentV1InjectAgentMessage": ".types", "AgentV1InjectAgentMessageBehavior": ".types", @@ -209,34 +177,16 @@ "AgentV1SettingsAgentContext": ".types", "AgentV1SettingsAgentContextContext": ".types", "AgentV1SettingsAgentContextContextMessagesItem": ".types", - "AgentV1SettingsAgentContextContextMessagesItemContentRole": ".types", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem": ".types", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams": ".requests", "AgentV1SettingsAgentContextContextMessagesItemParams": ".requests", "AgentV1SettingsAgentContextContextParams": ".requests", "AgentV1SettingsAgentContextListen": ".types", "AgentV1SettingsAgentContextListenParams": ".requests", "AgentV1SettingsAgentContextListenProvider": ".types", "AgentV1SettingsAgentContextListenProviderParams": ".requests", - "AgentV1SettingsAgentContextListenProviderV1": ".types", - "AgentV1SettingsAgentContextListenProviderV1Params": ".requests", - "AgentV1SettingsAgentContextListenProviderV2": ".types", - "AgentV1SettingsAgentContextListenProviderV2LanguageHint": ".types", - "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams": ".requests", - "AgentV1SettingsAgentContextListenProviderV2Params": ".requests", "AgentV1SettingsAgentContextListenProvider_V1": ".types", "AgentV1SettingsAgentContextListenProvider_V1Params": ".requests", "AgentV1SettingsAgentContextListenProvider_V2": ".types", "AgentV1SettingsAgentContextListenProvider_V2Params": ".requests", - "AgentV1SettingsAgentContextMessagesItem": ".types", - "AgentV1SettingsAgentContextMessagesItemContent": ".types", - "AgentV1SettingsAgentContextMessagesItemContentParams": ".requests", - "AgentV1SettingsAgentContextMessagesItemContentRole": ".types", - "AgentV1SettingsAgentContextMessagesItemFunctionCalls": ".types", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem": ".types", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams": ".requests", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams": ".requests", - "AgentV1SettingsAgentContextMessagesItemParams": ".requests", "AgentV1SettingsAgentContextParams": ".requests", "AgentV1SettingsAgentContextSpeak": ".types", "AgentV1SettingsAgentContextSpeakParams": ".requests", @@ -246,10 +196,6 @@ "AgentV1SettingsAgentListenParams": ".requests", "AgentV1SettingsAgentListenProvider": ".types", "AgentV1SettingsAgentListenProviderParams": ".requests", - "AgentV1SettingsAgentListenProviderV1": ".types", - "AgentV1SettingsAgentListenProviderV1Params": ".requests", - "AgentV1SettingsAgentListenProviderV2": ".types", - "AgentV1SettingsAgentListenProviderV2Params": ".requests", "AgentV1SettingsAgentListenProvider_V1": ".types", "AgentV1SettingsAgentListenProvider_V1Params": ".requests", "AgentV1SettingsAgentListenProvider_V2": ".types", @@ -347,18 +293,13 @@ def __dir__(): "AgentV1ConversationTextRole", "AgentV1Error", "AgentV1ErrorParams", + "AgentV1ForceEndTurn", + "AgentV1ForceEndTurnParams", "AgentV1FunctionCallRequest", "AgentV1FunctionCallRequestFunctionsItem", "AgentV1FunctionCallRequestFunctionsItemParams", "AgentV1FunctionCallRequestParams", "AgentV1History", - "AgentV1HistoryContent", - "AgentV1HistoryContentParams", - "AgentV1HistoryContentRole", - "AgentV1HistoryFunctionCalls", - "AgentV1HistoryFunctionCallsFunctionCallsItem", - "AgentV1HistoryFunctionCallsFunctionCallsItemParams", - "AgentV1HistoryFunctionCallsParams", "AgentV1HistoryParams", "AgentV1InjectAgentMessage", "AgentV1InjectAgentMessageBehavior", @@ -384,34 +325,16 @@ def __dir__(): "AgentV1SettingsAgentContext", "AgentV1SettingsAgentContextContext", "AgentV1SettingsAgentContextContextMessagesItem", - "AgentV1SettingsAgentContextContextMessagesItemContentRole", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams", "AgentV1SettingsAgentContextContextMessagesItemParams", "AgentV1SettingsAgentContextContextParams", "AgentV1SettingsAgentContextListen", "AgentV1SettingsAgentContextListenParams", "AgentV1SettingsAgentContextListenProvider", "AgentV1SettingsAgentContextListenProviderParams", - "AgentV1SettingsAgentContextListenProviderV1", - "AgentV1SettingsAgentContextListenProviderV1Params", - "AgentV1SettingsAgentContextListenProviderV2", - "AgentV1SettingsAgentContextListenProviderV2LanguageHint", - "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams", - "AgentV1SettingsAgentContextListenProviderV2Params", "AgentV1SettingsAgentContextListenProvider_V1", "AgentV1SettingsAgentContextListenProvider_V1Params", "AgentV1SettingsAgentContextListenProvider_V2", "AgentV1SettingsAgentContextListenProvider_V2Params", - "AgentV1SettingsAgentContextMessagesItem", - "AgentV1SettingsAgentContextMessagesItemContent", - "AgentV1SettingsAgentContextMessagesItemContentParams", - "AgentV1SettingsAgentContextMessagesItemContentRole", - "AgentV1SettingsAgentContextMessagesItemFunctionCalls", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams", - "AgentV1SettingsAgentContextMessagesItemParams", "AgentV1SettingsAgentContextParams", "AgentV1SettingsAgentContextSpeak", "AgentV1SettingsAgentContextSpeakParams", @@ -421,10 +344,6 @@ def __dir__(): "AgentV1SettingsAgentListenParams", "AgentV1SettingsAgentListenProvider", "AgentV1SettingsAgentListenProviderParams", - "AgentV1SettingsAgentListenProviderV1", - "AgentV1SettingsAgentListenProviderV1Params", - "AgentV1SettingsAgentListenProviderV2", - "AgentV1SettingsAgentListenProviderV2Params", "AgentV1SettingsAgentListenProvider_V1", "AgentV1SettingsAgentListenProvider_V1Params", "AgentV1SettingsAgentListenProvider_V2", diff --git a/src/deepgram/agent/v1/requests/__init__.py b/src/deepgram/agent/v1/requests/__init__.py index 387bc379..1b3e69e3 100644 --- a/src/deepgram/agent/v1/requests/__init__.py +++ b/src/deepgram/agent/v1/requests/__init__.py @@ -11,6 +11,7 @@ from .agent_v1agent_thinking import AgentV1AgentThinkingParams from .agent_v1conversation_text import AgentV1ConversationTextParams from .agent_v1error import AgentV1ErrorParams + from .agent_v1force_end_turn import AgentV1ForceEndTurnParams from .agent_v1function_call_request import AgentV1FunctionCallRequestParams from .agent_v1function_call_request_functions_item import AgentV1FunctionCallRequestFunctionsItemParams from .agent_v1history import AgentV1HistoryParams @@ -71,30 +72,15 @@ from .conversation_history_message import ConversationHistoryMessageParams from .function_call_history_message import FunctionCallHistoryMessageParams from .function_call_history_message_function_calls_item import FunctionCallHistoryMessageFunctionCallsItemParams - from .agent_v1history_content import AgentV1HistoryContentParams - from .agent_v1history_function_calls_function_calls_item import AgentV1HistoryFunctionCallsFunctionCallsItemParams - from .agent_v1history_function_calls import AgentV1HistoryFunctionCallsParams - from .agent_v1settings_agent_context_context_messages_item_function_calls_function_calls_item import AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams - from .agent_v1settings_agent_context_listen_provider_v1 import AgentV1SettingsAgentContextListenProviderV1Params - from .agent_v1settings_agent_context_listen_provider_v2language_hint import AgentV1SettingsAgentContextListenProviderV2LanguageHintParams - from .agent_v1settings_agent_context_listen_provider_v2 import AgentV1SettingsAgentContextListenProviderV2Params - from .agent_v1settings_agent_context_messages_item_content import AgentV1SettingsAgentContextMessagesItemContentParams - from .agent_v1settings_agent_context_messages_item_function_calls_function_calls_item import AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams - from .agent_v1settings_agent_context_messages_item_function_calls import AgentV1SettingsAgentContextMessagesItemFunctionCallsParams - from .agent_v1settings_agent_context_messages_item import AgentV1SettingsAgentContextMessagesItemParams - from .agent_v1settings_agent_listen_provider_v1 import AgentV1SettingsAgentListenProviderV1Params - from .agent_v1settings_agent_listen_provider_v2 import AgentV1SettingsAgentListenProviderV2Params _dynamic_imports: typing.Dict[str, str] = { "AgentV1AgentAudioDoneParams": ".agent_v1agent_audio_done", "AgentV1AgentStartedSpeakingParams": ".agent_v1agent_started_speaking", "AgentV1AgentThinkingParams": ".agent_v1agent_thinking", "AgentV1ConversationTextParams": ".agent_v1conversation_text", "AgentV1ErrorParams": ".agent_v1error", + "AgentV1ForceEndTurnParams": ".agent_v1force_end_turn", "AgentV1FunctionCallRequestFunctionsItemParams": ".agent_v1function_call_request_functions_item", "AgentV1FunctionCallRequestParams": ".agent_v1function_call_request", - "AgentV1HistoryContentParams": ".agent_v1history_content", - "AgentV1HistoryFunctionCallsFunctionCallsItemParams": ".agent_v1history_function_calls_function_calls_item", - "AgentV1HistoryFunctionCallsParams": ".agent_v1history_function_calls", "AgentV1HistoryParams": ".agent_v1history", "AgentV1InjectAgentMessageParams": ".agent_v1inject_agent_message", "AgentV1InjectUserMessageParams": ".agent_v1inject_user_message", @@ -105,27 +91,17 @@ "AgentV1PromptUpdatedParams": ".agent_v1prompt_updated", "AgentV1ReceiveFunctionCallResponseParams": ".agent_v1receive_function_call_response", "AgentV1SendFunctionCallResponseParams": ".agent_v1send_function_call_response", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams": ".agent_v1settings_agent_context_context_messages_item_function_calls_function_calls_item", "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", - "AgentV1SettingsAgentContextListenProviderV1Params": ".agent_v1settings_agent_context_listen_provider_v1", - "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams": ".agent_v1settings_agent_context_listen_provider_v2language_hint", - "AgentV1SettingsAgentContextListenProviderV2Params": ".agent_v1settings_agent_context_listen_provider_v2", "AgentV1SettingsAgentContextListenProvider_V1Params": ".agent_v1settings_agent_context_listen_provider", "AgentV1SettingsAgentContextListenProvider_V2Params": ".agent_v1settings_agent_context_listen_provider", - "AgentV1SettingsAgentContextMessagesItemContentParams": ".agent_v1settings_agent_context_messages_item_content", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams": ".agent_v1settings_agent_context_messages_item_function_calls_function_calls_item", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams": ".agent_v1settings_agent_context_messages_item_function_calls", - "AgentV1SettingsAgentContextMessagesItemParams": ".agent_v1settings_agent_context_messages_item", "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", - "AgentV1SettingsAgentListenProviderV1Params": ".agent_v1settings_agent_listen_provider_v1", - "AgentV1SettingsAgentListenProviderV2Params": ".agent_v1settings_agent_listen_provider_v2", "AgentV1SettingsAgentListenProvider_V1Params": ".agent_v1settings_agent_listen_provider", "AgentV1SettingsAgentListenProvider_V2Params": ".agent_v1settings_agent_listen_provider", "AgentV1SettingsAgentParams": ".agent_v1settings_agent", @@ -185,11 +161,9 @@ def __dir__(): "AgentV1AgentThinkingParams", "AgentV1ConversationTextParams", "AgentV1ErrorParams", + "AgentV1ForceEndTurnParams", "AgentV1FunctionCallRequestFunctionsItemParams", "AgentV1FunctionCallRequestParams", - "AgentV1HistoryContentParams", - "AgentV1HistoryFunctionCallsFunctionCallsItemParams", - "AgentV1HistoryFunctionCallsParams", "AgentV1HistoryParams", "AgentV1InjectAgentMessageParams", "AgentV1InjectUserMessageParams", @@ -200,27 +174,17 @@ def __dir__(): "AgentV1PromptUpdatedParams", "AgentV1ReceiveFunctionCallResponseParams", "AgentV1SendFunctionCallResponseParams", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams", "AgentV1SettingsAgentContextContextMessagesItemParams", "AgentV1SettingsAgentContextContextParams", "AgentV1SettingsAgentContextListenParams", "AgentV1SettingsAgentContextListenProviderParams", - "AgentV1SettingsAgentContextListenProviderV1Params", - "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams", - "AgentV1SettingsAgentContextListenProviderV2Params", "AgentV1SettingsAgentContextListenProvider_V1Params", "AgentV1SettingsAgentContextListenProvider_V2Params", - "AgentV1SettingsAgentContextMessagesItemContentParams", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams", - "AgentV1SettingsAgentContextMessagesItemParams", "AgentV1SettingsAgentContextParams", "AgentV1SettingsAgentContextSpeakParams", "AgentV1SettingsAgentContextThinkParams", "AgentV1SettingsAgentListenParams", "AgentV1SettingsAgentListenProviderParams", - "AgentV1SettingsAgentListenProviderV1Params", - "AgentV1SettingsAgentListenProviderV2Params", "AgentV1SettingsAgentListenProvider_V1Params", "AgentV1SettingsAgentListenProvider_V2Params", "AgentV1SettingsAgentParams", diff --git a/src/deepgram/agent/v1/requests/agent_v1force_end_turn.py b/src/deepgram/agent/v1/requests/agent_v1force_end_turn.py new file mode 100644 index 00000000..13bdff23 --- /dev/null +++ b/src/deepgram/agent/v1/requests/agent_v1force_end_turn.py @@ -0,0 +1,12 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import typing_extensions + + +class AgentV1ForceEndTurnParams(typing_extensions.TypedDict): + type: typing.Literal["ForceEndTurn"] + """ + Message type identifier for forcing the end of the current turn + """ 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 01bffc21..0da4b0f3 100644 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent.py +++ b/src/deepgram/agent/v1/requests/agent_v1settings_agent.py @@ -1,27 +1,7 @@ # This file was auto-generated by Fern from our API Definition. -import typing_extensions -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 -class AgentV1SettingsAgentParams(typing_extensions.TypedDict): - language: typing_extensions.NotRequired[str] - """ - Deprecated. Use `listen.provider.language` and `speak.provider.language` fields instead. - """ - - context: typing_extensions.NotRequired[AgentV1SettingsAgentContextParams] - """ - Conversation context including the history of messages and function calls - """ +from .agent_v1settings_agent_context import AgentV1SettingsAgentContextParams - listen: typing_extensions.NotRequired[AgentV1SettingsAgentListenParams] - think: typing_extensions.NotRequired[AgentV1SettingsAgentThinkParams] - speak: typing_extensions.NotRequired[AgentV1SettingsAgentSpeakParams] - greeting: typing_extensions.NotRequired[str] - """ - Optional message that agent will speak at the start - """ +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 b399ef99..c52f05af 100644 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py +++ b/src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py @@ -1,11 +1,8 @@ # This file was auto-generated by Fern from our API Definition. -import typing - import typing_extensions 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 @@ -16,11 +13,6 @@ class AgentV1SettingsAgentContextParams(typing_extensions.TypedDict): Deprecated. Use `listen.provider.language` and `speak.provider.language` fields instead. """ - messages: typing_extensions.NotRequired[typing.Sequence[AgentV1SettingsAgentContextMessagesItemParams]] - """ - Deprecated. Conversation history as a list of messages and function calls. - """ - 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 70616b09..1f4db8c3 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 @@ -12,6 +14,7 @@ from .types.agent_v1agent_thinking import AgentV1AgentThinking from .types.agent_v1conversation_text import AgentV1ConversationText from .types.agent_v1error import AgentV1Error +from .types.agent_v1force_end_turn import AgentV1ForceEndTurn from .types.agent_v1function_call_request import AgentV1FunctionCallRequest from .types.agent_v1history import AgentV1History from .types.agent_v1inject_agent_message import AgentV1InjectAgentMessage @@ -40,27 +43,6 @@ except ImportError: from websockets import WebSocketClientProtocol # type: ignore - -def _sanitize_numeric_types(obj: typing.Any) -> typing.Any: - """ - Recursively convert float values that are whole numbers to int. - - Workaround for Fern-generated models that type integer API fields - (like sample_rate) as float, causing JSON serialization to produce - values like 44100.0 instead of 44100. The Deepgram API rejects - float representations of integer fields. - - See: https://github.com/deepgram/internal-api-specs/issues/205 - """ - if isinstance(obj, dict): - return {k: _sanitize_numeric_types(v) for k, v in obj.items()} - elif isinstance(obj, list): - return [_sanitize_numeric_types(item) for item in obj] - elif isinstance(obj, float) and obj.is_integer(): - return int(obj) - return obj - - _logger = logging.getLogger(__name__) V1SocketClientResponse = typing.Union[ AgentV1ListenUpdated, @@ -128,7 +110,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) @@ -182,12 +164,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: """ @@ -196,6 +178,13 @@ async def send_update_prompt(self, message: AgentV1UpdatePrompt) -> None: """ await self._send_model(message) + 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) + async def send_media(self, message: bytes) -> None: """ Send a message to the websocket connection. @@ -229,7 +218,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): @@ -275,7 +264,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) @@ -329,12 +318,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: """ @@ -343,6 +332,13 @@ def send_update_prompt(self, message: AgentV1UpdatePrompt) -> None: """ self._send_model(message) + 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) + def send_media(self, message: bytes) -> None: """ Send a message to the websocket connection. @@ -376,4 +372,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 7c6e20c6..9b334ba6 100644 --- a/src/deepgram/agent/v1/types/__init__.py +++ b/src/deepgram/agent/v1/types/__init__.py @@ -12,6 +12,7 @@ from .agent_v1conversation_text import AgentV1ConversationText from .agent_v1conversation_text_role import AgentV1ConversationTextRole from .agent_v1error import AgentV1Error + from .agent_v1force_end_turn import AgentV1ForceEndTurn from .agent_v1function_call_request import AgentV1FunctionCallRequest from .agent_v1function_call_request_functions_item import AgentV1FunctionCallRequestFunctionsItem from .agent_v1history import AgentV1History @@ -75,22 +76,6 @@ from .conversation_history_message_role import ConversationHistoryMessageRole from .function_call_history_message import FunctionCallHistoryMessage from .function_call_history_message_function_calls_item import FunctionCallHistoryMessageFunctionCallsItem - from .agent_v1history_content import AgentV1HistoryContent - from .agent_v1history_content_role import AgentV1HistoryContentRole - from .agent_v1history_function_calls import AgentV1HistoryFunctionCalls - from .agent_v1history_function_calls_function_calls_item import AgentV1HistoryFunctionCallsFunctionCallsItem - from .agent_v1settings_agent_context_context_messages_item_content_role import AgentV1SettingsAgentContextContextMessagesItemContentRole - from .agent_v1settings_agent_context_context_messages_item_function_calls_function_calls_item import AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem - from .agent_v1settings_agent_context_listen_provider_v1 import AgentV1SettingsAgentContextListenProviderV1 - from .agent_v1settings_agent_context_listen_provider_v2 import AgentV1SettingsAgentContextListenProviderV2 - from .agent_v1settings_agent_context_listen_provider_v2language_hint import AgentV1SettingsAgentContextListenProviderV2LanguageHint - from .agent_v1settings_agent_context_messages_item import AgentV1SettingsAgentContextMessagesItem - from .agent_v1settings_agent_context_messages_item_content import AgentV1SettingsAgentContextMessagesItemContent - from .agent_v1settings_agent_context_messages_item_content_role import AgentV1SettingsAgentContextMessagesItemContentRole - from .agent_v1settings_agent_context_messages_item_function_calls import AgentV1SettingsAgentContextMessagesItemFunctionCalls - from .agent_v1settings_agent_context_messages_item_function_calls_function_calls_item import AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem - from .agent_v1settings_agent_listen_provider_v1 import AgentV1SettingsAgentListenProviderV1 - from .agent_v1settings_agent_listen_provider_v2 import AgentV1SettingsAgentListenProviderV2 _dynamic_imports: typing.Dict[str, str] = { "AgentV1AgentAudioDone": ".agent_v1agent_audio_done", "AgentV1AgentStartedSpeaking": ".agent_v1agent_started_speaking", @@ -98,13 +83,10 @@ "AgentV1ConversationText": ".agent_v1conversation_text", "AgentV1ConversationTextRole": ".agent_v1conversation_text_role", "AgentV1Error": ".agent_v1error", + "AgentV1ForceEndTurn": ".agent_v1force_end_turn", "AgentV1FunctionCallRequest": ".agent_v1function_call_request", "AgentV1FunctionCallRequestFunctionsItem": ".agent_v1function_call_request_functions_item", "AgentV1History": ".agent_v1history", - "AgentV1HistoryContent": ".agent_v1history_content", - "AgentV1HistoryContentRole": ".agent_v1history_content_role", - "AgentV1HistoryFunctionCalls": ".agent_v1history_function_calls", - "AgentV1HistoryFunctionCallsFunctionCallsItem": ".agent_v1history_function_calls_function_calls_item", "AgentV1InjectAgentMessage": ".agent_v1inject_agent_message", "AgentV1InjectAgentMessageBehavior": ".agent_v1inject_agent_message_behavior", "AgentV1InjectUserMessage": ".agent_v1inject_user_message", @@ -120,26 +102,14 @@ "AgentV1SettingsAgentContext": ".agent_v1settings_agent_context", "AgentV1SettingsAgentContextContext": ".agent_v1settings_agent_context_context", "AgentV1SettingsAgentContextContextMessagesItem": ".agent_v1settings_agent_context_context_messages_item", - "AgentV1SettingsAgentContextContextMessagesItemContentRole": ".agent_v1settings_agent_context_context_messages_item_content_role", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem": ".agent_v1settings_agent_context_context_messages_item_function_calls_function_calls_item", "AgentV1SettingsAgentContextListen": ".agent_v1settings_agent_context_listen", "AgentV1SettingsAgentContextListenProvider": ".agent_v1settings_agent_context_listen_provider", - "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", "AgentV1SettingsAgentContextListenProvider_V1": ".agent_v1settings_agent_context_listen_provider", "AgentV1SettingsAgentContextListenProvider_V2": ".agent_v1settings_agent_context_listen_provider", - "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", "AgentV1SettingsAgentContextSpeak": ".agent_v1settings_agent_context_speak", "AgentV1SettingsAgentContextThink": ".agent_v1settings_agent_context_think", "AgentV1SettingsAgentListen": ".agent_v1settings_agent_listen", "AgentV1SettingsAgentListenProvider": ".agent_v1settings_agent_listen_provider", - "AgentV1SettingsAgentListenProviderV1": ".agent_v1settings_agent_listen_provider_v1", - "AgentV1SettingsAgentListenProviderV2": ".agent_v1settings_agent_listen_provider_v2", "AgentV1SettingsAgentListenProvider_V1": ".agent_v1settings_agent_listen_provider", "AgentV1SettingsAgentListenProvider_V2": ".agent_v1settings_agent_listen_provider", "AgentV1SettingsAgentSpeak": ".agent_v1settings_agent_speak", @@ -202,13 +172,10 @@ def __dir__(): "AgentV1ConversationText", "AgentV1ConversationTextRole", "AgentV1Error", + "AgentV1ForceEndTurn", "AgentV1FunctionCallRequest", "AgentV1FunctionCallRequestFunctionsItem", "AgentV1History", - "AgentV1HistoryContent", - "AgentV1HistoryContentRole", - "AgentV1HistoryFunctionCalls", - "AgentV1HistoryFunctionCallsFunctionCallsItem", "AgentV1InjectAgentMessage", "AgentV1InjectAgentMessageBehavior", "AgentV1InjectUserMessage", @@ -224,26 +191,14 @@ def __dir__(): "AgentV1SettingsAgentContext", "AgentV1SettingsAgentContextContext", "AgentV1SettingsAgentContextContextMessagesItem", - "AgentV1SettingsAgentContextContextMessagesItemContentRole", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem", "AgentV1SettingsAgentContextListen", "AgentV1SettingsAgentContextListenProvider", - "AgentV1SettingsAgentContextListenProviderV1", - "AgentV1SettingsAgentContextListenProviderV2", - "AgentV1SettingsAgentContextListenProviderV2LanguageHint", "AgentV1SettingsAgentContextListenProvider_V1", "AgentV1SettingsAgentContextListenProvider_V2", - "AgentV1SettingsAgentContextMessagesItem", - "AgentV1SettingsAgentContextMessagesItemContent", - "AgentV1SettingsAgentContextMessagesItemContentRole", - "AgentV1SettingsAgentContextMessagesItemFunctionCalls", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem", "AgentV1SettingsAgentContextSpeak", "AgentV1SettingsAgentContextThink", "AgentV1SettingsAgentListen", "AgentV1SettingsAgentListenProvider", - "AgentV1SettingsAgentListenProviderV1", - "AgentV1SettingsAgentListenProviderV2", "AgentV1SettingsAgentListenProvider_V1", "AgentV1SettingsAgentListenProvider_V2", "AgentV1SettingsAgentSpeak", diff --git a/src/deepgram/agent/v1/types/agent_v1force_end_turn.py b/src/deepgram/agent/v1/types/agent_v1force_end_turn.py new file mode 100644 index 00000000..e3977885 --- /dev/null +++ b/src/deepgram/agent/v1/types/agent_v1force_end_turn.py @@ -0,0 +1,23 @@ +# 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 AgentV1ForceEndTurn(UncheckedBaseModel): + type: typing.Literal["ForceEndTurn"] = pydantic.Field(default="ForceEndTurn") + """ + Message type identifier for forcing the end of the current turn + """ + + 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 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 0335ad2c..c1483c35 100644 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent.py +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent.py @@ -2,65 +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): - # Backward-compat: before the 2026-05-05 schema restructure this public name - # was the top-level agent settings model. Keep it callable and translate the - # legacy nested `context=AgentV1SettingsAgentContext(messages=[...])` shape - # into the current `context={"messages": [...]}` payload. - 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.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.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 776a2936..fcbea2f3 100644 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_context.py +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent_context.py @@ -7,7 +7,6 @@ from ....core.unchecked_base_model import UncheckedBaseModel 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 @@ -31,38 +30,6 @@ class AgentV1SettingsAgentContext(UncheckedBaseModel): Optional message that agent will speak at the start """ - # Backward-compat: pre-2026-05-05 callers passed `messages=[...]` directly on - # AgentV1SettingsAgentContext. The schema now nests that list under - # `context.messages`. Translate the legacy kwarg into the new shape so old - # call sites keep producing the correct wire payload. - 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) - messages = values.pop("messages") - values["context"] = {"messages": messages} - return values - else: - - @pydantic.root_validator(pre=True) # type: ignore[deprecated] - def _migrate_legacy_messages_to_context( # type: ignore[no-redef] - cls, values: typing.Any - ) -> typing.Any: - if isinstance(values, dict) and "messages" in values and "context" not in values: - values = dict(values) - messages = values.pop("messages") - values["context"] = {"messages": messages} - return values - - @property - def messages(self) -> typing.Optional[typing.List[AgentV1SettingsAgentContextMessagesItem]]: - if self.context is None: - return None - return self.context.messages - if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: 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 13d6739a..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,43 +33,11 @@ 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 - # Backward-compat: the public field was historically named `language_hint` - # and accepted a string or a list. The API field is `language_hints` (a - # list). Translate the legacy kwarg so existing callers keep working, and - # drop the dead singular key so it is not rejected by the API - # (deny_unknown_fields). Hand-maintained. - 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): - return values - if "language_hint" in 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 - 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): - return values - if "language_hint" in 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 - if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: 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 9bc63301..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,43 +33,11 @@ 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 - # Backward-compat: the public field was historically named `language_hint` - # and accepted a string or a list. The API field is `language_hints` (a - # list). Translate the legacy kwarg so existing callers keep working, and - # drop the dead singular key so it is not rejected by the API - # (deny_unknown_fields). Hand-maintained. - 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): - return values - if "language_hint" in 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 - 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): - return values - if "language_hint" in 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 - if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: 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 62273600..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,52 +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 -# Fields that exist only on the v1 (Listen V1) provider shape. Used to infer the -# intended version of a legacy unversioned dict from its own keys, rather than -# blanket-stamping "v2" onto a dict that is clearly describing a v1 provider. -_V1_ONLY_KEYS = frozenset({"language", "smart_format"}) - - -def _coerce_legacy_update_listen_provider(values: typing.Any) -> typing.Any: - # Backward-compat: before the 2026-07-31 regen the provider field was a bare - # DeepgramListenProviderV2. The regen replaced it with the versioned - # AgentV1UpdateListenListenProvider union (discriminant="version"). Coerce a - # legacy Deepgram provider (or a dict lacking the version discriminant) into - # the new shape so existing callers keep producing the correct wire payload. - 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: - # Route the dict through the same shim model the instance branches - # use, so its own `model_validator(mode="before")` runs. That is what - # remaps a deprecated `language_hint=` to `language_hints` and drops - # the singular key -- the API uses deny_unknown_fields, so leaving it - # in is a hard rejection. Going through the model keeps ONE remap - # implementation instead of duplicating it here. - coerced = provider_cls(**provider).dict() - except Exception: - # A malformed dict (e.g. missing the required `model`) makes the - # model constructor raise. Pre-regen this path passed the dict - # through untouched, so fall back to that rather than turning a - # compat shim into a new source of exceptions. - coerced = dict(provider) - values["provider"] = {**coerced, "version": version} - return values - class AgentV1UpdateListenListen(UncheckedBaseModel): """ @@ -59,18 +15,6 @@ 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) - 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) - if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: diff --git a/src/deepgram/core/api_error.py b/src/deepgram/core/api_error.py index a24abadc..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,13 +15,7 @@ def __init__( status_code: Optional[int] = None, body: Any = None, ) -> None: - # Mask credential headers at construction, not just in __str__. The - # websocket connect paths raise with the full request headers, so an - # unredacted Authorization would otherwise reach anywhere this exception - # goes: str(e), a traceback, a log aggregator, or an error tracker (which - # serialises attributes as well as the message). Non-sensitive headers are - # kept -- dg-request-id is the main reason to look at them at all. - 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 f02cdd03..b0cbad30 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.7.1" + _sdk_version = "7.8.2" 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 bfa3a2f7..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,9 +23,7 @@ def __init__( body: Any = None, cause: Optional[Exception] = None, ) -> None: - # See the note in core/api_error.py: credential headers are masked at - # construction so they cannot reach a log, traceback, or error tracker. - 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 6b81f9bc..3183001d 100644 --- a/src/deepgram/core/query_encoder.py +++ b/src/deepgram/core/query_encoder.py @@ -5,14 +5,6 @@ import pydantic -def _coerce_query_value(value: Any) -> Any: - # urllib.parse.urlencode stringifies bools via str(), producing "True"/"False"; - # APIs (including Deepgram's websocket endpoints) expect lowercase. - 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 = [] @@ -25,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 @@ -49,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 54752b7b..b720c394 100644 --- a/src/deepgram/listen/__init__.py +++ b/src/deepgram/listen/__init__.py @@ -66,7 +66,6 @@ ListenV2TurnInfoWordsItem, ListenV2TurnInfoWordsItemParams, ) - from .v2 import ListenV2CloseStreamType _dynamic_imports: typing.Dict[str, str] = { "DiarizeModel": ".v1", "ListenV1CloseStream": ".v1", @@ -102,7 +101,6 @@ "ListenV1UtteranceEndParams": ".v1", "ListenV2CloseStream": ".v2", "ListenV2CloseStreamParams": ".v2", - "ListenV2CloseStreamType": ".v2", "ListenV2Configure": ".v2", "ListenV2ConfigureFailure": ".v2", "ListenV2ConfigureFailureParams": ".v2", @@ -185,7 +183,6 @@ def __dir__(): "ListenV1UtteranceEndParams", "ListenV2CloseStream", "ListenV2CloseStreamParams", - "ListenV2CloseStreamType", "ListenV2Configure", "ListenV2ConfigureFailure", "ListenV2ConfigureFailureParams", diff --git a/src/deepgram/listen/v1/media/client.py b/src/deepgram/listen/v1/media/client.py index eb71694e..5541bd58 100644 --- a/src/deepgram/listen/v1/media/client.py +++ b/src/deepgram/listen/v1/media/client.py @@ -149,7 +149,7 @@ def transcribe_url( To boost multiple separate keyterms, repeat the `keyterm` parameter (for example, `keyterm=term1&keyterm=term2`). To boost one multi-word phrase as a single keyterm, join the words with `%20` or `+` (for example, `keyterm=customer%20service`). Do not separate keyterms with commas, semicolons, or line breaks. keywords : typing.Optional[typing.Union[str, typing.Sequence[str]]] - Keywords can boost or suppress specialized terminology and brands + Keywords can boost or suppress specialized terminology and brands. `keywords` is not supported with Nova-3 models; use `keyterm` instead. language : typing.Optional[str] The [BCP-47 language tag](https://tools.ietf.org/html/bcp47) that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available @@ -376,7 +376,7 @@ def transcribe_file( To boost multiple separate keyterms, repeat the `keyterm` parameter (for example, `keyterm=term1&keyterm=term2`). To boost one multi-word phrase as a single keyterm, join the words with `%20` or `+` (for example, `keyterm=customer%20service`). Do not separate keyterms with commas, semicolons, or line breaks. keywords : typing.Optional[typing.Union[str, typing.Sequence[str]]] - Keywords can boost or suppress specialized terminology and brands + Keywords can boost or suppress specialized terminology and brands. `keywords` is not supported with Nova-3 models; use `keyterm` instead. language : typing.Optional[str] The [BCP-47 language tag](https://tools.ietf.org/html/bcp47) that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available @@ -617,7 +617,7 @@ async def transcribe_url( To boost multiple separate keyterms, repeat the `keyterm` parameter (for example, `keyterm=term1&keyterm=term2`). To boost one multi-word phrase as a single keyterm, join the words with `%20` or `+` (for example, `keyterm=customer%20service`). Do not separate keyterms with commas, semicolons, or line breaks. keywords : typing.Optional[typing.Union[str, typing.Sequence[str]]] - Keywords can boost or suppress specialized terminology and brands + Keywords can boost or suppress specialized terminology and brands. `keywords` is not supported with Nova-3 models; use `keyterm` instead. language : typing.Optional[str] The [BCP-47 language tag](https://tools.ietf.org/html/bcp47) that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available @@ -852,7 +852,7 @@ async def transcribe_file( To boost multiple separate keyterms, repeat the `keyterm` parameter (for example, `keyterm=term1&keyterm=term2`). To boost one multi-word phrase as a single keyterm, join the words with `%20` or `+` (for example, `keyterm=customer%20service`). Do not separate keyterms with commas, semicolons, or line breaks. keywords : typing.Optional[typing.Union[str, typing.Sequence[str]]] - Keywords can boost or suppress specialized terminology and brands + Keywords can boost or suppress specialized terminology and brands. `keywords` is not supported with Nova-3 models; use `keyterm` instead. language : typing.Optional[str] The [BCP-47 language tag](https://tools.ietf.org/html/bcp47) that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available diff --git a/src/deepgram/listen/v1/media/raw_client.py b/src/deepgram/listen/v1/media/raw_client.py index e8c3767c..723aab7e 100644 --- a/src/deepgram/listen/v1/media/raw_client.py +++ b/src/deepgram/listen/v1/media/raw_client.py @@ -144,7 +144,7 @@ def transcribe_url( To boost multiple separate keyterms, repeat the `keyterm` parameter (for example, `keyterm=term1&keyterm=term2`). To boost one multi-word phrase as a single keyterm, join the words with `%20` or `+` (for example, `keyterm=customer%20service`). Do not separate keyterms with commas, semicolons, or line breaks. keywords : typing.Optional[typing.Union[str, typing.Sequence[str]]] - Keywords can boost or suppress specialized terminology and brands + Keywords can boost or suppress specialized terminology and brands. `keywords` is not supported with Nova-3 models; use `keyterm` instead. language : typing.Optional[str] The [BCP-47 language tag](https://tools.ietf.org/html/bcp47) that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available @@ -399,7 +399,7 @@ def transcribe_file( To boost multiple separate keyterms, repeat the `keyterm` parameter (for example, `keyterm=term1&keyterm=term2`). To boost one multi-word phrase as a single keyterm, join the words with `%20` or `+` (for example, `keyterm=customer%20service`). Do not separate keyterms with commas, semicolons, or line breaks. keywords : typing.Optional[typing.Union[str, typing.Sequence[str]]] - Keywords can boost or suppress specialized terminology and brands + Keywords can boost or suppress specialized terminology and brands. `keywords` is not supported with Nova-3 models; use `keyterm` instead. language : typing.Optional[str] The [BCP-47 language tag](https://tools.ietf.org/html/bcp47) that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available @@ -657,7 +657,7 @@ async def transcribe_url( To boost multiple separate keyterms, repeat the `keyterm` parameter (for example, `keyterm=term1&keyterm=term2`). To boost one multi-word phrase as a single keyterm, join the words with `%20` or `+` (for example, `keyterm=customer%20service`). Do not separate keyterms with commas, semicolons, or line breaks. keywords : typing.Optional[typing.Union[str, typing.Sequence[str]]] - Keywords can boost or suppress specialized terminology and brands + Keywords can boost or suppress specialized terminology and brands. `keywords` is not supported with Nova-3 models; use `keyterm` instead. language : typing.Optional[str] The [BCP-47 language tag](https://tools.ietf.org/html/bcp47) that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available @@ -912,7 +912,7 @@ async def transcribe_file( To boost multiple separate keyterms, repeat the `keyterm` parameter (for example, `keyterm=term1&keyterm=term2`). To boost one multi-word phrase as a single keyterm, join the words with `%20` or `+` (for example, `keyterm=customer%20service`). Do not separate keyterms with commas, semicolons, or line breaks. keywords : typing.Optional[typing.Union[str, typing.Sequence[str]]] - Keywords can boost or suppress specialized terminology and brands + Keywords can boost or suppress specialized terminology and brands. `keywords` is not supported with Nova-3 models; use `keyterm` instead. language : typing.Optional[str] The [BCP-47 language tag](https://tools.ietf.org/html/bcp47) that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available diff --git a/src/deepgram/listen/v1/socket_client.py b/src/deepgram/listen/v1/socket_client.py index 5954d116..cffa82b7 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 @@ -67,7 +69,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) @@ -79,26 +81,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 recv(self) -> V1SocketClientResponse: """ @@ -172,7 +174,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) @@ -184,26 +186,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 recv(self) -> V1SocketClientResponse: """ diff --git a/src/deepgram/listen/v2/__init__.py b/src/deepgram/listen/v2/__init__.py index ebb5f4a9..ce03538d 100644 --- a/src/deepgram/listen/v2/__init__.py +++ b/src/deepgram/listen/v2/__init__.py @@ -33,11 +33,9 @@ ListenV2TurnInfoParams, ListenV2TurnInfoWordsItemParams, ) - from .types import ListenV2CloseStreamType _dynamic_imports: typing.Dict[str, str] = { "ListenV2CloseStream": ".types", "ListenV2CloseStreamParams": ".requests", - "ListenV2CloseStreamType": ".types", "ListenV2Configure": ".types", "ListenV2ConfigureFailure": ".types", "ListenV2ConfigureFailureParams": ".requests", @@ -86,7 +84,6 @@ def __dir__(): __all__ = [ "ListenV2CloseStream", "ListenV2CloseStreamParams", - "ListenV2CloseStreamType", "ListenV2Configure", "ListenV2ConfigureFailure", "ListenV2ConfigureFailureParams", diff --git a/src/deepgram/listen/v2/socket_client.py b/src/deepgram/listen/v2/socket_client.py index b441bbb0..33d419b3 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 @@ -70,7 +72,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,41 +84,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. - - Ends the current turn immediately, whatever the end-of-turn confidence. The - resulting ``TurnInfo`` carries ``trigger="manual"``, and the connection stays open - for the next turn. - - Requires server-side enablement. On a deployment without it the server replies - ``UNPARSABLE_CLIENT_MESSAGE`` ("The ForceEndTurn message is not enabled on this - deployment.") and **closes the connection**, so guard against that path until the - feature is confirmed live for the deployment you target. """ - 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. A raw dict is also - accepted and sent verbatim for back-compat with pre-typed-model callers. + 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: """ @@ -190,7 +177,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) @@ -202,39 +189,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. - - Ends the current turn immediately, whatever the end-of-turn confidence. The - resulting ``TurnInfo`` carries ``trigger="manual"``, and the connection stays open - for the next turn. - - Requires server-side enablement. On a deployment without it the server replies - ``UNPARSABLE_CLIENT_MESSAGE`` ("The ForceEndTurn message is not enabled on this - deployment.") and **closes the connection**, so guard against that path until the - feature is confirmed live for the deployment you target. """ - 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. A raw dict is also - accepted and sent verbatim for back-compat with pre-typed-model callers. + 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: """ diff --git a/src/deepgram/listen/v2/types/__init__.py b/src/deepgram/listen/v2/types/__init__.py index 7f084d96..e0bb48fb 100644 --- a/src/deepgram/listen/v2/types/__init__.py +++ b/src/deepgram/listen/v2/types/__init__.py @@ -18,10 +18,8 @@ from .listen_v2turn_info import ListenV2TurnInfo from .listen_v2turn_info_event import ListenV2TurnInfoEvent from .listen_v2turn_info_words_item import ListenV2TurnInfoWordsItem - from .listen_v2close_stream_type import ListenV2CloseStreamType _dynamic_imports: typing.Dict[str, str] = { "ListenV2CloseStream": ".listen_v2close_stream", - "ListenV2CloseStreamType": ".listen_v2close_stream_type", "ListenV2Configure": ".listen_v2configure", "ListenV2ConfigureFailure": ".listen_v2configure_failure", "ListenV2ConfigureSuccess": ".listen_v2configure_success", @@ -59,7 +57,6 @@ def __dir__(): __all__ = [ "ListenV2CloseStream", - "ListenV2CloseStreamType", "ListenV2Configure", "ListenV2ConfigureFailure", "ListenV2ConfigureSuccess", diff --git a/src/deepgram/listen/v2/types/listen_v2configure_failure.py b/src/deepgram/listen/v2/types/listen_v2configure_failure.py index bf30e353..2d0cb34f 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 bde84d6f..ce20724a 100644 --- a/src/deepgram/listen/v2/types/listen_v2configure_success.py +++ b/src/deepgram/listen/v2/types/listen_v2configure_success.py @@ -4,12 +4,12 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel 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 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/requests/__init__.py b/src/deepgram/requests/__init__.py index e3de268f..12ebb69f 100644 --- a/src/deepgram/requests/__init__.py +++ b/src/deepgram/requests/__init__.py @@ -218,9 +218,6 @@ from .usage_fields_v1response_models_item import UsageFieldsV1ResponseModelsItemParams from .usage_v1response import UsageV1ResponseParams from .usage_v1response_resolution import UsageV1ResponseResolutionParams - from .cartesia_speak_provider_voice import CartesiaSpeakProviderVoiceParams - from .create_key_v1request_one import CreateKeyV1RequestOneParams - from .deepgram_listen_provider_v2language_hint import DeepgramListenProviderV2LanguageHintParams _dynamic_imports: typing.Dict[str, str] = { "AgentConfigurationV1Params": ".agent_configuration_v1", "AgentThinkModelsV1ResponseModelsItemIdParams": ".agent_think_models_v1response_models_item_id", @@ -241,10 +238,8 @@ "BillingBreakdownV1ResponseResultsItemGroupingParams": ".billing_breakdown_v1response_results_item_grouping", "BillingBreakdownV1ResponseResultsItemParams": ".billing_breakdown_v1response_results_item", "CartesiaParams": ".cartesia", - "CartesiaSpeakProviderVoiceParams": ".cartesia_speak_provider_voice", "CartesiaVoiceParams": ".cartesia_voice", "CreateAgentConfigurationV1ResponseParams": ".create_agent_configuration_v1response", - "CreateKeyV1RequestOneParams": ".create_key_v1request_one", "CreateKeyV1RequestParams": ".create_key_v1request", "CreateKeyV1ResponseParams": ".create_key_v1response", "CreateProjectDistributionCredentialsV1ResponseDistributionCredentialsParams": ".create_project_distribution_credentials_v1response_distribution_credentials", @@ -252,7 +247,6 @@ "CreateProjectDistributionCredentialsV1ResponseParams": ".create_project_distribution_credentials_v1response", "CreateProjectInviteV1ResponseParams": ".create_project_invite_v1response", "DeepgramListenProviderV1Params": ".deepgram_listen_provider_v1", - "DeepgramListenProviderV2LanguageHintParams": ".deepgram_listen_provider_v2language_hint", "DeepgramListenProviderV2Params": ".deepgram_listen_provider_v2", "DeepgramParams": ".deepgram", "DeleteProjectInviteV1ResponseParams": ".delete_project_invite_v1response", @@ -439,10 +433,8 @@ def __dir__(): "BillingBreakdownV1ResponseResultsItemGroupingParams", "BillingBreakdownV1ResponseResultsItemParams", "CartesiaParams", - "CartesiaSpeakProviderVoiceParams", "CartesiaVoiceParams", "CreateAgentConfigurationV1ResponseParams", - "CreateKeyV1RequestOneParams", "CreateKeyV1RequestParams", "CreateKeyV1ResponseParams", "CreateProjectDistributionCredentialsV1ResponseDistributionCredentialsParams", @@ -450,7 +442,6 @@ def __dir__(): "CreateProjectDistributionCredentialsV1ResponseParams", "CreateProjectInviteV1ResponseParams", "DeepgramListenProviderV1Params", - "DeepgramListenProviderV2LanguageHintParams", "DeepgramListenProviderV2Params", "DeepgramParams", "DeleteProjectInviteV1ResponseParams", diff --git a/src/deepgram/requests/deepgram.py b/src/deepgram/requests/deepgram.py index c8ddc121..cdd30bb3 100644 --- a/src/deepgram/requests/deepgram.py +++ b/src/deepgram/requests/deepgram.py @@ -24,5 +24,10 @@ class DeepgramParams(typing_extensions.TypedDict): speed: typing_extensions.NotRequired[float] """ - 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 only 0.85, 0.9, 0.95, 1.0, 1.05, 1.1 and 1.15; another value ends the session with FAILED_TO_SPEAK. Not yet supported in all languages. + 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_extensions.NotRequired[int] + """ + 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/requests/deepgram_listen_provider_v2.py b/src/deepgram/requests/deepgram_listen_provider_v2.py index 47a41ed7..ad404dbe 100644 --- a/src/deepgram/requests/deepgram_listen_provider_v2.py +++ b/src/deepgram/requests/deepgram_listen_provider_v2.py @@ -28,7 +28,7 @@ class DeepgramListenProviderV2Params(typing_extensions.TypedDict): eot_threshold: typing_extensions.NotRequired[float] """ - End-of-turn confidence required to finish a turn. Valid range: 0.5 - 0.9. Defaults to 0.7. + 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 natural end-of-turn detection and end turns with the ForceEndTurn message. """ eager_eot_threshold: typing_extensions.NotRequired[float] diff --git a/src/deepgram/requests/speak_settings_v1provider.py b/src/deepgram/requests/speak_settings_v1provider.py index 185b1484..e34b761c 100644 --- a/src/deepgram/requests/speak_settings_v1provider.py +++ b/src/deepgram/requests/speak_settings_v1provider.py @@ -21,6 +21,7 @@ class SpeakSettingsV1Provider_DeepgramParams(typing_extensions.TypedDict): version: typing_extensions.NotRequired[str] model: DeepgramModel speed: typing_extensions.NotRequired[float] + expressivity: typing_extensions.NotRequired[int] class SpeakSettingsV1Provider_ElevenLabsParams(typing_extensions.TypedDict): diff --git a/src/deepgram/speak/v1/audio/types/audio_generate_request_model.py b/src/deepgram/speak/v1/audio/types/audio_generate_request_model.py index 31b1cabd..1dac1339 100644 --- a/src/deepgram/speak/v1/audio/types/audio_generate_request_model.py +++ b/src/deepgram/speak/v1/audio/types/audio_generate_request_model.py @@ -101,7 +101,6 @@ "aura-2-livia-it", "aura-2-maia-it", "aura-2-melia-it", - "aura-2-perseo-it", "aura-2-ama-ja", "aura-2-ebisu-ja", "aura-2-fujin-ja", diff --git a/src/deepgram/speak/v1/socket_client.py b/src/deepgram/speak/v1/socket_client.py index e3c28bb5..9f1cad28 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 @@ -68,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) @@ -80,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: """ @@ -173,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) @@ -185,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 6e72e33b..7750a65b 100644 --- a/src/deepgram/speak/v2/audio/client.py +++ b/src/deepgram/speak/v2/audio/client.py @@ -85,7 +85,7 @@ def generate( 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 speed : typing.Optional[float] - Speaking rate multiplier that adjusts the pace of generated speech while preserving natural prosody and voice quality. Accepted values run `0.85` to `1.15` in `0.05` increments. Not yet supported in all languages. + Speaking rate multiplier that adjusts the pace of generated speech while preserving natural prosody and voice quality. Accepted values run `0.5` to `1.5` in `0.05` increments. Not yet supported in all languages. priority : typing.Optional[typing.Literal["low"]] Processing priority for asynchronous (callback) requests. The only supported value is low. @@ -201,7 +201,7 @@ async def generate( 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 speed : typing.Optional[float] - Speaking rate multiplier that adjusts the pace of generated speech while preserving natural prosody and voice quality. Accepted values run `0.85` to `1.15` in `0.05` increments. Not yet supported in all languages. + Speaking rate multiplier that adjusts the pace of generated speech while preserving natural prosody and voice quality. Accepted values run `0.5` to `1.5` in `0.05` increments. Not yet supported in all languages. priority : typing.Optional[typing.Literal["low"]] Processing priority for asynchronous (callback) requests. The only supported value is low. diff --git a/src/deepgram/speak/v2/audio/raw_client.py b/src/deepgram/speak/v2/audio/raw_client.py index 088e63b5..c26b37e4 100644 --- a/src/deepgram/speak/v2/audio/raw_client.py +++ b/src/deepgram/speak/v2/audio/raw_client.py @@ -82,7 +82,7 @@ def generate( 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 speed : typing.Optional[float] - Speaking rate multiplier that adjusts the pace of generated speech while preserving natural prosody and voice quality. Accepted values run `0.85` to `1.15` in `0.05` increments. Not yet supported in all languages. + Speaking rate multiplier that adjusts the pace of generated speech while preserving natural prosody and voice quality. Accepted values run `0.5` to `1.5` in `0.05` increments. Not yet supported in all languages. priority : typing.Optional[typing.Literal["low"]] Processing priority for asynchronous (callback) requests. The only supported value is low. @@ -221,7 +221,7 @@ async def generate( 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 speed : typing.Optional[float] - Speaking rate multiplier that adjusts the pace of generated speech while preserving natural prosody and voice quality. Accepted values run `0.85` to `1.15` in `0.05` increments. Not yet supported in all languages. + Speaking rate multiplier that adjusts the pace of generated speech while preserving natural prosody and voice quality. Accepted values run `0.5` to `1.5` in `0.05` increments. Not yet supported in all languages. priority : typing.Optional[typing.Literal["low"]] Processing priority for asynchronous (callback) requests. The only supported value is low. diff --git a/src/deepgram/speak/v2/requests/speak_v2configure_failure.py b/src/deepgram/speak/v2/requests/speak_v2configure_failure.py index 7940a7c4..97ea557c 100644 --- a/src/deepgram/speak/v2/requests/speak_v2configure_failure.py +++ b/src/deepgram/speak/v2/requests/speak_v2configure_failure.py @@ -14,7 +14,7 @@ class SpeakV2ConfigureFailureParams(typing_extensions.TypedDict): code: SpeakV2ConfigureFailureCode """ - Failure code, in `SCREAMING_SNAKE_CASE`. `SPEED_OUT_OF_RANGE`: outside the multipliers the model publishes. `SPEED_INCREMENT_INVALID`: inside the published range but not one of the multipliers. `SPEED_NOT_SUPPORTED`: this model or language has no runtime speed control at all. `INTERNAL_ERROR`: the configuration was acceptable but the server could not apply it — unlike the others, a server-side failure rather than a statement about the request. + Failure code, in `SCREAMING_SNAKE_CASE`. `SPEED_OUT_OF_RANGE`: outside the range the model publishes. `SPEED_INCREMENT_INVALID`: inside the published range but off the `0.05` increment. `SPEED_NOT_SUPPORTED`: this model or language has no runtime speed control at all. `INTERNAL_ERROR`: the configuration was acceptable but the server could not apply it — unlike the others, a server-side failure rather than a statement about the request. """ field: typing_extensions.NotRequired[typing.Literal["speed"]] diff --git a/src/deepgram/speak/v2/socket_client.py b/src/deepgram/speak/v2/socket_client.py index c6729c32..b9d4d1a2 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 @@ -87,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) @@ -99,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: """ @@ -120,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: """ @@ -199,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) @@ -211,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: """ @@ -232,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_v2configure_failure.py b/src/deepgram/speak/v2/types/speak_v2configure_failure.py index a3801ea4..76d5a202 100644 --- a/src/deepgram/speak/v2/types/speak_v2configure_failure.py +++ b/src/deepgram/speak/v2/types/speak_v2configure_failure.py @@ -16,7 +16,7 @@ class SpeakV2ConfigureFailure(UncheckedBaseModel): code: SpeakV2ConfigureFailureCode = pydantic.Field() """ - Failure code, in `SCREAMING_SNAKE_CASE`. `SPEED_OUT_OF_RANGE`: outside the multipliers the model publishes. `SPEED_INCREMENT_INVALID`: inside the published range but not one of the multipliers. `SPEED_NOT_SUPPORTED`: this model or language has no runtime speed control at all. `INTERNAL_ERROR`: the configuration was acceptable but the server could not apply it — unlike the others, a server-side failure rather than a statement about the request. + Failure code, in `SCREAMING_SNAKE_CASE`. `SPEED_OUT_OF_RANGE`: outside the range the model publishes. `SPEED_INCREMENT_INVALID`: inside the published range but off the `0.05` increment. `SPEED_NOT_SUPPORTED`: this model or language has no runtime speed control at all. `INTERNAL_ERROR`: the configuration was acceptable but the server could not apply it — unlike the others, a server-side failure rather than a statement about the request. """ field: typing.Optional[typing.Literal["speed"]] = pydantic.Field(default=None) diff --git a/src/deepgram/types/__init__.py b/src/deepgram/types/__init__.py index 54b2869d..51e2768b 100644 --- a/src/deepgram/types/__init__.py +++ b/src/deepgram/types/__init__.py @@ -292,15 +292,6 @@ from .usage_fields_v1response_models_item import UsageFieldsV1ResponseModelsItem from .usage_v1response import UsageV1Response from .usage_v1response_resolution import UsageV1ResponseResolution - from .anthropic_think_provider_model import AnthropicThinkProviderModel - from .cartesia_speak_provider_model_id import CartesiaSpeakProviderModelId - from .cartesia_speak_provider_voice import CartesiaSpeakProviderVoice - from .create_key_v1request_one import CreateKeyV1RequestOne - from .deepgram_listen_provider_v2language_hint import DeepgramListenProviderV2LanguageHint - from .deepgram_speak_provider_model import DeepgramSpeakProviderModel - from .google_think_provider_model import GoogleThinkProviderModel - from .google_think_provider_version import GoogleThinkProviderVersion - from .groq_think_provider_reasoning_mode import GroqThinkProviderReasoningMode _dynamic_imports: typing.Dict[str, str] = { "AgentConfigurationV1": ".agent_configuration_v1", "AgentThinkModelsV1Response": ".agent_think_models_v1response", @@ -316,7 +307,6 @@ "AgentVariableV1": ".agent_variable_v1", "Anthropic": ".anthropic", "AnthropicModel": ".anthropic_model", - "AnthropicThinkProviderModel": ".anthropic_think_provider_model", "AwsBedrockThinkProvider": ".aws_bedrock_think_provider", "AwsBedrockThinkProviderCredentials": ".aws_bedrock_think_provider_credentials", "AwsBedrockThinkProviderCredentialsType": ".aws_bedrock_think_provider_credentials_type", @@ -332,12 +322,9 @@ "BillingBreakdownV1ResponseResultsItemGrouping": ".billing_breakdown_v1response_results_item_grouping", "Cartesia": ".cartesia", "CartesiaModelId": ".cartesia_model_id", - "CartesiaSpeakProviderModelId": ".cartesia_speak_provider_model_id", - "CartesiaSpeakProviderVoice": ".cartesia_speak_provider_voice", "CartesiaVoice": ".cartesia_voice", "CreateAgentConfigurationV1Response": ".create_agent_configuration_v1response", "CreateKeyV1Request": ".create_key_v1request", - "CreateKeyV1RequestOne": ".create_key_v1request_one", "CreateKeyV1Response": ".create_key_v1response", "CreateProjectDistributionCredentialsV1Response": ".create_project_distribution_credentials_v1response", "CreateProjectDistributionCredentialsV1ResponseDistributionCredentials": ".create_project_distribution_credentials_v1response_distribution_credentials", @@ -346,9 +333,7 @@ "Deepgram": ".deepgram", "DeepgramListenProviderV1": ".deepgram_listen_provider_v1", "DeepgramListenProviderV2": ".deepgram_listen_provider_v2", - "DeepgramListenProviderV2LanguageHint": ".deepgram_listen_provider_v2language_hint", "DeepgramModel": ".deepgram_model", - "DeepgramSpeakProviderModel": ".deepgram_speak_provider_model", "DeleteAgentConfigurationV1Response": ".delete_agent_configuration_v1response", "DeleteAgentVariableV1Response": ".delete_agent_variable_v1response", "DeleteProjectInviteV1Response": ".delete_project_invite_v1response", @@ -377,13 +362,10 @@ "GetProjectV1Response": ".get_project_v1response", "Google": ".google", "GoogleModel": ".google_model", - "GoogleThinkProviderModel": ".google_think_provider_model", - "GoogleThinkProviderVersion": ".google_think_provider_version", "GoogleVersion": ".google_version", "GrantV1Response": ".grant_v1response", "Groq": ".groq", "GroqReasoningMode": ".groq_reasoning_mode", - "GroqThinkProviderReasoningMode": ".groq_think_provider_reasoning_mode", "LeaveProjectV1Response": ".leave_project_v1response", "ListAgentConfigurationsV1Response": ".list_agent_configurations_v1response", "ListAgentVariablesV1Response": ".list_agent_variables_v1response", @@ -598,7 +580,6 @@ def __dir__(): "AgentVariableV1", "Anthropic", "AnthropicModel", - "AnthropicThinkProviderModel", "AwsBedrockThinkProvider", "AwsBedrockThinkProviderCredentials", "AwsBedrockThinkProviderCredentialsType", @@ -614,12 +595,9 @@ def __dir__(): "BillingBreakdownV1ResponseResultsItemGrouping", "Cartesia", "CartesiaModelId", - "CartesiaSpeakProviderModelId", - "CartesiaSpeakProviderVoice", "CartesiaVoice", "CreateAgentConfigurationV1Response", "CreateKeyV1Request", - "CreateKeyV1RequestOne", "CreateKeyV1Response", "CreateProjectDistributionCredentialsV1Response", "CreateProjectDistributionCredentialsV1ResponseDistributionCredentials", @@ -628,9 +606,7 @@ def __dir__(): "Deepgram", "DeepgramListenProviderV1", "DeepgramListenProviderV2", - "DeepgramListenProviderV2LanguageHint", "DeepgramModel", - "DeepgramSpeakProviderModel", "DeleteAgentConfigurationV1Response", "DeleteAgentVariableV1Response", "DeleteProjectInviteV1Response", @@ -659,13 +635,10 @@ def __dir__(): "GetProjectV1Response", "Google", "GoogleModel", - "GoogleThinkProviderModel", - "GoogleThinkProviderVersion", "GoogleVersion", "GrantV1Response", "Groq", "GroqReasoningMode", - "GroqThinkProviderReasoningMode", "LeaveProjectV1Response", "ListAgentConfigurationsV1Response", "ListAgentVariablesV1Response", diff --git a/src/deepgram/types/deepgram.py b/src/deepgram/types/deepgram.py index a798a03b..ec242762 100644 --- a/src/deepgram/types/deepgram.py +++ b/src/deepgram/types/deepgram.py @@ -26,7 +26,12 @@ class Deepgram(UncheckedBaseModel): 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 only 0.85, 0.9, 0.95, 1.0, 1.05, 1.1 and 1.15; another value ends the session with FAILED_TO_SPEAK. Not yet supported in all languages. + 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) + """ + 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: diff --git a/src/deepgram/types/deepgram_listen_provider_v2.py b/src/deepgram/types/deepgram_listen_provider_v2.py index e55bf684..8a15c6d9 100644 --- a/src/deepgram/types/deepgram_listen_provider_v2.py +++ b/src/deepgram/types/deepgram_listen_provider_v2.py @@ -28,16 +28,9 @@ 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 (str or list) for backward - compatibility and remapped to `language_hints` by the validator below; - `exclude=True` keeps it off the wire (the API rejects unknown fields). - """ - eot_threshold: typing.Optional[float] = pydantic.Field(default=None) """ - End-of-turn confidence required to finish a turn. Valid range: 0.5 - 0.9. Defaults to 0.7. + 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 natural end-of-turn detection and end turns with the ForceEndTurn message. """ eager_eot_threshold: typing.Optional[float] = pydantic.Field(default=None) @@ -55,37 +48,6 @@ class DeepgramListenProviderV2(UncheckedBaseModel): Prompt keyterm recognition to improve Keyword Recall Rate """ - # Backward-compat: the public field was historically named `language_hint` - # and accepted a string or a list. The API field is `language_hints` (a - # list). Translate the legacy kwarg so existing callers keep working, and - # drop the dead singular key so it is not rejected by the API - # (deny_unknown_fields). Hand-maintained. - 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): - return values - if "language_hint" in 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 - 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): - return values - if "language_hint" in 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 - if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: diff --git a/src/deepgram/types/listen_v1keywords.py b/src/deepgram/types/listen_v1keywords.py index 7840c947..04f177ad 100644 --- a/src/deepgram/types/listen_v1keywords.py +++ b/src/deepgram/types/listen_v1keywords.py @@ -4,5 +4,5 @@ ListenV1Keywords = typing.Any """ -Keywords can boost or suppress specialized terminology and brands +Keywords can boost or suppress specialized terminology and brands. `keywords` is not supported with Nova-3 models; use `keyterm` instead. """ diff --git a/src/deepgram/types/speak_settings_v1provider.py b/src/deepgram/types/speak_settings_v1provider.py index b8c3bdf6..305cdba8 100644 --- a/src/deepgram/types/speak_settings_v1provider.py +++ b/src/deepgram/types/speak_settings_v1provider.py @@ -24,6 +24,7 @@ class SpeakSettingsV1Provider_Deepgram(UncheckedBaseModel): version: typing.Optional[str] = None model: DeepgramModel speed: typing.Optional[float] = 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_v1model.py b/src/deepgram/types/speak_v1model.py index 4019b620..4cadc144 100644 --- a/src/deepgram/types/speak_v1model.py +++ b/src/deepgram/types/speak_v1model.py @@ -101,7 +101,6 @@ "aura-2-livia-it", "aura-2-maia-it", "aura-2-melia-it", - "aura-2-perseo-it", "aura-2-ama-ja", "aura-2-ebisu-ja", "aura-2-fujin-ja", diff --git a/src/deepgram/types/speak_v2speed.py b/src/deepgram/types/speak_v2speed.py index b9e1e10c..c829c072 100644 --- a/src/deepgram/types/speak_v2speed.py +++ b/src/deepgram/types/speak_v2speed.py @@ -1,15 +1,6 @@ # This file was auto-generated by Fern from our API Definition. -# Backward-compat patch (2026-08-18 regen): the generator retyped this from -# `float` to `Union[Literal["0.85"..."1.15"], Any]` -- a string-literal enum. -# That contradicts the actual API contract (a numeric speech-rate multiplier; -# see the sibling `SpeakV2SpeedValue = float` used by the Configure message) and -# silently changed the documented domain of the `speak.v2.connect(speed=...)` -# parameter from numeric to string. Only the `Any` fallback kept `speed=1.05` -# working. Restored to `float` so the connect param stays exactly what it was on -# `main`, mypy-precise (no reliance on `Any`), and consistent with the Configure -# message. Unfreeze when the spec types the connect `speed` as a number. SpeakV2Speed = float """ -Speech-rate multiplier. `1.0` is the model's nominal rate; lower is slower. Accepted values run `0.85` to `1.15` in `0.05` increments. A value outside that range is rejected with `SPEED_OUT_OF_RANGE`; a value inside it but off the `0.05` increment with `SPEED_INCREMENT_INVALID`. Models and languages without runtime speed control reject any value with `SPEED_NOT_SUPPORTED`. +Speech-rate multiplier. `1.0` is the model's nominal rate; lower is slower. Accepted values run `0.5` to `1.5` in `0.05` increments. A value outside that range is rejected with `SPEED_OUT_OF_RANGE`; a value inside it but off the `0.05` increment with `SPEED_INCREMENT_INVALID`. Models and languages without runtime speed control reject any value with `SPEED_NOT_SUPPORTED`. """ diff --git a/src/deepgram/types/speak_v2speed_value.py b/src/deepgram/types/speak_v2speed_value.py index 2a6991ef..8a8e7bc4 100644 --- a/src/deepgram/types/speak_v2speed_value.py +++ b/src/deepgram/types/speak_v2speed_value.py @@ -2,5 +2,5 @@ SpeakV2SpeedValue = float """ -Speech-rate multiplier. `1.0` is the model's nominal rate; lower is slower. Accepted values run `0.85` to `1.15` in `0.05` increments. A value outside that range is rejected with `SPEED_OUT_OF_RANGE`; a value inside it but off the `0.05` increment with `SPEED_INCREMENT_INVALID`. Models and languages without runtime speed control reject any value with `SPEED_NOT_SUPPORTED`. +Speech-rate multiplier. `1.0` is the model's nominal rate; lower is slower. Accepted values run `0.5` to `1.5` in `0.05` increments. A value outside that range is rejected with `SPEED_OUT_OF_RANGE`; a value inside it but off the `0.05` increment with `SPEED_INCREMENT_INVALID`. Models and languages without runtime speed control reject any value with `SPEED_NOT_SUPPORTED`. """ diff --git a/tests/wire/test_listen_v1_media.py b/tests/wire/test_listen_v1_media.py index 96a5bb28..e4264985 100644 --- a/tests/wire/test_listen_v1_media.py +++ b/tests/wire/test_listen_v1_media.py @@ -9,104 +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: - """All 37 optional query params must reach the wire, with bools lowercased. - - The 2026-08-18 regen simplified the upstream spec *example* for this endpoint, - and Fern derives the wire test from that example -- so the generated test - dropped every query parameter, leaving their serialization unverified while - the client signature still forwards all 37. This restores that coverage; the - file is frozen in .fernignore so a future regen cannot silently drop it again. - - Same failure mode as tests/wire/test_manage_v1_projects_keys.py and - tests/wire/test_manage_v1_projects_requests.py, which are frozen for this reason. - """ - 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="language", - 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": "language", - "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 cf232369..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,18 +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 create endpoint with the legacy request alias""" - 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 acf577b0..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,50 +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: - """All ten optional query params must reach the wire, with datetime encoded as ISO-8601 Z. - - The 2026-08-11 regen simplified the upstream spec *example* for this endpoint, - and Fern derives the wire test from that example -- so the generated test - dropped every query parameter, leaving their serialization unverified while - the client signature still forwards all ten. This restores that coverage; the - file is frozen in .fernignore so a future regen cannot silently drop it again. - """ - 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 d003d42a303ff257e44c18c4f53d3b8cdeb91c2f Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Fri, 4 Sep 2026 12:33:30 +0100 Subject: [PATCH 05/10] chore: re-apply manual patches after regen --- .fernignore | 87 +- .gitignore | 3 + .gitignore.bak | 8 - AGENTS.md | 1 - src/deepgram/__init__.py | 26 + src/deepgram/__init__.py.bak | 1362 ----------------- src/deepgram/agent/__init__.py | 89 ++ src/deepgram/agent/__init__.py.bak | 487 ------ src/deepgram/agent/v1/__init__.py | 91 ++ src/deepgram/agent/v1/__init__.py.bak | 489 ------ src/deepgram/agent/v1/requests/__init__.py | 39 + .../agent/v1/requests/__init__.py.bak | 253 --- .../agent/v1/requests/agent_v1settings.py | 3 +- .../agent/v1/requests/agent_v1settings.py.bak | 31 - .../v1/requests/agent_v1settings_agent.py | 26 +- .../v1/requests/agent_v1settings_agent.py.bak | 27 - .../agent_v1settings_agent_context.py | 8 + .../agent_v1settings_agent_context.py.bak | 35 - src/deepgram/agent/v1/socket_client.py | 38 +- src/deepgram/agent/v1/socket_client.py.bak | 379 ----- src/deepgram/agent/v1/types/__init__.py | 48 + src/deepgram/agent/v1/types/__init__.py.bak | 278 ---- .../agent/v1/types/agent_v1settings.py | 3 +- .../agent/v1/types/agent_v1settings.py.bak | 42 - .../agent/v1/types/agent_v1settings_agent.py | 57 +- .../v1/types/agent_v1settings_agent.py.bak | 66 - .../types/agent_v1settings_agent_context.py | 25 + .../agent_v1settings_agent_context.py.bak | 73 - ...1settings_agent_context_listen_provider.py | 25 + ...tings_agent_context_listen_provider.py.bak | 86 -- .../agent_v1settings_agent_listen_provider.py | 25 + ...nt_v1settings_agent_listen_provider.py.bak | 86 -- .../v1/types/agent_v1update_listen_listen.py | 39 + .../types/agent_v1update_listen_listen.py.bak | 81 - src/deepgram/core/api_error.py | 4 +- src/deepgram/core/api_error.py.bak | 31 - src/deepgram/core/parse_error.py | 4 +- src/deepgram/core/parse_error.py.bak | 40 - src/deepgram/core/query_encoder.py | 15 +- src/deepgram/core/query_encoder.py.bak | 66 - src/deepgram/listen/__init__.py | 3 + src/deepgram/listen/__init__.py.bak | 212 --- src/deepgram/listen/v1/socket_client.py | 30 +- src/deepgram/listen/v1/socket_client.py.bak | 234 --- src/deepgram/listen/v2/__init__.py | 3 + src/deepgram/listen/v2/__init__.py.bak | 111 -- src/deepgram/listen/v2/socket_client.py | 36 +- src/deepgram/listen/v2/socket_client.py.bak | 265 ---- src/deepgram/listen/v2/types/__init__.py | 3 + src/deepgram/listen/v2/types/__init__.py.bak | 74 - .../v2/types/listen_v2configure_failure.py | 4 +- .../types/listen_v2configure_failure.py.bak | 35 - .../v2/types/listen_v2configure_success.py | 4 +- .../types/listen_v2configure_success.py.bak | 49 - .../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 - src/deepgram/requests/__init__.py | 9 + src/deepgram/requests/__init__.py.bak | 596 -------- src/deepgram/speak/v1/socket_client.py | 30 +- src/deepgram/speak/v1/socket_client.py.bak | 235 --- src/deepgram/speak/v2/socket_client.py | 30 +- src/deepgram/speak/v2/socket_client.py.bak | 268 ---- src/deepgram/types/__init__.py | 27 + src/deepgram/types/__init__.py.bak | 844 ---------- .../types/deepgram_listen_provider_v2.py | 30 + .../types/deepgram_listen_provider_v2.py.bak | 96 -- src/deepgram/types/speak_v2speed.py.bak | 15 - tests/wire/test_listen_v1_media.py | 91 ++ tests/wire/test_listen_v1_media.py.bak | 112 -- tests/wire/test_manage_v1_projects_keys.py | 11 + .../wire/test_manage_v1_projects_keys.py.bak | 63 - .../wire/test_manage_v1_projects_requests.py | 39 + .../test_manage_v1_projects_requests.py.bak | 74 - 81 files changed, 873 insertions(+), 7601 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_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_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/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/socket_client.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/requests/__init__.py.bak delete mode 100644 src/deepgram/speak/v1/socket_client.py.bak delete mode 100644 src/deepgram/speak/v2/socket_client.py.bak delete mode 100644 src/deepgram/types/__init__.py.bak delete mode 100644 src/deepgram/types/deepgram_listen_provider_v2.py.bak delete mode 100644 src/deepgram/types/speak_v2speed.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 a54a2bb0..afdf32cd 100644 --- a/.fernignore +++ b/.fernignore @@ -27,11 +27,11 @@ src/deepgram/listen/v2/types/_dict_compat.py # - listen/v2 send_configure: runtime tolerance for a raw dict alongside the # generated ListenV2Configure model # [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 # Backward-compat patch: AgentV1SettingsAgentContext schema restructure as of # 2026-05-05. The new schema nests messages under .context.messages; this file @@ -39,12 +39,12 @@ src/deepgram/speak/v2/socket_client.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. @@ -119,9 +119,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. Frozen so Fern won't strip the validator on regen. Remove the shim and unfreeze 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 @@ -130,16 +130,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 - -# Backward-compat patch for the 2026-08-18 regen SpeakV2Speed retype. The generator -# changed this from `float` to `Union[Literal["0.85"..."1.15"], Any]` -- a string-literal -# enum that contradicts the API contract (a numeric multiplier; cf. SpeakV2SpeedValue = -# float, used by the Configure message) and silently changed the documented domain of the -# `speak.v2.connect(speed=...)` param from numeric to string. Restored to `float` so the -# connect param stays exactly what it was on main and consistent with Configure. Unfreeze -# when the spec types the connect `speed` as a number. -src/deepgram/types/speak_v2speed.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 @@ -153,17 +144,17 @@ src/deepgram/listen/v2/types/listen_v2close_stream_type.py # above shims. Fern would otherwise regenerate these and strip the legacy entries on # every regen. Frozen to preserve the public-import surface for renamed types/params. # Re-apply genuine new generator additions to these files manually after each regen. -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 @@ -180,23 +171,23 @@ 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 -src/deepgram/core/query_encoder.py.bak +src/deepgram/core/query_encoder.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_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 # Hand-written custom tests tests/custom/test_api_error_redaction.py @@ -232,14 +223,14 @@ tests/custom/test_websocket_streaming_coverage.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 @@ -248,7 +239,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 @@ -298,7 +289,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/AGENTS.md b/AGENTS.md index 3e7b3310..7b5b10db 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -70,7 +70,6 @@ Current temporarily frozen files: - `src/deepgram/core/query_encoder.py` — coerces Python bools to lowercase `"true"`/`"false"` before they reach `urllib.parse.urlencode` (which would otherwise produce `"True"`/`"False"` via `str()` and break websocket query strings). Only the four `*/connect()` paths call `urlencode`; HTTP raw clients hand params to httpx, which lowercases bools itself, so the patch is a no-op for the HTTP path. Once Fern's websocket codegen normalizes bools (or the spec types these as `boolean` end-to-end), this can be unfrozen. - `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` — read-side compatibility for the SDK 7.7 Listen V2 response retype. Through 7.6, `V2SocketClientResponse` contained `typing.Any`, so every response was returned as a raw dict; fixing the union made responses typed models and broke callers using `response["field"]`. These generated response classes inherit the hand-written base above, preserving read-only wire-key subscript access alongside canonical attribute access. Restore direct `UncheckedBaseModel` inheritance and unfreeze these files in the next 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` — behavioural back-compat shim for the `language_hint` -> `language_hints` rename (2026-06-15 regen). The public field was historically (incorrectly) singular and accepted a str or a list; the API field is `language_hints` (a list, and the server uses `deny_unknown_fields` so the singular key is rejected on the wire). Each carries a hand-added `model_validator(mode='before')` / `root_validator(pre=True)` that remaps a legacy `language_hint=` kwarg and drops the dead singular key. Remove and unfreeze when the singular alias is retired in a future major. -- `src/deepgram/types/speak_v2speed.py` — behavioural back-compat patch for the 2026-08-18 regen `SpeakV2Speed` retype. The generator changed it from `float` to `Union[Literal["0.85"…"1.15"], Any]` (a string-literal enum), which silently changed the documented domain of the `speak.v2.connect(speed=...)` parameter from numeric to string and contradicts the actual API contract (`SpeakV2SpeedValue = float`, used by the mid-stream `SpeakV2Configure` message). Only the `Any` fallback kept `speed=1.05` working. Restored to `float` so the connect param stays exactly what it was on `main`, mypy-precise, and consistent with the `Configure` message. Regression coverage in `tests/custom/test_speak_v2_coverage.py`. Unfreeze when the spec types the connect `speed` as a number. - `src/deepgram/agent/v1/types/agent_v1update_listen_listen.py` — backward-compat patch for the 2026-07-31 `AgentV1UpdateListen` provider retype. The `provider` field changed from a bare `DeepgramListenProviderV2` to the required discriminated union `AgentV1UpdateListenListenProvider` (`_V1`/`_V2`, discriminant `version`). Carries a hand-added `model_validator(mode='before')` / `root_validator(pre=True)` 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. NOTE: this patch was silently lost once (it was absent from `.fernignore`, so a regen overwrote it) — keep it frozen. - `tests/wire/test_manage_v1_projects_keys.py` — restored wire coverage for the legacy `CreateKeyV1RequestOneParams` request alias so future regens do not silently drop that compatibility check - `tests/wire/test_manage_v1_projects_requests.py` — restored query-parameter coverage for `manage.v1.projects.requests.list`. The 2026-08-11 regen simplified the upstream spec *example*, and Fern derives the wire test from the example, so all ten optional query params (and the `datetime` → ISO-8601 `Z` encoding) lost their assertions while the client signature still forwarded them. Frozen for the same reason as the `_keys.py` entry above. diff --git a/src/deepgram/__init__.py b/src/deepgram/__init__.py index e857eead..0e610bef 100644 --- a/src/deepgram/__init__.py +++ b/src/deepgram/__init__.py @@ -434,6 +434,10 @@ UsageV1ResponseResolutionParams, ) from .version import __version__ + from .types import AnthropicThinkProviderModel, CartesiaSpeakProviderModelId, CartesiaSpeakProviderVoice + from .requests import CartesiaSpeakProviderVoiceParams, DeepgramListenProviderV2LanguageHintParams + from .types import CreateKeyV1RequestOne, DeepgramListenProviderV2LanguageHint, DeepgramSpeakProviderModel + from .types import GoogleThinkProviderModel, GoogleThinkProviderVersion, GroqThinkProviderReasoningMode _dynamic_imports: typing.Dict[str, str] = { "AgentConfigurationV1": ".types", "AgentConfigurationV1Params": ".requests", @@ -868,6 +872,17 @@ "self_hosted": ".self_hosted", "speak": ".speak", "voice_agent": ".voice_agent", + "AnthropicThinkProviderModel": ".types", + "CartesiaSpeakProviderModelId": ".types", + "CartesiaSpeakProviderVoice": ".types", + "CartesiaSpeakProviderVoiceParams": ".requests", + "CreateKeyV1RequestOne": ".types", + "DeepgramListenProviderV2LanguageHint": ".types", + "DeepgramListenProviderV2LanguageHintParams": ".requests", + "DeepgramSpeakProviderModel": ".types", + "GoogleThinkProviderModel": ".types", + "GoogleThinkProviderVersion": ".types", + "GroqThinkProviderReasoningMode": ".types", } @@ -1326,4 +1341,15 @@ def __dir__(): "self_hosted", "speak", "voice_agent", + "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 be1a85ec..00000000 --- a/src/deepgram/__init__.py.bak +++ /dev/null @@ -1,1362 +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, - 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, - 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, - 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, - SharedIntentsResults, - SharedIntentsResultsIntents, - SharedIntentsResultsIntentsSegmentsItem, - SharedIntentsResultsIntentsSegmentsItemIntentsItem, - SharedSentiments, - SharedSentimentsAverage, - SharedSentimentsSegmentsItem, - SharedTopics, - SharedTopicsResults, - SharedTopicsResultsTopics, - SharedTopicsResultsTopicsSegmentsItem, - SharedTopicsResultsTopicsSegmentsItemTopicsItem, - 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, - ThinkSettingsV1, - ThinkSettingsV1ContextLength, - ThinkSettingsV1Endpoint, - ThinkSettingsV1FunctionsItem, - ThinkSettingsV1FunctionsItemEndpoint, - ThinkSettingsV1Provider, - ThinkSettingsV1Provider_Anthropic, - ThinkSettingsV1Provider_AwsBedrock, - 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, - 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, - 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, - SharedIntentsResultsIntentsParams, - SharedIntentsResultsIntentsSegmentsItemIntentsItemParams, - SharedIntentsResultsIntentsSegmentsItemParams, - SharedIntentsResultsParams, - SharedSentimentsAverageParams, - SharedSentimentsParams, - SharedSentimentsSegmentsItemParams, - SharedTopicsParams, - SharedTopicsResultsParams, - SharedTopicsResultsTopicsParams, - SharedTopicsResultsTopicsSegmentsItemParams, - SharedTopicsResultsTopicsSegmentsItemTopicsItemParams, - SpeakSettingsV1EndpointParams, - SpeakSettingsV1Params, - SpeakSettingsV1ProviderParams, - SpeakSettingsV1Provider_AwsPollyParams, - SpeakSettingsV1Provider_CartesiaParams, - SpeakSettingsV1Provider_DeepgramParams, - SpeakSettingsV1Provider_ElevenLabsParams, - SpeakSettingsV1Provider_OpenAiParams, - SpeakV2AcceptedResponseParams, - ThinkSettingsV1ContextLengthParams, - ThinkSettingsV1EndpointParams, - ThinkSettingsV1FunctionsItemEndpointParams, - ThinkSettingsV1FunctionsItemParams, - ThinkSettingsV1Params, - ThinkSettingsV1ProviderParams, - ThinkSettingsV1Provider_AnthropicParams, - ThinkSettingsV1Provider_AwsBedrockParams, - ThinkSettingsV1Provider_GoogleParams, - ThinkSettingsV1Provider_GroqParams, - ThinkSettingsV1Provider_OpenAiParams, - UpdateProjectMemberScopesV1ResponseParams, - UpdateProjectV1ResponseParams, - UsageBreakdownV1ResponseParams, - UsageBreakdownV1ResponseResolutionParams, - UsageBreakdownV1ResponseResultsItemGroupingParams, - UsageBreakdownV1ResponseResultsItemParams, - UsageFieldsV1ResponseModelsItemParams, - UsageFieldsV1ResponseParams, - UsageV1ResponseParams, - UsageV1ResponseResolutionParams, - ) - from .version import __version__ - from .types import AnthropicThinkProviderModel - from .types import CartesiaSpeakProviderModelId - from .types import CartesiaSpeakProviderVoice - from .requests import CartesiaSpeakProviderVoiceParams - from .types import CreateKeyV1RequestOne - from .types import DeepgramListenProviderV2LanguageHint - from .requests import DeepgramListenProviderV2LanguageHintParams - from .types import DeepgramSpeakProviderModel - from .types import GoogleThinkProviderModel - from .types import GoogleThinkProviderVersion - from .types import GroqThinkProviderReasoningMode -_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", - "AnthropicThinkProviderModel": ".types", - "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", - "CartesiaSpeakProviderModelId": ".types", - "CartesiaSpeakProviderVoice": ".types", - "CartesiaSpeakProviderVoiceParams": ".requests", - "CartesiaVoice": ".types", - "CartesiaVoiceParams": ".requests", - "CreateAgentConfigurationV1Response": ".types", - "CreateAgentConfigurationV1ResponseParams": ".requests", - "CreateKeyV1Request": ".types", - "CreateKeyV1RequestOne": ".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", - "DeepgramListenProviderV2LanguageHint": ".types", - "DeepgramListenProviderV2LanguageHintParams": ".requests", - "DeepgramListenProviderV2Params": ".requests", - "DeepgramModel": ".types", - "DeepgramParams": ".requests", - "DeepgramSpeakProviderModel": ".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", - "GoogleThinkProviderModel": ".types", - "GoogleThinkProviderVersion": ".types", - "GoogleVersion": ".types", - "GrantV1Response": ".types", - "GrantV1ResponseParams": ".requests", - "Groq": ".types", - "GroqParams": ".requests", - "GroqReasoningMode": ".types", - "GroqThinkProviderReasoningMode": ".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", - "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", - "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", - "SharedIntentsResults": ".types", - "SharedIntentsResultsIntents": ".types", - "SharedIntentsResultsIntentsParams": ".requests", - "SharedIntentsResultsIntentsSegmentsItem": ".types", - "SharedIntentsResultsIntentsSegmentsItemIntentsItem": ".types", - "SharedIntentsResultsIntentsSegmentsItemIntentsItemParams": ".requests", - "SharedIntentsResultsIntentsSegmentsItemParams": ".requests", - "SharedIntentsResultsParams": ".requests", - "SharedSentiments": ".types", - "SharedSentimentsAverage": ".types", - "SharedSentimentsAverageParams": ".requests", - "SharedSentimentsParams": ".requests", - "SharedSentimentsSegmentsItem": ".types", - "SharedSentimentsSegmentsItemParams": ".requests", - "SharedTopics": ".types", - "SharedTopicsParams": ".requests", - "SharedTopicsResults": ".types", - "SharedTopicsResultsParams": ".requests", - "SharedTopicsResultsTopics": ".types", - "SharedTopicsResultsTopicsParams": ".requests", - "SharedTopicsResultsTopicsSegmentsItem": ".types", - "SharedTopicsResultsTopicsSegmentsItemParams": ".requests", - "SharedTopicsResultsTopicsSegmentsItemTopicsItem": ".types", - "SharedTopicsResultsTopicsSegmentsItemTopicsItemParams": ".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", - "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_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", -} - - -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", - "AnthropicThinkProviderModel", - "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", - "CartesiaSpeakProviderModelId", - "CartesiaSpeakProviderVoice", - "CartesiaSpeakProviderVoiceParams", - "CartesiaVoice", - "CartesiaVoiceParams", - "CreateAgentConfigurationV1Response", - "CreateAgentConfigurationV1ResponseParams", - "CreateKeyV1Request", - "CreateKeyV1RequestOne", - "CreateKeyV1RequestParams", - "CreateKeyV1Response", - "CreateKeyV1ResponseParams", - "CreateProjectDistributionCredentialsV1Response", - "CreateProjectDistributionCredentialsV1ResponseDistributionCredentials", - "CreateProjectDistributionCredentialsV1ResponseDistributionCredentialsParams", - "CreateProjectDistributionCredentialsV1ResponseMember", - "CreateProjectDistributionCredentialsV1ResponseMemberParams", - "CreateProjectDistributionCredentialsV1ResponseParams", - "CreateProjectInviteV1Response", - "CreateProjectInviteV1ResponseParams", - "Deepgram", - "DeepgramClient", - "DeepgramClientEnvironment", - "DeepgramListenProviderV1", - "DeepgramListenProviderV1Params", - "DeepgramListenProviderV2", - "DeepgramListenProviderV2LanguageHint", - "DeepgramListenProviderV2LanguageHintParams", - "DeepgramListenProviderV2Params", - "DeepgramModel", - "DeepgramParams", - "DeepgramSpeakProviderModel", - "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", - "GoogleThinkProviderModel", - "GoogleThinkProviderVersion", - "GoogleVersion", - "GrantV1Response", - "GrantV1ResponseParams", - "Groq", - "GroqParams", - "GroqReasoningMode", - "GroqThinkProviderReasoningMode", - "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", - "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", - "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", - "SharedIntentsResults", - "SharedIntentsResultsIntents", - "SharedIntentsResultsIntentsParams", - "SharedIntentsResultsIntentsSegmentsItem", - "SharedIntentsResultsIntentsSegmentsItemIntentsItem", - "SharedIntentsResultsIntentsSegmentsItemIntentsItemParams", - "SharedIntentsResultsIntentsSegmentsItemParams", - "SharedIntentsResultsParams", - "SharedSentiments", - "SharedSentimentsAverage", - "SharedSentimentsAverageParams", - "SharedSentimentsParams", - "SharedSentimentsSegmentsItem", - "SharedSentimentsSegmentsItemParams", - "SharedTopics", - "SharedTopicsParams", - "SharedTopicsResults", - "SharedTopicsResultsParams", - "SharedTopicsResultsTopics", - "SharedTopicsResultsTopicsParams", - "SharedTopicsResultsTopicsSegmentsItem", - "SharedTopicsResultsTopicsSegmentsItemParams", - "SharedTopicsResultsTopicsSegmentsItemTopicsItem", - "SharedTopicsResultsTopicsSegmentsItemTopicsItemParams", - "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", - "ThinkSettingsV1", - "ThinkSettingsV1ContextLength", - "ThinkSettingsV1ContextLengthParams", - "ThinkSettingsV1Endpoint", - "ThinkSettingsV1EndpointParams", - "ThinkSettingsV1FunctionsItem", - "ThinkSettingsV1FunctionsItemEndpoint", - "ThinkSettingsV1FunctionsItemEndpointParams", - "ThinkSettingsV1FunctionsItemParams", - "ThinkSettingsV1Params", - "ThinkSettingsV1Provider", - "ThinkSettingsV1ProviderParams", - "ThinkSettingsV1Provider_Anthropic", - "ThinkSettingsV1Provider_AnthropicParams", - "ThinkSettingsV1Provider_AwsBedrock", - "ThinkSettingsV1Provider_AwsBedrockParams", - "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", -] diff --git a/src/deepgram/agent/__init__.py b/src/deepgram/agent/__init__.py index 7cfeda7d..dc1efba5 100644 --- a/src/deepgram/agent/__init__.py +++ b/src/deepgram/agent/__init__.py @@ -131,6 +131,37 @@ FunctionCallHistoryMessageFunctionCallsItemParams, FunctionCallHistoryMessageParams, ) + from .v1 import ( + 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, + ) _dynamic_imports: typing.Dict[str, str] = { "AgentV1AgentAudioDone": ".v1", "AgentV1AgentAudioDoneParams": ".v1", @@ -255,6 +286,35 @@ "FunctionCallHistoryMessageFunctionCallsItemParams": ".v1", "FunctionCallHistoryMessageParams": ".v1", "v1": ".v1", + "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", } @@ -403,4 +463,33 @@ def __dir__(): "FunctionCallHistoryMessageFunctionCallsItemParams", "FunctionCallHistoryMessageParams", "v1", + "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 11be1460..00000000 --- a/src/deepgram/agent/__init__.py.bak +++ /dev/null @@ -1,487 +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, - AgentV1ConversationTextParams, - AgentV1ConversationTextRole, - AgentV1Error, - AgentV1ErrorParams, - AgentV1FunctionCallRequest, - AgentV1FunctionCallRequestFunctionsItem, - AgentV1FunctionCallRequestFunctionsItemParams, - AgentV1FunctionCallRequestParams, - AgentV1History, - AgentV1HistoryParams, - AgentV1InjectAgentMessage, - AgentV1InjectAgentMessageBehavior, - AgentV1InjectAgentMessageParams, - 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, - AgentV1ThinkUpdated, - AgentV1ThinkUpdatedParams, - AgentV1UpdateListen, - AgentV1UpdateListenListen, - AgentV1UpdateListenListenParams, - AgentV1UpdateListenListenProvider, - AgentV1UpdateListenListenProviderParams, - AgentV1UpdateListenListenProvider_V1, - AgentV1UpdateListenListenProvider_V1Params, - AgentV1UpdateListenListenProvider_V2, - AgentV1UpdateListenListenProvider_V2Params, - AgentV1UpdateListenParams, - AgentV1UpdatePrompt, - AgentV1UpdatePromptParams, - AgentV1UpdateSpeak, - AgentV1UpdateSpeakParams, - AgentV1UpdateSpeakSpeak, - AgentV1UpdateSpeakSpeakParams, - AgentV1UpdateThink, - AgentV1UpdateThinkParams, - AgentV1UpdateThinkThink, - AgentV1UpdateThinkThinkParams, - AgentV1UserStartedSpeaking, - AgentV1UserStartedSpeakingParams, - AgentV1Warning, - AgentV1WarningParams, - AgentV1Welcome, - AgentV1WelcomeParams, - ConversationHistoryMessage, - ConversationHistoryMessageParams, - ConversationHistoryMessageRole, - FunctionCallHistoryMessage, - FunctionCallHistoryMessageFunctionCallsItem, - FunctionCallHistoryMessageFunctionCallsItemParams, - FunctionCallHistoryMessageParams, - ) - from .v1 import AgentV1HistoryContent - from .v1 import AgentV1HistoryContentParams - from .v1 import AgentV1HistoryContentRole - from .v1 import AgentV1HistoryFunctionCalls - from .v1 import AgentV1HistoryFunctionCallsFunctionCallsItem - from .v1 import AgentV1HistoryFunctionCallsFunctionCallsItemParams - from .v1 import AgentV1HistoryFunctionCallsParams - from .v1 import AgentV1SettingsAgentContextContextMessagesItemContentRole - from .v1 import AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem - from .v1 import AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams - from .v1 import AgentV1SettingsAgentContextListenProviderV1 - from .v1 import AgentV1SettingsAgentContextListenProviderV1Params - from .v1 import AgentV1SettingsAgentContextListenProviderV2 - from .v1 import AgentV1SettingsAgentContextListenProviderV2LanguageHint - from .v1 import AgentV1SettingsAgentContextListenProviderV2LanguageHintParams - from .v1 import AgentV1SettingsAgentContextListenProviderV2Params - from .v1 import AgentV1SettingsAgentContextMessagesItem - from .v1 import AgentV1SettingsAgentContextMessagesItemContent - from .v1 import AgentV1SettingsAgentContextMessagesItemContentParams - from .v1 import AgentV1SettingsAgentContextMessagesItemContentRole - from .v1 import AgentV1SettingsAgentContextMessagesItemFunctionCalls - from .v1 import AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem - from .v1 import AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams - from .v1 import AgentV1SettingsAgentContextMessagesItemFunctionCallsParams - from .v1 import AgentV1SettingsAgentContextMessagesItemParams - from .v1 import AgentV1SettingsAgentListenProviderV1 - from .v1 import AgentV1SettingsAgentListenProviderV1Params - from .v1 import AgentV1SettingsAgentListenProviderV2 - from .v1 import AgentV1SettingsAgentListenProviderV2Params -_dynamic_imports: typing.Dict[str, str] = { - "AgentV1AgentAudioDone": ".v1", - "AgentV1AgentAudioDoneParams": ".v1", - "AgentV1AgentStartedSpeaking": ".v1", - "AgentV1AgentStartedSpeakingParams": ".v1", - "AgentV1AgentThinking": ".v1", - "AgentV1AgentThinkingParams": ".v1", - "AgentV1ConversationText": ".v1", - "AgentV1ConversationTextParams": ".v1", - "AgentV1ConversationTextRole": ".v1", - "AgentV1Error": ".v1", - "AgentV1ErrorParams": ".v1", - "AgentV1FunctionCallRequest": ".v1", - "AgentV1FunctionCallRequestFunctionsItem": ".v1", - "AgentV1FunctionCallRequestFunctionsItemParams": ".v1", - "AgentV1FunctionCallRequestParams": ".v1", - "AgentV1History": ".v1", - "AgentV1HistoryContent": ".v1", - "AgentV1HistoryContentParams": ".v1", - "AgentV1HistoryContentRole": ".v1", - "AgentV1HistoryFunctionCalls": ".v1", - "AgentV1HistoryFunctionCallsFunctionCallsItem": ".v1", - "AgentV1HistoryFunctionCallsFunctionCallsItemParams": ".v1", - "AgentV1HistoryFunctionCallsParams": ".v1", - "AgentV1HistoryParams": ".v1", - "AgentV1InjectAgentMessage": ".v1", - "AgentV1InjectAgentMessageBehavior": ".v1", - "AgentV1InjectAgentMessageParams": ".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", - "AgentV1SettingsAgentContextContextMessagesItemContentRole": ".v1", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem": ".v1", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams": ".v1", - "AgentV1SettingsAgentContextContextMessagesItemParams": ".v1", - "AgentV1SettingsAgentContextContextParams": ".v1", - "AgentV1SettingsAgentContextListen": ".v1", - "AgentV1SettingsAgentContextListenParams": ".v1", - "AgentV1SettingsAgentContextListenProvider": ".v1", - "AgentV1SettingsAgentContextListenProviderParams": ".v1", - "AgentV1SettingsAgentContextListenProviderV1": ".v1", - "AgentV1SettingsAgentContextListenProviderV1Params": ".v1", - "AgentV1SettingsAgentContextListenProviderV2": ".v1", - "AgentV1SettingsAgentContextListenProviderV2LanguageHint": ".v1", - "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams": ".v1", - "AgentV1SettingsAgentContextListenProviderV2Params": ".v1", - "AgentV1SettingsAgentContextListenProvider_V1": ".v1", - "AgentV1SettingsAgentContextListenProvider_V1Params": ".v1", - "AgentV1SettingsAgentContextListenProvider_V2": ".v1", - "AgentV1SettingsAgentContextListenProvider_V2Params": ".v1", - "AgentV1SettingsAgentContextMessagesItem": ".v1", - "AgentV1SettingsAgentContextMessagesItemContent": ".v1", - "AgentV1SettingsAgentContextMessagesItemContentParams": ".v1", - "AgentV1SettingsAgentContextMessagesItemContentRole": ".v1", - "AgentV1SettingsAgentContextMessagesItemFunctionCalls": ".v1", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem": ".v1", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams": ".v1", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams": ".v1", - "AgentV1SettingsAgentContextMessagesItemParams": ".v1", - "AgentV1SettingsAgentContextParams": ".v1", - "AgentV1SettingsAgentContextSpeak": ".v1", - "AgentV1SettingsAgentContextSpeakParams": ".v1", - "AgentV1SettingsAgentContextThink": ".v1", - "AgentV1SettingsAgentContextThinkParams": ".v1", - "AgentV1SettingsAgentListen": ".v1", - "AgentV1SettingsAgentListenParams": ".v1", - "AgentV1SettingsAgentListenProvider": ".v1", - "AgentV1SettingsAgentListenProviderParams": ".v1", - "AgentV1SettingsAgentListenProviderV1": ".v1", - "AgentV1SettingsAgentListenProviderV1Params": ".v1", - "AgentV1SettingsAgentListenProviderV2": ".v1", - "AgentV1SettingsAgentListenProviderV2Params": ".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", - "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", - "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", -} - - -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", - "AgentV1ConversationTextParams", - "AgentV1ConversationTextRole", - "AgentV1Error", - "AgentV1ErrorParams", - "AgentV1FunctionCallRequest", - "AgentV1FunctionCallRequestFunctionsItem", - "AgentV1FunctionCallRequestFunctionsItemParams", - "AgentV1FunctionCallRequestParams", - "AgentV1History", - "AgentV1HistoryContent", - "AgentV1HistoryContentParams", - "AgentV1HistoryContentRole", - "AgentV1HistoryFunctionCalls", - "AgentV1HistoryFunctionCallsFunctionCallsItem", - "AgentV1HistoryFunctionCallsFunctionCallsItemParams", - "AgentV1HistoryFunctionCallsParams", - "AgentV1HistoryParams", - "AgentV1InjectAgentMessage", - "AgentV1InjectAgentMessageBehavior", - "AgentV1InjectAgentMessageParams", - "AgentV1InjectUserMessage", - "AgentV1InjectUserMessageParams", - "AgentV1InjectionRefused", - "AgentV1InjectionRefusedParams", - "AgentV1KeepAlive", - "AgentV1KeepAliveParams", - "AgentV1LatencyReport", - "AgentV1LatencyReportParams", - "AgentV1ListenUpdated", - "AgentV1ListenUpdatedParams", - "AgentV1PromptUpdated", - "AgentV1PromptUpdatedParams", - "AgentV1ReceiveFunctionCallResponse", - "AgentV1ReceiveFunctionCallResponseParams", - "AgentV1SendFunctionCallResponse", - "AgentV1SendFunctionCallResponseParams", - "AgentV1Settings", - "AgentV1SettingsAgent", - "AgentV1SettingsAgentContext", - "AgentV1SettingsAgentContextContext", - "AgentV1SettingsAgentContextContextMessagesItem", - "AgentV1SettingsAgentContextContextMessagesItemContentRole", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams", - "AgentV1SettingsAgentContextContextMessagesItemParams", - "AgentV1SettingsAgentContextContextParams", - "AgentV1SettingsAgentContextListen", - "AgentV1SettingsAgentContextListenParams", - "AgentV1SettingsAgentContextListenProvider", - "AgentV1SettingsAgentContextListenProviderParams", - "AgentV1SettingsAgentContextListenProviderV1", - "AgentV1SettingsAgentContextListenProviderV1Params", - "AgentV1SettingsAgentContextListenProviderV2", - "AgentV1SettingsAgentContextListenProviderV2LanguageHint", - "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams", - "AgentV1SettingsAgentContextListenProviderV2Params", - "AgentV1SettingsAgentContextListenProvider_V1", - "AgentV1SettingsAgentContextListenProvider_V1Params", - "AgentV1SettingsAgentContextListenProvider_V2", - "AgentV1SettingsAgentContextListenProvider_V2Params", - "AgentV1SettingsAgentContextMessagesItem", - "AgentV1SettingsAgentContextMessagesItemContent", - "AgentV1SettingsAgentContextMessagesItemContentParams", - "AgentV1SettingsAgentContextMessagesItemContentRole", - "AgentV1SettingsAgentContextMessagesItemFunctionCalls", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams", - "AgentV1SettingsAgentContextMessagesItemParams", - "AgentV1SettingsAgentContextParams", - "AgentV1SettingsAgentContextSpeak", - "AgentV1SettingsAgentContextSpeakParams", - "AgentV1SettingsAgentContextThink", - "AgentV1SettingsAgentContextThinkParams", - "AgentV1SettingsAgentListen", - "AgentV1SettingsAgentListenParams", - "AgentV1SettingsAgentListenProvider", - "AgentV1SettingsAgentListenProviderParams", - "AgentV1SettingsAgentListenProviderV1", - "AgentV1SettingsAgentListenProviderV1Params", - "AgentV1SettingsAgentListenProviderV2", - "AgentV1SettingsAgentListenProviderV2Params", - "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", - "AgentV1ThinkUpdated", - "AgentV1ThinkUpdatedParams", - "AgentV1UpdateListen", - "AgentV1UpdateListenListen", - "AgentV1UpdateListenListenParams", - "AgentV1UpdateListenListenProvider", - "AgentV1UpdateListenListenProviderParams", - "AgentV1UpdateListenListenProvider_V1", - "AgentV1UpdateListenListenProvider_V1Params", - "AgentV1UpdateListenListenProvider_V2", - "AgentV1UpdateListenListenProvider_V2Params", - "AgentV1UpdateListenParams", - "AgentV1UpdatePrompt", - "AgentV1UpdatePromptParams", - "AgentV1UpdateSpeak", - "AgentV1UpdateSpeakParams", - "AgentV1UpdateSpeakSpeak", - "AgentV1UpdateSpeakSpeakParams", - "AgentV1UpdateThink", - "AgentV1UpdateThinkParams", - "AgentV1UpdateThinkThink", - "AgentV1UpdateThinkThinkParams", - "AgentV1UserStartedSpeaking", - "AgentV1UserStartedSpeakingParams", - "AgentV1Warning", - "AgentV1WarningParams", - "AgentV1Welcome", - "AgentV1WelcomeParams", - "ConversationHistoryMessage", - "ConversationHistoryMessageParams", - "ConversationHistoryMessageRole", - "FunctionCallHistoryMessage", - "FunctionCallHistoryMessageFunctionCallsItem", - "FunctionCallHistoryMessageFunctionCallsItemParams", - "FunctionCallHistoryMessageParams", - "v1", -] diff --git a/src/deepgram/agent/v1/__init__.py b/src/deepgram/agent/v1/__init__.py index 06b0ad1c..0757c9c0 100644 --- a/src/deepgram/agent/v1/__init__.py +++ b/src/deepgram/agent/v1/__init__.py @@ -133,6 +133,39 @@ FunctionCallHistoryMessageFunctionCallsItemParams, FunctionCallHistoryMessageParams, ) + from .types import ( + AgentV1HistoryContent, + AgentV1HistoryContentRole, + AgentV1HistoryFunctionCalls, + AgentV1HistoryFunctionCallsFunctionCallsItem, + AgentV1SettingsAgentContextContextMessagesItemContentRole, + AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem, + AgentV1SettingsAgentContextListenProviderV1, + AgentV1SettingsAgentContextListenProviderV2, + AgentV1SettingsAgentContextListenProviderV2LanguageHint, + AgentV1SettingsAgentContextMessagesItem, + AgentV1SettingsAgentContextMessagesItemContent, + AgentV1SettingsAgentContextMessagesItemContentRole, + AgentV1SettingsAgentContextMessagesItemFunctionCalls, + AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem, + AgentV1SettingsAgentListenProviderV1, + AgentV1SettingsAgentListenProviderV2, + ) + from .requests import ( + AgentV1HistoryContentParams, + AgentV1HistoryFunctionCallsFunctionCallsItemParams, + AgentV1HistoryFunctionCallsParams, + AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams, + AgentV1SettingsAgentContextListenProviderV1Params, + AgentV1SettingsAgentContextListenProviderV2LanguageHintParams, + AgentV1SettingsAgentContextListenProviderV2Params, + AgentV1SettingsAgentContextMessagesItemContentParams, + AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams, + AgentV1SettingsAgentContextMessagesItemFunctionCallsParams, + AgentV1SettingsAgentContextMessagesItemParams, + AgentV1SettingsAgentListenProviderV1Params, + AgentV1SettingsAgentListenProviderV2Params, + ) _dynamic_imports: typing.Dict[str, str] = { "AgentV1AgentAudioDone": ".types", "AgentV1AgentAudioDoneParams": ".requests", @@ -257,6 +290,35 @@ "FunctionCallHistoryMessageFunctionCallsItemParams": ".requests", "FunctionCallHistoryMessageParams": ".requests", "settings": ".settings", + "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", } @@ -405,4 +467,33 @@ def __dir__(): "FunctionCallHistoryMessageFunctionCallsItemParams", "FunctionCallHistoryMessageParams", "settings", + "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 59444380..00000000 --- a/src/deepgram/agent/v1/__init__.py.bak +++ /dev/null @@ -1,489 +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, - AgentV1ConversationTextRole, - AgentV1Error, - AgentV1FunctionCallRequest, - AgentV1FunctionCallRequestFunctionsItem, - AgentV1History, - AgentV1InjectAgentMessage, - AgentV1InjectAgentMessageBehavior, - 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, - AgentV1ThinkUpdated, - AgentV1UpdateListen, - AgentV1UpdateListenListen, - AgentV1UpdateListenListenProvider, - AgentV1UpdateListenListenProvider_V1, - AgentV1UpdateListenListenProvider_V2, - AgentV1UpdatePrompt, - AgentV1UpdateSpeak, - AgentV1UpdateSpeakSpeak, - AgentV1UpdateThink, - AgentV1UpdateThinkThink, - AgentV1UserStartedSpeaking, - AgentV1Warning, - AgentV1Welcome, - ConversationHistoryMessage, - ConversationHistoryMessageRole, - FunctionCallHistoryMessage, - FunctionCallHistoryMessageFunctionCallsItem, - ) - from . import settings - from .requests import ( - AgentV1AgentAudioDoneParams, - AgentV1AgentStartedSpeakingParams, - AgentV1AgentThinkingParams, - AgentV1ConversationTextParams, - AgentV1ErrorParams, - AgentV1FunctionCallRequestFunctionsItemParams, - AgentV1FunctionCallRequestParams, - AgentV1HistoryParams, - AgentV1InjectAgentMessageParams, - 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, - AgentV1ThinkUpdatedParams, - AgentV1UpdateListenListenParams, - AgentV1UpdateListenListenProviderParams, - AgentV1UpdateListenListenProvider_V1Params, - AgentV1UpdateListenListenProvider_V2Params, - AgentV1UpdateListenParams, - AgentV1UpdatePromptParams, - AgentV1UpdateSpeakParams, - AgentV1UpdateSpeakSpeakParams, - AgentV1UpdateThinkParams, - AgentV1UpdateThinkThinkParams, - AgentV1UserStartedSpeakingParams, - AgentV1WarningParams, - AgentV1WelcomeParams, - ConversationHistoryMessageParams, - FunctionCallHistoryMessageFunctionCallsItemParams, - FunctionCallHistoryMessageParams, - ) - from .types import AgentV1HistoryContent - from .requests import AgentV1HistoryContentParams - from .types import AgentV1HistoryContentRole - from .types import AgentV1HistoryFunctionCalls - from .types import AgentV1HistoryFunctionCallsFunctionCallsItem - from .requests import AgentV1HistoryFunctionCallsFunctionCallsItemParams - from .requests import AgentV1HistoryFunctionCallsParams - from .types import AgentV1SettingsAgentContextContextMessagesItemContentRole - from .types import AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem - from .requests import AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams - from .types import AgentV1SettingsAgentContextListenProviderV1 - from .requests import AgentV1SettingsAgentContextListenProviderV1Params - from .types import AgentV1SettingsAgentContextListenProviderV2 - from .types import AgentV1SettingsAgentContextListenProviderV2LanguageHint - from .requests import AgentV1SettingsAgentContextListenProviderV2LanguageHintParams - from .requests import AgentV1SettingsAgentContextListenProviderV2Params - from .types import AgentV1SettingsAgentContextMessagesItem - from .types import AgentV1SettingsAgentContextMessagesItemContent - from .requests import AgentV1SettingsAgentContextMessagesItemContentParams - from .types import AgentV1SettingsAgentContextMessagesItemContentRole - from .types import AgentV1SettingsAgentContextMessagesItemFunctionCalls - from .types import AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem - from .requests import AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams - from .requests import AgentV1SettingsAgentContextMessagesItemFunctionCallsParams - from .requests import AgentV1SettingsAgentContextMessagesItemParams - from .types import AgentV1SettingsAgentListenProviderV1 - from .requests import AgentV1SettingsAgentListenProviderV1Params - from .types import AgentV1SettingsAgentListenProviderV2 - from .requests import AgentV1SettingsAgentListenProviderV2Params -_dynamic_imports: typing.Dict[str, str] = { - "AgentV1AgentAudioDone": ".types", - "AgentV1AgentAudioDoneParams": ".requests", - "AgentV1AgentStartedSpeaking": ".types", - "AgentV1AgentStartedSpeakingParams": ".requests", - "AgentV1AgentThinking": ".types", - "AgentV1AgentThinkingParams": ".requests", - "AgentV1ConversationText": ".types", - "AgentV1ConversationTextParams": ".requests", - "AgentV1ConversationTextRole": ".types", - "AgentV1Error": ".types", - "AgentV1ErrorParams": ".requests", - "AgentV1FunctionCallRequest": ".types", - "AgentV1FunctionCallRequestFunctionsItem": ".types", - "AgentV1FunctionCallRequestFunctionsItemParams": ".requests", - "AgentV1FunctionCallRequestParams": ".requests", - "AgentV1History": ".types", - "AgentV1HistoryContent": ".types", - "AgentV1HistoryContentParams": ".requests", - "AgentV1HistoryContentRole": ".types", - "AgentV1HistoryFunctionCalls": ".types", - "AgentV1HistoryFunctionCallsFunctionCallsItem": ".types", - "AgentV1HistoryFunctionCallsFunctionCallsItemParams": ".requests", - "AgentV1HistoryFunctionCallsParams": ".requests", - "AgentV1HistoryParams": ".requests", - "AgentV1InjectAgentMessage": ".types", - "AgentV1InjectAgentMessageBehavior": ".types", - "AgentV1InjectAgentMessageParams": ".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", - "AgentV1SettingsAgentContextContextMessagesItemContentRole": ".types", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem": ".types", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams": ".requests", - "AgentV1SettingsAgentContextContextMessagesItemParams": ".requests", - "AgentV1SettingsAgentContextContextParams": ".requests", - "AgentV1SettingsAgentContextListen": ".types", - "AgentV1SettingsAgentContextListenParams": ".requests", - "AgentV1SettingsAgentContextListenProvider": ".types", - "AgentV1SettingsAgentContextListenProviderParams": ".requests", - "AgentV1SettingsAgentContextListenProviderV1": ".types", - "AgentV1SettingsAgentContextListenProviderV1Params": ".requests", - "AgentV1SettingsAgentContextListenProviderV2": ".types", - "AgentV1SettingsAgentContextListenProviderV2LanguageHint": ".types", - "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams": ".requests", - "AgentV1SettingsAgentContextListenProviderV2Params": ".requests", - "AgentV1SettingsAgentContextListenProvider_V1": ".types", - "AgentV1SettingsAgentContextListenProvider_V1Params": ".requests", - "AgentV1SettingsAgentContextListenProvider_V2": ".types", - "AgentV1SettingsAgentContextListenProvider_V2Params": ".requests", - "AgentV1SettingsAgentContextMessagesItem": ".types", - "AgentV1SettingsAgentContextMessagesItemContent": ".types", - "AgentV1SettingsAgentContextMessagesItemContentParams": ".requests", - "AgentV1SettingsAgentContextMessagesItemContentRole": ".types", - "AgentV1SettingsAgentContextMessagesItemFunctionCalls": ".types", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem": ".types", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams": ".requests", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams": ".requests", - "AgentV1SettingsAgentContextMessagesItemParams": ".requests", - "AgentV1SettingsAgentContextParams": ".requests", - "AgentV1SettingsAgentContextSpeak": ".types", - "AgentV1SettingsAgentContextSpeakParams": ".requests", - "AgentV1SettingsAgentContextThink": ".types", - "AgentV1SettingsAgentContextThinkParams": ".requests", - "AgentV1SettingsAgentListen": ".types", - "AgentV1SettingsAgentListenParams": ".requests", - "AgentV1SettingsAgentListenProvider": ".types", - "AgentV1SettingsAgentListenProviderParams": ".requests", - "AgentV1SettingsAgentListenProviderV1": ".types", - "AgentV1SettingsAgentListenProviderV1Params": ".requests", - "AgentV1SettingsAgentListenProviderV2": ".types", - "AgentV1SettingsAgentListenProviderV2Params": ".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", - "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", - "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", -} - - -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", - "AgentV1ConversationTextParams", - "AgentV1ConversationTextRole", - "AgentV1Error", - "AgentV1ErrorParams", - "AgentV1FunctionCallRequest", - "AgentV1FunctionCallRequestFunctionsItem", - "AgentV1FunctionCallRequestFunctionsItemParams", - "AgentV1FunctionCallRequestParams", - "AgentV1History", - "AgentV1HistoryContent", - "AgentV1HistoryContentParams", - "AgentV1HistoryContentRole", - "AgentV1HistoryFunctionCalls", - "AgentV1HistoryFunctionCallsFunctionCallsItem", - "AgentV1HistoryFunctionCallsFunctionCallsItemParams", - "AgentV1HistoryFunctionCallsParams", - "AgentV1HistoryParams", - "AgentV1InjectAgentMessage", - "AgentV1InjectAgentMessageBehavior", - "AgentV1InjectAgentMessageParams", - "AgentV1InjectUserMessage", - "AgentV1InjectUserMessageParams", - "AgentV1InjectionRefused", - "AgentV1InjectionRefusedParams", - "AgentV1KeepAlive", - "AgentV1KeepAliveParams", - "AgentV1LatencyReport", - "AgentV1LatencyReportParams", - "AgentV1ListenUpdated", - "AgentV1ListenUpdatedParams", - "AgentV1PromptUpdated", - "AgentV1PromptUpdatedParams", - "AgentV1ReceiveFunctionCallResponse", - "AgentV1ReceiveFunctionCallResponseParams", - "AgentV1SendFunctionCallResponse", - "AgentV1SendFunctionCallResponseParams", - "AgentV1Settings", - "AgentV1SettingsAgent", - "AgentV1SettingsAgentContext", - "AgentV1SettingsAgentContextContext", - "AgentV1SettingsAgentContextContextMessagesItem", - "AgentV1SettingsAgentContextContextMessagesItemContentRole", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams", - "AgentV1SettingsAgentContextContextMessagesItemParams", - "AgentV1SettingsAgentContextContextParams", - "AgentV1SettingsAgentContextListen", - "AgentV1SettingsAgentContextListenParams", - "AgentV1SettingsAgentContextListenProvider", - "AgentV1SettingsAgentContextListenProviderParams", - "AgentV1SettingsAgentContextListenProviderV1", - "AgentV1SettingsAgentContextListenProviderV1Params", - "AgentV1SettingsAgentContextListenProviderV2", - "AgentV1SettingsAgentContextListenProviderV2LanguageHint", - "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams", - "AgentV1SettingsAgentContextListenProviderV2Params", - "AgentV1SettingsAgentContextListenProvider_V1", - "AgentV1SettingsAgentContextListenProvider_V1Params", - "AgentV1SettingsAgentContextListenProvider_V2", - "AgentV1SettingsAgentContextListenProvider_V2Params", - "AgentV1SettingsAgentContextMessagesItem", - "AgentV1SettingsAgentContextMessagesItemContent", - "AgentV1SettingsAgentContextMessagesItemContentParams", - "AgentV1SettingsAgentContextMessagesItemContentRole", - "AgentV1SettingsAgentContextMessagesItemFunctionCalls", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams", - "AgentV1SettingsAgentContextMessagesItemParams", - "AgentV1SettingsAgentContextParams", - "AgentV1SettingsAgentContextSpeak", - "AgentV1SettingsAgentContextSpeakParams", - "AgentV1SettingsAgentContextThink", - "AgentV1SettingsAgentContextThinkParams", - "AgentV1SettingsAgentListen", - "AgentV1SettingsAgentListenParams", - "AgentV1SettingsAgentListenProvider", - "AgentV1SettingsAgentListenProviderParams", - "AgentV1SettingsAgentListenProviderV1", - "AgentV1SettingsAgentListenProviderV1Params", - "AgentV1SettingsAgentListenProviderV2", - "AgentV1SettingsAgentListenProviderV2Params", - "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", - "AgentV1ThinkUpdated", - "AgentV1ThinkUpdatedParams", - "AgentV1UpdateListen", - "AgentV1UpdateListenListen", - "AgentV1UpdateListenListenParams", - "AgentV1UpdateListenListenProvider", - "AgentV1UpdateListenListenProviderParams", - "AgentV1UpdateListenListenProvider_V1", - "AgentV1UpdateListenListenProvider_V1Params", - "AgentV1UpdateListenListenProvider_V2", - "AgentV1UpdateListenListenProvider_V2Params", - "AgentV1UpdateListenParams", - "AgentV1UpdatePrompt", - "AgentV1UpdatePromptParams", - "AgentV1UpdateSpeak", - "AgentV1UpdateSpeakParams", - "AgentV1UpdateSpeakSpeak", - "AgentV1UpdateSpeakSpeakParams", - "AgentV1UpdateThink", - "AgentV1UpdateThinkParams", - "AgentV1UpdateThinkThink", - "AgentV1UpdateThinkThinkParams", - "AgentV1UserStartedSpeaking", - "AgentV1UserStartedSpeakingParams", - "AgentV1Warning", - "AgentV1WarningParams", - "AgentV1Welcome", - "AgentV1WelcomeParams", - "ConversationHistoryMessage", - "ConversationHistoryMessageParams", - "ConversationHistoryMessageRole", - "FunctionCallHistoryMessage", - "FunctionCallHistoryMessageFunctionCallsItem", - "FunctionCallHistoryMessageFunctionCallsItemParams", - "FunctionCallHistoryMessageParams", - "settings", -] diff --git a/src/deepgram/agent/v1/requests/__init__.py b/src/deepgram/agent/v1/requests/__init__.py index 1b3e69e3..0dbbb824 100644 --- a/src/deepgram/agent/v1/requests/__init__.py +++ b/src/deepgram/agent/v1/requests/__init__.py @@ -72,6 +72,19 @@ from .conversation_history_message import ConversationHistoryMessageParams from .function_call_history_message import FunctionCallHistoryMessageParams from .function_call_history_message_function_calls_item import FunctionCallHistoryMessageFunctionCallsItemParams + from .agent_v1history_content import AgentV1HistoryContentParams + from .agent_v1history_function_calls import AgentV1HistoryFunctionCallsParams + from .agent_v1history_function_calls_function_calls_item import AgentV1HistoryFunctionCallsFunctionCallsItemParams + from .agent_v1settings_agent_context_context_messages_item_function_calls_function_calls_item import AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams + from .agent_v1settings_agent_context_listen_provider_v1 import AgentV1SettingsAgentContextListenProviderV1Params + from .agent_v1settings_agent_context_listen_provider_v2 import AgentV1SettingsAgentContextListenProviderV2Params + from .agent_v1settings_agent_context_listen_provider_v2language_hint import AgentV1SettingsAgentContextListenProviderV2LanguageHintParams + from .agent_v1settings_agent_context_messages_item import AgentV1SettingsAgentContextMessagesItemParams + from .agent_v1settings_agent_context_messages_item_content import AgentV1SettingsAgentContextMessagesItemContentParams + from .agent_v1settings_agent_context_messages_item_function_calls import AgentV1SettingsAgentContextMessagesItemFunctionCallsParams + from .agent_v1settings_agent_context_messages_item_function_calls_function_calls_item import AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams + from .agent_v1settings_agent_listen_provider_v1 import AgentV1SettingsAgentListenProviderV1Params + from .agent_v1settings_agent_listen_provider_v2 import AgentV1SettingsAgentListenProviderV2Params _dynamic_imports: typing.Dict[str, str] = { "AgentV1AgentAudioDoneParams": ".agent_v1agent_audio_done", "AgentV1AgentStartedSpeakingParams": ".agent_v1agent_started_speaking", @@ -131,6 +144,19 @@ "ConversationHistoryMessageParams": ".conversation_history_message", "FunctionCallHistoryMessageFunctionCallsItemParams": ".function_call_history_message_function_calls_item", "FunctionCallHistoryMessageParams": ".function_call_history_message", + "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", } @@ -214,4 +240,17 @@ def __dir__(): "ConversationHistoryMessageParams", "FunctionCallHistoryMessageFunctionCallsItemParams", "FunctionCallHistoryMessageParams", + "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 387bc379..00000000 --- a/src/deepgram/agent/v1/requests/__init__.py.bak +++ /dev/null @@ -1,253 +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_v1error import AgentV1ErrorParams - from .agent_v1function_call_request import AgentV1FunctionCallRequestParams - from .agent_v1function_call_request_functions_item import AgentV1FunctionCallRequestFunctionsItemParams - from .agent_v1history import AgentV1HistoryParams - from .agent_v1inject_agent_message import AgentV1InjectAgentMessageParams - 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_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_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 - from .agent_v1history_content import AgentV1HistoryContentParams - from .agent_v1history_function_calls_function_calls_item import AgentV1HistoryFunctionCallsFunctionCallsItemParams - from .agent_v1history_function_calls import AgentV1HistoryFunctionCallsParams - from .agent_v1settings_agent_context_context_messages_item_function_calls_function_calls_item import AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams - from .agent_v1settings_agent_context_listen_provider_v1 import AgentV1SettingsAgentContextListenProviderV1Params - from .agent_v1settings_agent_context_listen_provider_v2language_hint import AgentV1SettingsAgentContextListenProviderV2LanguageHintParams - from .agent_v1settings_agent_context_listen_provider_v2 import AgentV1SettingsAgentContextListenProviderV2Params - from .agent_v1settings_agent_context_messages_item_content import AgentV1SettingsAgentContextMessagesItemContentParams - from .agent_v1settings_agent_context_messages_item_function_calls_function_calls_item import AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams - from .agent_v1settings_agent_context_messages_item_function_calls import AgentV1SettingsAgentContextMessagesItemFunctionCallsParams - from .agent_v1settings_agent_context_messages_item import AgentV1SettingsAgentContextMessagesItemParams - from .agent_v1settings_agent_listen_provider_v1 import AgentV1SettingsAgentListenProviderV1Params - from .agent_v1settings_agent_listen_provider_v2 import AgentV1SettingsAgentListenProviderV2Params -_dynamic_imports: typing.Dict[str, str] = { - "AgentV1AgentAudioDoneParams": ".agent_v1agent_audio_done", - "AgentV1AgentStartedSpeakingParams": ".agent_v1agent_started_speaking", - "AgentV1AgentThinkingParams": ".agent_v1agent_thinking", - "AgentV1ConversationTextParams": ".agent_v1conversation_text", - "AgentV1ErrorParams": ".agent_v1error", - "AgentV1FunctionCallRequestFunctionsItemParams": ".agent_v1function_call_request_functions_item", - "AgentV1FunctionCallRequestParams": ".agent_v1function_call_request", - "AgentV1HistoryContentParams": ".agent_v1history_content", - "AgentV1HistoryFunctionCallsFunctionCallsItemParams": ".agent_v1history_function_calls_function_calls_item", - "AgentV1HistoryFunctionCallsParams": ".agent_v1history_function_calls", - "AgentV1HistoryParams": ".agent_v1history", - "AgentV1InjectAgentMessageParams": ".agent_v1inject_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", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams": ".agent_v1settings_agent_context_context_messages_item_function_calls_function_calls_item", - "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", - "AgentV1SettingsAgentContextListenProviderV1Params": ".agent_v1settings_agent_context_listen_provider_v1", - "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams": ".agent_v1settings_agent_context_listen_provider_v2language_hint", - "AgentV1SettingsAgentContextListenProviderV2Params": ".agent_v1settings_agent_context_listen_provider_v2", - "AgentV1SettingsAgentContextListenProvider_V1Params": ".agent_v1settings_agent_context_listen_provider", - "AgentV1SettingsAgentContextListenProvider_V2Params": ".agent_v1settings_agent_context_listen_provider", - "AgentV1SettingsAgentContextMessagesItemContentParams": ".agent_v1settings_agent_context_messages_item_content", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams": ".agent_v1settings_agent_context_messages_item_function_calls_function_calls_item", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams": ".agent_v1settings_agent_context_messages_item_function_calls", - "AgentV1SettingsAgentContextMessagesItemParams": ".agent_v1settings_agent_context_messages_item", - "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", - "AgentV1SettingsAgentListenProviderV1Params": ".agent_v1settings_agent_listen_provider_v1", - "AgentV1SettingsAgentListenProviderV2Params": ".agent_v1settings_agent_listen_provider_v2", - "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", - "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", - "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", -} - - -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", - "AgentV1ErrorParams", - "AgentV1FunctionCallRequestFunctionsItemParams", - "AgentV1FunctionCallRequestParams", - "AgentV1HistoryContentParams", - "AgentV1HistoryFunctionCallsFunctionCallsItemParams", - "AgentV1HistoryFunctionCallsParams", - "AgentV1HistoryParams", - "AgentV1InjectAgentMessageParams", - "AgentV1InjectUserMessageParams", - "AgentV1InjectionRefusedParams", - "AgentV1KeepAliveParams", - "AgentV1LatencyReportParams", - "AgentV1ListenUpdatedParams", - "AgentV1PromptUpdatedParams", - "AgentV1ReceiveFunctionCallResponseParams", - "AgentV1SendFunctionCallResponseParams", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams", - "AgentV1SettingsAgentContextContextMessagesItemParams", - "AgentV1SettingsAgentContextContextParams", - "AgentV1SettingsAgentContextListenParams", - "AgentV1SettingsAgentContextListenProviderParams", - "AgentV1SettingsAgentContextListenProviderV1Params", - "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams", - "AgentV1SettingsAgentContextListenProviderV2Params", - "AgentV1SettingsAgentContextListenProvider_V1Params", - "AgentV1SettingsAgentContextListenProvider_V2Params", - "AgentV1SettingsAgentContextMessagesItemContentParams", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams", - "AgentV1SettingsAgentContextMessagesItemParams", - "AgentV1SettingsAgentContextParams", - "AgentV1SettingsAgentContextSpeakParams", - "AgentV1SettingsAgentContextThinkParams", - "AgentV1SettingsAgentListenParams", - "AgentV1SettingsAgentListenProviderParams", - "AgentV1SettingsAgentListenProviderV1Params", - "AgentV1SettingsAgentListenProviderV2Params", - "AgentV1SettingsAgentListenProvider_V1Params", - "AgentV1SettingsAgentListenProvider_V2Params", - "AgentV1SettingsAgentParams", - "AgentV1SettingsAgentSpeakParams", - "AgentV1SettingsAgentThinkParams", - "AgentV1SettingsAppliedParams", - "AgentV1SettingsAudioInputParams", - "AgentV1SettingsAudioOutputParams", - "AgentV1SettingsAudioParams", - "AgentV1SettingsFlagsParams", - "AgentV1SettingsParams", - "AgentV1SpeakUpdatedParams", - "AgentV1ThinkUpdatedParams", - "AgentV1UpdateListenListenParams", - "AgentV1UpdateListenListenProviderParams", - "AgentV1UpdateListenListenProvider_V1Params", - "AgentV1UpdateListenListenProvider_V2Params", - "AgentV1UpdateListenParams", - "AgentV1UpdatePromptParams", - "AgentV1UpdateSpeakParams", - "AgentV1UpdateSpeakSpeakParams", - "AgentV1UpdateThinkParams", - "AgentV1UpdateThinkThinkParams", - "AgentV1UserStartedSpeakingParams", - "AgentV1WarningParams", - "AgentV1WelcomeParams", - "ConversationHistoryMessageParams", - "FunctionCallHistoryMessageFunctionCallsItemParams", - "FunctionCallHistoryMessageParams", -] 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..01bffc21 100644 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent.py +++ b/src/deepgram/agent/v1/requests/agent_v1settings_agent.py @@ -1,7 +1,27 @@ # This file was auto-generated by Fern from our API Definition. -import typing - +import typing_extensions 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] + """ + Deprecated. Use `listen.provider.language` and `speak.provider.language` fields instead. + """ + + context: typing_extensions.NotRequired[AgentV1SettingsAgentContextParams] + """ + Conversation context including the history of messages and function calls + """ -AgentV1SettingsAgentParams = typing.Union[AgentV1SettingsAgentContextParams, str] + listen: typing_extensions.NotRequired[AgentV1SettingsAgentListenParams] + think: typing_extensions.NotRequired[AgentV1SettingsAgentThinkParams] + speak: typing_extensions.NotRequired[AgentV1SettingsAgentSpeakParams] + greeting: typing_extensions.NotRequired[str] + """ + Optional message that agent will speak at the start + """ 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 01bffc21..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent.py.bak +++ /dev/null @@ -1,27 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -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] - """ - Deprecated. Use `listen.provider.language` and `speak.provider.language` fields instead. - """ - - context: typing_extensions.NotRequired[AgentV1SettingsAgentContextParams] - """ - Conversation context including the history of messages and function calls - """ - - listen: typing_extensions.NotRequired[AgentV1SettingsAgentListenParams] - think: typing_extensions.NotRequired[AgentV1SettingsAgentThinkParams] - speak: typing_extensions.NotRequired[AgentV1SettingsAgentSpeakParams] - greeting: typing_extensions.NotRequired[str] - """ - Optional message that agent will speak at the start - """ 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 c52f05af..b399ef99 100644 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py +++ b/src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py @@ -1,8 +1,11 @@ # This file was auto-generated by Fern from our API Definition. +import typing + import typing_extensions 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 @@ -13,6 +16,11 @@ class AgentV1SettingsAgentContextParams(typing_extensions.TypedDict): Deprecated. Use `listen.provider.language` and `speak.provider.language` fields instead. """ + messages: typing_extensions.NotRequired[typing.Sequence[AgentV1SettingsAgentContextMessagesItemParams]] + """ + Deprecated. Conversation history as a list of messages and function calls. + """ + 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 b399ef99..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py.bak +++ /dev/null @@ -1,35 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -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]] - """ - Deprecated. Conversation history as a list of messages and function calls. - """ - - 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] - 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 1f4db8c3..6e4930ad 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 @@ -43,6 +41,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, @@ -110,7 +120,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) @@ -164,12 +174,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: """ @@ -178,12 +188,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_media(self, message: bytes) -> None: """ @@ -218,7 +228,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): @@ -264,7 +274,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) @@ -318,12 +328,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: """ @@ -332,12 +342,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_media(self, message: bytes) -> None: """ @@ -372,4 +382,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 70616b09..00000000 --- a/src/deepgram/agent/v1/socket_client.py.bak +++ /dev/null @@ -1,379 +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_v1error import AgentV1Error -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_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_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_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: - """ - Recursively convert float values that are whole numbers to int. - - Workaround for Fern-generated models that type integer API fields - (like sample_rate) as float, causing JSON serialization to produce - values like 44100.0 instead of 44100. The Deepgram API rejects - float representations of integer fields. - - See: https://github.com/deepgram/internal-api-specs/issues/205 - """ - if isinstance(obj, dict): - return {k: _sanitize_numeric_types(v) for k, v in obj.items()} - elif isinstance(obj, list): - return [_sanitize_numeric_types(item) for item in obj] - elif isinstance(obj, float) and obj.is_integer(): - return int(obj) - return obj - - -_logger = logging.getLogger(__name__) -V1SocketClientResponse = typing.Union[ - AgentV1ListenUpdated, - AgentV1ThinkUpdated, - AgentV1ReceiveFunctionCallResponse, - AgentV1PromptUpdated, - AgentV1SpeakUpdated, - AgentV1InjectionRefused, - AgentV1Welcome, - AgentV1SettingsApplied, - AgentV1ConversationText, - AgentV1UserStartedSpeaking, - AgentV1AgentThinking, - AgentV1LatencyReport, - AgentV1FunctionCallRequest, - AgentV1AgentStartedSpeaking, - AgentV1AgentAudioDone, - AgentV1Error, - AgentV1Warning, - AgentV1History, - bytes, -] - - -class AsyncV1SocketClient(EventEmitterMixin): - def __init__(self, *, websocket: WebSocketClientProtocol): - super().__init__() - self._websocket = websocket - - async def __aiter__(self): - 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_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_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_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_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): - 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_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_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_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_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 9b334ba6..1d1a15fe 100644 --- a/src/deepgram/agent/v1/types/__init__.py +++ b/src/deepgram/agent/v1/types/__init__.py @@ -76,6 +76,22 @@ from .conversation_history_message_role import ConversationHistoryMessageRole from .function_call_history_message import FunctionCallHistoryMessage from .function_call_history_message_function_calls_item import FunctionCallHistoryMessageFunctionCallsItem + from .agent_v1history_content import AgentV1HistoryContent + from .agent_v1history_content_role import AgentV1HistoryContentRole + from .agent_v1history_function_calls import AgentV1HistoryFunctionCalls + from .agent_v1history_function_calls_function_calls_item import AgentV1HistoryFunctionCallsFunctionCallsItem + from .agent_v1settings_agent_context_context_messages_item_content_role import AgentV1SettingsAgentContextContextMessagesItemContentRole + from .agent_v1settings_agent_context_context_messages_item_function_calls_function_calls_item import AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem + from .agent_v1settings_agent_context_listen_provider_v1 import AgentV1SettingsAgentContextListenProviderV1 + from .agent_v1settings_agent_context_listen_provider_v2 import AgentV1SettingsAgentContextListenProviderV2 + from .agent_v1settings_agent_context_listen_provider_v2language_hint import AgentV1SettingsAgentContextListenProviderV2LanguageHint + from .agent_v1settings_agent_context_messages_item import AgentV1SettingsAgentContextMessagesItem + from .agent_v1settings_agent_context_messages_item_content import AgentV1SettingsAgentContextMessagesItemContent + from .agent_v1settings_agent_context_messages_item_content_role import AgentV1SettingsAgentContextMessagesItemContentRole + from .agent_v1settings_agent_context_messages_item_function_calls import AgentV1SettingsAgentContextMessagesItemFunctionCalls + from .agent_v1settings_agent_context_messages_item_function_calls_function_calls_item import AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem + from .agent_v1settings_agent_listen_provider_v1 import AgentV1SettingsAgentListenProviderV1 + from .agent_v1settings_agent_listen_provider_v2 import AgentV1SettingsAgentListenProviderV2 _dynamic_imports: typing.Dict[str, str] = { "AgentV1AgentAudioDone": ".agent_v1agent_audio_done", "AgentV1AgentStartedSpeaking": ".agent_v1agent_started_speaking", @@ -141,6 +157,22 @@ "ConversationHistoryMessageRole": ".conversation_history_message_role", "FunctionCallHistoryMessage": ".function_call_history_message", "FunctionCallHistoryMessageFunctionCallsItem": ".function_call_history_message_function_calls_item", + "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", } @@ -230,4 +262,20 @@ def __dir__(): "ConversationHistoryMessageRole", "FunctionCallHistoryMessage", "FunctionCallHistoryMessageFunctionCallsItem", + "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 7c6e20c6..00000000 --- a/src/deepgram/agent/v1/types/__init__.py.bak +++ /dev/null @@ -1,278 +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_role import AgentV1ConversationTextRole - from .agent_v1error import AgentV1Error - 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_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_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_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 - from .agent_v1history_content import AgentV1HistoryContent - from .agent_v1history_content_role import AgentV1HistoryContentRole - from .agent_v1history_function_calls import AgentV1HistoryFunctionCalls - from .agent_v1history_function_calls_function_calls_item import AgentV1HistoryFunctionCallsFunctionCallsItem - from .agent_v1settings_agent_context_context_messages_item_content_role import AgentV1SettingsAgentContextContextMessagesItemContentRole - from .agent_v1settings_agent_context_context_messages_item_function_calls_function_calls_item import AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem - from .agent_v1settings_agent_context_listen_provider_v1 import AgentV1SettingsAgentContextListenProviderV1 - from .agent_v1settings_agent_context_listen_provider_v2 import AgentV1SettingsAgentContextListenProviderV2 - from .agent_v1settings_agent_context_listen_provider_v2language_hint import AgentV1SettingsAgentContextListenProviderV2LanguageHint - from .agent_v1settings_agent_context_messages_item import AgentV1SettingsAgentContextMessagesItem - from .agent_v1settings_agent_context_messages_item_content import AgentV1SettingsAgentContextMessagesItemContent - from .agent_v1settings_agent_context_messages_item_content_role import AgentV1SettingsAgentContextMessagesItemContentRole - from .agent_v1settings_agent_context_messages_item_function_calls import AgentV1SettingsAgentContextMessagesItemFunctionCalls - from .agent_v1settings_agent_context_messages_item_function_calls_function_calls_item import AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem - from .agent_v1settings_agent_listen_provider_v1 import AgentV1SettingsAgentListenProviderV1 - from .agent_v1settings_agent_listen_provider_v2 import AgentV1SettingsAgentListenProviderV2 -_dynamic_imports: typing.Dict[str, str] = { - "AgentV1AgentAudioDone": ".agent_v1agent_audio_done", - "AgentV1AgentStartedSpeaking": ".agent_v1agent_started_speaking", - "AgentV1AgentThinking": ".agent_v1agent_thinking", - "AgentV1ConversationText": ".agent_v1conversation_text", - "AgentV1ConversationTextRole": ".agent_v1conversation_text_role", - "AgentV1Error": ".agent_v1error", - "AgentV1FunctionCallRequest": ".agent_v1function_call_request", - "AgentV1FunctionCallRequestFunctionsItem": ".agent_v1function_call_request_functions_item", - "AgentV1History": ".agent_v1history", - "AgentV1HistoryContent": ".agent_v1history_content", - "AgentV1HistoryContentRole": ".agent_v1history_content_role", - "AgentV1HistoryFunctionCalls": ".agent_v1history_function_calls", - "AgentV1HistoryFunctionCallsFunctionCallsItem": ".agent_v1history_function_calls_function_calls_item", - "AgentV1InjectAgentMessage": ".agent_v1inject_agent_message", - "AgentV1InjectAgentMessageBehavior": ".agent_v1inject_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", - "AgentV1SettingsAgentContextContextMessagesItemContentRole": ".agent_v1settings_agent_context_context_messages_item_content_role", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem": ".agent_v1settings_agent_context_context_messages_item_function_calls_function_calls_item", - "AgentV1SettingsAgentContextListen": ".agent_v1settings_agent_context_listen", - "AgentV1SettingsAgentContextListenProvider": ".agent_v1settings_agent_context_listen_provider", - "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", - "AgentV1SettingsAgentContextListenProvider_V1": ".agent_v1settings_agent_context_listen_provider", - "AgentV1SettingsAgentContextListenProvider_V2": ".agent_v1settings_agent_context_listen_provider", - "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", - "AgentV1SettingsAgentContextSpeak": ".agent_v1settings_agent_context_speak", - "AgentV1SettingsAgentContextThink": ".agent_v1settings_agent_context_think", - "AgentV1SettingsAgentListen": ".agent_v1settings_agent_listen", - "AgentV1SettingsAgentListenProvider": ".agent_v1settings_agent_listen_provider", - "AgentV1SettingsAgentListenProviderV1": ".agent_v1settings_agent_listen_provider_v1", - "AgentV1SettingsAgentListenProviderV2": ".agent_v1settings_agent_listen_provider_v2", - "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", - "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", - "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", -} - - -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", - "AgentV1ConversationTextRole", - "AgentV1Error", - "AgentV1FunctionCallRequest", - "AgentV1FunctionCallRequestFunctionsItem", - "AgentV1History", - "AgentV1HistoryContent", - "AgentV1HistoryContentRole", - "AgentV1HistoryFunctionCalls", - "AgentV1HistoryFunctionCallsFunctionCallsItem", - "AgentV1InjectAgentMessage", - "AgentV1InjectAgentMessageBehavior", - "AgentV1InjectUserMessage", - "AgentV1InjectionRefused", - "AgentV1KeepAlive", - "AgentV1LatencyReport", - "AgentV1ListenUpdated", - "AgentV1PromptUpdated", - "AgentV1ReceiveFunctionCallResponse", - "AgentV1SendFunctionCallResponse", - "AgentV1Settings", - "AgentV1SettingsAgent", - "AgentV1SettingsAgentContext", - "AgentV1SettingsAgentContextContext", - "AgentV1SettingsAgentContextContextMessagesItem", - "AgentV1SettingsAgentContextContextMessagesItemContentRole", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem", - "AgentV1SettingsAgentContextListen", - "AgentV1SettingsAgentContextListenProvider", - "AgentV1SettingsAgentContextListenProviderV1", - "AgentV1SettingsAgentContextListenProviderV2", - "AgentV1SettingsAgentContextListenProviderV2LanguageHint", - "AgentV1SettingsAgentContextListenProvider_V1", - "AgentV1SettingsAgentContextListenProvider_V2", - "AgentV1SettingsAgentContextMessagesItem", - "AgentV1SettingsAgentContextMessagesItemContent", - "AgentV1SettingsAgentContextMessagesItemContentRole", - "AgentV1SettingsAgentContextMessagesItemFunctionCalls", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem", - "AgentV1SettingsAgentContextSpeak", - "AgentV1SettingsAgentContextThink", - "AgentV1SettingsAgentListen", - "AgentV1SettingsAgentListenProvider", - "AgentV1SettingsAgentListenProviderV1", - "AgentV1SettingsAgentListenProviderV2", - "AgentV1SettingsAgentListenProvider_V1", - "AgentV1SettingsAgentListenProvider_V2", - "AgentV1SettingsAgentSpeak", - "AgentV1SettingsAgentThink", - "AgentV1SettingsApplied", - "AgentV1SettingsAudio", - "AgentV1SettingsAudioInput", - "AgentV1SettingsAudioInputEncoding", - "AgentV1SettingsAudioOutput", - "AgentV1SettingsAudioOutputContainer", - "AgentV1SettingsAudioOutputEncoding", - "AgentV1SettingsFlags", - "AgentV1SpeakUpdated", - "AgentV1ThinkUpdated", - "AgentV1UpdateListen", - "AgentV1UpdateListenListen", - "AgentV1UpdateListenListenProvider", - "AgentV1UpdateListenListenProvider_V1", - "AgentV1UpdateListenListenProvider_V2", - "AgentV1UpdatePrompt", - "AgentV1UpdateSpeak", - "AgentV1UpdateSpeakSpeak", - "AgentV1UpdateThink", - "AgentV1UpdateThinkThink", - "AgentV1UserStartedSpeaking", - "AgentV1Warning", - "AgentV1Welcome", - "ConversationHistoryMessage", - "ConversationHistoryMessageRole", - "FunctionCallHistoryMessage", - "FunctionCallHistoryMessageFunctionCallsItem", -] 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..fae21e75 100644 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent.py +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent.py @@ -2,6 +2,61 @@ 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): + # Keep the formerly callable public model name working with the schema's + # current nested context format. + 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.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.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 0335ad2c..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent.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 .agent_v1settings_agent_context import AgentV1SettingsAgentContext -from .agent_v1settings_agent_listen import AgentV1SettingsAgentListen - - -class AgentV1SettingsAgent(AgentV1SettingsAgentContext): - # Backward-compat: before the 2026-05-05 schema restructure this public name - # was the top-level agent settings model. Keep it callable and translate the - # legacy nested `context=AgentV1SettingsAgentContext(messages=[...])` shape - # into the current `context={"messages": [...]}` payload. - 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.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.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 fcbea2f3..827aad63 100644 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_context.py +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent_context.py @@ -7,6 +7,7 @@ from ....core.unchecked_base_model import UncheckedBaseModel 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 @@ -30,6 +31,30 @@ class AgentV1SettingsAgentContext(UncheckedBaseModel): Optional message that agent will speak at the start """ + # Translate the pre-restructure top-level messages field to the current + # nested context.messages payload while retaining read-side access. + 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 + 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 + + @property + def messages(self) -> typing.Optional[typing.List[AgentV1SettingsAgentContextMessagesItem]]: + return None if self.context is None else self.context.messages + if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: 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 776a2936..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_context.py.bak +++ /dev/null @@ -1,73 +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_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] = None - speak: typing.Optional[AgentV1SettingsAgentContextSpeak] = None - greeting: typing.Optional[str] = pydantic.Field(default=None) - """ - Optional message that agent will speak at the start - """ - - # Backward-compat: pre-2026-05-05 callers passed `messages=[...]` directly on - # AgentV1SettingsAgentContext. The schema now nests that list under - # `context.messages`. Translate the legacy kwarg into the new shape so old - # call sites keep producing the correct wire payload. - 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) - messages = values.pop("messages") - values["context"] = {"messages": messages} - return values - else: - - @pydantic.root_validator(pre=True) # type: ignore[deprecated] - def _migrate_legacy_messages_to_context( # type: ignore[no-redef] - cls, values: typing.Any - ) -> typing.Any: - if isinstance(values, dict) and "messages" in values and "context" not in values: - values = dict(values) - messages = values.pop("messages") - values["context"] = {"messages": messages} - return values - - @property - def messages(self) -> typing.Optional[typing.List[AgentV1SettingsAgentContextMessagesItem]]: - if self.context is None: - return None - return self.context.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/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..a13d2a63 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,11 +33,36 @@ 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 + 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 + if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: 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 13d6739a..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py.bak +++ /dev/null @@ -1,86 +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 - - # Backward-compat: the public field was historically named `language_hint` - # and accepted a string or a list. The API field is `language_hints` (a - # list). Translate the legacy kwarg so existing callers keep working, and - # drop the dead singular key so it is not rejected by the API - # (deny_unknown_fields). Hand-maintained. - 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): - return values - if "language_hint" in 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 - 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): - return values - if "language_hint" in 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 - - 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 - - -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..40706b47 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,11 +33,36 @@ 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 + 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 + if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: 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 9bc63301..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py.bak +++ /dev/null @@ -1,86 +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 - - # Backward-compat: the public field was historically named `language_hint` - # and accepted a string or a list. The API field is `language_hints` (a - # list). Translate the legacy kwarg so existing callers keep working, and - # drop the dead singular key so it is not rejected by the API - # (deny_unknown_fields). Hand-maintained. - 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): - return values - if "language_hint" in 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 - 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): - return values - if "language_hint" in 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 - - 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 - - -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..d6ad435a 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,35 @@ 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: + """Add the discriminator required by the versioned provider union.""" + 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): """ @@ -15,6 +42,18 @@ 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) + 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) + if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: 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 62273600..00000000 --- a/src/deepgram/agent/v1/types/agent_v1update_listen_listen.py.bak +++ /dev/null @@ -1,81 +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 - -# Fields that exist only on the v1 (Listen V1) provider shape. Used to infer the -# intended version of a legacy unversioned dict from its own keys, rather than -# blanket-stamping "v2" onto a dict that is clearly describing a v1 provider. -_V1_ONLY_KEYS = frozenset({"language", "smart_format"}) - - -def _coerce_legacy_update_listen_provider(values: typing.Any) -> typing.Any: - # Backward-compat: before the 2026-07-31 regen the provider field was a bare - # DeepgramListenProviderV2. The regen replaced it with the versioned - # AgentV1UpdateListenListenProvider union (discriminant="version"). Coerce a - # legacy Deepgram provider (or a dict lacking the version discriminant) into - # the new shape so existing callers keep producing the correct wire payload. - 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: - # Route the dict through the same shim model the instance branches - # use, so its own `model_validator(mode="before")` runs. That is what - # remaps a deprecated `language_hint=` to `language_hints` and drops - # the singular key -- the API uses deny_unknown_fields, so leaving it - # in is a hard rejection. Going through the model keeps ONE remap - # implementation instead of duplicating it here. - coerced = provider_cls(**provider).dict() - except Exception: - # A malformed dict (e.g. missing the required `model`) makes the - # model constructor raise. Pre-regen this path passed the dict - # through untouched, so fall back to that rather than turning a - # compat shim into a new source of exceptions. - 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) - 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) - - 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/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 a24abadc..00000000 --- a/src/deepgram/core/api_error.py.bak +++ /dev/null @@ -1,31 +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: - # Mask credential headers at construction, not just in __str__. The - # websocket connect paths raise with the full request headers, so an - # unredacted Authorization would otherwise reach anywhere this exception - # goes: str(e), a traceback, a log aggregator, or an error tracker (which - # serialises attributes as well as the message). Non-sensitive headers are - # kept -- dg-request-id is the main reason to look at them at all. - 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/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 bfa3a2f7..00000000 --- a/src/deepgram/core/parse_error.py.bak +++ /dev/null @@ -1,40 +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: - # See the note in core/api_error.py: credential headers are masked at - # construction so they cannot reach a log, traceback, or error tracker. - 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 6b81f9bc..00000000 --- a/src/deepgram/core/query_encoder.py.bak +++ /dev/null @@ -1,66 +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 stringifies bools via str(), producing "True"/"False"; - # APIs (including Deepgram's websocket endpoints) expect lowercase. - 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 b720c394..54752b7b 100644 --- a/src/deepgram/listen/__init__.py +++ b/src/deepgram/listen/__init__.py @@ -66,6 +66,7 @@ ListenV2TurnInfoWordsItem, ListenV2TurnInfoWordsItemParams, ) + from .v2 import ListenV2CloseStreamType _dynamic_imports: typing.Dict[str, str] = { "DiarizeModel": ".v1", "ListenV1CloseStream": ".v1", @@ -101,6 +102,7 @@ "ListenV1UtteranceEndParams": ".v1", "ListenV2CloseStream": ".v2", "ListenV2CloseStreamParams": ".v2", + "ListenV2CloseStreamType": ".v2", "ListenV2Configure": ".v2", "ListenV2ConfigureFailure": ".v2", "ListenV2ConfigureFailureParams": ".v2", @@ -183,6 +185,7 @@ def __dir__(): "ListenV1UtteranceEndParams", "ListenV2CloseStream", "ListenV2CloseStreamParams", + "ListenV2CloseStreamType", "ListenV2Configure", "ListenV2ConfigureFailure", "ListenV2ConfigureFailureParams", diff --git a/src/deepgram/listen/__init__.py.bak b/src/deepgram/listen/__init__.py.bak deleted file mode 100644 index 54752b7b..00000000 --- a/src/deepgram/listen/__init__.py.bak +++ /dev/null @@ -1,212 +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, - 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, - ) - from .v2 import ListenV2CloseStreamType -_dynamic_imports: typing.Dict[str, str] = { - "DiarizeModel": ".v1", - "ListenV1CloseStream": ".v1", - "ListenV1CloseStreamParams": ".v1", - "ListenV1CloseStreamType": ".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", - "ListenV2CloseStreamType": ".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", - "v1": ".v1", - "v2": ".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", - "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", - "ListenV2CloseStreamType", - "ListenV2Configure", - "ListenV2ConfigureFailure", - "ListenV2ConfigureFailureParams", - "ListenV2ConfigureParams", - "ListenV2ConfigureSuccess", - "ListenV2ConfigureSuccessParams", - "ListenV2ConfigureSuccessThresholds", - "ListenV2ConfigureSuccessThresholdsParams", - "ListenV2ConfigureThresholds", - "ListenV2ConfigureThresholdsParams", - "ListenV2Connected", - "ListenV2ConnectedParams", - "ListenV2FatalError", - "ListenV2FatalErrorParams", - "ListenV2ForceEndTurn", - "ListenV2ForceEndTurnParams", - "ListenV2TurnInfo", - "ListenV2TurnInfoEvent", - "ListenV2TurnInfoParams", - "ListenV2TurnInfoWordsItem", - "ListenV2TurnInfoWordsItemParams", - "v1", - "v2", -] diff --git a/src/deepgram/listen/v1/socket_client.py b/src/deepgram/listen/v1/socket_client.py index cffa82b7..5954d116 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 @@ -69,7 +67,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) @@ -81,26 +79,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 recv(self) -> V1SocketClientResponse: """ @@ -174,7 +172,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) @@ -186,26 +184,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 recv(self) -> V1SocketClientResponse: """ 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 5954d116..00000000 --- a/src/deepgram/listen/v1/socket_client.py.bak +++ /dev/null @@ -1,234 +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_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[ListenV1Results, ListenV1Metadata, ListenV1UtteranceEnd, ListenV1SpeechStarted] - - -class AsyncV1SocketClient(EventEmitterMixin): - def __init__(self, *, websocket: WebSocketClientProtocol): - super().__init__() - self._websocket = websocket - - async def __aiter__(self): - 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 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): - 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 recv(self) -> V1SocketClientResponse: - """ - Receive a message from the websocket connection. - """ - data = self._websocket.recv() - if isinstance(data, bytes): - return data # type: ignore - json_data = json.loads(data) - try: - return construct_type(type_=V1SocketClientResponse, object_=json_data) # type: ignore - except Exception: - _logger.warning("Skipping unknown WebSocket message; update your SDK version to support new message types.") - return json_data # type: ignore - - def _send(self, data: typing.Any) -> None: - """ - Send a message to the websocket connection. - """ - if isinstance(data, dict): - data = json.dumps(data) - self._websocket.send(data) - - def _send_model(self, data: typing.Any) -> None: - """ - Send a Pydantic model to the websocket connection. - """ - self._send(data.dict()) diff --git a/src/deepgram/listen/v2/__init__.py b/src/deepgram/listen/v2/__init__.py index ce03538d..ebb5f4a9 100644 --- a/src/deepgram/listen/v2/__init__.py +++ b/src/deepgram/listen/v2/__init__.py @@ -33,9 +33,11 @@ ListenV2TurnInfoParams, ListenV2TurnInfoWordsItemParams, ) + from .types import ListenV2CloseStreamType _dynamic_imports: typing.Dict[str, str] = { "ListenV2CloseStream": ".types", "ListenV2CloseStreamParams": ".requests", + "ListenV2CloseStreamType": ".types", "ListenV2Configure": ".types", "ListenV2ConfigureFailure": ".types", "ListenV2ConfigureFailureParams": ".requests", @@ -84,6 +86,7 @@ def __dir__(): __all__ = [ "ListenV2CloseStream", "ListenV2CloseStreamParams", + "ListenV2CloseStreamType", "ListenV2Configure", "ListenV2ConfigureFailure", "ListenV2ConfigureFailureParams", diff --git a/src/deepgram/listen/v2/__init__.py.bak b/src/deepgram/listen/v2/__init__.py.bak deleted file mode 100644 index ebb5f4a9..00000000 --- a/src/deepgram/listen/v2/__init__.py.bak +++ /dev/null @@ -1,111 +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, - ) - from .requests import ( - ListenV2CloseStreamParams, - ListenV2ConfigureFailureParams, - ListenV2ConfigureParams, - ListenV2ConfigureSuccessParams, - ListenV2ConfigureSuccessThresholdsParams, - ListenV2ConfigureThresholdsParams, - ListenV2ConnectedParams, - ListenV2FatalErrorParams, - ListenV2ForceEndTurnParams, - ListenV2TurnInfoParams, - ListenV2TurnInfoWordsItemParams, - ) - from .types import ListenV2CloseStreamType -_dynamic_imports: typing.Dict[str, str] = { - "ListenV2CloseStream": ".types", - "ListenV2CloseStreamParams": ".requests", - "ListenV2CloseStreamType": ".types", - "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", -} - - -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", - "ListenV2CloseStreamType", - "ListenV2Configure", - "ListenV2ConfigureFailure", - "ListenV2ConfigureFailureParams", - "ListenV2ConfigureParams", - "ListenV2ConfigureSuccess", - "ListenV2ConfigureSuccessParams", - "ListenV2ConfigureSuccessThresholds", - "ListenV2ConfigureSuccessThresholdsParams", - "ListenV2ConfigureThresholds", - "ListenV2ConfigureThresholdsParams", - "ListenV2Connected", - "ListenV2ConnectedParams", - "ListenV2FatalError", - "ListenV2FatalErrorParams", - "ListenV2ForceEndTurn", - "ListenV2ForceEndTurnParams", - "ListenV2TurnInfo", - "ListenV2TurnInfoEvent", - "ListenV2TurnInfoParams", - "ListenV2TurnInfoWordsItem", - "ListenV2TurnInfoWordsItemParams", -] diff --git a/src/deepgram/listen/v2/socket_client.py b/src/deepgram/listen/v2/socket_client.py index 33d419b3..ec2c9685 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 @@ -72,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) @@ -84,26 +82,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: """ @@ -177,7 +178,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) @@ -189,26 +190,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 b441bbb0..00000000 --- a/src/deepgram/listen/v2/socket_client.py.bak +++ /dev/null @@ -1,265 +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 - -try: - from websockets.legacy.client import WebSocketClientProtocol # type: ignore -except ImportError: - from websockets import WebSocketClientProtocol # type: ignore - -_logger = logging.getLogger(__name__) -V2SocketClientResponse = typing.Union[ - ListenV2Connected, ListenV2TurnInfo, ListenV2ConfigureSuccess, ListenV2ConfigureFailure, ListenV2FatalError -] - - -class AsyncV2SocketClient(EventEmitterMixin): - def __init__(self, *, websocket: WebSocketClientProtocol): - super().__init__() - self._websocket = websocket - - async def __aiter__(self): - 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. - - Ends the current turn immediately, whatever the end-of-turn confidence. The - resulting ``TurnInfo`` carries ``trigger="manual"``, and the connection stays open - for the next turn. - - Requires server-side enablement. On a deployment without it the server replies - ``UNPARSABLE_CLIENT_MESSAGE`` ("The ForceEndTurn message is not enabled on this - deployment.") and **closes the connection**, so guard against that path until the - feature is confirmed live for the deployment you target. - """ - 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. A raw dict is also - accepted and sent verbatim for back-compat with pre-typed-model callers. - """ - if isinstance(message, dict): - await self._send(message) - else: - await self._send_model(message) - - async def recv(self) -> V2SocketClientResponse: - """ - Receive a message from the websocket connection. - """ - data = await self._websocket.recv() - if isinstance(data, bytes): - return data # type: ignore - json_data = json.loads(data) - try: - return construct_type(type_=V2SocketClientResponse, object_=json_data) # type: ignore - except Exception: - _logger.warning("Skipping unknown WebSocket message; update your SDK version to support new message types.") - return json_data # type: ignore - - async def _send(self, data: typing.Any) -> None: - """ - Send a message to the websocket connection. - """ - if isinstance(data, dict): - data = json.dumps(data) - await self._websocket.send(data) - - async def _send_model(self, data: typing.Any) -> None: - """ - Send a Pydantic model to the websocket connection. - """ - await self._send(data.dict()) - - -class V2SocketClient(EventEmitterMixin): - def __init__(self, *, websocket: websockets_sync_connection.Connection): - super().__init__() - self._websocket = websocket - - def __iter__(self): - 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. - - Ends the current turn immediately, whatever the end-of-turn confidence. The - resulting ``TurnInfo`` carries ``trigger="manual"``, and the connection stays open - for the next turn. - - Requires server-side enablement. On a deployment without it the server replies - ``UNPARSABLE_CLIENT_MESSAGE`` ("The ForceEndTurn message is not enabled on this - deployment.") and **closes the connection**, so guard against that path until the - feature is confirmed live for the deployment you target. - """ - 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. A raw dict is also - accepted and sent verbatim for back-compat with pre-typed-model callers. - """ - if isinstance(message, dict): - self._send(message) - else: - self._send_model(message) - - def recv(self) -> V2SocketClientResponse: - """ - Receive a message from the websocket connection. - """ - data = self._websocket.recv() - if isinstance(data, bytes): - return data # type: ignore - json_data = json.loads(data) - try: - return construct_type(type_=V2SocketClientResponse, object_=json_data) # type: ignore - except Exception: - _logger.warning("Skipping unknown WebSocket message; update your SDK version to support new message types.") - return json_data # type: ignore - - def _send(self, data: typing.Any) -> None: - """ - Send a message to the websocket connection. - """ - if isinstance(data, dict): - data = json.dumps(data) - self._websocket.send(data) - - def _send_model(self, data: typing.Any) -> None: - """ - Send a Pydantic model to the websocket connection. - """ - self._send(data.dict()) diff --git a/src/deepgram/listen/v2/types/__init__.py b/src/deepgram/listen/v2/types/__init__.py index e0bb48fb..7f084d96 100644 --- a/src/deepgram/listen/v2/types/__init__.py +++ b/src/deepgram/listen/v2/types/__init__.py @@ -18,8 +18,10 @@ from .listen_v2turn_info import ListenV2TurnInfo from .listen_v2turn_info_event import ListenV2TurnInfoEvent from .listen_v2turn_info_words_item import ListenV2TurnInfoWordsItem + from .listen_v2close_stream_type import ListenV2CloseStreamType _dynamic_imports: typing.Dict[str, str] = { "ListenV2CloseStream": ".listen_v2close_stream", + "ListenV2CloseStreamType": ".listen_v2close_stream_type", "ListenV2Configure": ".listen_v2configure", "ListenV2ConfigureFailure": ".listen_v2configure_failure", "ListenV2ConfigureSuccess": ".listen_v2configure_success", @@ -57,6 +59,7 @@ def __dir__(): __all__ = [ "ListenV2CloseStream", + "ListenV2CloseStreamType", "ListenV2Configure", "ListenV2ConfigureFailure", "ListenV2ConfigureSuccess", 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 7f084d96..00000000 --- a/src/deepgram/listen/v2/types/__init__.py.bak +++ /dev/null @@ -1,74 +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_v2close_stream_type import ListenV2CloseStreamType -_dynamic_imports: typing.Dict[str, str] = { - "ListenV2CloseStream": ".listen_v2close_stream", - "ListenV2CloseStreamType": ".listen_v2close_stream_type", - "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", -} - - -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", - "ListenV2CloseStreamType", - "ListenV2Configure", - "ListenV2ConfigureFailure", - "ListenV2ConfigureSuccess", - "ListenV2ConfigureSuccessThresholds", - "ListenV2ConfigureThresholds", - "ListenV2Connected", - "ListenV2FatalError", - "ListenV2ForceEndTurn", - "ListenV2TurnInfo", - "ListenV2TurnInfoEvent", - "ListenV2TurnInfoWordsItem", -] diff --git a/src/deepgram/listen/v2/types/listen_v2configure_failure.py b/src/deepgram/listen/v2/types/listen_v2configure_failure.py index 2d0cb34f..bf30e353 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 bf30e353..00000000 --- a/src/deepgram/listen/v2/types/listen_v2configure_failure.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 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. - """ - - 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 ce20724a..bde84d6f 100644 --- a/src/deepgram/listen/v2/types/listen_v2configure_success.py +++ b/src/deepgram/listen/v2/types/listen_v2configure_success.py @@ -4,12 +4,12 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 -from ....core.unchecked_base_model import UncheckedBaseModel 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 bde84d6f..00000000 --- a/src/deepgram/listen/v2/types/listen_v2configure_success.py.bak +++ /dev/null @@ -1,49 +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_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. - """ - - 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/requests/__init__.py b/src/deepgram/requests/__init__.py index 12ebb69f..f3ac75bd 100644 --- a/src/deepgram/requests/__init__.py +++ b/src/deepgram/requests/__init__.py @@ -218,6 +218,9 @@ from .usage_fields_v1response_models_item import UsageFieldsV1ResponseModelsItemParams from .usage_v1response import UsageV1ResponseParams from .usage_v1response_resolution import UsageV1ResponseResolutionParams + from .cartesia_speak_provider_voice import CartesiaSpeakProviderVoiceParams + from .create_key_v1request_one import CreateKeyV1RequestOneParams + from .deepgram_listen_provider_v2language_hint import DeepgramListenProviderV2LanguageHintParams _dynamic_imports: typing.Dict[str, str] = { "AgentConfigurationV1Params": ".agent_configuration_v1", "AgentThinkModelsV1ResponseModelsItemIdParams": ".agent_think_models_v1response_models_item_id", @@ -389,6 +392,9 @@ "UsageFieldsV1ResponseParams": ".usage_fields_v1response", "UsageV1ResponseParams": ".usage_v1response", "UsageV1ResponseResolutionParams": ".usage_v1response_resolution", + "CartesiaSpeakProviderVoiceParams": ".cartesia_speak_provider_voice", + "CreateKeyV1RequestOneParams": ".create_key_v1request_one", + "DeepgramListenProviderV2LanguageHintParams": ".deepgram_listen_provider_v2language_hint", } @@ -584,4 +590,7 @@ def __dir__(): "UsageFieldsV1ResponseParams", "UsageV1ResponseParams", "UsageV1ResponseResolutionParams", + "CartesiaSpeakProviderVoiceParams", + "CreateKeyV1RequestOneParams", + "DeepgramListenProviderV2LanguageHintParams", ] diff --git a/src/deepgram/requests/__init__.py.bak b/src/deepgram/requests/__init__.py.bak deleted file mode 100644 index e3de268f..00000000 --- a/src/deepgram/requests/__init__.py.bak +++ /dev/null @@ -1,596 +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 .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_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_results import SharedIntentsResultsParams - from .shared_intents_results_intents import SharedIntentsResultsIntentsParams - from .shared_intents_results_intents_segments_item import SharedIntentsResultsIntentsSegmentsItemParams - from .shared_intents_results_intents_segments_item_intents_item import ( - SharedIntentsResultsIntentsSegmentsItemIntentsItemParams, - ) - 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_results import SharedTopicsResultsParams - from .shared_topics_results_topics import SharedTopicsResultsTopicsParams - from .shared_topics_results_topics_segments_item import SharedTopicsResultsTopicsSegmentsItemParams - from .shared_topics_results_topics_segments_item_topics_item import ( - SharedTopicsResultsTopicsSegmentsItemTopicsItemParams, - ) - 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_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_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 - from .cartesia_speak_provider_voice import CartesiaSpeakProviderVoiceParams - from .create_key_v1request_one import CreateKeyV1RequestOneParams - from .deepgram_listen_provider_v2language_hint import DeepgramListenProviderV2LanguageHintParams -_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", - "CartesiaSpeakProviderVoiceParams": ".cartesia_speak_provider_voice", - "CartesiaVoiceParams": ".cartesia_voice", - "CreateAgentConfigurationV1ResponseParams": ".create_agent_configuration_v1response", - "CreateKeyV1RequestOneParams": ".create_key_v1request_one", - "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", - "DeepgramListenProviderV2LanguageHintParams": ".deepgram_listen_provider_v2language_hint", - "DeepgramListenProviderV2Params": ".deepgram_listen_provider_v2", - "DeepgramParams": ".deepgram", - "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", - "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", - "SharedIntentsResultsIntentsParams": ".shared_intents_results_intents", - "SharedIntentsResultsIntentsSegmentsItemIntentsItemParams": ".shared_intents_results_intents_segments_item_intents_item", - "SharedIntentsResultsIntentsSegmentsItemParams": ".shared_intents_results_intents_segments_item", - "SharedIntentsResultsParams": ".shared_intents_results", - "SharedSentimentsAverageParams": ".shared_sentiments_average", - "SharedSentimentsParams": ".shared_sentiments", - "SharedSentimentsSegmentsItemParams": ".shared_sentiments_segments_item", - "SharedTopicsParams": ".shared_topics", - "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", - "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", - "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_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", -} - - -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", - "CartesiaSpeakProviderVoiceParams", - "CartesiaVoiceParams", - "CreateAgentConfigurationV1ResponseParams", - "CreateKeyV1RequestOneParams", - "CreateKeyV1RequestParams", - "CreateKeyV1ResponseParams", - "CreateProjectDistributionCredentialsV1ResponseDistributionCredentialsParams", - "CreateProjectDistributionCredentialsV1ResponseMemberParams", - "CreateProjectDistributionCredentialsV1ResponseParams", - "CreateProjectInviteV1ResponseParams", - "DeepgramListenProviderV1Params", - "DeepgramListenProviderV2LanguageHintParams", - "DeepgramListenProviderV2Params", - "DeepgramParams", - "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", - "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", - "SharedIntentsResultsIntentsParams", - "SharedIntentsResultsIntentsSegmentsItemIntentsItemParams", - "SharedIntentsResultsIntentsSegmentsItemParams", - "SharedIntentsResultsParams", - "SharedSentimentsAverageParams", - "SharedSentimentsParams", - "SharedSentimentsSegmentsItemParams", - "SharedTopicsParams", - "SharedTopicsResultsParams", - "SharedTopicsResultsTopicsParams", - "SharedTopicsResultsTopicsSegmentsItemParams", - "SharedTopicsResultsTopicsSegmentsItemTopicsItemParams", - "SpeakSettingsV1EndpointParams", - "SpeakSettingsV1Params", - "SpeakSettingsV1ProviderParams", - "SpeakSettingsV1Provider_AwsPollyParams", - "SpeakSettingsV1Provider_CartesiaParams", - "SpeakSettingsV1Provider_DeepgramParams", - "SpeakSettingsV1Provider_ElevenLabsParams", - "SpeakSettingsV1Provider_OpenAiParams", - "SpeakV2AcceptedResponseParams", - "ThinkSettingsV1ContextLengthParams", - "ThinkSettingsV1EndpointParams", - "ThinkSettingsV1FunctionsItemEndpointParams", - "ThinkSettingsV1FunctionsItemParams", - "ThinkSettingsV1Params", - "ThinkSettingsV1ProviderParams", - "ThinkSettingsV1Provider_AnthropicParams", - "ThinkSettingsV1Provider_AwsBedrockParams", - "ThinkSettingsV1Provider_GoogleParams", - "ThinkSettingsV1Provider_GroqParams", - "ThinkSettingsV1Provider_OpenAiParams", - "UpdateProjectMemberScopesV1ResponseParams", - "UpdateProjectV1ResponseParams", - "UsageBreakdownV1ResponseParams", - "UsageBreakdownV1ResponseResolutionParams", - "UsageBreakdownV1ResponseResultsItemGroupingParams", - "UsageBreakdownV1ResponseResultsItemParams", - "UsageFieldsV1ResponseModelsItemParams", - "UsageFieldsV1ResponseParams", - "UsageV1ResponseParams", - "UsageV1ResponseResolutionParams", -] diff --git a/src/deepgram/speak/v1/socket_client.py b/src/deepgram/speak/v1/socket_client.py index 9f1cad28..e3c28bb5 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 @@ -70,7 +68,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 +80,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 +173,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 +185,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 e3c28bb5..00000000 --- a/src/deepgram/speak/v1/socket_client.py.bak +++ /dev/null @@ -1,235 +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] - - -class AsyncV1SocketClient(EventEmitterMixin): - def __init__(self, *, websocket: WebSocketClientProtocol): - super().__init__() - self._websocket = websocket - - async def __aiter__(self): - 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_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): - 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_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/socket_client.py b/src/deepgram/speak/v2/socket_client.py index b9d4d1a2..c6729c32 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 @@ -89,7 +87,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 +99,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 +120,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 +199,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 +211,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 +232,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 c6729c32..00000000 --- a/src/deepgram/speak/v2/socket_client.py.bak +++ /dev/null @@ -1,268 +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, -] - - -class AsyncV2SocketClient(EventEmitterMixin): - def __init__(self, *, websocket: WebSocketClientProtocol): - super().__init__() - self._websocket = websocket - - async def __aiter__(self): - 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_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): - 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_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/types/__init__.py b/src/deepgram/types/__init__.py index 51e2768b..264a979b 100644 --- a/src/deepgram/types/__init__.py +++ b/src/deepgram/types/__init__.py @@ -292,6 +292,15 @@ from .usage_fields_v1response_models_item import UsageFieldsV1ResponseModelsItem from .usage_v1response import UsageV1Response from .usage_v1response_resolution import UsageV1ResponseResolution + from .anthropic_think_provider_model import AnthropicThinkProviderModel + from .cartesia_speak_provider_model_id import CartesiaSpeakProviderModelId + from .cartesia_speak_provider_voice import CartesiaSpeakProviderVoice + from .create_key_v1request_one import CreateKeyV1RequestOne + from .deepgram_listen_provider_v2language_hint import DeepgramListenProviderV2LanguageHint + from .deepgram_speak_provider_model import DeepgramSpeakProviderModel + from .google_think_provider_model import GoogleThinkProviderModel + from .google_think_provider_version import GoogleThinkProviderVersion + from .groq_think_provider_reasoning_mode import GroqThinkProviderReasoningMode _dynamic_imports: typing.Dict[str, str] = { "AgentConfigurationV1": ".agent_configuration_v1", "AgentThinkModelsV1Response": ".agent_think_models_v1response", @@ -541,6 +550,15 @@ "UsageFieldsV1ResponseModelsItem": ".usage_fields_v1response_models_item", "UsageV1Response": ".usage_v1response", "UsageV1ResponseResolution": ".usage_v1response_resolution", + "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", } @@ -814,4 +832,13 @@ def __dir__(): "UsageFieldsV1ResponseModelsItem", "UsageV1Response", "UsageV1ResponseResolution", + "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 54b2869d..00000000 --- a/src/deepgram/types/__init__.py.bak +++ /dev/null @@ -1,844 +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 .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_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_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_results import SharedIntentsResults - from .shared_intents_results_intents import SharedIntentsResultsIntents - from .shared_intents_results_intents_segments_item import SharedIntentsResultsIntentsSegmentsItem - from .shared_intents_results_intents_segments_item_intents_item import ( - SharedIntentsResultsIntentsSegmentsItemIntentsItem, - ) - 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_results import SharedTopicsResults - from .shared_topics_results_topics import SharedTopicsResultsTopics - from .shared_topics_results_topics_segments_item import SharedTopicsResultsTopicsSegmentsItem - from .shared_topics_results_topics_segments_item_topics_item import SharedTopicsResultsTopicsSegmentsItemTopicsItem - 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_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_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 - from .anthropic_think_provider_model import AnthropicThinkProviderModel - from .cartesia_speak_provider_model_id import CartesiaSpeakProviderModelId - from .cartesia_speak_provider_voice import CartesiaSpeakProviderVoice - from .create_key_v1request_one import CreateKeyV1RequestOne - from .deepgram_listen_provider_v2language_hint import DeepgramListenProviderV2LanguageHint - from .deepgram_speak_provider_model import DeepgramSpeakProviderModel - from .google_think_provider_model import GoogleThinkProviderModel - from .google_think_provider_version import GoogleThinkProviderVersion - from .groq_think_provider_reasoning_mode import GroqThinkProviderReasoningMode -_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", - "AnthropicThinkProviderModel": ".anthropic_think_provider_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", - "CartesiaSpeakProviderModelId": ".cartesia_speak_provider_model_id", - "CartesiaSpeakProviderVoice": ".cartesia_speak_provider_voice", - "CartesiaVoice": ".cartesia_voice", - "CreateAgentConfigurationV1Response": ".create_agent_configuration_v1response", - "CreateKeyV1Request": ".create_key_v1request", - "CreateKeyV1RequestOne": ".create_key_v1request_one", - "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", - "DeepgramListenProviderV2LanguageHint": ".deepgram_listen_provider_v2language_hint", - "DeepgramModel": ".deepgram_model", - "DeepgramSpeakProviderModel": ".deepgram_speak_provider_model", - "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", - "GoogleThinkProviderModel": ".google_think_provider_model", - "GoogleThinkProviderVersion": ".google_think_provider_version", - "GoogleVersion": ".google_version", - "GrantV1Response": ".grant_v1response", - "Groq": ".groq", - "GroqReasoningMode": ".groq_reasoning_mode", - "GroqThinkProviderReasoningMode": ".groq_think_provider_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", - "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", - "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", - "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", - "SharedSentiments": ".shared_sentiments", - "SharedSentimentsAverage": ".shared_sentiments_average", - "SharedSentimentsSegmentsItem": ".shared_sentiments_segments_item", - "SharedTopics": ".shared_topics", - "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", - "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", - "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_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", -} - - -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", - "AnthropicThinkProviderModel", - "AwsBedrockThinkProvider", - "AwsBedrockThinkProviderCredentials", - "AwsBedrockThinkProviderCredentialsType", - "AwsBedrockThinkProviderModel", - "AwsPollySpeakProvider", - "AwsPollySpeakProviderCredentials", - "AwsPollySpeakProviderCredentialsType", - "AwsPollySpeakProviderEngine", - "AwsPollySpeakProviderVoice", - "BillingBreakdownV1Response", - "BillingBreakdownV1ResponseResolution", - "BillingBreakdownV1ResponseResultsItem", - "BillingBreakdownV1ResponseResultsItemGrouping", - "Cartesia", - "CartesiaModelId", - "CartesiaSpeakProviderModelId", - "CartesiaSpeakProviderVoice", - "CartesiaVoice", - "CreateAgentConfigurationV1Response", - "CreateKeyV1Request", - "CreateKeyV1RequestOne", - "CreateKeyV1Response", - "CreateProjectDistributionCredentialsV1Response", - "CreateProjectDistributionCredentialsV1ResponseDistributionCredentials", - "CreateProjectDistributionCredentialsV1ResponseMember", - "CreateProjectInviteV1Response", - "Deepgram", - "DeepgramListenProviderV1", - "DeepgramListenProviderV2", - "DeepgramListenProviderV2LanguageHint", - "DeepgramModel", - "DeepgramSpeakProviderModel", - "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", - "GoogleThinkProviderModel", - "GoogleThinkProviderVersion", - "GoogleVersion", - "GrantV1Response", - "Groq", - "GroqReasoningMode", - "GroqThinkProviderReasoningMode", - "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", - "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", - "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", - "SharedIntentsResults", - "SharedIntentsResultsIntents", - "SharedIntentsResultsIntentsSegmentsItem", - "SharedIntentsResultsIntentsSegmentsItemIntentsItem", - "SharedSentiments", - "SharedSentimentsAverage", - "SharedSentimentsSegmentsItem", - "SharedTopics", - "SharedTopicsResults", - "SharedTopicsResultsTopics", - "SharedTopicsResultsTopicsSegmentsItem", - "SharedTopicsResultsTopicsSegmentsItemTopicsItem", - "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", - "ThinkSettingsV1", - "ThinkSettingsV1ContextLength", - "ThinkSettingsV1Endpoint", - "ThinkSettingsV1FunctionsItem", - "ThinkSettingsV1FunctionsItemEndpoint", - "ThinkSettingsV1Provider", - "ThinkSettingsV1Provider_Anthropic", - "ThinkSettingsV1Provider_AwsBedrock", - "ThinkSettingsV1Provider_Google", - "ThinkSettingsV1Provider_Groq", - "ThinkSettingsV1Provider_OpenAi", - "UpdateProjectMemberScopesV1Response", - "UpdateProjectV1Response", - "UsageBreakdownV1Response", - "UsageBreakdownV1ResponseResolution", - "UsageBreakdownV1ResponseResultsItem", - "UsageBreakdownV1ResponseResultsItemGrouping", - "UsageFieldsV1Response", - "UsageFieldsV1ResponseModelsItem", - "UsageV1Response", - "UsageV1ResponseResolution", -] diff --git a/src/deepgram/types/deepgram_listen_provider_v2.py b/src/deepgram/types/deepgram_listen_provider_v2.py index 8a15c6d9..45e3f8bf 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 natural end-of-turn detection and end turns with the ForceEndTurn message. @@ -48,6 +54,30 @@ class DeepgramListenProviderV2(UncheckedBaseModel): 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 + 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 + if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: 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 e55bf684..00000000 --- a/src/deepgram/types/deepgram_listen_provider_v2.py.bak +++ /dev/null @@ -1,96 +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 (str or list) for backward - compatibility and remapped to `language_hints` by the validator below; - `exclude=True` keeps it off the wire (the API rejects unknown fields). - """ - - eot_threshold: typing.Optional[float] = pydantic.Field(default=None) - """ - End-of-turn confidence required to finish a turn. Valid range: 0.5 - 0.9. Defaults to 0.7. - """ - - 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 - """ - - # Backward-compat: the public field was historically named `language_hint` - # and accepted a string or a list. The API field is `language_hints` (a - # list). Translate the legacy kwarg so existing callers keep working, and - # drop the dead singular key so it is not rejected by the API - # (deny_unknown_fields). Hand-maintained. - 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): - return values - if "language_hint" in 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 - 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): - return values - if "language_hint" in 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 - - 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/speak_v2speed.py.bak b/src/deepgram/types/speak_v2speed.py.bak deleted file mode 100644 index b9e1e10c..00000000 --- a/src/deepgram/types/speak_v2speed.py.bak +++ /dev/null @@ -1,15 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -# Backward-compat patch (2026-08-18 regen): the generator retyped this from -# `float` to `Union[Literal["0.85"..."1.15"], Any]` -- a string-literal enum. -# That contradicts the actual API contract (a numeric speech-rate multiplier; -# see the sibling `SpeakV2SpeedValue = float` used by the Configure message) and -# silently changed the documented domain of the `speak.v2.connect(speed=...)` -# parameter from numeric to string. Only the `Any` fallback kept `speed=1.05` -# working. Restored to `float` so the connect param stays exactly what it was on -# `main`, mypy-precise (no reliance on `Any`), and consistent with the Configure -# message. Unfreeze when the spec types the connect `speed` as a number. -SpeakV2Speed = float -""" -Speech-rate multiplier. `1.0` is the model's nominal rate; lower is slower. Accepted values run `0.85` to `1.15` in `0.05` increments. A value outside that range is rejected with `SPEED_OUT_OF_RANGE`; a value inside it but off the `0.05` increment with `SPEED_INCREMENT_INVALID`. Models and languages without runtime speed control reject any value with `SPEED_NOT_SUPPORTED`. -""" diff --git a/tests/wire/test_listen_v1_media.py b/tests/wire/test_listen_v1_media.py index e4264985..d46dbc2a 100644 --- a/tests/wire/test_listen_v1_media.py +++ b/tests/wire/test_listen_v1_media.py @@ -9,3 +9,94 @@ 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: + """All optional transcribe-url query parameters reach the wire.""" + 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="language", + 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": "language", + "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 96a5bb28..00000000 --- a/tests/wire/test_listen_v1_media.py.bak +++ /dev/null @@ -1,112 +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: - """All 37 optional query params must reach the wire, with bools lowercased. - - The 2026-08-18 regen simplified the upstream spec *example* for this endpoint, - and Fern derives the wire test from that example -- so the generated test - dropped every query parameter, leaving their serialization unverified while - the client signature still forwards all 37. This restores that coverage; the - file is frozen in .fernignore so a future regen cannot silently drop it again. - - Same failure mode as tests/wire/test_manage_v1_projects_keys.py and - tests/wire/test_manage_v1_projects_requests.py, which are frozen for this reason. - """ - 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="language", - 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": "language", - "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..db30e0e0 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,15 @@ 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 create endpoint with the legacy request alias.""" + 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 cf232369..00000000 --- a/tests/wire/test_manage_v1_projects_keys.py.bak +++ /dev/null @@ -1,63 +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 create endpoint with the legacy request alias""" - 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..f95ac71c 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,43 @@ 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: + """All optional request-list query parameters reach the wire.""" + 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 acf577b0..00000000 --- a/tests/wire/test_manage_v1_projects_requests.py.bak +++ /dev/null @@ -1,74 +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: - """All ten optional query params must reach the wire, with datetime encoded as ISO-8601 Z. - - The 2026-08-11 regen simplified the upstream spec *example* for this endpoint, - and Fern derives the wire test from that example -- so the generated test - dropped every query parameter, leaving their serialization unverified while - the client signature still forwards all ten. This restores that coverage; the - file is frozen in .fernignore so a future regen cannot silently drop it again. - """ - 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 2e7d3de513fe4079f0ed6d3ed95fc0c7005904d2 Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Fri, 4 Sep 2026 13:24:00 +0100 Subject: [PATCH 06/10] test: cover regenerated Agent and Flux controls --- reference.md | 18 +++++-- tests/custom/test_listen_v2_connect_wire.py | 34 ++++++++++++ tests/custom/test_socket_client_shims.py | 60 ++++++++++++++++++++- tests/custom/test_speak_v2_coverage.py | 21 ++++++++ 4 files changed, 128 insertions(+), 5 deletions(-) diff --git a/reference.md b/reference.md index 07feb4b1..9c6aa2bf 100644 --- a/reference.md +++ b/reference.md @@ -375,7 +375,7 @@ client.listen.v1.media.transcribe_url(
-**keywords:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Keywords can boost or suppress specialized terminology and brands +**keywords:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Keywords can boost or suppress specialized terminology and brands. Not compatible with Nova-3; use `keyterm` instead.
@@ -733,7 +733,7 @@ with open("audio.wav", "rb") as f:
-**keywords:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Keywords can boost or suppress specialized terminology and brands +**keywords:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Keywords can boost or suppress specialized terminology and brands. Not compatible with Nova-3; use `keyterm` instead.
@@ -6070,7 +6070,7 @@ asyncio.run(main())
-**speed:** `typing.Optional[SpeakV2Speed]` — Speech-rate multiplier. `1.0` is the model's nominal rate. Accepted values: `0.85`, `0.90`, `0.95`, `1.00`, `1.05`, `1.10`, `1.15` — any other value is rejected with `SPEED_OUT_OF_RANGE` or `SPEED_INCREMENT_INVALID` +**speed:** `typing.Optional[SpeakV2Speed]` — Speech-rate multiplier. `1.0` is the model's nominal rate; accepted values run from `0.5` to `1.5` in `0.05` increments. Values outside that range are rejected with `SPEED_OUT_OF_RANGE`, and values off the increment are rejected with `SPEED_INCREMENT_INVALID`. Models and languages without runtime speed control reject any value with `SPEED_NOT_SUPPORTED`.
@@ -6244,6 +6244,8 @@ with client.agent.v1.connect() as agent: ``` +For Flux TTS, set the Deepgram provider `version="v2"` and a `flux-*` model. The optional `expressivity` setting accepts whole numbers from `-2` (calmer) to `2` (more animated); `0` is the default. It applies for the session and is beta, so audition non-default values before shipping. + @@ -6474,6 +6476,15 @@ asyncio.run(main()) - `AgentV1SendFunctionCallResponse(name="...", content="...")` — Provide function execution results + + +
+
+ +**`send_force_end_turn()`** — Send the `ForceEndTurn` control message to the agent + +- `agent.send_force_end_turn()` +
@@ -6482,4 +6493,3 @@ asyncio.run(main()) - diff --git a/tests/custom/test_listen_v2_connect_wire.py b/tests/custom/test_listen_v2_connect_wire.py index 1f914438..8444fca7 100644 --- a/tests/custom/test_listen_v2_connect_wire.py +++ b/tests/custom/test_listen_v2_connect_wire.py @@ -127,3 +127,37 @@ async def test_async_connect_targets_v2_listen_and_serializes_numerals(): assert path == "/v2/listen" assert query["model"] == ["flux-general-en"] assert query["numerals"] == ["true"] + + +def test_sync_connect_serializes_eot_controls(): + capture = _CaptureConnect() + with patch.object(listen_v2_client.websockets_sync_client, "connect", capture): + with DeepgramClient(api_key="test_api_key").listen.v2.connect( + model="flux-general-en", + eager_eot_threshold="0.5", + eot_threshold="1.0", + eot_timeout_ms="1000", + ): + pass + + _, query = _path_and_query(capture.url) + assert query["eager_eot_threshold"] == ["0.5"] + assert query["eot_threshold"] == ["1.0"] + assert query["eot_timeout_ms"] == ["1000"] + + +async def test_async_connect_serializes_eot_controls(): + capture = _CaptureConnect() + with patch.object(listen_v2_client, "websockets_client_connect", capture): + async with AsyncDeepgramClient(api_key="test_api_key").listen.v2.connect( + model="flux-general-en", + eager_eot_threshold="0.5", + eot_threshold="1.0", + eot_timeout_ms="1000", + ): + pass + + _, query = _path_and_query(capture.url) + assert query["eager_eot_threshold"] == ["0.5"] + assert query["eot_threshold"] == ["1.0"] + assert query["eot_timeout_ms"] == ["1000"] diff --git a/tests/custom/test_socket_client_shims.py b/tests/custom/test_socket_client_shims.py index 4d66f3f7..238e1e8e 100644 --- a/tests/custom/test_socket_client_shims.py +++ b/tests/custom/test_socket_client_shims.py @@ -18,12 +18,23 @@ import json -from deepgram.agent.v1.socket_client import V1SocketClient, _sanitize_numeric_types +from deepgram.agent.v1.socket_client import AsyncV1SocketClient, V1SocketClient, _sanitize_numeric_types +from deepgram.agent.v1.types.agent_v1force_end_turn import AgentV1ForceEndTurn +from deepgram.agent.v1.types.agent_v1settings import AgentV1Settings +from deepgram.agent.v1.types.agent_v1settings_agent import AgentV1SettingsAgent +from deepgram.agent.v1.types.agent_v1settings_agent_listen import AgentV1SettingsAgentListen +from deepgram.agent.v1.types.agent_v1settings_agent_listen_provider import AgentV1SettingsAgentListenProvider_V1 +from deepgram.agent.v1.types.agent_v1settings_audio import AgentV1SettingsAudio +from deepgram.agent.v1.types.agent_v1settings_audio_input import AgentV1SettingsAudioInput from deepgram.listen.v2.socket_client import AsyncV2SocketClient, V2SocketClient from deepgram.listen.v2.types.listen_v2close_stream import ListenV2CloseStream from deepgram.listen.v2.types.listen_v2configure import ListenV2Configure from deepgram.listen.v2.types.listen_v2force_end_turn import ListenV2ForceEndTurn from deepgram.speak.v2.socket_client import V2SocketClient as SpeakV2SocketClient +from deepgram.types.speak_settings_v1 import SpeakSettingsV1 +from deepgram.types.speak_settings_v1provider import SpeakSettingsV1Provider_Deepgram +from deepgram.types.think_settings_v1 import ThinkSettingsV1 +from deepgram.types.think_settings_v1provider import ThinkSettingsV1Provider_OpenAi class _FakeWebSocket: @@ -52,6 +63,26 @@ def _sent_json(ws): return json.loads(payload) if isinstance(payload, str) else payload +def _agent_settings_with_expressivity() -> AgentV1Settings: + return AgentV1Settings( + audio=AgentV1SettingsAudio(input=AgentV1SettingsAudioInput(encoding="linear16", sample_rate=24000)), + agent=AgentV1SettingsAgent( + listen=AgentV1SettingsAgentListen( + provider=AgentV1SettingsAgentListenProvider_V1(type="deepgram", model="nova-3") + ), + think=ThinkSettingsV1( + provider=ThinkSettingsV1Provider_OpenAi(type="open_ai", model="gpt-4o-mini"), + prompt="Be concise.", + ), + speak=SpeakSettingsV1( + provider=SpeakSettingsV1Provider_Deepgram( + type="deepgram", version="v2", model="flux-alexis-en", expressivity=2 + ) + ), + ), + ) + + class TestSanitizeNumericTypes: def test_whole_float_becomes_int(self): result = _sanitize_numeric_types(44100.0) @@ -121,12 +152,39 @@ def test_listen_v2_force_end_turn_explicit_message(self): V2SocketClient(websocket=ws).send_force_end_turn(ListenV2ForceEndTurn(type="ForceEndTurn")) assert _sent_json(ws)["type"] == "ForceEndTurn" + def test_agent_force_end_turn_no_arg(self): + ws = _FakeWebSocket() + V1SocketClient(websocket=ws).send_force_end_turn() + assert _sent_json(ws) == {"type": "ForceEndTurn"} + + def test_agent_force_end_turn_explicit_message(self): + ws = _FakeWebSocket() + V1SocketClient(websocket=ws).send_force_end_turn(AgentV1ForceEndTurn(type="ForceEndTurn")) + assert _sent_json(ws) == {"type": "ForceEndTurn"} + async def test_listen_v2_force_end_turn_async_no_arg(self): # Cover the async client's send_force_end_turn too (asyncio_mode="auto"). ws = _FakeAsyncWebSocket() await AsyncV2SocketClient(websocket=ws).send_force_end_turn() assert _sent_json(ws) == {"type": "ForceEndTurn"} + async def test_agent_force_end_turn_async_no_arg(self): + ws = _FakeAsyncWebSocket() + await AsyncV1SocketClient(websocket=ws).send_force_end_turn() + assert _sent_json(ws) == {"type": "ForceEndTurn"} + + +class TestAgentSettingsSerialization: + def test_sync_send_settings_serializes_expressivity(self): + ws = _FakeWebSocket() + V1SocketClient(websocket=ws).send_settings(_agent_settings_with_expressivity()) + assert _sent_json(ws)["agent"]["speak"]["provider"]["expressivity"] == 2 + + async def test_async_send_settings_serializes_expressivity(self): + ws = _FakeAsyncWebSocket() + await AsyncV1SocketClient(websocket=ws).send_settings(_agent_settings_with_expressivity()) + assert _sent_json(ws)["agent"]["speak"]["provider"]["expressivity"] == 2 + class TestSendConfigureRawShim: def test_passthrough_dict_is_sent_verbatim(self): diff --git a/tests/custom/test_speak_v2_coverage.py b/tests/custom/test_speak_v2_coverage.py index 1cded6c4..bb3fece4 100644 --- a/tests/custom/test_speak_v2_coverage.py +++ b/tests/custom/test_speak_v2_coverage.py @@ -99,6 +99,27 @@ async def test_async_streams_audio_bytes(self) -> None: chunks += chunk assert chunks == b"audio-bytes" + 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) + ) + assert route.called + assert route.calls.last.request.url.params["speed"] == "1.05" + assert route.calls.last.request.url.params["expressivity"] == "2" + + 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 + ): + pass + assert route.called + assert route.calls.last.request.url.params["speed"] == "1.05" + assert route.calls.last.request.url.params["expressivity"] == "2" + def test_with_raw_response_accessor(self) -> None: assert isinstance( _sync_client().speak.v2.audio.with_raw_response, From e4bfa05ff9a5965257dc233cffb040342603518d Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Fri, 4 Sep 2026 13:54:57 +0100 Subject: [PATCH 07/10] docs(examples): document Agent ForceEndTurn requirements --- examples/32-voice-agent-force-end-turn.py | 96 +++++++++++++++++++++++ examples/README.md | 1 + reference.md | 6 +- tests/custom/test_speak_v2_coverage.py | 13 ++- 4 files changed, 106 insertions(+), 10 deletions(-) create mode 100644 examples/32-voice-agent-force-end-turn.py diff --git a/examples/32-voice-agent-force-end-turn.py b/examples/32-voice-agent-force-end-turn.py new file mode 100644 index 00000000..a5861462 --- /dev/null +++ b/examples/32-voice-agent-force-end-turn.py @@ -0,0 +1,96 @@ +""" +Example: Force an active Voice Agent turn to end. + +ForceEndTurn requires a Deepgram V2 (Flux) listen provider. It sends the +control message after the server reports UserStartedSpeaking, then waits for +the agent response. The example streams the first two seconds of the bundled +WAV fixture and does not capture microphone audio. +""" + +import threading +import time +from pathlib import Path + +from dotenv import load_dotenv + +from deepgram import DeepgramClient +from deepgram.agent.v1.types import ( + AgentV1Settings, + AgentV1SettingsAgent, + AgentV1SettingsAgentListen, + AgentV1SettingsAgentListenProvider_V2, + AgentV1SettingsAudio, + AgentV1SettingsAudioInput, +) +from deepgram.core.events import EventType +from deepgram.types.speak_settings_v1 import SpeakSettingsV1 +from deepgram.types.speak_settings_v1provider import SpeakSettingsV1Provider_Deepgram +from deepgram.types.think_settings_v1 import ThinkSettingsV1 +from deepgram.types.think_settings_v1provider import ThinkSettingsV1Provider_OpenAi + +load_dotenv() + +AUDIO_PATH = Path(__file__).parent / "fixtures" / "audio.wav" + + +def main() -> None: + user_started = threading.Event() + agent_finished = threading.Event() + + settings = AgentV1Settings( + audio=AgentV1SettingsAudio(input=AgentV1SettingsAudioInput(encoding="linear16", sample_rate=44100)), + agent=AgentV1SettingsAgent( + listen=AgentV1SettingsAgentListen( + provider=AgentV1SettingsAgentListenProvider_V2(type="deepgram", model="flux-general-en") + ), + think=ThinkSettingsV1( + provider=ThinkSettingsV1Provider_OpenAi(type="open_ai", model="gpt-4o-mini"), + prompt="Reply briefly.", + ), + speak=SpeakSettingsV1( + provider=SpeakSettingsV1Provider_Deepgram(type="deepgram", model="aura-2-asteria-en") + ), + ), + ) + + with DeepgramClient().agent.v1.connect() as agent: + + def on_message(message: object) -> None: + message_type = getattr(message, "type", None) + if message_type == "UserStartedSpeaking": + user_started.set() + print("UserStartedSpeaking received") + elif message_type == "ConversationText": + print(f"[{message.role}] {message.content}") + elif message_type == "AgentAudioDone": + agent_finished.set() + print("AgentAudioDone received") + elif message_type in {"Warning", "Error"}: + print(f"{message_type}: {message.code} - {message.description}") + + agent.on(EventType.MESSAGE, on_message) + agent.on(EventType.ERROR, lambda error: print(f"Connection error: {error}")) + threading.Thread(target=agent.start_listening, daemon=True).start() + + agent.send_settings(settings) + with AUDIO_PATH.open("rb") as audio_file: + audio_file.read(44) + audio = audio_file.read(44100 * 2 * 2) + + for start in range(0, len(audio), 44100 // 10 * 2): + agent.send_media(audio[start : start + 44100 // 10 * 2]) + time.sleep(0.1) + if user_started.is_set(): + break + + if not user_started.is_set(): + raise TimeoutError("Timed out waiting for UserStartedSpeaking") + + print("Sending ForceEndTurn") + agent.send_force_end_turn() + if not agent_finished.wait(15): + raise TimeoutError("Timed out waiting for the agent response") + + +if __name__ == "__main__": + main() diff --git a/examples/README.md b/examples/README.md index 65d22050..a8cb771b 100644 --- a/examples/README.md +++ b/examples/README.md @@ -34,6 +34,7 @@ This directory contains comprehensive examples demonstrating how to use the Deep - **30-voice-agent.py** - Voice Agent configuration and usage - **31-voice-agent-session-recording.py** - Record selected Voice Agent events as JSON +- **32-voice-agent-force-end-turn.py** - End an active Voice Agent Flux turn with ForceEndTurn ### 40-49: Text Intelligence (Read) diff --git a/reference.md b/reference.md index 9c6aa2bf..ca149bba 100644 --- a/reference.md +++ b/reference.md @@ -5462,7 +5462,7 @@ asyncio.run(main())
-**eot_threshold:** `typing.Optional[str]` — Threshold for end-of-turn detection +**eot_threshold:** `typing.Optional[str]` — Threshold for Flux end-of-turn detection. Set `1.0` to suppress confidence-based turn endings when the application uses `send_force_end_turn()`; `eot_timeout_ms` still ends idle turns independently.
@@ -5470,7 +5470,7 @@ asyncio.run(main())
-**eot_timeout_ms:** `typing.Optional[str]` — Timeout in milliseconds for end-of-turn detection +**eot_timeout_ms:** `typing.Optional[str]` — Idle timeout in milliseconds for end-of-turn detection. Increase it with `eot_threshold=1.0` when the application needs full manual turn control through `send_force_end_turn()`.
@@ -6485,6 +6485,8 @@ asyncio.run(main()) - `agent.send_force_end_turn()` +- Requires a Deepgram V2 (Flux) listen provider. With a V1 provider, the server emits `FORCE_END_TURN_UNSUPPORTED` and leaves the current turn open. + diff --git a/tests/custom/test_speak_v2_coverage.py b/tests/custom/test_speak_v2_coverage.py index bb3fece4..a711fef4 100644 --- a/tests/custom/test_speak_v2_coverage.py +++ b/tests/custom/test_speak_v2_coverage.py @@ -543,14 +543,11 @@ async def test_async_start_listening_skips_on_construct_error(self) -> None: class TestSpeakV2SpeedTypeIsFloat: - """Regression guard for the 2026-08-18 regen SpeakV2Speed retype (frozen patch). - - The generator changed SpeakV2Speed from ``float`` to - ``Union[Literal["0.85"..."1.15"], Any]`` -- a string-literal enum that - silently changed the ``speak.v2.connect(speed=...)`` parameter's documented - domain from numeric to string and contradicted the API contract - (``SpeakV2SpeedValue = float`` on the Configure message). We restored it to - ``float``; this test fails loudly if a future regen reverts the patch. + """Regression guard for the SpeakV2Speed numeric contract. + + Fern now emits ``float``. Keep this test so a future regeneration cannot + silently reintroduce a string-literal speed type that contradicts + ``SpeakV2SpeedValue = float`` on the Configure message. """ def test_connect_speed_type_is_plain_float(self) -> None: From acb99f6ae320b67d8016711f276d0e8720556cf3 Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Fri, 4 Sep 2026 14:12:05 +0100 Subject: [PATCH 08/10] docs: narrow Agent ForceEndTurn requirement --- reference.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference.md b/reference.md index ca149bba..58b3e169 100644 --- a/reference.md +++ b/reference.md @@ -6485,7 +6485,7 @@ asyncio.run(main()) - `agent.send_force_end_turn()` -- Requires a Deepgram V2 (Flux) listen provider. With a V1 provider, the server emits `FORCE_END_TURN_UNSUPPORTED` and leaves the current turn open. +- Requires a Deepgram V2 (Flux) listen provider. With a V1 provider, the server emits `FORCE_END_TURN_UNSUPPORTED`. From 3c211f6386d169d995c14fe67dc55ddf7ce543e8 Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Fri, 4 Sep 2026 15:55:06 +0100 Subject: [PATCH 09/10] docs: add Agent ForceEndTurn skill guidance --- .agents/skills/deepgram-python-voice-agent/SKILL.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.agents/skills/deepgram-python-voice-agent/SKILL.md b/.agents/skills/deepgram-python-voice-agent/SKILL.md index bdcf64cb..9ba51f4e 100644 --- a/.agents/skills/deepgram-python-voice-agent/SKILL.md +++ b/.agents/skills/deepgram-python-voice-agent/SKILL.md @@ -119,6 +119,7 @@ with client.agent.v1.connect() as agent: - Prompt / think / speak update messages (change mid-session) - User / assistant text injection - Function call response (reply to `FunctionCallRequest`) +- `ForceEndTurn` (end an active user turn; requires a Deepgram V2/Flux listen provider) ## Reusable agent configurations @@ -190,6 +191,10 @@ agent.send_inject_user_message( # 6. Idle-period keep-alive (no payload required; the SDK fills in the type literal) agent.send_keep_alive(AgentV1KeepAlive()) # Or simply: agent.send_keep_alive() — the message arg is optional. + +# 7. End an active user turn immediately (for example, on push-to-talk release). +# Requires a Deepgram V2/Flux listen provider; V1 returns FORCE_END_TURN_UNSUPPORTED. +agent.send_force_end_turn() ``` Async client equivalents are identical but `await`-prefixed: @@ -197,6 +202,7 @@ Async client equivalents are identical but `await`-prefixed: ```python await agent.send_update_prompt(AgentV1UpdatePrompt(prompt="...")) await agent.send_inject_agent_message(AgentV1InjectAgentMessage(message="...")) +await agent.send_force_end_turn() ``` ## Stream lifecycle & recovery @@ -288,6 +294,7 @@ The server emits a `History` message on connect when the SDK has captured prior ## Example files in this repo - `examples/30-voice-agent.py` +- `examples/32-voice-agent-force-end-turn.py` — Force an active turn to end with a Flux listen provider - `tests/manual/agent/v1/connect/main.py` — live connection test ## Central product skills From f676bfee6e0360f5630f1de2fec43e417087e375 Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Fri, 4 Sep 2026 16:32:26 +0100 Subject: [PATCH 10/10] docs: clarify Flux manual turn control --- .../skills/deepgram-python-conversational-stt/SKILL.md | 8 +++++--- reference.md | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.agents/skills/deepgram-python-conversational-stt/SKILL.md b/.agents/skills/deepgram-python-conversational-stt/SKILL.md index 888f1259..4d9bfac6 100644 --- a/.agents/skills/deepgram-python-conversational-stt/SKILL.md +++ b/.agents/skills/deepgram-python-conversational-stt/SKILL.md @@ -82,8 +82,8 @@ with client.listen.v2.connect( | `encoding` | `linear16`, `mulaw`, etc. Omit for containerized audio | | `sample_rate` | String in the SDK signature, e.g. `"16000"` | | `eager_eot_threshold` | Fire end-of-turn early at this confidence | -| `eot_threshold` | Primary end-of-turn confidence | -| `eot_timeout_ms` | Time-based fallback turn end | +| `eot_threshold` | Primary end-of-turn confidence; set to `"1.0"` to suppress confidence-based endings | +| `eot_timeout_ms` | Time-based fallback turn end; still applies when `eot_threshold="1.0"` | | `keyterm` | Bias for domain keywords | | `mip_opt_out`, `tag` | Metadata / privacy flags | | `language_hint` | **ONLY for `flux-general-multi`** | @@ -91,6 +91,8 @@ with client.listen.v2.connect( **No `language` parameter** on v2 — language is implied by model (`flux-general-en`) or hinted via `language_hint` on multi. +For application-controlled turns, use `eot_threshold="1.0"` with a sufficiently large `eot_timeout_ms`, then call `conn.send_force_end_turn()` for the active turn. ForceEndTurn requires deployment enablement; see `examples/16-transcription-force-end-turn.py`. + ## Events (server → client) - `ListenV2Connected` — connection established @@ -98,7 +100,7 @@ with client.listen.v2.connect( - `ListenV2TurnInfo` — per-turn transcript + event (`Update`, `EndOfTurn`, `EagerEndOfTurn`, ...) + `turn_index` - `ListenV2FatalError` — terminal error -Client messages: `ListenV2Media`, `ListenV2Configure`, `ListenV2CloseStream`. +Client messages: `ListenV2Media`, `ListenV2Configure`, `ListenV2ForceEndTurn`, `ListenV2CloseStream`. ## Async equivalent diff --git a/reference.md b/reference.md index 58b3e169..0c0b096a 100644 --- a/reference.md +++ b/reference.md @@ -5090,7 +5090,7 @@ asyncio.run(main())
-**keywords:** `typing.Optional[str]` — Keywords can boost or suppress specialized terminology and brands +**keywords:** `typing.Optional[str]` — Keywords can boost or suppress specialized terminology and brands. Not compatible with Nova-3; use `keyterm` instead.