From daea8476da1ee5d1b807ce10e100b3b35b19b6ad Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Thu, 1 Oct 2026 09:41:35 +0100 Subject: [PATCH 01/15] chore: initialize SDK regeneration branch From 0d7323c749e1039490b3d3806c14a505fdd7a721 Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Thu, 1 Oct 2026 09:43:11 +0100 Subject: [PATCH 02/15] chore: unfreeze files pending regen --- .fernignore | 82 +- .gitignore.bak | 8 + src/deepgram/__init__.py.bak | 1358 +++++++++++++++++ src/deepgram/agent/__init__.py.bak | 507 ++++++ src/deepgram/agent/v1/__init__.py.bak | 511 +++++++ .../agent/v1/requests/__init__.py.bak | 262 ++++ .../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 | 386 +++++ src/deepgram/agent/v1/types/__init__.py.bak | 287 ++++ .../agent/v1/types/agent_v1settings.py.bak | 42 + .../v1/types/agent_v1settings_agent.py.bak | 62 + .../agent_v1settings_agent_context.py.bak | 65 + ...tings_agent_context_listen_provider.py.bak | 77 + ...nt_v1settings_agent_listen_provider.py.bak | 77 + .../types/agent_v1update_listen_listen.py.bak | 62 + src/deepgram/core/api_error.py.bak | 25 + src/deepgram/core/parse_error.py.bak | 38 + src/deepgram/core/query_encoder.py.bak | 65 + 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 | 247 +++ 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 | 847 ++++++++++ src/deepgram/types/deepgram.py.bak | 44 + .../types/deepgram_listen_provider_v2.py.bak | 88 ++ .../types/speak_settings_v1provider.py.bak | 117 ++ tests/wire/test_listen_v1_media.py.bak | 102 ++ .../wire/test_manage_v1_projects_keys.py.bak | 60 + .../test_manage_v1_projects_requests.py.bak | 67 + 42 files changed, 7597 insertions(+), 41 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.py.bak create mode 100644 src/deepgram/types/deepgram_listen_provider_v2.py.bak create mode 100644 src/deepgram/types/speak_settings_v1provider.py.bak create mode 100644 tests/wire/test_listen_v1_media.py.bak create mode 100644 tests/wire/test_manage_v1_projects_keys.py.bak create mode 100644 tests/wire/test_manage_v1_projects_requests.py.bak diff --git a/.fernignore b/.fernignore index 977c2623..f89dab66 100644 --- a/.fernignore +++ b/.fernignore @@ -27,17 +27,17 @@ 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 # Agent TTS provider expressivity must reject fractional values rather than # allowing Pydantic v1 to truncate them before the API sees the request. # [temporarily frozen — remove when Fern emits a strict integer] -src/deepgram/types/speak_settings_v1provider.py -src/deepgram/types/deepgram.py +src/deepgram/types/speak_settings_v1provider.py.bak +src/deepgram/types/deepgram.py.bak # Backward-compat patch: AgentV1SettingsAgentContext schema restructure as of # 2026-05-05. The new schema nests messages under .context.messages; this file @@ -45,12 +45,12 @@ src/deepgram/types/deepgram.py # kwarg and remaps it to `context={"messages": ...}` so existing callers keep # producing the correct wire payload, plus a read-side `.messages` property so # existing attribute access keeps working. -src/deepgram/agent/v1/types/agent_v1settings_agent_context.py -src/deepgram/agent/v1/types/agent_v1settings_agent.py -src/deepgram/agent/v1/types/agent_v1settings.py -src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py -src/deepgram/agent/v1/requests/agent_v1settings_agent.py -src/deepgram/agent/v1/requests/agent_v1settings.py +src/deepgram/agent/v1/types/agent_v1settings_agent_context.py.bak +src/deepgram/agent/v1/types/agent_v1settings_agent.py.bak +src/deepgram/agent/v1/types/agent_v1settings.py.bak +src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py.bak +src/deepgram/agent/v1/requests/agent_v1settings_agent.py.bak +src/deepgram/agent/v1/requests/agent_v1settings.py.bak # Backward-compatibility alias shims for renamed generated public types/params. # These are hand-written wrappers around the current generated names and must not be regenerated. @@ -125,9 +125,9 @@ src/deepgram/requests/deepgram_listen_provider_v2language_hint.py # remaps a legacy `language_hint=` kwarg to `language_hints` and drops the dead singular # key. Remove and unfreeze these shims when the singular alias is intentionally retired in a # future major release. -src/deepgram/types/deepgram_listen_provider_v2.py -src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py -src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py +src/deepgram/types/deepgram_listen_provider_v2.py.bak +src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py.bak +src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py.bak # Backward-compat patch for the 2026-07-31 AgentV1UpdateListen provider retype. The # generated `provider` field is now the required discriminated union @@ -136,7 +136,7 @@ src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py # that coerces a legacy DeepgramListenProviderV1/V2 (or a dict lacking the version # discriminant) into the new shape so existing callers keep working. Remove and unfreeze # when the old provider payloads are retired in a future major. -src/deepgram/agent/v1/types/agent_v1update_listen_listen.py +src/deepgram/agent/v1/types/agent_v1update_listen_listen.py.bak # Hand-written compat shim recreating ListenV2CloseStreamType, which Fern removed in the # 2026-06-15 regen (docs #946). The original generated type wrongly allowed @@ -149,17 +149,17 @@ src/deepgram/listen/v2/types/listen_v2close_stream_type.py # Temporarily frozen generated package barrels that carry hand-applied legacy alias # re-exports. Before each regen, swap these originals to .bak paths so Fern can add new # exports; then restore the aliases alongside every genuine generated addition. -src/deepgram/__init__.py -src/deepgram/agent/__init__.py -src/deepgram/agent/v1/__init__.py -src/deepgram/agent/v1/types/__init__.py -src/deepgram/agent/v1/requests/__init__.py -src/deepgram/types/__init__.py -src/deepgram/requests/__init__.py +src/deepgram/__init__.py.bak +src/deepgram/agent/__init__.py.bak +src/deepgram/agent/v1/__init__.py.bak +src/deepgram/agent/v1/types/__init__.py.bak +src/deepgram/agent/v1/requests/__init__.py.bak +src/deepgram/types/__init__.py.bak +src/deepgram/requests/__init__.py.bak # listen __init__.py files re-export the ListenV2CloseStreamType shim above. -src/deepgram/listen/__init__.py -src/deepgram/listen/v2/__init__.py -src/deepgram/listen/v2/types/__init__.py +src/deepgram/listen/__init__.py.bak +src/deepgram/listen/v2/__init__.py.bak +src/deepgram/listen/v2/types/__init__.py.bak # Coerces Python bools to lowercase "true"/"false" before urlencode, which # otherwise stringifies via str() and produces "True"/"False" — rejected by @@ -176,23 +176,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 @@ -228,14 +228,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 @@ -244,7 +244,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 @@ -294,7 +294,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..f143f308 --- /dev/null +++ b/src/deepgram/__init__.py.bak @@ -0,0 +1,1358 @@ +# 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, + ListenV2ConfigureNumerals, + ListenV2EagerEotThreshold, + ListenV2Encoding, + ListenV2EotThreshold, + ListenV2EotTimeoutMs, + ListenV2Keyterm, + ListenV2LanguageHint, + ListenV2MipOptOut, + ListenV2Model, + ListenV2Numerals, + ListenV2ProfanityFilter, + ListenV2Redact, + ListenV2SampleRate, + ListenV2Tag, + OpenAiSpeakProvider, + OpenAiSpeakProviderModel, + OpenAiSpeakProviderVoice, + OpenAiThinkProvider, + OpenAiThinkProviderModel, + OpenAiThinkProviderReasoningMode, + ProjectRequestResponse, + ReadV1Request, + ReadV1RequestText, + ReadV1RequestUrl, + ReadV1Response, + ReadV1ResponseMetadata, + ReadV1ResponseMetadataMetadata, + ReadV1ResponseMetadataMetadataIntentsInfo, + ReadV1ResponseMetadataMetadataSentimentInfo, + ReadV1ResponseMetadataMetadataSummaryInfo, + ReadV1ResponseMetadataMetadataTopicsInfo, + ReadV1ResponseResults, + ReadV1ResponseResultsSummary, + ReadV1ResponseResultsSummaryResults, + ReadV1ResponseResultsSummaryResultsSummary, + SharedIntents, + 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, 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", + "AgentThinkModelsV1Response": ".types", + "AgentThinkModelsV1ResponseModelsItem": ".types", + "AgentThinkModelsV1ResponseModelsItemId": ".types", + "AgentThinkModelsV1ResponseModelsItemIdParams": ".requests", + "AgentThinkModelsV1ResponseModelsItemOne": ".types", + "AgentThinkModelsV1ResponseModelsItemOneId": ".types", + "AgentThinkModelsV1ResponseModelsItemOneParams": ".requests", + "AgentThinkModelsV1ResponseModelsItemParams": ".requests", + "AgentThinkModelsV1ResponseModelsItemThree": ".types", + "AgentThinkModelsV1ResponseModelsItemThreeParams": ".requests", + "AgentThinkModelsV1ResponseModelsItemTwo": ".types", + "AgentThinkModelsV1ResponseModelsItemTwoId": ".types", + "AgentThinkModelsV1ResponseModelsItemTwoParams": ".requests", + "AgentThinkModelsV1ResponseModelsItemZero": ".types", + "AgentThinkModelsV1ResponseModelsItemZeroId": ".types", + "AgentThinkModelsV1ResponseModelsItemZeroParams": ".requests", + "AgentThinkModelsV1ResponseParams": ".requests", + "AgentVariableV1": ".types", + "AgentVariableV1Params": ".requests", + "Anthropic": ".types", + "AnthropicModel": ".types", + "AnthropicParams": ".requests", + "AsyncDeepgramClient": ".client", + "AwsBedrockThinkProvider": ".types", + "AwsBedrockThinkProviderCredentials": ".types", + "AwsBedrockThinkProviderCredentialsParams": ".requests", + "AwsBedrockThinkProviderCredentialsType": ".types", + "AwsBedrockThinkProviderModel": ".types", + "AwsBedrockThinkProviderParams": ".requests", + "AwsPollySpeakProvider": ".types", + "AwsPollySpeakProviderCredentials": ".types", + "AwsPollySpeakProviderCredentialsParams": ".requests", + "AwsPollySpeakProviderCredentialsType": ".types", + "AwsPollySpeakProviderEngine": ".types", + "AwsPollySpeakProviderParams": ".requests", + "AwsPollySpeakProviderVoice": ".types", + "BadRequestError": ".errors", + "BillingBreakdownV1Response": ".types", + "BillingBreakdownV1ResponseParams": ".requests", + "BillingBreakdownV1ResponseResolution": ".types", + "BillingBreakdownV1ResponseResolutionParams": ".requests", + "BillingBreakdownV1ResponseResultsItem": ".types", + "BillingBreakdownV1ResponseResultsItemGrouping": ".types", + "BillingBreakdownV1ResponseResultsItemGroupingParams": ".requests", + "BillingBreakdownV1ResponseResultsItemParams": ".requests", + "Cartesia": ".types", + "CartesiaModelId": ".types", + "CartesiaParams": ".requests", + "CartesiaVoice": ".types", + "CartesiaVoiceParams": ".requests", + "CreateAgentConfigurationV1Response": ".types", + "CreateAgentConfigurationV1ResponseParams": ".requests", + "CreateKeyV1Request": ".types", + "CreateKeyV1RequestParams": ".requests", + "CreateKeyV1Response": ".types", + "CreateKeyV1ResponseParams": ".requests", + "CreateProjectDistributionCredentialsV1Response": ".types", + "CreateProjectDistributionCredentialsV1ResponseDistributionCredentials": ".types", + "CreateProjectDistributionCredentialsV1ResponseDistributionCredentialsParams": ".requests", + "CreateProjectDistributionCredentialsV1ResponseMember": ".types", + "CreateProjectDistributionCredentialsV1ResponseMemberParams": ".requests", + "CreateProjectDistributionCredentialsV1ResponseParams": ".requests", + "CreateProjectInviteV1Response": ".types", + "CreateProjectInviteV1ResponseParams": ".requests", + "Deepgram": ".types", + "DeepgramClient": ".client", + "DeepgramClientEnvironment": ".environment", + "DeepgramListenProviderV1": ".types", + "DeepgramListenProviderV1Params": ".requests", + "DeepgramListenProviderV2": ".types", + "DeepgramListenProviderV2Params": ".requests", + "DeepgramModel": ".types", + "DeepgramParams": ".requests", + "DefaultAioHttpClient": "._default_clients", + "DefaultAsyncHttpxClient": "._default_clients", + "DeleteAgentConfigurationV1Response": ".types", + "DeleteAgentVariableV1Response": ".types", + "DeleteProjectInviteV1Response": ".types", + "DeleteProjectInviteV1ResponseParams": ".requests", + "DeleteProjectKeyV1Response": ".types", + "DeleteProjectKeyV1ResponseParams": ".requests", + "DeleteProjectMemberV1Response": ".types", + "DeleteProjectMemberV1ResponseParams": ".requests", + "DeleteProjectV1Response": ".types", + "DeleteProjectV1ResponseParams": ".requests", + "ElevenLabsSpeakProvider": ".types", + "ElevenLabsSpeakProviderModelId": ".types", + "ElevenLabsSpeakProviderParams": ".requests", + "ErrorResponse": ".types", + "ErrorResponseLegacyError": ".types", + "ErrorResponseLegacyErrorParams": ".requests", + "ErrorResponseModernError": ".types", + "ErrorResponseModernErrorParams": ".requests", + "ErrorResponseParams": ".requests", + "ErrorResponseTextError": ".types", + "GetModelV1Response": ".types", + "GetModelV1ResponseBatch": ".types", + "GetModelV1ResponseBatchParams": ".requests", + "GetModelV1ResponseMetadata": ".types", + "GetModelV1ResponseMetadataMetadata": ".types", + "GetModelV1ResponseMetadataMetadataParams": ".requests", + "GetModelV1ResponseMetadataParams": ".requests", + "GetModelV1ResponseParams": ".requests", + "GetProjectBalanceV1Response": ".types", + "GetProjectBalanceV1ResponseParams": ".requests", + "GetProjectDistributionCredentialsV1Response": ".types", + "GetProjectDistributionCredentialsV1ResponseDistributionCredentials": ".types", + "GetProjectDistributionCredentialsV1ResponseDistributionCredentialsParams": ".requests", + "GetProjectDistributionCredentialsV1ResponseMember": ".types", + "GetProjectDistributionCredentialsV1ResponseMemberParams": ".requests", + "GetProjectDistributionCredentialsV1ResponseParams": ".requests", + "GetProjectKeyV1Response": ".types", + "GetProjectKeyV1ResponseItem": ".types", + "GetProjectKeyV1ResponseItemMember": ".types", + "GetProjectKeyV1ResponseItemMemberApiKey": ".types", + "GetProjectKeyV1ResponseItemMemberApiKeyParams": ".requests", + "GetProjectKeyV1ResponseItemMemberParams": ".requests", + "GetProjectKeyV1ResponseItemParams": ".requests", + "GetProjectKeyV1ResponseParams": ".requests", + "GetProjectRequestV1Response": ".types", + "GetProjectRequestV1ResponseParams": ".requests", + "GetProjectV1Response": ".types", + "GetProjectV1ResponseParams": ".requests", + "Google": ".types", + "GoogleModel": ".types", + "GoogleParams": ".requests", + "GoogleVersion": ".types", + "GrantV1Response": ".types", + "GrantV1ResponseParams": ".requests", + "Groq": ".types", + "GroqParams": ".requests", + "GroqReasoningMode": ".types", + "LeaveProjectV1Response": ".types", + "LeaveProjectV1ResponseParams": ".requests", + "ListAgentConfigurationsV1Response": ".types", + "ListAgentConfigurationsV1ResponseParams": ".requests", + "ListAgentVariablesV1Response": ".types", + "ListAgentVariablesV1ResponseParams": ".requests", + "ListBillingFieldsV1Response": ".types", + "ListBillingFieldsV1ResponseDeploymentsItem": ".types", + "ListBillingFieldsV1ResponseParams": ".requests", + "ListModelsV1Response": ".types", + "ListModelsV1ResponseParams": ".requests", + "ListModelsV1ResponseSttModels": ".types", + "ListModelsV1ResponseSttModelsParams": ".requests", + "ListModelsV1ResponseTtsModels": ".types", + "ListModelsV1ResponseTtsModelsMetadata": ".types", + "ListModelsV1ResponseTtsModelsMetadataParams": ".requests", + "ListModelsV1ResponseTtsModelsParams": ".requests", + "ListProjectBalancesV1Response": ".types", + "ListProjectBalancesV1ResponseBalancesItem": ".types", + "ListProjectBalancesV1ResponseBalancesItemParams": ".requests", + "ListProjectBalancesV1ResponseParams": ".requests", + "ListProjectDistributionCredentialsV1Response": ".types", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem": ".types", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials": ".types", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentialsParams": ".requests", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember": ".types", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMemberParams": ".requests", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemParams": ".requests", + "ListProjectDistributionCredentialsV1ResponseParams": ".requests", + "ListProjectInvitesV1Response": ".types", + "ListProjectInvitesV1ResponseInvitesItem": ".types", + "ListProjectInvitesV1ResponseInvitesItemParams": ".requests", + "ListProjectInvitesV1ResponseParams": ".requests", + "ListProjectKeysV1Response": ".types", + "ListProjectKeysV1ResponseApiKeysItem": ".types", + "ListProjectKeysV1ResponseApiKeysItemApiKey": ".types", + "ListProjectKeysV1ResponseApiKeysItemApiKeyParams": ".requests", + "ListProjectKeysV1ResponseApiKeysItemMember": ".types", + "ListProjectKeysV1ResponseApiKeysItemMemberParams": ".requests", + "ListProjectKeysV1ResponseApiKeysItemParams": ".requests", + "ListProjectKeysV1ResponseParams": ".requests", + "ListProjectMemberScopesV1Response": ".types", + "ListProjectMemberScopesV1ResponseParams": ".requests", + "ListProjectMembersV1Response": ".types", + "ListProjectMembersV1ResponseMembersItem": ".types", + "ListProjectMembersV1ResponseMembersItemParams": ".requests", + "ListProjectMembersV1ResponseParams": ".requests", + "ListProjectPurchasesV1Response": ".types", + "ListProjectPurchasesV1ResponseOrdersItem": ".types", + "ListProjectPurchasesV1ResponseOrdersItemParams": ".requests", + "ListProjectPurchasesV1ResponseParams": ".requests", + "ListProjectRequestsV1Response": ".types", + "ListProjectRequestsV1ResponseParams": ".requests", + "ListProjectsV1Response": ".types", + "ListProjectsV1ResponseParams": ".requests", + "ListProjectsV1ResponseProjectsItem": ".types", + "ListProjectsV1ResponseProjectsItemParams": ".requests", + "ListenV1AcceptedResponse": ".types", + "ListenV1AcceptedResponseParams": ".requests", + "ListenV1Callback": ".types", + "ListenV1CallbackMethod": ".types", + "ListenV1Channels": ".types", + "ListenV1DetectEntities": ".types", + "ListenV1Diarize": ".types", + "ListenV1Dictation": ".types", + "ListenV1Encoding": ".types", + "ListenV1Endpointing": ".types", + "ListenV1Extra": ".types", + "ListenV1InterimResults": ".types", + "ListenV1Keyterm": ".types", + "ListenV1Keywords": ".types", + "ListenV1Language": ".types", + "ListenV1MipOptOut": ".types", + "ListenV1Model": ".types", + "ListenV1Multichannel": ".types", + "ListenV1Numerals": ".types", + "ListenV1ProfanityFilter": ".types", + "ListenV1Punctuate": ".types", + "ListenV1Redact": ".types", + "ListenV1Replace": ".types", + "ListenV1RequestFile": ".types", + "ListenV1Response": ".types", + "ListenV1ResponseMetadata": ".types", + "ListenV1ResponseMetadataDiarizeInfo": ".types", + "ListenV1ResponseMetadataDiarizeInfoParams": ".requests", + "ListenV1ResponseMetadataIntentsInfo": ".types", + "ListenV1ResponseMetadataIntentsInfoParams": ".requests", + "ListenV1ResponseMetadataParams": ".requests", + "ListenV1ResponseMetadataSentimentInfo": ".types", + "ListenV1ResponseMetadataSentimentInfoParams": ".requests", + "ListenV1ResponseMetadataSummaryInfo": ".types", + "ListenV1ResponseMetadataSummaryInfoParams": ".requests", + "ListenV1ResponseMetadataTopicsInfo": ".types", + "ListenV1ResponseMetadataTopicsInfoParams": ".requests", + "ListenV1ResponseParams": ".requests", + "ListenV1ResponseResults": ".types", + "ListenV1ResponseResultsChannels": ".types", + "ListenV1ResponseResultsChannelsItem": ".types", + "ListenV1ResponseResultsChannelsItemAlternativesItem": ".types", + "ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem": ".types", + "ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItemParams": ".requests", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs": ".types", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem": ".types", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemParams": ".requests", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem": ".types", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItemParams": ".requests", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParams": ".requests", + "ListenV1ResponseResultsChannelsItemAlternativesItemParams": ".requests", + "ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem": ".types", + "ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItemParams": ".requests", + "ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem": ".types", + "ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItemParams": ".requests", + "ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem": ".types", + "ListenV1ResponseResultsChannelsItemAlternativesItemWordsItemParams": ".requests", + "ListenV1ResponseResultsChannelsItemParams": ".requests", + "ListenV1ResponseResultsChannelsItemSearchItem": ".types", + "ListenV1ResponseResultsChannelsItemSearchItemHitsItem": ".types", + "ListenV1ResponseResultsChannelsItemSearchItemHitsItemParams": ".requests", + "ListenV1ResponseResultsChannelsItemSearchItemParams": ".requests", + "ListenV1ResponseResultsChannelsParams": ".requests", + "ListenV1ResponseResultsParams": ".requests", + "ListenV1ResponseResultsSummary": ".types", + "ListenV1ResponseResultsSummaryParams": ".requests", + "ListenV1ResponseResultsUtterances": ".types", + "ListenV1ResponseResultsUtterancesItem": ".types", + "ListenV1ResponseResultsUtterancesItemParams": ".requests", + "ListenV1ResponseResultsUtterancesItemWordsItem": ".types", + "ListenV1ResponseResultsUtterancesItemWordsItemParams": ".requests", + "ListenV1ResponseResultsUtterancesParams": ".requests", + "ListenV1SampleRate": ".types", + "ListenV1Search": ".types", + "ListenV1SmartFormat": ".types", + "ListenV1Tag": ".types", + "ListenV1UtteranceEndMs": ".types", + "ListenV1VadEvents": ".types", + "ListenV1Version": ".types", + "ListenV2ConfigureNumerals": ".types", + "ListenV2EagerEotThreshold": ".types", + "ListenV2Encoding": ".types", + "ListenV2EotThreshold": ".types", + "ListenV2EotTimeoutMs": ".types", + "ListenV2Keyterm": ".types", + "ListenV2KeytermParams": ".requests", + "ListenV2LanguageHint": ".types", + "ListenV2LanguageHintParams": ".requests", + "ListenV2MipOptOut": ".types", + "ListenV2Model": ".types", + "ListenV2Numerals": ".types", + "ListenV2ProfanityFilter": ".types", + "ListenV2Redact": ".types", + "ListenV2SampleRate": ".types", + "ListenV2Tag": ".types", + "OpenAiSpeakProvider": ".types", + "OpenAiSpeakProviderModel": ".types", + "OpenAiSpeakProviderParams": ".requests", + "OpenAiSpeakProviderVoice": ".types", + "OpenAiThinkProvider": ".types", + "OpenAiThinkProviderModel": ".types", + "OpenAiThinkProviderParams": ".requests", + "OpenAiThinkProviderReasoningMode": ".types", + "ProjectRequestResponse": ".types", + "ProjectRequestResponseParams": ".requests", + "ReadV1Request": ".types", + "ReadV1RequestParams": ".requests", + "ReadV1RequestText": ".types", + "ReadV1RequestTextParams": ".requests", + "ReadV1RequestUrl": ".types", + "ReadV1RequestUrlParams": ".requests", + "ReadV1Response": ".types", + "ReadV1ResponseMetadata": ".types", + "ReadV1ResponseMetadataMetadata": ".types", + "ReadV1ResponseMetadataMetadataIntentsInfo": ".types", + "ReadV1ResponseMetadataMetadataIntentsInfoParams": ".requests", + "ReadV1ResponseMetadataMetadataParams": ".requests", + "ReadV1ResponseMetadataMetadataSentimentInfo": ".types", + "ReadV1ResponseMetadataMetadataSentimentInfoParams": ".requests", + "ReadV1ResponseMetadataMetadataSummaryInfo": ".types", + "ReadV1ResponseMetadataMetadataSummaryInfoParams": ".requests", + "ReadV1ResponseMetadataMetadataTopicsInfo": ".types", + "ReadV1ResponseMetadataMetadataTopicsInfoParams": ".requests", + "ReadV1ResponseMetadataParams": ".requests", + "ReadV1ResponseParams": ".requests", + "ReadV1ResponseResults": ".types", + "ReadV1ResponseResultsParams": ".requests", + "ReadV1ResponseResultsSummary": ".types", + "ReadV1ResponseResultsSummaryParams": ".requests", + "ReadV1ResponseResultsSummaryResults": ".types", + "ReadV1ResponseResultsSummaryResultsParams": ".requests", + "ReadV1ResponseResultsSummaryResultsSummary": ".types", + "ReadV1ResponseResultsSummaryResultsSummaryParams": ".requests", + "SharedIntents": ".types", + "SharedIntentsParams": ".requests", + "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", + "AnthropicThinkProviderModel": ".types", + "CartesiaSpeakProviderModelId": ".types", + "CartesiaSpeakProviderVoice": ".types", + "CartesiaSpeakProviderVoiceParams": ".requests", + "CreateKeyV1RequestOne": ".types", + "DeepgramListenProviderV2LanguageHint": ".types", + "DeepgramListenProviderV2LanguageHintParams": ".requests", + "DeepgramSpeakProviderModel": ".types", + "GoogleThinkProviderModel": ".types", + "GoogleThinkProviderVersion": ".types", + "GroqThinkProviderReasoningMode": ".types", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "AgentConfigurationV1", + "AgentConfigurationV1Params", + "AgentThinkModelsV1Response", + "AgentThinkModelsV1ResponseModelsItem", + "AgentThinkModelsV1ResponseModelsItemId", + "AgentThinkModelsV1ResponseModelsItemIdParams", + "AgentThinkModelsV1ResponseModelsItemOne", + "AgentThinkModelsV1ResponseModelsItemOneId", + "AgentThinkModelsV1ResponseModelsItemOneParams", + "AgentThinkModelsV1ResponseModelsItemParams", + "AgentThinkModelsV1ResponseModelsItemThree", + "AgentThinkModelsV1ResponseModelsItemThreeParams", + "AgentThinkModelsV1ResponseModelsItemTwo", + "AgentThinkModelsV1ResponseModelsItemTwoId", + "AgentThinkModelsV1ResponseModelsItemTwoParams", + "AgentThinkModelsV1ResponseModelsItemZero", + "AgentThinkModelsV1ResponseModelsItemZeroId", + "AgentThinkModelsV1ResponseModelsItemZeroParams", + "AgentThinkModelsV1ResponseParams", + "AgentVariableV1", + "AgentVariableV1Params", + "Anthropic", + "AnthropicModel", + "AnthropicParams", + "AsyncDeepgramClient", + "AwsBedrockThinkProvider", + "AwsBedrockThinkProviderCredentials", + "AwsBedrockThinkProviderCredentialsParams", + "AwsBedrockThinkProviderCredentialsType", + "AwsBedrockThinkProviderModel", + "AwsBedrockThinkProviderParams", + "AwsPollySpeakProvider", + "AwsPollySpeakProviderCredentials", + "AwsPollySpeakProviderCredentialsParams", + "AwsPollySpeakProviderCredentialsType", + "AwsPollySpeakProviderEngine", + "AwsPollySpeakProviderParams", + "AwsPollySpeakProviderVoice", + "BadRequestError", + "BillingBreakdownV1Response", + "BillingBreakdownV1ResponseParams", + "BillingBreakdownV1ResponseResolution", + "BillingBreakdownV1ResponseResolutionParams", + "BillingBreakdownV1ResponseResultsItem", + "BillingBreakdownV1ResponseResultsItemGrouping", + "BillingBreakdownV1ResponseResultsItemGroupingParams", + "BillingBreakdownV1ResponseResultsItemParams", + "Cartesia", + "CartesiaModelId", + "CartesiaParams", + "CartesiaVoice", + "CartesiaVoiceParams", + "CreateAgentConfigurationV1Response", + "CreateAgentConfigurationV1ResponseParams", + "CreateKeyV1Request", + "CreateKeyV1RequestParams", + "CreateKeyV1Response", + "CreateKeyV1ResponseParams", + "CreateProjectDistributionCredentialsV1Response", + "CreateProjectDistributionCredentialsV1ResponseDistributionCredentials", + "CreateProjectDistributionCredentialsV1ResponseDistributionCredentialsParams", + "CreateProjectDistributionCredentialsV1ResponseMember", + "CreateProjectDistributionCredentialsV1ResponseMemberParams", + "CreateProjectDistributionCredentialsV1ResponseParams", + "CreateProjectInviteV1Response", + "CreateProjectInviteV1ResponseParams", + "Deepgram", + "DeepgramClient", + "DeepgramClientEnvironment", + "DeepgramListenProviderV1", + "DeepgramListenProviderV1Params", + "DeepgramListenProviderV2", + "DeepgramListenProviderV2Params", + "DeepgramModel", + "DeepgramParams", + "DefaultAioHttpClient", + "DefaultAsyncHttpxClient", + "DeleteAgentConfigurationV1Response", + "DeleteAgentVariableV1Response", + "DeleteProjectInviteV1Response", + "DeleteProjectInviteV1ResponseParams", + "DeleteProjectKeyV1Response", + "DeleteProjectKeyV1ResponseParams", + "DeleteProjectMemberV1Response", + "DeleteProjectMemberV1ResponseParams", + "DeleteProjectV1Response", + "DeleteProjectV1ResponseParams", + "ElevenLabsSpeakProvider", + "ElevenLabsSpeakProviderModelId", + "ElevenLabsSpeakProviderParams", + "ErrorResponse", + "ErrorResponseLegacyError", + "ErrorResponseLegacyErrorParams", + "ErrorResponseModernError", + "ErrorResponseModernErrorParams", + "ErrorResponseParams", + "ErrorResponseTextError", + "GetModelV1Response", + "GetModelV1ResponseBatch", + "GetModelV1ResponseBatchParams", + "GetModelV1ResponseMetadata", + "GetModelV1ResponseMetadataMetadata", + "GetModelV1ResponseMetadataMetadataParams", + "GetModelV1ResponseMetadataParams", + "GetModelV1ResponseParams", + "GetProjectBalanceV1Response", + "GetProjectBalanceV1ResponseParams", + "GetProjectDistributionCredentialsV1Response", + "GetProjectDistributionCredentialsV1ResponseDistributionCredentials", + "GetProjectDistributionCredentialsV1ResponseDistributionCredentialsParams", + "GetProjectDistributionCredentialsV1ResponseMember", + "GetProjectDistributionCredentialsV1ResponseMemberParams", + "GetProjectDistributionCredentialsV1ResponseParams", + "GetProjectKeyV1Response", + "GetProjectKeyV1ResponseItem", + "GetProjectKeyV1ResponseItemMember", + "GetProjectKeyV1ResponseItemMemberApiKey", + "GetProjectKeyV1ResponseItemMemberApiKeyParams", + "GetProjectKeyV1ResponseItemMemberParams", + "GetProjectKeyV1ResponseItemParams", + "GetProjectKeyV1ResponseParams", + "GetProjectRequestV1Response", + "GetProjectRequestV1ResponseParams", + "GetProjectV1Response", + "GetProjectV1ResponseParams", + "Google", + "GoogleModel", + "GoogleParams", + "GoogleVersion", + "GrantV1Response", + "GrantV1ResponseParams", + "Groq", + "GroqParams", + "GroqReasoningMode", + "LeaveProjectV1Response", + "LeaveProjectV1ResponseParams", + "ListAgentConfigurationsV1Response", + "ListAgentConfigurationsV1ResponseParams", + "ListAgentVariablesV1Response", + "ListAgentVariablesV1ResponseParams", + "ListBillingFieldsV1Response", + "ListBillingFieldsV1ResponseDeploymentsItem", + "ListBillingFieldsV1ResponseParams", + "ListModelsV1Response", + "ListModelsV1ResponseParams", + "ListModelsV1ResponseSttModels", + "ListModelsV1ResponseSttModelsParams", + "ListModelsV1ResponseTtsModels", + "ListModelsV1ResponseTtsModelsMetadata", + "ListModelsV1ResponseTtsModelsMetadataParams", + "ListModelsV1ResponseTtsModelsParams", + "ListProjectBalancesV1Response", + "ListProjectBalancesV1ResponseBalancesItem", + "ListProjectBalancesV1ResponseBalancesItemParams", + "ListProjectBalancesV1ResponseParams", + "ListProjectDistributionCredentialsV1Response", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentialsParams", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMemberParams", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemParams", + "ListProjectDistributionCredentialsV1ResponseParams", + "ListProjectInvitesV1Response", + "ListProjectInvitesV1ResponseInvitesItem", + "ListProjectInvitesV1ResponseInvitesItemParams", + "ListProjectInvitesV1ResponseParams", + "ListProjectKeysV1Response", + "ListProjectKeysV1ResponseApiKeysItem", + "ListProjectKeysV1ResponseApiKeysItemApiKey", + "ListProjectKeysV1ResponseApiKeysItemApiKeyParams", + "ListProjectKeysV1ResponseApiKeysItemMember", + "ListProjectKeysV1ResponseApiKeysItemMemberParams", + "ListProjectKeysV1ResponseApiKeysItemParams", + "ListProjectKeysV1ResponseParams", + "ListProjectMemberScopesV1Response", + "ListProjectMemberScopesV1ResponseParams", + "ListProjectMembersV1Response", + "ListProjectMembersV1ResponseMembersItem", + "ListProjectMembersV1ResponseMembersItemParams", + "ListProjectMembersV1ResponseParams", + "ListProjectPurchasesV1Response", + "ListProjectPurchasesV1ResponseOrdersItem", + "ListProjectPurchasesV1ResponseOrdersItemParams", + "ListProjectPurchasesV1ResponseParams", + "ListProjectRequestsV1Response", + "ListProjectRequestsV1ResponseParams", + "ListProjectsV1Response", + "ListProjectsV1ResponseParams", + "ListProjectsV1ResponseProjectsItem", + "ListProjectsV1ResponseProjectsItemParams", + "ListenV1AcceptedResponse", + "ListenV1AcceptedResponseParams", + "ListenV1Callback", + "ListenV1CallbackMethod", + "ListenV1Channels", + "ListenV1DetectEntities", + "ListenV1Diarize", + "ListenV1Dictation", + "ListenV1Encoding", + "ListenV1Endpointing", + "ListenV1Extra", + "ListenV1InterimResults", + "ListenV1Keyterm", + "ListenV1Keywords", + "ListenV1Language", + "ListenV1MipOptOut", + "ListenV1Model", + "ListenV1Multichannel", + "ListenV1Numerals", + "ListenV1ProfanityFilter", + "ListenV1Punctuate", + "ListenV1Redact", + "ListenV1Replace", + "ListenV1RequestFile", + "ListenV1Response", + "ListenV1ResponseMetadata", + "ListenV1ResponseMetadataDiarizeInfo", + "ListenV1ResponseMetadataDiarizeInfoParams", + "ListenV1ResponseMetadataIntentsInfo", + "ListenV1ResponseMetadataIntentsInfoParams", + "ListenV1ResponseMetadataParams", + "ListenV1ResponseMetadataSentimentInfo", + "ListenV1ResponseMetadataSentimentInfoParams", + "ListenV1ResponseMetadataSummaryInfo", + "ListenV1ResponseMetadataSummaryInfoParams", + "ListenV1ResponseMetadataTopicsInfo", + "ListenV1ResponseMetadataTopicsInfoParams", + "ListenV1ResponseParams", + "ListenV1ResponseResults", + "ListenV1ResponseResultsChannels", + "ListenV1ResponseResultsChannelsItem", + "ListenV1ResponseResultsChannelsItemAlternativesItem", + "ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem", + "ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItemParams", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemParams", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItemParams", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParams", + "ListenV1ResponseResultsChannelsItemAlternativesItemParams", + "ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem", + "ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItemParams", + "ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem", + "ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItemParams", + "ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem", + "ListenV1ResponseResultsChannelsItemAlternativesItemWordsItemParams", + "ListenV1ResponseResultsChannelsItemParams", + "ListenV1ResponseResultsChannelsItemSearchItem", + "ListenV1ResponseResultsChannelsItemSearchItemHitsItem", + "ListenV1ResponseResultsChannelsItemSearchItemHitsItemParams", + "ListenV1ResponseResultsChannelsItemSearchItemParams", + "ListenV1ResponseResultsChannelsParams", + "ListenV1ResponseResultsParams", + "ListenV1ResponseResultsSummary", + "ListenV1ResponseResultsSummaryParams", + "ListenV1ResponseResultsUtterances", + "ListenV1ResponseResultsUtterancesItem", + "ListenV1ResponseResultsUtterancesItemParams", + "ListenV1ResponseResultsUtterancesItemWordsItem", + "ListenV1ResponseResultsUtterancesItemWordsItemParams", + "ListenV1ResponseResultsUtterancesParams", + "ListenV1SampleRate", + "ListenV1Search", + "ListenV1SmartFormat", + "ListenV1Tag", + "ListenV1UtteranceEndMs", + "ListenV1VadEvents", + "ListenV1Version", + "ListenV2ConfigureNumerals", + "ListenV2EagerEotThreshold", + "ListenV2Encoding", + "ListenV2EotThreshold", + "ListenV2EotTimeoutMs", + "ListenV2Keyterm", + "ListenV2KeytermParams", + "ListenV2LanguageHint", + "ListenV2LanguageHintParams", + "ListenV2MipOptOut", + "ListenV2Model", + "ListenV2Numerals", + "ListenV2ProfanityFilter", + "ListenV2Redact", + "ListenV2SampleRate", + "ListenV2Tag", + "OpenAiSpeakProvider", + "OpenAiSpeakProviderModel", + "OpenAiSpeakProviderParams", + "OpenAiSpeakProviderVoice", + "OpenAiThinkProvider", + "OpenAiThinkProviderModel", + "OpenAiThinkProviderParams", + "OpenAiThinkProviderReasoningMode", + "ProjectRequestResponse", + "ProjectRequestResponseParams", + "ReadV1Request", + "ReadV1RequestParams", + "ReadV1RequestText", + "ReadV1RequestTextParams", + "ReadV1RequestUrl", + "ReadV1RequestUrlParams", + "ReadV1Response", + "ReadV1ResponseMetadata", + "ReadV1ResponseMetadataMetadata", + "ReadV1ResponseMetadataMetadataIntentsInfo", + "ReadV1ResponseMetadataMetadataIntentsInfoParams", + "ReadV1ResponseMetadataMetadataParams", + "ReadV1ResponseMetadataMetadataSentimentInfo", + "ReadV1ResponseMetadataMetadataSentimentInfoParams", + "ReadV1ResponseMetadataMetadataSummaryInfo", + "ReadV1ResponseMetadataMetadataSummaryInfoParams", + "ReadV1ResponseMetadataMetadataTopicsInfo", + "ReadV1ResponseMetadataMetadataTopicsInfoParams", + "ReadV1ResponseMetadataParams", + "ReadV1ResponseParams", + "ReadV1ResponseResults", + "ReadV1ResponseResultsParams", + "ReadV1ResponseResultsSummary", + "ReadV1ResponseResultsSummaryParams", + "ReadV1ResponseResultsSummaryResults", + "ReadV1ResponseResultsSummaryResultsParams", + "ReadV1ResponseResultsSummaryResultsSummary", + "ReadV1ResponseResultsSummaryResultsSummaryParams", + "SharedIntents", + "SharedIntentsParams", + "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", + "AnthropicThinkProviderModel", + "CartesiaSpeakProviderModelId", + "CartesiaSpeakProviderVoice", + "CartesiaSpeakProviderVoiceParams", + "CreateKeyV1RequestOne", + "DeepgramListenProviderV2LanguageHint", + "DeepgramListenProviderV2LanguageHintParams", + "DeepgramSpeakProviderModel", + "GoogleThinkProviderModel", + "GoogleThinkProviderVersion", + "GroqThinkProviderReasoningMode", +] diff --git a/src/deepgram/agent/__init__.py.bak b/src/deepgram/agent/__init__.py.bak new file mode 100644 index 00000000..7a372700 --- /dev/null +++ b/src/deepgram/agent/__init__.py.bak @@ -0,0 +1,507 @@ +# 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, + AgentV1ForceEndTurn, + AgentV1ForceEndTurnParams, + AgentV1FunctionCallCancelled, + AgentV1FunctionCallCancelledFunctionsItem, + AgentV1FunctionCallCancelledFunctionsItemParams, + AgentV1FunctionCallCancelledParams, + 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, + 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", + "AgentV1AgentStartedSpeaking": ".v1", + "AgentV1AgentStartedSpeakingParams": ".v1", + "AgentV1AgentThinking": ".v1", + "AgentV1AgentThinkingParams": ".v1", + "AgentV1ConversationText": ".v1", + "AgentV1ConversationTextParams": ".v1", + "AgentV1ConversationTextRole": ".v1", + "AgentV1Error": ".v1", + "AgentV1ErrorParams": ".v1", + "AgentV1ForceEndTurn": ".v1", + "AgentV1ForceEndTurnParams": ".v1", + "AgentV1FunctionCallCancelled": ".v1", + "AgentV1FunctionCallCancelledFunctionsItem": ".v1", + "AgentV1FunctionCallCancelledFunctionsItemParams": ".v1", + "AgentV1FunctionCallCancelledParams": ".v1", + "AgentV1FunctionCallRequest": ".v1", + "AgentV1FunctionCallRequestFunctionsItem": ".v1", + "AgentV1FunctionCallRequestFunctionsItemParams": ".v1", + "AgentV1FunctionCallRequestParams": ".v1", + "AgentV1History": ".v1", + "AgentV1HistoryParams": ".v1", + "AgentV1InjectAgentMessage": ".v1", + "AgentV1InjectAgentMessageBehavior": ".v1", + "AgentV1InjectAgentMessageParams": ".v1", + "AgentV1InjectUserMessage": ".v1", + "AgentV1InjectUserMessageParams": ".v1", + "AgentV1InjectionRefused": ".v1", + "AgentV1InjectionRefusedParams": ".v1", + "AgentV1KeepAlive": ".v1", + "AgentV1KeepAliveParams": ".v1", + "AgentV1LatencyReport": ".v1", + "AgentV1LatencyReportParams": ".v1", + "AgentV1ListenUpdated": ".v1", + "AgentV1ListenUpdatedParams": ".v1", + "AgentV1PromptUpdated": ".v1", + "AgentV1PromptUpdatedParams": ".v1", + "AgentV1ReceiveFunctionCallResponse": ".v1", + "AgentV1ReceiveFunctionCallResponseParams": ".v1", + "AgentV1SendFunctionCallResponse": ".v1", + "AgentV1SendFunctionCallResponseParams": ".v1", + "AgentV1Settings": ".v1", + "AgentV1SettingsAgent": ".v1", + "AgentV1SettingsAgentContext": ".v1", + "AgentV1SettingsAgentContextContext": ".v1", + "AgentV1SettingsAgentContextContextMessagesItem": ".v1", + "AgentV1SettingsAgentContextContextMessagesItemParams": ".v1", + "AgentV1SettingsAgentContextContextParams": ".v1", + "AgentV1SettingsAgentContextListen": ".v1", + "AgentV1SettingsAgentContextListenParams": ".v1", + "AgentV1SettingsAgentContextListenProvider": ".v1", + "AgentV1SettingsAgentContextListenProviderParams": ".v1", + "AgentV1SettingsAgentContextListenProvider_V1": ".v1", + "AgentV1SettingsAgentContextListenProvider_V1Params": ".v1", + "AgentV1SettingsAgentContextListenProvider_V2": ".v1", + "AgentV1SettingsAgentContextListenProvider_V2Params": ".v1", + "AgentV1SettingsAgentContextParams": ".v1", + "AgentV1SettingsAgentContextSpeak": ".v1", + "AgentV1SettingsAgentContextSpeakParams": ".v1", + "AgentV1SettingsAgentContextThink": ".v1", + "AgentV1SettingsAgentContextThinkParams": ".v1", + "AgentV1SettingsAgentListen": ".v1", + "AgentV1SettingsAgentListenParams": ".v1", + "AgentV1SettingsAgentListenProvider": ".v1", + "AgentV1SettingsAgentListenProviderParams": ".v1", + "AgentV1SettingsAgentListenProvider_V1": ".v1", + "AgentV1SettingsAgentListenProvider_V1Params": ".v1", + "AgentV1SettingsAgentListenProvider_V2": ".v1", + "AgentV1SettingsAgentListenProvider_V2Params": ".v1", + "AgentV1SettingsAgentParams": ".v1", + "AgentV1SettingsAgentSpeak": ".v1", + "AgentV1SettingsAgentSpeakParams": ".v1", + "AgentV1SettingsAgentThink": ".v1", + "AgentV1SettingsAgentThinkParams": ".v1", + "AgentV1SettingsApplied": ".v1", + "AgentV1SettingsAppliedParams": ".v1", + "AgentV1SettingsAudio": ".v1", + "AgentV1SettingsAudioInput": ".v1", + "AgentV1SettingsAudioInputEncoding": ".v1", + "AgentV1SettingsAudioInputParams": ".v1", + "AgentV1SettingsAudioOutput": ".v1", + "AgentV1SettingsAudioOutputContainer": ".v1", + "AgentV1SettingsAudioOutputEncoding": ".v1", + "AgentV1SettingsAudioOutputParams": ".v1", + "AgentV1SettingsAudioParams": ".v1", + "AgentV1SettingsFlags": ".v1", + "AgentV1SettingsFlagsParams": ".v1", + "AgentV1SettingsParams": ".v1", + "AgentV1SpeakUpdated": ".v1", + "AgentV1SpeakUpdatedParams": ".v1", + "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", + "AgentV1HistoryContent": ".v1", + "AgentV1HistoryContentParams": ".v1", + "AgentV1HistoryContentRole": ".v1", + "AgentV1HistoryFunctionCalls": ".v1", + "AgentV1HistoryFunctionCallsFunctionCallsItem": ".v1", + "AgentV1HistoryFunctionCallsFunctionCallsItemParams": ".v1", + "AgentV1HistoryFunctionCallsParams": ".v1", + "AgentV1SettingsAgentContextContextMessagesItemContentRole": ".v1", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem": ".v1", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams": ".v1", + "AgentV1SettingsAgentContextListenProviderV1": ".v1", + "AgentV1SettingsAgentContextListenProviderV1Params": ".v1", + "AgentV1SettingsAgentContextListenProviderV2": ".v1", + "AgentV1SettingsAgentContextListenProviderV2LanguageHint": ".v1", + "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams": ".v1", + "AgentV1SettingsAgentContextListenProviderV2Params": ".v1", + "AgentV1SettingsAgentContextMessagesItem": ".v1", + "AgentV1SettingsAgentContextMessagesItemContent": ".v1", + "AgentV1SettingsAgentContextMessagesItemContentParams": ".v1", + "AgentV1SettingsAgentContextMessagesItemContentRole": ".v1", + "AgentV1SettingsAgentContextMessagesItemFunctionCalls": ".v1", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem": ".v1", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams": ".v1", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams": ".v1", + "AgentV1SettingsAgentContextMessagesItemParams": ".v1", + "AgentV1SettingsAgentListenProviderV1": ".v1", + "AgentV1SettingsAgentListenProviderV1Params": ".v1", + "AgentV1SettingsAgentListenProviderV2": ".v1", + "AgentV1SettingsAgentListenProviderV2Params": ".v1", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "AgentV1AgentAudioDone", + "AgentV1AgentAudioDoneParams", + "AgentV1AgentStartedSpeaking", + "AgentV1AgentStartedSpeakingParams", + "AgentV1AgentThinking", + "AgentV1AgentThinkingParams", + "AgentV1ConversationText", + "AgentV1ConversationTextParams", + "AgentV1ConversationTextRole", + "AgentV1Error", + "AgentV1ErrorParams", + "AgentV1ForceEndTurn", + "AgentV1ForceEndTurnParams", + "AgentV1FunctionCallCancelled", + "AgentV1FunctionCallCancelledFunctionsItem", + "AgentV1FunctionCallCancelledFunctionsItemParams", + "AgentV1FunctionCallCancelledParams", + "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", + "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/v1/__init__.py.bak b/src/deepgram/agent/v1/__init__.py.bak new file mode 100644 index 00000000..ef258d66 --- /dev/null +++ b/src/deepgram/agent/v1/__init__.py.bak @@ -0,0 +1,511 @@ +# 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, + AgentV1ForceEndTurn, + AgentV1FunctionCallCancelled, + AgentV1FunctionCallCancelledFunctionsItem, + 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, + AgentV1ForceEndTurnParams, + AgentV1FunctionCallCancelledFunctionsItemParams, + AgentV1FunctionCallCancelledParams, + 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, + 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", + "AgentV1AgentStartedSpeaking": ".types", + "AgentV1AgentStartedSpeakingParams": ".requests", + "AgentV1AgentThinking": ".types", + "AgentV1AgentThinkingParams": ".requests", + "AgentV1ConversationText": ".types", + "AgentV1ConversationTextParams": ".requests", + "AgentV1ConversationTextRole": ".types", + "AgentV1Error": ".types", + "AgentV1ErrorParams": ".requests", + "AgentV1ForceEndTurn": ".types", + "AgentV1ForceEndTurnParams": ".requests", + "AgentV1FunctionCallCancelled": ".types", + "AgentV1FunctionCallCancelledFunctionsItem": ".types", + "AgentV1FunctionCallCancelledFunctionsItemParams": ".requests", + "AgentV1FunctionCallCancelledParams": ".requests", + "AgentV1FunctionCallRequest": ".types", + "AgentV1FunctionCallRequestFunctionsItem": ".types", + "AgentV1FunctionCallRequestFunctionsItemParams": ".requests", + "AgentV1FunctionCallRequestParams": ".requests", + "AgentV1History": ".types", + "AgentV1HistoryParams": ".requests", + "AgentV1InjectAgentMessage": ".types", + "AgentV1InjectAgentMessageBehavior": ".types", + "AgentV1InjectAgentMessageParams": ".requests", + "AgentV1InjectUserMessage": ".types", + "AgentV1InjectUserMessageParams": ".requests", + "AgentV1InjectionRefused": ".types", + "AgentV1InjectionRefusedParams": ".requests", + "AgentV1KeepAlive": ".types", + "AgentV1KeepAliveParams": ".requests", + "AgentV1LatencyReport": ".types", + "AgentV1LatencyReportParams": ".requests", + "AgentV1ListenUpdated": ".types", + "AgentV1ListenUpdatedParams": ".requests", + "AgentV1PromptUpdated": ".types", + "AgentV1PromptUpdatedParams": ".requests", + "AgentV1ReceiveFunctionCallResponse": ".types", + "AgentV1ReceiveFunctionCallResponseParams": ".requests", + "AgentV1SendFunctionCallResponse": ".types", + "AgentV1SendFunctionCallResponseParams": ".requests", + "AgentV1Settings": ".types", + "AgentV1SettingsAgent": ".types", + "AgentV1SettingsAgentContext": ".types", + "AgentV1SettingsAgentContextContext": ".types", + "AgentV1SettingsAgentContextContextMessagesItem": ".types", + "AgentV1SettingsAgentContextContextMessagesItemParams": ".requests", + "AgentV1SettingsAgentContextContextParams": ".requests", + "AgentV1SettingsAgentContextListen": ".types", + "AgentV1SettingsAgentContextListenParams": ".requests", + "AgentV1SettingsAgentContextListenProvider": ".types", + "AgentV1SettingsAgentContextListenProviderParams": ".requests", + "AgentV1SettingsAgentContextListenProvider_V1": ".types", + "AgentV1SettingsAgentContextListenProvider_V1Params": ".requests", + "AgentV1SettingsAgentContextListenProvider_V2": ".types", + "AgentV1SettingsAgentContextListenProvider_V2Params": ".requests", + "AgentV1SettingsAgentContextParams": ".requests", + "AgentV1SettingsAgentContextSpeak": ".types", + "AgentV1SettingsAgentContextSpeakParams": ".requests", + "AgentV1SettingsAgentContextThink": ".types", + "AgentV1SettingsAgentContextThinkParams": ".requests", + "AgentV1SettingsAgentListen": ".types", + "AgentV1SettingsAgentListenParams": ".requests", + "AgentV1SettingsAgentListenProvider": ".types", + "AgentV1SettingsAgentListenProviderParams": ".requests", + "AgentV1SettingsAgentListenProvider_V1": ".types", + "AgentV1SettingsAgentListenProvider_V1Params": ".requests", + "AgentV1SettingsAgentListenProvider_V2": ".types", + "AgentV1SettingsAgentListenProvider_V2Params": ".requests", + "AgentV1SettingsAgentParams": ".requests", + "AgentV1SettingsAgentSpeak": ".types", + "AgentV1SettingsAgentSpeakParams": ".requests", + "AgentV1SettingsAgentThink": ".types", + "AgentV1SettingsAgentThinkParams": ".requests", + "AgentV1SettingsApplied": ".types", + "AgentV1SettingsAppliedParams": ".requests", + "AgentV1SettingsAudio": ".types", + "AgentV1SettingsAudioInput": ".types", + "AgentV1SettingsAudioInputEncoding": ".types", + "AgentV1SettingsAudioInputParams": ".requests", + "AgentV1SettingsAudioOutput": ".types", + "AgentV1SettingsAudioOutputContainer": ".types", + "AgentV1SettingsAudioOutputEncoding": ".types", + "AgentV1SettingsAudioOutputParams": ".requests", + "AgentV1SettingsAudioParams": ".requests", + "AgentV1SettingsFlags": ".types", + "AgentV1SettingsFlagsParams": ".requests", + "AgentV1SettingsParams": ".requests", + "AgentV1SpeakUpdated": ".types", + "AgentV1SpeakUpdatedParams": ".requests", + "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", + "AgentV1HistoryContent": ".types", + "AgentV1HistoryContentParams": ".requests", + "AgentV1HistoryContentRole": ".types", + "AgentV1HistoryFunctionCalls": ".types", + "AgentV1HistoryFunctionCallsFunctionCallsItem": ".types", + "AgentV1HistoryFunctionCallsFunctionCallsItemParams": ".requests", + "AgentV1HistoryFunctionCallsParams": ".requests", + "AgentV1SettingsAgentContextContextMessagesItemContentRole": ".types", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem": ".types", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams": ".requests", + "AgentV1SettingsAgentContextListenProviderV1": ".types", + "AgentV1SettingsAgentContextListenProviderV1Params": ".requests", + "AgentV1SettingsAgentContextListenProviderV2": ".types", + "AgentV1SettingsAgentContextListenProviderV2LanguageHint": ".types", + "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams": ".requests", + "AgentV1SettingsAgentContextListenProviderV2Params": ".requests", + "AgentV1SettingsAgentContextMessagesItem": ".types", + "AgentV1SettingsAgentContextMessagesItemContent": ".types", + "AgentV1SettingsAgentContextMessagesItemContentParams": ".requests", + "AgentV1SettingsAgentContextMessagesItemContentRole": ".types", + "AgentV1SettingsAgentContextMessagesItemFunctionCalls": ".types", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem": ".types", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams": ".requests", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams": ".requests", + "AgentV1SettingsAgentContextMessagesItemParams": ".requests", + "AgentV1SettingsAgentListenProviderV1": ".types", + "AgentV1SettingsAgentListenProviderV1Params": ".requests", + "AgentV1SettingsAgentListenProviderV2": ".types", + "AgentV1SettingsAgentListenProviderV2Params": ".requests", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "AgentV1AgentAudioDone", + "AgentV1AgentAudioDoneParams", + "AgentV1AgentStartedSpeaking", + "AgentV1AgentStartedSpeakingParams", + "AgentV1AgentThinking", + "AgentV1AgentThinkingParams", + "AgentV1ConversationText", + "AgentV1ConversationTextParams", + "AgentV1ConversationTextRole", + "AgentV1Error", + "AgentV1ErrorParams", + "AgentV1ForceEndTurn", + "AgentV1ForceEndTurnParams", + "AgentV1FunctionCallCancelled", + "AgentV1FunctionCallCancelledFunctionsItem", + "AgentV1FunctionCallCancelledFunctionsItemParams", + "AgentV1FunctionCallCancelledParams", + "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", + "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/requests/__init__.py.bak b/src/deepgram/agent/v1/requests/__init__.py.bak new file mode 100644 index 00000000..16e50f9d --- /dev/null +++ b/src/deepgram/agent/v1/requests/__init__.py.bak @@ -0,0 +1,262 @@ +# 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_v1force_end_turn import AgentV1ForceEndTurnParams + from .agent_v1function_call_cancelled import AgentV1FunctionCallCancelledParams + from .agent_v1function_call_cancelled_functions_item import AgentV1FunctionCallCancelledFunctionsItemParams + from .agent_v1function_call_request import AgentV1FunctionCallRequestParams + from .agent_v1function_call_request_functions_item import AgentV1FunctionCallRequestFunctionsItemParams + from .agent_v1history import AgentV1HistoryParams + from .agent_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 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", + "AgentV1AgentThinkingParams": ".agent_v1agent_thinking", + "AgentV1ConversationTextParams": ".agent_v1conversation_text", + "AgentV1ErrorParams": ".agent_v1error", + "AgentV1ForceEndTurnParams": ".agent_v1force_end_turn", + "AgentV1FunctionCallCancelledFunctionsItemParams": ".agent_v1function_call_cancelled_functions_item", + "AgentV1FunctionCallCancelledParams": ".agent_v1function_call_cancelled", + "AgentV1FunctionCallRequestFunctionsItemParams": ".agent_v1function_call_request_functions_item", + "AgentV1FunctionCallRequestParams": ".agent_v1function_call_request", + "AgentV1HistoryParams": ".agent_v1history", + "AgentV1InjectAgentMessageParams": ".agent_v1inject_agent_message", + "AgentV1InjectUserMessageParams": ".agent_v1inject_user_message", + "AgentV1InjectionRefusedParams": ".agent_v1injection_refused", + "AgentV1KeepAliveParams": ".agent_v1keep_alive", + "AgentV1LatencyReportParams": ".agent_v1latency_report", + "AgentV1ListenUpdatedParams": ".agent_v1listen_updated", + "AgentV1PromptUpdatedParams": ".agent_v1prompt_updated", + "AgentV1ReceiveFunctionCallResponseParams": ".agent_v1receive_function_call_response", + "AgentV1SendFunctionCallResponseParams": ".agent_v1send_function_call_response", + "AgentV1SettingsAgentContextContextMessagesItemParams": ".agent_v1settings_agent_context_context_messages_item", + "AgentV1SettingsAgentContextContextParams": ".agent_v1settings_agent_context_context", + "AgentV1SettingsAgentContextListenParams": ".agent_v1settings_agent_context_listen", + "AgentV1SettingsAgentContextListenProviderParams": ".agent_v1settings_agent_context_listen_provider", + "AgentV1SettingsAgentContextListenProvider_V1Params": ".agent_v1settings_agent_context_listen_provider", + "AgentV1SettingsAgentContextListenProvider_V2Params": ".agent_v1settings_agent_context_listen_provider", + "AgentV1SettingsAgentContextParams": ".agent_v1settings_agent_context", + "AgentV1SettingsAgentContextSpeakParams": ".agent_v1settings_agent_context_speak", + "AgentV1SettingsAgentContextThinkParams": ".agent_v1settings_agent_context_think", + "AgentV1SettingsAgentListenParams": ".agent_v1settings_agent_listen", + "AgentV1SettingsAgentListenProviderParams": ".agent_v1settings_agent_listen_provider", + "AgentV1SettingsAgentListenProvider_V1Params": ".agent_v1settings_agent_listen_provider", + "AgentV1SettingsAgentListenProvider_V2Params": ".agent_v1settings_agent_listen_provider", + "AgentV1SettingsAgentParams": ".agent_v1settings_agent", + "AgentV1SettingsAgentSpeakParams": ".agent_v1settings_agent_speak", + "AgentV1SettingsAgentThinkParams": ".agent_v1settings_agent_think", + "AgentV1SettingsAppliedParams": ".agent_v1settings_applied", + "AgentV1SettingsAudioInputParams": ".agent_v1settings_audio_input", + "AgentV1SettingsAudioOutputParams": ".agent_v1settings_audio_output", + "AgentV1SettingsAudioParams": ".agent_v1settings_audio", + "AgentV1SettingsFlagsParams": ".agent_v1settings_flags", + "AgentV1SettingsParams": ".agent_v1settings", + "AgentV1SpeakUpdatedParams": ".agent_v1speak_updated", + "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", + "AgentV1HistoryContentParams": ".agent_v1history_content", + "AgentV1HistoryFunctionCallsParams": ".agent_v1history_function_calls", + "AgentV1HistoryFunctionCallsFunctionCallsItemParams": ".agent_v1history_function_calls_function_calls_item", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams": ".agent_v1settings_agent_context_context_messages_item_function_calls_function_calls_item", + "AgentV1SettingsAgentContextListenProviderV1Params": ".agent_v1settings_agent_context_listen_provider_v1", + "AgentV1SettingsAgentContextListenProviderV2Params": ".agent_v1settings_agent_context_listen_provider_v2", + "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams": ".agent_v1settings_agent_context_listen_provider_v2language_hint", + "AgentV1SettingsAgentContextMessagesItemParams": ".agent_v1settings_agent_context_messages_item", + "AgentV1SettingsAgentContextMessagesItemContentParams": ".agent_v1settings_agent_context_messages_item_content", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams": ".agent_v1settings_agent_context_messages_item_function_calls", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams": ".agent_v1settings_agent_context_messages_item_function_calls_function_calls_item", + "AgentV1SettingsAgentListenProviderV1Params": ".agent_v1settings_agent_listen_provider_v1", + "AgentV1SettingsAgentListenProviderV2Params": ".agent_v1settings_agent_listen_provider_v2", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "AgentV1AgentAudioDoneParams", + "AgentV1AgentStartedSpeakingParams", + "AgentV1AgentThinkingParams", + "AgentV1ConversationTextParams", + "AgentV1ErrorParams", + "AgentV1ForceEndTurnParams", + "AgentV1FunctionCallCancelledFunctionsItemParams", + "AgentV1FunctionCallCancelledParams", + "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", + "AgentV1HistoryContentParams", + "AgentV1HistoryFunctionCallsParams", + "AgentV1HistoryFunctionCallsFunctionCallsItemParams", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams", + "AgentV1SettingsAgentContextListenProviderV1Params", + "AgentV1SettingsAgentContextListenProviderV2Params", + "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams", + "AgentV1SettingsAgentContextMessagesItemParams", + "AgentV1SettingsAgentContextMessagesItemContentParams", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams", + "AgentV1SettingsAgentListenProviderV1Params", + "AgentV1SettingsAgentListenProviderV2Params", +] 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..98076e89 --- /dev/null +++ b/src/deepgram/agent/v1/socket_client.py.bak @@ -0,0 +1,386 @@ +# 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_v1force_end_turn import AgentV1ForceEndTurn +from .types.agent_v1function_call_cancelled import AgentV1FunctionCallCancelled +from .types.agent_v1function_call_request import AgentV1FunctionCallRequest +from .types.agent_v1history import AgentV1History +from .types.agent_v1inject_agent_message import AgentV1InjectAgentMessage +from .types.agent_v1inject_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: + """Convert whole-number floats to integers for wire-compatible JSON. See: internal-api-specs/issues/205.""" + if isinstance(obj, dict): + return {key: _sanitize_numeric_types(value) for key, value in obj.items()} + if isinstance(obj, list): + return [_sanitize_numeric_types(item) for item in obj] + if isinstance(obj, float) and obj.is_integer(): + return int(obj) + return obj + +_logger = logging.getLogger(__name__) +V1SocketClientResponse = typing.Union[ + AgentV1ListenUpdated, + AgentV1ThinkUpdated, + AgentV1ReceiveFunctionCallResponse, + AgentV1PromptUpdated, + AgentV1SpeakUpdated, + AgentV1InjectionRefused, + AgentV1Welcome, + AgentV1SettingsApplied, + AgentV1ConversationText, + AgentV1UserStartedSpeaking, + AgentV1AgentThinking, + AgentV1LatencyReport, + AgentV1FunctionCallRequest, + AgentV1FunctionCallCancelled, + 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_force_end_turn(self, message: typing.Optional[AgentV1ForceEndTurn] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1ForceEndTurn. + """ + await self._send_model(message or AgentV1ForceEndTurn(type="ForceEndTurn")) + + async def send_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_force_end_turn(self, message: typing.Optional[AgentV1ForceEndTurn] = None) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a AgentV1ForceEndTurn. + """ + self._send_model(message or AgentV1ForceEndTurn(type="ForceEndTurn")) + + def send_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..d33043f2 --- /dev/null +++ b/src/deepgram/agent/v1/types/__init__.py.bak @@ -0,0 +1,287 @@ +# 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_v1force_end_turn import AgentV1ForceEndTurn + from .agent_v1function_call_cancelled import AgentV1FunctionCallCancelled + from .agent_v1function_call_cancelled_functions_item import AgentV1FunctionCallCancelledFunctionsItem + from .agent_v1function_call_request import AgentV1FunctionCallRequest + from .agent_v1function_call_request_functions_item import AgentV1FunctionCallRequestFunctionsItem + from .agent_v1history import AgentV1History + from .agent_v1inject_agent_message import AgentV1InjectAgentMessage + from .agent_v1inject_agent_message_behavior import AgentV1InjectAgentMessageBehavior + from .agent_v1inject_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", + "AgentV1ForceEndTurn": ".agent_v1force_end_turn", + "AgentV1FunctionCallCancelled": ".agent_v1function_call_cancelled", + "AgentV1FunctionCallCancelledFunctionsItem": ".agent_v1function_call_cancelled_functions_item", + "AgentV1FunctionCallRequest": ".agent_v1function_call_request", + "AgentV1FunctionCallRequestFunctionsItem": ".agent_v1function_call_request_functions_item", + "AgentV1History": ".agent_v1history", + "AgentV1InjectAgentMessage": ".agent_v1inject_agent_message", + "AgentV1InjectAgentMessageBehavior": ".agent_v1inject_agent_message_behavior", + "AgentV1InjectUserMessage": ".agent_v1inject_user_message", + "AgentV1InjectionRefused": ".agent_v1injection_refused", + "AgentV1KeepAlive": ".agent_v1keep_alive", + "AgentV1LatencyReport": ".agent_v1latency_report", + "AgentV1ListenUpdated": ".agent_v1listen_updated", + "AgentV1PromptUpdated": ".agent_v1prompt_updated", + "AgentV1ReceiveFunctionCallResponse": ".agent_v1receive_function_call_response", + "AgentV1SendFunctionCallResponse": ".agent_v1send_function_call_response", + "AgentV1Settings": ".agent_v1settings", + "AgentV1SettingsAgent": ".agent_v1settings_agent", + "AgentV1SettingsAgentContext": ".agent_v1settings_agent_context", + "AgentV1SettingsAgentContextContext": ".agent_v1settings_agent_context_context", + "AgentV1SettingsAgentContextContextMessagesItem": ".agent_v1settings_agent_context_context_messages_item", + "AgentV1SettingsAgentContextListen": ".agent_v1settings_agent_context_listen", + "AgentV1SettingsAgentContextListenProvider": ".agent_v1settings_agent_context_listen_provider", + "AgentV1SettingsAgentContextListenProvider_V1": ".agent_v1settings_agent_context_listen_provider", + "AgentV1SettingsAgentContextListenProvider_V2": ".agent_v1settings_agent_context_listen_provider", + "AgentV1SettingsAgentContextSpeak": ".agent_v1settings_agent_context_speak", + "AgentV1SettingsAgentContextThink": ".agent_v1settings_agent_context_think", + "AgentV1SettingsAgentListen": ".agent_v1settings_agent_listen", + "AgentV1SettingsAgentListenProvider": ".agent_v1settings_agent_listen_provider", + "AgentV1SettingsAgentListenProvider_V1": ".agent_v1settings_agent_listen_provider", + "AgentV1SettingsAgentListenProvider_V2": ".agent_v1settings_agent_listen_provider", + "AgentV1SettingsAgentSpeak": ".agent_v1settings_agent_speak", + "AgentV1SettingsAgentThink": ".agent_v1settings_agent_think", + "AgentV1SettingsApplied": ".agent_v1settings_applied", + "AgentV1SettingsAudio": ".agent_v1settings_audio", + "AgentV1SettingsAudioInput": ".agent_v1settings_audio_input", + "AgentV1SettingsAudioInputEncoding": ".agent_v1settings_audio_input_encoding", + "AgentV1SettingsAudioOutput": ".agent_v1settings_audio_output", + "AgentV1SettingsAudioOutputContainer": ".agent_v1settings_audio_output_container", + "AgentV1SettingsAudioOutputEncoding": ".agent_v1settings_audio_output_encoding", + "AgentV1SettingsFlags": ".agent_v1settings_flags", + "AgentV1SpeakUpdated": ".agent_v1speak_updated", + "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", + "AgentV1HistoryContent": ".agent_v1history_content", + "AgentV1HistoryContentRole": ".agent_v1history_content_role", + "AgentV1HistoryFunctionCalls": ".agent_v1history_function_calls", + "AgentV1HistoryFunctionCallsFunctionCallsItem": ".agent_v1history_function_calls_function_calls_item", + "AgentV1SettingsAgentContextContextMessagesItemContentRole": ".agent_v1settings_agent_context_context_messages_item_content_role", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem": ".agent_v1settings_agent_context_context_messages_item_function_calls_function_calls_item", + "AgentV1SettingsAgentContextListenProviderV1": ".agent_v1settings_agent_context_listen_provider_v1", + "AgentV1SettingsAgentContextListenProviderV2": ".agent_v1settings_agent_context_listen_provider_v2", + "AgentV1SettingsAgentContextListenProviderV2LanguageHint": ".agent_v1settings_agent_context_listen_provider_v2language_hint", + "AgentV1SettingsAgentContextMessagesItem": ".agent_v1settings_agent_context_messages_item", + "AgentV1SettingsAgentContextMessagesItemContent": ".agent_v1settings_agent_context_messages_item_content", + "AgentV1SettingsAgentContextMessagesItemContentRole": ".agent_v1settings_agent_context_messages_item_content_role", + "AgentV1SettingsAgentContextMessagesItemFunctionCalls": ".agent_v1settings_agent_context_messages_item_function_calls", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem": ".agent_v1settings_agent_context_messages_item_function_calls_function_calls_item", + "AgentV1SettingsAgentListenProviderV1": ".agent_v1settings_agent_listen_provider_v1", + "AgentV1SettingsAgentListenProviderV2": ".agent_v1settings_agent_listen_provider_v2", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "AgentV1AgentAudioDone", + "AgentV1AgentStartedSpeaking", + "AgentV1AgentThinking", + "AgentV1ConversationText", + "AgentV1ConversationTextRole", + "AgentV1Error", + "AgentV1ForceEndTurn", + "AgentV1FunctionCallCancelled", + "AgentV1FunctionCallCancelledFunctionsItem", + "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", + "AgentV1HistoryContent", + "AgentV1HistoryContentRole", + "AgentV1HistoryFunctionCalls", + "AgentV1HistoryFunctionCallsFunctionCallsItem", + "AgentV1SettingsAgentContextContextMessagesItemContentRole", + "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem", + "AgentV1SettingsAgentContextListenProviderV1", + "AgentV1SettingsAgentContextListenProviderV2", + "AgentV1SettingsAgentContextListenProviderV2LanguageHint", + "AgentV1SettingsAgentContextMessagesItem", + "AgentV1SettingsAgentContextMessagesItemContent", + "AgentV1SettingsAgentContextMessagesItemContentRole", + "AgentV1SettingsAgentContextMessagesItemFunctionCalls", + "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem", + "AgentV1SettingsAgentListenProviderV1", + "AgentV1SettingsAgentListenProviderV2", +] diff --git a/src/deepgram/agent/v1/types/agent_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..fae21e75 --- /dev/null +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent.py.bak @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from .agent_v1settings_agent_context import AgentV1SettingsAgentContext +from .agent_v1settings_agent_listen import AgentV1SettingsAgentListen + + +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_context.py.bak b/src/deepgram/agent/v1/types/agent_v1settings_agent_context.py.bak new file mode 100644 index 00000000..827aad63 --- /dev/null +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent_context.py.bak @@ -0,0 +1,65 @@ +# 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 + """ + + # 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: + + 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..222c18a3 --- /dev/null +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py.bak @@ -0,0 +1,77 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class AgentV1SettingsAgentContextListenProvider_V1(UncheckedBaseModel): + version: typing.Literal["v1"] = "v1" + type: typing.Literal["deepgram"] = "deepgram" + model: typing.Optional[str] = None + language: typing.Optional[str] = None + keyterms: typing.Optional[typing.List[str]] = None + smart_format: typing.Optional[bool] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class AgentV1SettingsAgentContextListenProvider_V2(UncheckedBaseModel): + version: typing.Literal["v2"] = "v2" + type: typing.Literal["deepgram"] = "deepgram" + model: str + language_hints: typing.Optional[typing.List[str]] = None + language_hint: typing.Optional[typing.Union[str, typing.List[str]]] = pydantic.Field(default=None, exclude=True) + eot_threshold: typing.Optional[float] = None + eager_eot_threshold: typing.Optional[float] = None + eot_timeout_ms: typing.Optional[int] = None + keyterms: typing.Optional[typing.List[str]] = None + + if IS_PYDANTIC_V2: + + @pydantic.model_validator(mode="before") + @classmethod + def _migrate_language_hint(cls, values: typing.Any) -> typing.Any: + if not isinstance(values, dict) or "language_hint" not in values: + return values + values = dict(values) + hint = values.pop("language_hint") + if hint is not None and values.get("language_hints") is None: + values["language_hints"] = [hint] if isinstance(hint, str) else list(hint) + return values + + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + @pydantic.root_validator(pre=True) # type: ignore[deprecated] + def _migrate_language_hint(cls, values: typing.Any) -> typing.Any: # type: ignore[no-redef] + if not isinstance(values, dict) or "language_hint" not in values: + return values + values = dict(values) + hint = values.pop("language_hint") + if hint is not None and values.get("language_hints") is None: + values["language_hints"] = [hint] if isinstance(hint, str) else list(hint) + return values + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +AgentV1SettingsAgentContextListenProvider = typing_extensions.Annotated[ + typing.Union[AgentV1SettingsAgentContextListenProvider_V1, AgentV1SettingsAgentContextListenProvider_V2], + UnionMetadata(discriminant="version"), +] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py.bak b/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py.bak new file mode 100644 index 00000000..d225e261 --- /dev/null +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py.bak @@ -0,0 +1,77 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class AgentV1SettingsAgentListenProvider_V1(UncheckedBaseModel): + version: typing.Literal["v1"] = "v1" + type: typing.Literal["deepgram"] = "deepgram" + model: typing.Optional[str] = None + language: typing.Optional[str] = None + keyterms: typing.Optional[typing.List[str]] = None + smart_format: typing.Optional[bool] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class AgentV1SettingsAgentListenProvider_V2(UncheckedBaseModel): + version: typing.Literal["v2"] = "v2" + type: typing.Literal["deepgram"] = "deepgram" + model: str + language_hints: typing.Optional[typing.List[str]] = None + language_hint: typing.Optional[typing.Union[str, typing.List[str]]] = pydantic.Field(default=None, exclude=True) + eot_threshold: typing.Optional[float] = None + eager_eot_threshold: typing.Optional[float] = None + eot_timeout_ms: typing.Optional[int] = None + keyterms: typing.Optional[typing.List[str]] = None + + if IS_PYDANTIC_V2: + + @pydantic.model_validator(mode="before") + @classmethod + def _migrate_language_hint(cls, values: typing.Any) -> typing.Any: + if not isinstance(values, dict) or "language_hint" not in values: + return values + values = dict(values) + hint = values.pop("language_hint") + if hint is not None and values.get("language_hints") is None: + values["language_hints"] = [hint] if isinstance(hint, str) else list(hint) + return values + + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + @pydantic.root_validator(pre=True) # type: ignore[deprecated] + def _migrate_language_hint(cls, values: typing.Any) -> typing.Any: # type: ignore[no-redef] + if not isinstance(values, dict) or "language_hint" not in values: + return values + values = dict(values) + hint = values.pop("language_hint") + if hint is not None and values.get("language_hints") is None: + values["language_hints"] = [hint] if isinstance(hint, str) else list(hint) + return values + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +AgentV1SettingsAgentListenProvider = typing_extensions.Annotated[ + typing.Union[AgentV1SettingsAgentListenProvider_V1, AgentV1SettingsAgentListenProvider_V2], + UnionMetadata(discriminant="version"), +] diff --git a/src/deepgram/agent/v1/types/agent_v1update_listen_listen.py.bak b/src/deepgram/agent/v1/types/agent_v1update_listen_listen.py.bak new file mode 100644 index 00000000..57f0751a --- /dev/null +++ b/src/deepgram/agent/v1/types/agent_v1update_listen_listen.py.bak @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel +from ....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): + """ + Listen configuration to update. Contains a provider object with the same schema as Settings. The model and language can be changed mid-session. Keyterms can only be updated mid-session for Flux models. + """ + + provider: AgentV1UpdateListenListenProvider + + if IS_PYDANTIC_V2: + + @pydantic.model_validator(mode="before") + @classmethod + def _migrate_legacy_provider(cls, values: typing.Any) -> typing.Any: + return _coerce_legacy_update_listen_provider(values) + + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + @pydantic.root_validator(pre=True) # type: ignore[deprecated] + def _migrate_legacy_provider(cls, values: typing.Any) -> typing.Any: # type: ignore[no-redef] + return _coerce_legacy_update_listen_provider(values) + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/deepgram/core/api_error.py.bak b/src/deepgram/core/api_error.py.bak new file mode 100644 index 00000000..2aa93914 --- /dev/null +++ b/src/deepgram/core/api_error.py.bak @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +from typing import Any, Dict, Optional + +from .._secure_logging import redact_sensitive_headers + + +class ApiError(Exception): + headers: Optional[Dict[str, str]] + status_code: Optional[int] + body: Any + + def __init__( + self, + *, + headers: Optional[Dict[str, str]] = None, + status_code: Optional[int] = None, + body: Any = None, + ) -> None: + self.headers = redact_sensitive_headers(headers) + self.status_code = status_code + self.body = body + + def __str__(self) -> str: + return f"headers: {self.headers}, status_code: {self.status_code}, body: {self.body}" diff --git a/src/deepgram/core/parse_error.py.bak b/src/deepgram/core/parse_error.py.bak new file mode 100644 index 00000000..c510c0e8 --- /dev/null +++ b/src/deepgram/core/parse_error.py.bak @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +from typing import Any, Dict, Optional + +from .._secure_logging import redact_sensitive_headers + + +class ParsingError(Exception): + """ + Raised when the SDK fails to parse/validate a response from the server. + This typically indicates that the server returned a response whose shape + does not match the expected schema. + """ + + headers: Optional[Dict[str, str]] + status_code: Optional[int] + body: Any + cause: Optional[Exception] + + def __init__( + self, + *, + headers: Optional[Dict[str, str]] = None, + status_code: Optional[int] = None, + body: Any = None, + cause: Optional[Exception] = None, + ) -> None: + self.headers = redact_sensitive_headers(headers) + self.status_code = status_code + self.body = body + self.cause = cause + super().__init__() + if cause is not None: + self.__cause__ = cause + + def __str__(self) -> str: + cause_str = f", cause: {self.cause}" if self.cause is not None else "" + return f"headers: {self.headers}, status_code: {self.status_code}, body: {self.body}{cause_str}" diff --git a/src/deepgram/core/query_encoder.py.bak b/src/deepgram/core/query_encoder.py.bak new file mode 100644 index 00000000..58088258 --- /dev/null +++ b/src/deepgram/core/query_encoder.py.bak @@ -0,0 +1,65 @@ +# This file was auto-generated by Fern from our API Definition. + +from typing import Any, Dict, List, Optional, Tuple + +import pydantic + + +def _coerce_query_value(value: Any) -> Any: + # urllib.parse.urlencode would otherwise turn bools into "True"/"False". + if isinstance(value, bool): + return "true" if value else "false" + return value + + +# Flattens dicts to be of the form {"key[subkey][subkey2]": value} where value is not a dict +def traverse_query_dict(dict_flat: Dict[str, Any], key_prefix: Optional[str] = None) -> List[Tuple[str, Any]]: + result = [] + for k, v in dict_flat.items(): + key = f"{key_prefix}[{k}]" if key_prefix is not None else k + if isinstance(v, dict): + result.extend(traverse_query_dict(v, key)) + elif isinstance(v, list): + for arr_v in v: + if isinstance(arr_v, dict): + result.extend(traverse_query_dict(arr_v, key)) + else: + result.append((key, _coerce_query_value(arr_v))) + else: + result.append((key, _coerce_query_value(v))) + return result + + +def single_query_encoder(query_key: str, query_value: Any) -> List[Tuple[str, Any]]: + if isinstance(query_value, pydantic.BaseModel) or isinstance(query_value, dict): + if isinstance(query_value, pydantic.BaseModel): + obj_dict = query_value.dict(by_alias=True) + else: + obj_dict = query_value + return traverse_query_dict(obj_dict, query_key) + elif isinstance(query_value, list): + encoded_values: List[Tuple[str, Any]] = [] + for value in query_value: + if isinstance(value, pydantic.BaseModel) or isinstance(value, dict): + if isinstance(value, pydantic.BaseModel): + obj_dict = value.dict(by_alias=True) + elif isinstance(value, dict): + obj_dict = value + + encoded_values.extend(single_query_encoder(query_key, obj_dict)) + else: + encoded_values.append((query_key, _coerce_query_value(value))) + + return encoded_values + + return [(query_key, _coerce_query_value(query_value))] + + +def encode_query(query: Optional[Dict[str, Any]]) -> Optional[List[Tuple[str, Any]]]: + if query is None: + return None + + encoded_query = [] + for k, v in query.items(): + encoded_query.extend(single_query_encoder(k, v)) + return encoded_query diff --git a/src/deepgram/listen/__init__.py.bak b/src/deepgram/listen/__init__.py.bak new file mode 100644 index 00000000..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..e4e09468 --- /dev/null +++ b/src/deepgram/listen/v2/socket_client.py.bak @@ -0,0 +1,247 @@ +# 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. + This requires server-side enablement. On deployments without the feature, the server returns + UNPARSABLE_CLIENT_MESSAGE and closes the connection. + """ + await self._send_model(message or ListenV2ForceEndTurn(type="ForceEndTurn")) + + async def send_configure(self, message: typing.Union[ListenV2Configure, typing.Dict[str, typing.Any]]) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a ListenV2Configure. + """ + if isinstance(message, dict): + await self._send(message) + else: + await self._send_model(message) + + async def recv(self) -> V2SocketClientResponse: + """ + Receive a message from the websocket connection. + """ + data = await self._websocket.recv() + if isinstance(data, bytes): + return data # type: ignore + json_data = json.loads(data) + try: + return construct_type(type_=V2SocketClientResponse, object_=json_data) # type: ignore + except Exception: + _logger.warning("Skipping unknown WebSocket message; update your SDK version to support new message types.") + return json_data # type: ignore + + async def _send(self, data: typing.Any) -> None: + """ + Send a message to the websocket connection. + """ + if isinstance(data, dict): + data = json.dumps(data) + await self._websocket.send(data) + + async def _send_model(self, data: typing.Any) -> None: + """ + Send a Pydantic model to the websocket connection. + """ + await self._send(data.dict()) + + +class V2SocketClient(EventEmitterMixin): + def __init__(self, *, websocket: websockets_sync_connection.Connection): + super().__init__() + self._websocket = websocket + + def __iter__(self): + 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. + This requires server-side enablement. On deployments without the feature, the server returns + UNPARSABLE_CLIENT_MESSAGE and closes the connection. + """ + self._send_model(message or ListenV2ForceEndTurn(type="ForceEndTurn")) + + def send_configure(self, message: typing.Union[ListenV2Configure, typing.Dict[str, typing.Any]]) -> None: + """ + Send a message to the websocket connection. + The message will be sent as a ListenV2Configure. + """ + if isinstance(message, dict): + self._send(message) + else: + self._send_model(message) + + def recv(self) -> V2SocketClientResponse: + """ + Receive a message from the websocket connection. + """ + data = self._websocket.recv() + if isinstance(data, bytes): + return data # type: ignore + json_data = json.loads(data) + try: + return construct_type(type_=V2SocketClientResponse, object_=json_data) # type: ignore + except Exception: + _logger.warning("Skipping unknown WebSocket message; update your SDK version to support new message types.") + return json_data # type: ignore + + def _send(self, data: typing.Any) -> None: + """ + Send a message to the websocket connection. + """ + if isinstance(data, dict): + data = json.dumps(data) + self._websocket.send(data) + + def _send_model(self, data: typing.Any) -> None: + """ + Send a Pydantic model to the websocket connection. + """ + self._send(data.dict()) diff --git a/src/deepgram/listen/v2/types/__init__.py.bak b/src/deepgram/listen/v2/types/__init__.py.bak new file mode 100644 index 00000000..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..f3ac75bd --- /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", + "CartesiaVoiceParams": ".cartesia_voice", + "CreateAgentConfigurationV1ResponseParams": ".create_agent_configuration_v1response", + "CreateKeyV1RequestParams": ".create_key_v1request", + "CreateKeyV1ResponseParams": ".create_key_v1response", + "CreateProjectDistributionCredentialsV1ResponseDistributionCredentialsParams": ".create_project_distribution_credentials_v1response_distribution_credentials", + "CreateProjectDistributionCredentialsV1ResponseMemberParams": ".create_project_distribution_credentials_v1response_member", + "CreateProjectDistributionCredentialsV1ResponseParams": ".create_project_distribution_credentials_v1response", + "CreateProjectInviteV1ResponseParams": ".create_project_invite_v1response", + "DeepgramListenProviderV1Params": ".deepgram_listen_provider_v1", + "DeepgramListenProviderV2Params": ".deepgram_listen_provider_v2", + "DeepgramParams": ".deepgram", + "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", + "CartesiaSpeakProviderVoiceParams": ".cartesia_speak_provider_voice", + "CreateKeyV1RequestOneParams": ".create_key_v1request_one", + "DeepgramListenProviderV2LanguageHintParams": ".deepgram_listen_provider_v2language_hint", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "AgentConfigurationV1Params", + "AgentThinkModelsV1ResponseModelsItemIdParams", + "AgentThinkModelsV1ResponseModelsItemOneParams", + "AgentThinkModelsV1ResponseModelsItemParams", + "AgentThinkModelsV1ResponseModelsItemThreeParams", + "AgentThinkModelsV1ResponseModelsItemTwoParams", + "AgentThinkModelsV1ResponseModelsItemZeroParams", + "AgentThinkModelsV1ResponseParams", + "AgentVariableV1Params", + "AnthropicParams", + "AwsBedrockThinkProviderCredentialsParams", + "AwsBedrockThinkProviderParams", + "AwsPollySpeakProviderCredentialsParams", + "AwsPollySpeakProviderParams", + "BillingBreakdownV1ResponseParams", + "BillingBreakdownV1ResponseResolutionParams", + "BillingBreakdownV1ResponseResultsItemGroupingParams", + "BillingBreakdownV1ResponseResultsItemParams", + "CartesiaParams", + "CartesiaVoiceParams", + "CreateAgentConfigurationV1ResponseParams", + "CreateKeyV1RequestParams", + "CreateKeyV1ResponseParams", + "CreateProjectDistributionCredentialsV1ResponseDistributionCredentialsParams", + "CreateProjectDistributionCredentialsV1ResponseMemberParams", + "CreateProjectDistributionCredentialsV1ResponseParams", + "CreateProjectInviteV1ResponseParams", + "DeepgramListenProviderV1Params", + "DeepgramListenProviderV2Params", + "DeepgramParams", + "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", + "CartesiaSpeakProviderVoiceParams", + "CreateKeyV1RequestOneParams", + "DeepgramListenProviderV2LanguageHintParams", +] 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..57674025 --- /dev/null +++ b/src/deepgram/types/__init__.py.bak @@ -0,0 +1,847 @@ +# 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_v2configure_numerals import ListenV2ConfigureNumerals + from .listen_v2eager_eot_threshold import ListenV2EagerEotThreshold + from .listen_v2encoding import ListenV2Encoding + from .listen_v2eot_threshold import ListenV2EotThreshold + from .listen_v2eot_timeout_ms import ListenV2EotTimeoutMs + from .listen_v2keyterm import ListenV2Keyterm + from .listen_v2language_hint import ListenV2LanguageHint + from .listen_v2mip_opt_out import ListenV2MipOptOut + from .listen_v2model import ListenV2Model + from .listen_v2numerals import ListenV2Numerals + from .listen_v2profanity_filter import ListenV2ProfanityFilter + from .listen_v2redact import ListenV2Redact + from .listen_v2sample_rate import ListenV2SampleRate + from .listen_v2tag import ListenV2Tag + from .open_ai_speak_provider import OpenAiSpeakProvider + from .open_ai_speak_provider_model import OpenAiSpeakProviderModel + from .open_ai_speak_provider_voice import OpenAiSpeakProviderVoice + from .open_ai_think_provider import OpenAiThinkProvider + from .open_ai_think_provider_model import OpenAiThinkProviderModel + from .open_ai_think_provider_reasoning_mode import OpenAiThinkProviderReasoningMode + from .project_request_response import ProjectRequestResponse + from .read_v1request import ReadV1Request + from .read_v1request_text import ReadV1RequestText + from .read_v1request_url import ReadV1RequestUrl + from .read_v1response import ReadV1Response + from .read_v1response_metadata import ReadV1ResponseMetadata + from .read_v1response_metadata_metadata import ReadV1ResponseMetadataMetadata + from .read_v1response_metadata_metadata_intents_info import ReadV1ResponseMetadataMetadataIntentsInfo + from .read_v1response_metadata_metadata_sentiment_info import ReadV1ResponseMetadataMetadataSentimentInfo + from .read_v1response_metadata_metadata_summary_info import ReadV1ResponseMetadataMetadataSummaryInfo + from .read_v1response_metadata_metadata_topics_info import ReadV1ResponseMetadataMetadataTopicsInfo + from .read_v1response_results import ReadV1ResponseResults + from .read_v1response_results_summary import ReadV1ResponseResultsSummary + from .read_v1response_results_summary_results import ReadV1ResponseResultsSummaryResults + from .read_v1response_results_summary_results_summary import ReadV1ResponseResultsSummaryResultsSummary + from .shared_intents import SharedIntents + from .shared_intents_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", + "AwsBedrockThinkProvider": ".aws_bedrock_think_provider", + "AwsBedrockThinkProviderCredentials": ".aws_bedrock_think_provider_credentials", + "AwsBedrockThinkProviderCredentialsType": ".aws_bedrock_think_provider_credentials_type", + "AwsBedrockThinkProviderModel": ".aws_bedrock_think_provider_model", + "AwsPollySpeakProvider": ".aws_polly_speak_provider", + "AwsPollySpeakProviderCredentials": ".aws_polly_speak_provider_credentials", + "AwsPollySpeakProviderCredentialsType": ".aws_polly_speak_provider_credentials_type", + "AwsPollySpeakProviderEngine": ".aws_polly_speak_provider_engine", + "AwsPollySpeakProviderVoice": ".aws_polly_speak_provider_voice", + "BillingBreakdownV1Response": ".billing_breakdown_v1response", + "BillingBreakdownV1ResponseResolution": ".billing_breakdown_v1response_resolution", + "BillingBreakdownV1ResponseResultsItem": ".billing_breakdown_v1response_results_item", + "BillingBreakdownV1ResponseResultsItemGrouping": ".billing_breakdown_v1response_results_item_grouping", + "Cartesia": ".cartesia", + "CartesiaModelId": ".cartesia_model_id", + "CartesiaVoice": ".cartesia_voice", + "CreateAgentConfigurationV1Response": ".create_agent_configuration_v1response", + "CreateKeyV1Request": ".create_key_v1request", + "CreateKeyV1Response": ".create_key_v1response", + "CreateProjectDistributionCredentialsV1Response": ".create_project_distribution_credentials_v1response", + "CreateProjectDistributionCredentialsV1ResponseDistributionCredentials": ".create_project_distribution_credentials_v1response_distribution_credentials", + "CreateProjectDistributionCredentialsV1ResponseMember": ".create_project_distribution_credentials_v1response_member", + "CreateProjectInviteV1Response": ".create_project_invite_v1response", + "Deepgram": ".deepgram", + "DeepgramListenProviderV1": ".deepgram_listen_provider_v1", + "DeepgramListenProviderV2": ".deepgram_listen_provider_v2", + "DeepgramModel": ".deepgram_model", + "DeleteAgentConfigurationV1Response": ".delete_agent_configuration_v1response", + "DeleteAgentVariableV1Response": ".delete_agent_variable_v1response", + "DeleteProjectInviteV1Response": ".delete_project_invite_v1response", + "DeleteProjectKeyV1Response": ".delete_project_key_v1response", + "DeleteProjectMemberV1Response": ".delete_project_member_v1response", + "DeleteProjectV1Response": ".delete_project_v1response", + "ElevenLabsSpeakProvider": ".eleven_labs_speak_provider", + "ElevenLabsSpeakProviderModelId": ".eleven_labs_speak_provider_model_id", + "ErrorResponse": ".error_response", + "ErrorResponseLegacyError": ".error_response_legacy_error", + "ErrorResponseModernError": ".error_response_modern_error", + "ErrorResponseTextError": ".error_response_text_error", + "GetModelV1Response": ".get_model_v1response", + "GetModelV1ResponseBatch": ".get_model_v1response_batch", + "GetModelV1ResponseMetadata": ".get_model_v1response_metadata", + "GetModelV1ResponseMetadataMetadata": ".get_model_v1response_metadata_metadata", + "GetProjectBalanceV1Response": ".get_project_balance_v1response", + "GetProjectDistributionCredentialsV1Response": ".get_project_distribution_credentials_v1response", + "GetProjectDistributionCredentialsV1ResponseDistributionCredentials": ".get_project_distribution_credentials_v1response_distribution_credentials", + "GetProjectDistributionCredentialsV1ResponseMember": ".get_project_distribution_credentials_v1response_member", + "GetProjectKeyV1Response": ".get_project_key_v1response", + "GetProjectKeyV1ResponseItem": ".get_project_key_v1response_item", + "GetProjectKeyV1ResponseItemMember": ".get_project_key_v1response_item_member", + "GetProjectKeyV1ResponseItemMemberApiKey": ".get_project_key_v1response_item_member_api_key", + "GetProjectRequestV1Response": ".get_project_request_v1response", + "GetProjectV1Response": ".get_project_v1response", + "Google": ".google", + "GoogleModel": ".google_model", + "GoogleVersion": ".google_version", + "GrantV1Response": ".grant_v1response", + "Groq": ".groq", + "GroqReasoningMode": ".groq_reasoning_mode", + "LeaveProjectV1Response": ".leave_project_v1response", + "ListAgentConfigurationsV1Response": ".list_agent_configurations_v1response", + "ListAgentVariablesV1Response": ".list_agent_variables_v1response", + "ListBillingFieldsV1Response": ".list_billing_fields_v1response", + "ListBillingFieldsV1ResponseDeploymentsItem": ".list_billing_fields_v1response_deployments_item", + "ListModelsV1Response": ".list_models_v1response", + "ListModelsV1ResponseSttModels": ".list_models_v1response_stt_models", + "ListModelsV1ResponseTtsModels": ".list_models_v1response_tts_models", + "ListModelsV1ResponseTtsModelsMetadata": ".list_models_v1response_tts_models_metadata", + "ListProjectBalancesV1Response": ".list_project_balances_v1response", + "ListProjectBalancesV1ResponseBalancesItem": ".list_project_balances_v1response_balances_item", + "ListProjectDistributionCredentialsV1Response": ".list_project_distribution_credentials_v1response", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem": ".list_project_distribution_credentials_v1response_distribution_credentials_item", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials": ".list_project_distribution_credentials_v1response_distribution_credentials_item_distribution_credentials", + "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember": ".list_project_distribution_credentials_v1response_distribution_credentials_item_member", + "ListProjectInvitesV1Response": ".list_project_invites_v1response", + "ListProjectInvitesV1ResponseInvitesItem": ".list_project_invites_v1response_invites_item", + "ListProjectKeysV1Response": ".list_project_keys_v1response", + "ListProjectKeysV1ResponseApiKeysItem": ".list_project_keys_v1response_api_keys_item", + "ListProjectKeysV1ResponseApiKeysItemApiKey": ".list_project_keys_v1response_api_keys_item_api_key", + "ListProjectKeysV1ResponseApiKeysItemMember": ".list_project_keys_v1response_api_keys_item_member", + "ListProjectMemberScopesV1Response": ".list_project_member_scopes_v1response", + "ListProjectMembersV1Response": ".list_project_members_v1response", + "ListProjectMembersV1ResponseMembersItem": ".list_project_members_v1response_members_item", + "ListProjectPurchasesV1Response": ".list_project_purchases_v1response", + "ListProjectPurchasesV1ResponseOrdersItem": ".list_project_purchases_v1response_orders_item", + "ListProjectRequestsV1Response": ".list_project_requests_v1response", + "ListProjectsV1Response": ".list_projects_v1response", + "ListProjectsV1ResponseProjectsItem": ".list_projects_v1response_projects_item", + "ListenV1AcceptedResponse": ".listen_v1accepted_response", + "ListenV1Callback": ".listen_v1callback", + "ListenV1CallbackMethod": ".listen_v1callback_method", + "ListenV1Channels": ".listen_v1channels", + "ListenV1DetectEntities": ".listen_v1detect_entities", + "ListenV1Diarize": ".listen_v1diarize", + "ListenV1Dictation": ".listen_v1dictation", + "ListenV1Encoding": ".listen_v1encoding", + "ListenV1Endpointing": ".listen_v1endpointing", + "ListenV1Extra": ".listen_v1extra", + "ListenV1InterimResults": ".listen_v1interim_results", + "ListenV1Keyterm": ".listen_v1keyterm", + "ListenV1Keywords": ".listen_v1keywords", + "ListenV1Language": ".listen_v1language", + "ListenV1MipOptOut": ".listen_v1mip_opt_out", + "ListenV1Model": ".listen_v1model", + "ListenV1Multichannel": ".listen_v1multichannel", + "ListenV1Numerals": ".listen_v1numerals", + "ListenV1ProfanityFilter": ".listen_v1profanity_filter", + "ListenV1Punctuate": ".listen_v1punctuate", + "ListenV1Redact": ".listen_v1redact", + "ListenV1Replace": ".listen_v1replace", + "ListenV1RequestFile": ".listen_v1request_file", + "ListenV1Response": ".listen_v1response", + "ListenV1ResponseMetadata": ".listen_v1response_metadata", + "ListenV1ResponseMetadataDiarizeInfo": ".listen_v1response_metadata_diarize_info", + "ListenV1ResponseMetadataIntentsInfo": ".listen_v1response_metadata_intents_info", + "ListenV1ResponseMetadataSentimentInfo": ".listen_v1response_metadata_sentiment_info", + "ListenV1ResponseMetadataSummaryInfo": ".listen_v1response_metadata_summary_info", + "ListenV1ResponseMetadataTopicsInfo": ".listen_v1response_metadata_topics_info", + "ListenV1ResponseResults": ".listen_v1response_results", + "ListenV1ResponseResultsChannels": ".listen_v1response_results_channels", + "ListenV1ResponseResultsChannelsItem": ".listen_v1response_results_channels_item", + "ListenV1ResponseResultsChannelsItemAlternativesItem": ".listen_v1response_results_channels_item_alternatives_item", + "ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem": ".listen_v1response_results_channels_item_alternatives_item_entities_item", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs": ".listen_v1response_results_channels_item_alternatives_item_paragraphs", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem": ".listen_v1response_results_channels_item_alternatives_item_paragraphs_paragraphs_item", + "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem": ".listen_v1response_results_channels_item_alternatives_item_paragraphs_paragraphs_item_sentences_item", + "ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem": ".listen_v1response_results_channels_item_alternatives_item_summaries_item", + "ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem": ".listen_v1response_results_channels_item_alternatives_item_topics_item", + "ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem": ".listen_v1response_results_channels_item_alternatives_item_words_item", + "ListenV1ResponseResultsChannelsItemSearchItem": ".listen_v1response_results_channels_item_search_item", + "ListenV1ResponseResultsChannelsItemSearchItemHitsItem": ".listen_v1response_results_channels_item_search_item_hits_item", + "ListenV1ResponseResultsSummary": ".listen_v1response_results_summary", + "ListenV1ResponseResultsUtterances": ".listen_v1response_results_utterances", + "ListenV1ResponseResultsUtterancesItem": ".listen_v1response_results_utterances_item", + "ListenV1ResponseResultsUtterancesItemWordsItem": ".listen_v1response_results_utterances_item_words_item", + "ListenV1SampleRate": ".listen_v1sample_rate", + "ListenV1Search": ".listen_v1search", + "ListenV1SmartFormat": ".listen_v1smart_format", + "ListenV1Tag": ".listen_v1tag", + "ListenV1UtteranceEndMs": ".listen_v1utterance_end_ms", + "ListenV1VadEvents": ".listen_v1vad_events", + "ListenV1Version": ".listen_v1version", + "ListenV2ConfigureNumerals": ".listen_v2configure_numerals", + "ListenV2EagerEotThreshold": ".listen_v2eager_eot_threshold", + "ListenV2Encoding": ".listen_v2encoding", + "ListenV2EotThreshold": ".listen_v2eot_threshold", + "ListenV2EotTimeoutMs": ".listen_v2eot_timeout_ms", + "ListenV2Keyterm": ".listen_v2keyterm", + "ListenV2LanguageHint": ".listen_v2language_hint", + "ListenV2MipOptOut": ".listen_v2mip_opt_out", + "ListenV2Model": ".listen_v2model", + "ListenV2Numerals": ".listen_v2numerals", + "ListenV2ProfanityFilter": ".listen_v2profanity_filter", + "ListenV2Redact": ".listen_v2redact", + "ListenV2SampleRate": ".listen_v2sample_rate", + "ListenV2Tag": ".listen_v2tag", + "OpenAiSpeakProvider": ".open_ai_speak_provider", + "OpenAiSpeakProviderModel": ".open_ai_speak_provider_model", + "OpenAiSpeakProviderVoice": ".open_ai_speak_provider_voice", + "OpenAiThinkProvider": ".open_ai_think_provider", + "OpenAiThinkProviderModel": ".open_ai_think_provider_model", + "OpenAiThinkProviderReasoningMode": ".open_ai_think_provider_reasoning_mode", + "ProjectRequestResponse": ".project_request_response", + "ReadV1Request": ".read_v1request", + "ReadV1RequestText": ".read_v1request_text", + "ReadV1RequestUrl": ".read_v1request_url", + "ReadV1Response": ".read_v1response", + "ReadV1ResponseMetadata": ".read_v1response_metadata", + "ReadV1ResponseMetadataMetadata": ".read_v1response_metadata_metadata", + "ReadV1ResponseMetadataMetadataIntentsInfo": ".read_v1response_metadata_metadata_intents_info", + "ReadV1ResponseMetadataMetadataSentimentInfo": ".read_v1response_metadata_metadata_sentiment_info", + "ReadV1ResponseMetadataMetadataSummaryInfo": ".read_v1response_metadata_metadata_summary_info", + "ReadV1ResponseMetadataMetadataTopicsInfo": ".read_v1response_metadata_metadata_topics_info", + "ReadV1ResponseResults": ".read_v1response_results", + "ReadV1ResponseResultsSummary": ".read_v1response_results_summary", + "ReadV1ResponseResultsSummaryResults": ".read_v1response_results_summary_results", + "ReadV1ResponseResultsSummaryResultsSummary": ".read_v1response_results_summary_results_summary", + "SharedIntents": ".shared_intents", + "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", + "AnthropicThinkProviderModel": ".anthropic_think_provider_model", + "CartesiaSpeakProviderModelId": ".cartesia_speak_provider_model_id", + "CartesiaSpeakProviderVoice": ".cartesia_speak_provider_voice", + "CreateKeyV1RequestOne": ".create_key_v1request_one", + "DeepgramListenProviderV2LanguageHint": ".deepgram_listen_provider_v2language_hint", + "DeepgramSpeakProviderModel": ".deepgram_speak_provider_model", + "GoogleThinkProviderModel": ".google_think_provider_model", + "GoogleThinkProviderVersion": ".google_think_provider_version", + "GroqThinkProviderReasoningMode": ".groq_think_provider_reasoning_mode", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "AgentConfigurationV1", + "AgentThinkModelsV1Response", + "AgentThinkModelsV1ResponseModelsItem", + "AgentThinkModelsV1ResponseModelsItemId", + "AgentThinkModelsV1ResponseModelsItemOne", + "AgentThinkModelsV1ResponseModelsItemOneId", + "AgentThinkModelsV1ResponseModelsItemThree", + "AgentThinkModelsV1ResponseModelsItemTwo", + "AgentThinkModelsV1ResponseModelsItemTwoId", + "AgentThinkModelsV1ResponseModelsItemZero", + "AgentThinkModelsV1ResponseModelsItemZeroId", + "AgentVariableV1", + "Anthropic", + "AnthropicModel", + "AwsBedrockThinkProvider", + "AwsBedrockThinkProviderCredentials", + "AwsBedrockThinkProviderCredentialsType", + "AwsBedrockThinkProviderModel", + "AwsPollySpeakProvider", + "AwsPollySpeakProviderCredentials", + "AwsPollySpeakProviderCredentialsType", + "AwsPollySpeakProviderEngine", + "AwsPollySpeakProviderVoice", + "BillingBreakdownV1Response", + "BillingBreakdownV1ResponseResolution", + "BillingBreakdownV1ResponseResultsItem", + "BillingBreakdownV1ResponseResultsItemGrouping", + "Cartesia", + "CartesiaModelId", + "CartesiaVoice", + "CreateAgentConfigurationV1Response", + "CreateKeyV1Request", + "CreateKeyV1Response", + "CreateProjectDistributionCredentialsV1Response", + "CreateProjectDistributionCredentialsV1ResponseDistributionCredentials", + "CreateProjectDistributionCredentialsV1ResponseMember", + "CreateProjectInviteV1Response", + "Deepgram", + "DeepgramListenProviderV1", + "DeepgramListenProviderV2", + "DeepgramModel", + "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", + "ListenV2ConfigureNumerals", + "ListenV2EagerEotThreshold", + "ListenV2Encoding", + "ListenV2EotThreshold", + "ListenV2EotTimeoutMs", + "ListenV2Keyterm", + "ListenV2LanguageHint", + "ListenV2MipOptOut", + "ListenV2Model", + "ListenV2Numerals", + "ListenV2ProfanityFilter", + "ListenV2Redact", + "ListenV2SampleRate", + "ListenV2Tag", + "OpenAiSpeakProvider", + "OpenAiSpeakProviderModel", + "OpenAiSpeakProviderVoice", + "OpenAiThinkProvider", + "OpenAiThinkProviderModel", + "OpenAiThinkProviderReasoningMode", + "ProjectRequestResponse", + "ReadV1Request", + "ReadV1RequestText", + "ReadV1RequestUrl", + "ReadV1Response", + "ReadV1ResponseMetadata", + "ReadV1ResponseMetadataMetadata", + "ReadV1ResponseMetadataMetadataIntentsInfo", + "ReadV1ResponseMetadataMetadataSentimentInfo", + "ReadV1ResponseMetadataMetadataSummaryInfo", + "ReadV1ResponseMetadataMetadataTopicsInfo", + "ReadV1ResponseResults", + "ReadV1ResponseResultsSummary", + "ReadV1ResponseResultsSummaryResults", + "ReadV1ResponseResultsSummaryResultsSummary", + "SharedIntents", + "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", + "AnthropicThinkProviderModel", + "CartesiaSpeakProviderModelId", + "CartesiaSpeakProviderVoice", + "CreateKeyV1RequestOne", + "DeepgramListenProviderV2LanguageHint", + "DeepgramSpeakProviderModel", + "GoogleThinkProviderModel", + "GoogleThinkProviderVersion", + "GroqThinkProviderReasoningMode", +] diff --git a/src/deepgram/types/deepgram.py.bak b/src/deepgram/types/deepgram.py.bak new file mode 100644 index 00000000..994f7a2c --- /dev/null +++ b/src/deepgram/types/deepgram.py.bak @@ -0,0 +1,44 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .deepgram_model import DeepgramModel + + +class Deepgram(UncheckedBaseModel): + """ + Deepgram text-to-speech provider. Aura models use version v1 (default); Flux TTS uses version v2 and a flux-* model. Flux TTS is the default when agent.speak is omitted, using the flux-kit-en voice. + """ + + type: typing.Literal["deepgram"] = "deepgram" + version: typing.Optional[str] = pydantic.Field(default=None) + """ + The Deepgram text-to-speech model family. Accepted values: `v1` (Aura, the default) and `v2` (Flux TTS). Use `v1` with an aura-* model and `v2` with a flux-* model. Defaults to `v1` when omitted. + """ + + model: DeepgramModel = pydantic.Field() + """ + Deepgram TTS model. Aura models (version v1) use the aura-* voices; Flux TTS (version v2) uses the flux-{voice}-{language} voices (e.g. flux-alexis-en). Defaults to flux-kit-en when agent.speak is omitted. + """ + + speed: typing.Optional[float] = pydantic.Field(default=None) + """ + Speaking rate multiplier that adjusts the pace of generated speech while preserving natural prosody and voice quality. Aura (version v1) accepts any value from 0.7 to 1.5. Flux TTS (version v2) accepts values from 0.5 to 1.5 in 0.05 increments; a value the family does not accept ends the session with FAILED_TO_SPEAK. Not yet supported in all languages. + """ + + expressivity: typing.Optional[pydantic.StrictInt] = pydantic.Field(default=None) + """ + Delivery register of the generated speech, on a calm-to-animated axis. Flux TTS (version v2) only, on every Flux voice. Accepts the whole numbers -2 to 2, where 0 (the default) is the voice's tuned delivery and the only value validated for production, -2 the calm end of the range and 2 the animated end. Fixed for the session. Beta: behavior may change in future model versions, and non-default values increase the risk of hallucinations and pronunciation errors. See [Expressivity](/docs/tts-expressivity). + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/deepgram/types/deepgram_listen_provider_v2.py.bak b/src/deepgram/types/deepgram_listen_provider_v2.py.bak new file mode 100644 index 00000000..4eacc10e --- /dev/null +++ b/src/deepgram/types/deepgram_listen_provider_v2.py.bak @@ -0,0 +1,88 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeepgramListenProviderV2(UncheckedBaseModel): + type: typing.Literal["deepgram"] = pydantic.Field(default="deepgram") + """ + Provider type for speech-to-text + """ + + version: typing.Optional[typing.Literal["v2"]] = pydantic.Field(default=None) + """ + Specifies usage of the V2 Deepgram speech-to-text API (e.g. Flux) + """ + + model: str = pydantic.Field() + """ + Model to use for speech to text using the V2 API (e.g. flux-general-en, flux-general-multi) + """ + + language_hints: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + An array of one or more BCP-47 language codes to bias the model toward specific languages. Only supported when model is flux-general-multi. Without hints, the model auto-detects the spoken language. See the Language Prompting guide for details. + """ + + language_hint: typing.Optional[typing.Union[str, typing.List[str]]] = pydantic.Field(default=None, exclude=True) + """ + Deprecated. Use `language_hints`. Accepted for backward compatibility and + remapped before serialization so the singular field never reaches the API. + """ + + eot_threshold: typing.Optional[float] = pydantic.Field(default=None) + """ + End-of-turn confidence required to finish a turn. Valid range: 0.5 - 1.0. Defaults to 0.7. Set to 1.0 to fully suppress confidence-based end-of-turn detection. `eot_timeout_ms` still ends idle turns; increase it when using ForceEndTurn for full manual turn control. + """ + + eager_eot_threshold: typing.Optional[float] = pydantic.Field(default=None) + """ + End-of-turn confidence required to fire an eager end-of-turn event. When set, enables EagerEndOfTurn and TurnResumed events. Valid range: 0.3 - 0.9. + """ + + eot_timeout_ms: typing.Optional[int] = pydantic.Field(default=None) + """ + A turn will be finished when this much time in milliseconds has passed after speech, regardless of EOT confidence. Defaults to 5000. + """ + + keyterms: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Prompt keyterm recognition to improve Keyword Recall Rate + """ + + if IS_PYDANTIC_V2: + + @pydantic.model_validator(mode="before") + @classmethod + def _migrate_language_hint(cls, values: typing.Any) -> typing.Any: + if not isinstance(values, dict) or "language_hint" not in values: + return values + values = dict(values) + hint = values.pop("language_hint") + if hint is not None and values.get("language_hints") is None: + values["language_hints"] = [hint] if isinstance(hint, str) else list(hint) + return values + 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: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/deepgram/types/speak_settings_v1provider.py.bak b/src/deepgram/types/speak_settings_v1provider.py.bak new file mode 100644 index 00000000..3fbef168 --- /dev/null +++ b/src/deepgram/types/speak_settings_v1provider.py.bak @@ -0,0 +1,117 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .aws_polly_speak_provider_credentials import AwsPollySpeakProviderCredentials +from .aws_polly_speak_provider_engine import AwsPollySpeakProviderEngine +from .aws_polly_speak_provider_voice import AwsPollySpeakProviderVoice +from .cartesia_model_id import CartesiaModelId +from .cartesia_voice import CartesiaVoice +from .deepgram_model import DeepgramModel +from .eleven_labs_speak_provider_model_id import ElevenLabsSpeakProviderModelId +from .open_ai_speak_provider_model import OpenAiSpeakProviderModel +from .open_ai_speak_provider_voice import OpenAiSpeakProviderVoice + + +class SpeakSettingsV1Provider_Deepgram(UncheckedBaseModel): + type: typing.Literal["deepgram"] = "deepgram" + version: typing.Optional[str] = None + model: DeepgramModel + speed: typing.Optional[float] = None + expressivity: typing.Optional[pydantic.StrictInt] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class SpeakSettingsV1Provider_ElevenLabs(UncheckedBaseModel): + type: typing.Literal["eleven_labs"] = "eleven_labs" + version: typing.Optional[typing.Literal["v1"]] = None + model_id: ElevenLabsSpeakProviderModelId + language: typing.Optional[str] = None + language_code: typing.Optional[str] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class SpeakSettingsV1Provider_Cartesia(UncheckedBaseModel): + type: typing.Literal["cartesia"] = "cartesia" + version: typing.Optional[typing.Literal["2025-03-17"]] = None + model_id: CartesiaModelId + voice: CartesiaVoice + language: typing.Optional[str] = None + volume: typing.Optional[float] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class SpeakSettingsV1Provider_OpenAi(UncheckedBaseModel): + type: typing.Literal["open_ai"] = "open_ai" + version: typing.Optional[typing.Literal["v1"]] = None + model: OpenAiSpeakProviderModel + voice: OpenAiSpeakProviderVoice + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class SpeakSettingsV1Provider_AwsPolly(UncheckedBaseModel): + type: typing.Literal["aws_polly"] = "aws_polly" + voice: AwsPollySpeakProviderVoice + language: str + language_code: typing.Optional[str] = None + engine: AwsPollySpeakProviderEngine + credentials: AwsPollySpeakProviderCredentials + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +SpeakSettingsV1Provider = typing_extensions.Annotated[ + typing.Union[ + SpeakSettingsV1Provider_Deepgram, + SpeakSettingsV1Provider_ElevenLabs, + SpeakSettingsV1Provider_Cartesia, + SpeakSettingsV1Provider_OpenAi, + SpeakSettingsV1Provider_AwsPolly, + ], + UnionMetadata(discriminant="type"), +] diff --git a/tests/wire/test_listen_v1_media.py.bak b/tests/wire/test_listen_v1_media.py.bak new file mode 100644 index 00000000..d46dbc2a --- /dev/null +++ b/tests/wire/test_listen_v1_media.py.bak @@ -0,0 +1,102 @@ +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 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_manage_v1_projects_keys.py.bak b/tests/wire/test_manage_v1_projects_keys.py.bak new file mode 100644 index 00000000..db30e0e0 --- /dev/null +++ b/tests/wire/test_manage_v1_projects_keys.py.bak @@ -0,0 +1,60 @@ +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..f95ac71c --- /dev/null +++ b/tests/wire/test_manage_v1_projects_requests.py.bak @@ -0,0 +1,67 @@ +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 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" + 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 3240f307b3904b87084df4e8f40c7d85d62824bd Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Thu, 1 Oct 2026 08:45:47 +0000 Subject: [PATCH 03/15] SDK regeneration --- .fern/metadata.json | 6 +- .gitignore | 3 - poetry.lock | 590 +++++++++--------- pyproject.toml | 2 +- src/deepgram/__init__.py | 98 +-- src/deepgram/agent/__init__.py | 89 --- src/deepgram/agent/v1/__init__.py | 91 --- src/deepgram/agent/v1/requests/__init__.py | 39 -- .../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 | 37 +- src/deepgram/agent/v1/types/__init__.py | 48 -- .../agent/v1/types/agent_v1settings.py | 3 +- .../agent/v1/types/agent_v1settings_agent.py | 57 +- .../types/agent_v1settings_agent_context.py | 25 - ...1settings_agent_context_listen_provider.py | 23 - .../agent_v1settings_agent_listen_provider.py | 23 - .../v1/types/agent_v1update_listen_listen.py | 37 -- src/deepgram/core/api_error.py | 4 +- src/deepgram/core/client_wrapper.py | 2 +- src/deepgram/core/parse_error.py | 4 +- src/deepgram/core/query_encoder.py | 15 +- src/deepgram/listen/__init__.py | 9 +- src/deepgram/listen/v1/socket_client.py | 30 +- src/deepgram/listen/v2/__init__.py | 9 +- src/deepgram/listen/v2/requests/__init__.py | 3 + .../v2/requests/listen_v2configure_failure.py | 10 + .../v2/requests/listen_v2configure_success.py | 6 + .../listen/v2/requests/listen_v2warning.py | 34 + src/deepgram/listen/v2/socket_client.py | 48 +- src/deepgram/listen/v2/types/__init__.py | 6 +- .../v2/types/listen_v2configure_failure.py | 14 +- .../v2/types/listen_v2configure_success.py | 10 +- .../listen_v2configure_success_thresholds.py | 4 +- .../listen/v2/types/listen_v2connected.py | 4 +- .../listen/v2/types/listen_v2fatal_error.py | 4 +- .../listen/v2/types/listen_v2turn_info.py | 4 +- .../v2/types/listen_v2turn_info_words_item.py | 4 +- .../listen/v2/types/listen_v2warning.py | 45 ++ src/deepgram/requests/__init__.py | 49 +- src/deepgram/requests/shared_intents.py | 6 +- .../requests/shared_intents_results.py | 8 - .../shared_intents_results_intents.py | 10 - ...tem.py => shared_intents_segments_item.py} | 8 +- ...red_intents_segments_item_intents_item.py} | 2 +- src/deepgram/requests/shared_topics.py | 6 +- .../requests/shared_topics_results.py | 8 - .../requests/shared_topics_results_topics.py | 10 - ...item.py => shared_topics_segments_item.py} | 8 +- ...hared_topics_segments_item_topics_item.py} | 2 +- src/deepgram/speak/v1/socket_client.py | 30 +- src/deepgram/speak/v2/audio/client.py | 8 +- src/deepgram/speak/v2/audio/raw_client.py | 8 +- .../v2/requests/speak_v2configure_failure.py | 2 +- .../speak/v2/requests/speak_v2error.py | 2 +- .../speak/v2/requests/speak_v2speak.py | 2 +- .../speak_v2speech_interrupted_metadata.py | 2 +- ...h_interrupted_metadata_controls_applied.py | 8 +- .../v2/requests/speak_v2speech_metadata.py | 2 +- ...peak_v2speech_metadata_controls_applied.py | 8 +- .../speak/v2/requests/speak_v2warning.py | 4 +- src/deepgram/speak/v2/socket_client.py | 30 +- .../v2/types/speak_v2configure_failure.py | 2 +- .../types/speak_v2configure_failure_code.py | 9 +- src/deepgram/speak/v2/types/speak_v2error.py | 2 +- src/deepgram/speak/v2/types/speak_v2speak.py | 2 +- .../speak_v2speech_interrupted_metadata.py | 2 +- ...h_interrupted_metadata_controls_applied.py | 8 +- .../speak/v2/types/speak_v2speech_metadata.py | 2 +- ...peak_v2speech_metadata_controls_applied.py | 8 +- .../speak/v2/types/speak_v2warning.py | 4 +- src/deepgram/types/__init__.py | 65 +- src/deepgram/types/deepgram.py | 2 +- .../types/deepgram_listen_provider_v2.py | 30 - .../types/listen_v2configure_numerals.py | 2 +- src/deepgram/types/shared_intents.py | 4 +- src/deepgram/types/shared_intents_results.py | 21 - .../types/shared_intents_results_intents.py | 21 - ...tem.py => shared_intents_segments_item.py} | 6 +- ...red_intents_segments_item_intents_item.py} | 2 +- src/deepgram/types/shared_topics.py | 4 +- src/deepgram/types/shared_topics_results.py | 21 - .../types/shared_topics_results_topics.py | 21 - ...item.py => shared_topics_segments_item.py} | 8 +- ...hared_topics_segments_item_topics_item.py} | 2 +- .../types/speak_settings_v1provider.py | 2 +- src/deepgram/types/speak_v2speed.py | 2 +- src/deepgram/types/speak_v2speed_value.py | 2 +- tests/wire/test_listen_v1_media.py | 91 --- tests/wire/test_manage_v1_projects_keys.py | 11 - .../wire/test_manage_v1_projects_requests.py | 39 -- wiremock/wiremock-mappings.json | 2 +- 93 files changed, 670 insertions(+), 1427 deletions(-) create mode 100644 src/deepgram/listen/v2/requests/listen_v2warning.py create mode 100644 src/deepgram/listen/v2/types/listen_v2warning.py delete mode 100644 src/deepgram/requests/shared_intents_results.py delete mode 100644 src/deepgram/requests/shared_intents_results_intents.py rename src/deepgram/requests/{shared_intents_results_intents_segments_item.py => shared_intents_segments_item.py} (53%) rename src/deepgram/requests/{shared_intents_results_intents_segments_item_intents_item.py => shared_intents_segments_item_intents_item.py} (68%) delete mode 100644 src/deepgram/requests/shared_topics_results.py delete mode 100644 src/deepgram/requests/shared_topics_results_topics.py rename src/deepgram/requests/{shared_topics_results_topics_segments_item.py => shared_topics_segments_item.py} (55%) rename src/deepgram/requests/{shared_topics_results_topics_segments_item_topics_item.py => shared_topics_segments_item_topics_item.py} (68%) delete mode 100644 src/deepgram/types/shared_intents_results.py delete mode 100644 src/deepgram/types/shared_intents_results_intents.py rename src/deepgram/types/{shared_topics_results_topics_segments_item.py => shared_intents_segments_item.py} (69%) rename src/deepgram/types/{shared_intents_results_intents_segments_item_intents_item.py => shared_intents_segments_item_intents_item.py} (88%) delete mode 100644 src/deepgram/types/shared_topics_results.py delete mode 100644 src/deepgram/types/shared_topics_results_topics.py rename src/deepgram/types/{shared_intents_results_intents_segments_item.py => shared_topics_segments_item.py} (67%) rename src/deepgram/types/{shared_topics_results_topics_segments_item_topics_item.py => shared_topics_segments_item_topics_item.py} (88%) diff --git a/.fern/metadata.json b/.fern/metadata.json index f98ef02b..bf9d5758 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -21,8 +21,8 @@ "skip_validation": true } }, - "originGitCommit": "460af9f2b10e5a374517a3a9e40e3045aaa59a08", + "originGitCommit": "e252995bcdb25f3e12d46ae342a2b93d0c1085f9", "originGitCommitIsDirty": true, "invokedBy": "manual", - "sdkVersion": "7.11.0" -} + "sdkVersion": "7.11.1" +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 765eb109..d2e4ca80 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,3 @@ __pycache__/ dist/ poetry.toml -.coverage -htmlcov/ -coverage.xml diff --git a/poetry.lock b/poetry.lock index f1d83e65..e0a1426c 100644 --- a/poetry.lock +++ b/poetry.lock @@ -259,184 +259,184 @@ files = [ [[package]] name = "charset-normalizer" -version = "3.5.1" +version = "3.5.2" description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." optional = false python-versions = ">=3.7" groups = ["dev"] files = [ - {file = "charset_normalizer-3.5.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:d1ee1e296209fdce05b81b663250eefa02213a2da7b41bf26f7829b8ba3545aa"}, - {file = "charset_normalizer-3.5.1-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e9fbdce1e47394b09bc9f26ab117dfc8d6491977a11d86f592bb42c779db2fda"}, - {file = "charset_normalizer-3.5.1-cp310-cp310-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:00668ebb0609751758682eb0b5857e7c35b9f00e84dfdef062e103244ec94d45"}, - {file = "charset_normalizer-3.5.1-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:ba2f37ee79e6338845261a3c5b1784e5d1acdff2c0785b284f1b633033d136ab"}, - {file = "charset_normalizer-3.5.1-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:ce854f5f478050ade5a238731c4ca985a7d3b3cb53ff600a9b5c3b689b5f0a7a"}, - {file = "charset_normalizer-3.5.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:96eefc178f8636b9c760c5829345307fd81cfae9ab1e80997dbddeb0f54ee9a3"}, - {file = "charset_normalizer-3.5.1-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:366ec70f5547c640d3ce1985722490f23faf4eb5216a7eeba78277490e78dacb"}, - {file = "charset_normalizer-3.5.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:950f23cb393f85543777b0433f082cddd25b51ab398eac7971146495679efe5f"}, - {file = "charset_normalizer-3.5.1-cp310-cp310-musllinux_1_2_armv7l.whl", hash = "sha256:c1dcc36dcb96abc02236e182d17e0f71430152a6c2c7447421da2d2dc144edea"}, - {file = "charset_normalizer-3.5.1-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:07ffd07412fc5d5e84cd8952acf9ff7e4ed7a708e69d1bada19d8ba91711353f"}, - {file = "charset_normalizer-3.5.1-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:f5542f9b941279d82d41eb0aa9f98eba36fe4df5c7086c651df7944935b37182"}, - {file = "charset_normalizer-3.5.1-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:a545775cfe815855ea32d7c27731d79da358ef2055b4a25830231b1622dd18aa"}, - {file = "charset_normalizer-3.5.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:494b70049a4d69aec6e8137c13af4cf8db8c9f9820a1392ac293b0dd2987a818"}, - {file = "charset_normalizer-3.5.1-cp310-cp310-win32.whl", hash = "sha256:94fbf1c0c6cc0d3d5e50f9a9313a8cdca90dd696d34b381cd1704f8c9e939f20"}, - {file = "charset_normalizer-3.5.1-cp310-cp310-win_amd64.whl", hash = "sha256:be47f99644b208bff7766314013f9acf57b056b04191d570d68ad14022cf5b1d"}, - {file = "charset_normalizer-3.5.1-cp310-cp310-win_arm64.whl", hash = "sha256:a6d095662e73e74f0a49988e0593373e243e3a52e27bfeea0a859e88acf4a0f5"}, - {file = "charset_normalizer-3.5.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:eda059b6bc8bc0812d626fd91a7ce01bf583df0a61296eff390fd94141a34e30"}, - {file = "charset_normalizer-3.5.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:aa2bb0b37202dca27175591f761108b5d34096ade1191ffe4808bdf6b1571488"}, - {file = "charset_normalizer-3.5.1-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:0b2b1b3fa5670c127b246df1d0c059defd41f689a868a3b9d79df9b1cac42d22"}, - {file = "charset_normalizer-3.5.1-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:6e5e4d73d588ca5ed09df1b7dcd1b203d1df3c542e3f50d126c947d432b10731"}, - {file = "charset_normalizer-3.5.1-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:b54e7e13267d49ffbfe68e25b3cbd774dab38fa37238f71265e91b36146eb21c"}, - {file = "charset_normalizer-3.5.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c7b742bf31c88566b4bb6335a7f393bb322e580b6bb98df7bd0c25e6e3519ce8"}, - {file = "charset_normalizer-3.5.1-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:6ba32c4d2abf1d2fe7cf27d280f4cca5664233b0f885549c7761719eb977f486"}, - {file = "charset_normalizer-3.5.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:0722590aabf9dc6a6c0343d523c05458fa2b5047dbe6302fd526bb570600753f"}, - {file = "charset_normalizer-3.5.1-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:aa1099b956fb795e686d073568f6dc002a0bb89765ea6d5b055dd7d9bf1b116c"}, - {file = "charset_normalizer-3.5.1-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:bd6c173f04743d483881bffa1478d5a4624475b8cd1d2194956a75548e191c18"}, - {file = "charset_normalizer-3.5.1-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:f298e218441525d3794428b4c8b8fb8662c6d3ea79925d4807ee6b9a96a3bca5"}, - {file = "charset_normalizer-3.5.1-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:6e2912d4babbc65196ac13c2f53468dc57fb8b9c25ef913e8c59ddf7c6dc0e1b"}, - {file = "charset_normalizer-3.5.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:3d27167433c0d5f18dc850f07d0b3816221984fecdc405d6c157a6f0b8f8e9e6"}, - {file = "charset_normalizer-3.5.1-cp311-cp311-win32.whl", hash = "sha256:ac00177c4831ffa650f8609e4bdddd5fe09c03b1c0c47acece7e6ea20421598b"}, - {file = "charset_normalizer-3.5.1-cp311-cp311-win_amd64.whl", hash = "sha256:f9b1e28d0e8dbfa858abdba91d6b547beaf2df1a59bec6da6faae7b96a4991a9"}, - {file = "charset_normalizer-3.5.1-cp311-cp311-win_arm64.whl", hash = "sha256:ae31a1a1db2ee6cc2942fccaf695c934bc7f3db9f2133a3fef1f367cf1a4ab10"}, - {file = "charset_normalizer-3.5.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:5b6d1386bf0096d26d3a863dc0a487a5b4eb9aa93cf5ba69683d29dde6b9d60f"}, - {file = "charset_normalizer-3.5.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4582c27e8c889d64811987b5967fbd3ae0c823fe1fd933b543d55ac20bb475fa"}, - {file = "charset_normalizer-3.5.1-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:1d1c7a53a6c2103925cdd6d7229f8c567379f211c869793df679f2e9f738c369"}, - {file = "charset_normalizer-3.5.1-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:e6621fb2a4988d6e53eedc455e5903e2679f3967b8acb3d639f1b63c14a2e893"}, - {file = "charset_normalizer-3.5.1-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:7c0c10730342b0c9b35dd1d619beb8214e520bd96a1f870f452680b238aab3e0"}, - {file = "charset_normalizer-3.5.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b9af956078716df40d985fb0dfeb2c2120c5ca92ba4ff4b388acfd01cdc14d08"}, - {file = "charset_normalizer-3.5.1-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:f9f8405c2c758532c74fed975dbee57be1f31a6e865c031870c79a6ed3212ada"}, - {file = "charset_normalizer-3.5.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:96fef3e886d6a9874b14f27fc193fbdc69d5d8035783d86aa4e1cea594e695f9"}, - {file = "charset_normalizer-3.5.1-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:5d8531a6569d025f68e2321e7638fb7978f23db58e5f69f56913837aae03816e"}, - {file = "charset_normalizer-3.5.1-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:aae2ee51122d3ae968a3837d97dc24a0aeebb0dea23694422cd172bd30017cd6"}, - {file = "charset_normalizer-3.5.1-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:7235dc28fc6dd9d832ac7c7bce95367dedb85929f17368a0c2bee1e080b9acbf"}, - {file = "charset_normalizer-3.5.1-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:4abdc5f9ad448c1ecbfae2974b820535d6bc6e7eef63babbab3d81cf46968c71"}, - {file = "charset_normalizer-3.5.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:ba501e667c17d8411f98e67a022d9604ef179aff0e459b7e292c796837c13573"}, - {file = "charset_normalizer-3.5.1-cp312-cp312-win32.whl", hash = "sha256:cfa1c0cc3a8f9f53f1243a5a99ac36fd003880199383b37672e86ddda9cb07e2"}, - {file = "charset_normalizer-3.5.1-cp312-cp312-win_amd64.whl", hash = "sha256:3617ac3cfd8b9888f145ad89dd6e692285834b0201c6074a5eeaad3fd4d668c2"}, - {file = "charset_normalizer-3.5.1-cp312-cp312-win_arm64.whl", hash = "sha256:88e85ab89cb822c1e635f51d6d32e488f94e002e70e2f492bdb8b945543f345a"}, - {file = "charset_normalizer-3.5.1-cp313-cp313-android_24_arm64_v8a.whl", hash = "sha256:4f298bdadb8f0b9e5672877f647d1be9373ef5320c9e2f049795e26cad28b6a9"}, - {file = "charset_normalizer-3.5.1-cp313-cp313-android_24_x86_64.whl", hash = "sha256:88ca277405c2d3b71c4e1c2ee0e7966e807bcba86a69d11e19ba199d18ae4491"}, - {file = "charset_normalizer-3.5.1-cp313-cp313-ios_13_0_arm64_iphoneos.whl", hash = "sha256:9362dd90aa7dab48c0054a21187791ccf05473f7dba5d92b8033ae62164675e7"}, - {file = "charset_normalizer-3.5.1-cp313-cp313-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:977cdbd483a9cff38179bea4fd754289a6f2195c7abd414aba85410b3e66cc5e"}, - {file = "charset_normalizer-3.5.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:e90251c0c7bdd54a100a0dce3c07b7e637278c93af29dbf78ebb89a58c4bac7d"}, - {file = "charset_normalizer-3.5.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:94d78ecec2605a8d0398b0f365d5f12a63248438516f5dac536a5eff7337df4a"}, - {file = "charset_normalizer-3.5.1-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:d59b75732e9b6f27388e10c14b0259cc5f2e48c78627d185e6a177b58ad3cffe"}, - {file = "charset_normalizer-3.5.1-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:0d929fc574b4d6fd9e7c0f5c2ede8716a41911923aa7fa5fce38e0818aa4a1ac"}, - {file = "charset_normalizer-3.5.1-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:394fea06235c8543390050ed5f529187074b029fb027213f6c46ac11ab5d950e"}, - {file = "charset_normalizer-3.5.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:62b55f6722735a6c472f88361cde6640608773d9443cebdbb51abf436a1fcdd3"}, - {file = "charset_normalizer-3.5.1-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:fa48b1b63d639f9483e0633e092f5851e2348c352f1f9bb6c8182f87884ef876"}, - {file = "charset_normalizer-3.5.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:c71fb0d56c920c269cd3e2e3fe7c610e3f1fdb21a6ce60efa6430ff63676cea6"}, - {file = "charset_normalizer-3.5.1-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:485a0d363cafefcd2538a73c7c838daa2035f09b2c9f9b5e3133f80c6aeb84c2"}, - {file = "charset_normalizer-3.5.1-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:5c0ea61a470e070686aa30892fed79e297d2c8d0ab46b8bcdf027d38c51da591"}, - {file = "charset_normalizer-3.5.1-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:90b7481fb62fbe172c558bc6fd1c4c98d82004a54a7551f20e11ac9bf0b8708c"}, - {file = "charset_normalizer-3.5.1-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:35fe081843b35aad20ffeccec3eeffbe637b15d14f3fb22cc1b59cd8ec17e93c"}, - {file = "charset_normalizer-3.5.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:fd0350afdc3aabd5576f60ea109228bd5538139713c7b094c5cd27c73a98bc6f"}, - {file = "charset_normalizer-3.5.1-cp313-cp313-pyemscripten_2025_0_wasm32.whl", hash = "sha256:9d9a0dc7cbe9bec24c3f767c9122c41fe5a1bc43f47cd099d00d393e09769de4"}, - {file = "charset_normalizer-3.5.1-cp313-cp313-win32.whl", hash = "sha256:d63600d620ad0064c3a748b950ac5ea38a80190e5498532efefa4b7b3f1da1f3"}, - {file = "charset_normalizer-3.5.1-cp313-cp313-win_amd64.whl", hash = "sha256:aea996a6aba25260827c9ea511d1addfde2da9eb686ac961838509086188b7e6"}, - {file = "charset_normalizer-3.5.1-cp313-cp313-win_arm64.whl", hash = "sha256:fd0a274c0e5f9a21565cd9d3dd749b61f96b7aa1e20a93aa1ba4029518f2e5c0"}, - {file = "charset_normalizer-3.5.1-cp314-cp314-android_24_arm64_v8a.whl", hash = "sha256:774d157f112367ff4abd29019f38f023c24e00e56edc7829c20e358a5a913ad8"}, - {file = "charset_normalizer-3.5.1-cp314-cp314-android_24_x86_64.whl", hash = "sha256:26422d45fd13551cf564c58932f7d72b4f58b93b0fcf18c35ba6be12b46bb102"}, - {file = "charset_normalizer-3.5.1-cp314-cp314-ios_13_0_arm64_iphoneos.whl", hash = "sha256:09a7bba9f739468c8e78c36a75c33768e53cb1959fc638f510454c14683f00d5"}, - {file = "charset_normalizer-3.5.1-cp314-cp314-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:4c9548dc78002099910abaebc0a72ac58b7d30931869e0351c09b507dff4ece3"}, - {file = "charset_normalizer-3.5.1-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:c428c6c31eb5f4277d7f8eccaf767fbd548ddd5ce3c8b4f4cbbfab3d96b5904c"}, - {file = "charset_normalizer-3.5.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:2f06b7eae9dbe77fe1d644ca244dad508de8d302870a43f3c559b521270938a0"}, - {file = "charset_normalizer-3.5.1-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:6b7430cf5728e68f6c462254009a6ef4086e1bea43cf2f57aa9c55fb4f50ff96"}, - {file = "charset_normalizer-3.5.1-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:ab743e9bc90c1f73552ec33e10e3331315acd2c397b36065b591b0181de533cc"}, - {file = "charset_normalizer-3.5.1-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:f6f7deae3feb4edfa2efaf7c574fe88cbf055038a6abdb40188e4fff66d5699f"}, - {file = "charset_normalizer-3.5.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:15f024313246a4ed976c60f440bb8d257815513a681d212ff74fd46f7d715a90"}, - {file = "charset_normalizer-3.5.1-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:823f82903d189af463d7df250ef1f7f696f3cee08cc8d91deb565e8d425f6506"}, - {file = "charset_normalizer-3.5.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:01e93745f7f219b703b60ba7afead36cfc4242782be5af484673fc500df12da5"}, - {file = "charset_normalizer-3.5.1-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:329fc3ccb63ad22d867d84c2adea759a64079a37ba4a343433b02c7a2816871e"}, - {file = "charset_normalizer-3.5.1-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:bb57753e36e4855b8ca375069482250a6246372331a3e4f3407eaebb007443f5"}, - {file = "charset_normalizer-3.5.1-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:fce8cbd4997efeb450bd298b54f755dcdff18d496f7a5ddbb4867c6d7c88fdc3"}, - {file = "charset_normalizer-3.5.1-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:6c9cdde8becb25a7fde49924511aa2644d6f8081cc8df8e9452724303348d8e3"}, - {file = "charset_normalizer-3.5.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:9ac4444d8d4fd4c4bd08bf451ed3167aa9e7ec6cdb41b648794f1d1103652e36"}, - {file = "charset_normalizer-3.5.1-cp314-cp314-pyemscripten_2026_0_wasm32.whl", hash = "sha256:f03ac127268b43ef4fe9e6ab6794a6794b49485a0cc0c1db79876d2f33f75bc7"}, - {file = "charset_normalizer-3.5.1-cp314-cp314-win32.whl", hash = "sha256:1f5883d77fd409a261abb5dc8ccbe335720d798b1de4abb3b1d47ccbbc76b53b"}, - {file = "charset_normalizer-3.5.1-cp314-cp314-win_amd64.whl", hash = "sha256:c658c50ac0c98cd755a2dd50b7977d3bca7df401dcc47fbdfa87db53ef7d4e8b"}, - {file = "charset_normalizer-3.5.1-cp314-cp314-win_arm64.whl", hash = "sha256:4bea7f8ebe90bbd7f0e4a2de42ca6924ba23e3e76418c408ff82f1d46fabd687"}, - {file = "charset_normalizer-3.5.1-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:fbc597639158fd7c14d55e808718848319540f51b0e6746e3eefa59723a4a348"}, - {file = "charset_normalizer-3.5.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e71c909f353863b2b89c83de2ebed71ea6d0df8a6ef65a128193c5e650766bef"}, - {file = "charset_normalizer-3.5.1-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:7ac76cf9afd34929d76eb7fcb63be476a4853d8a96f0dcf2d0db68a0cbdf9885"}, - {file = "charset_normalizer-3.5.1-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:a3a370082ce34d0612f421e15fe011c53bb1feff21a26d06ad4fb244dab5a375"}, - {file = "charset_normalizer-3.5.1-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:256dd4d85d9e4dc595e2bc983c980e73f62ddeb3165c58b4c3dfe78c5c8548c1"}, - {file = "charset_normalizer-3.5.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:58d4aa13a59c969dbfdf9e6a9560e242cbfd9e8a8f50c2747714df1a423adf65"}, - {file = "charset_normalizer-3.5.1-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:0c6dfb5ca6723eeed15aa8e564a014d69fcb8812f94eef11fe3631e0508199f5"}, - {file = "charset_normalizer-3.5.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:c010f5581d9c612804cc59fcf7b524b707fbcb72828551237ab545bb5c7034af"}, - {file = "charset_normalizer-3.5.1-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:52ec005752a56ae79547a05c0139ca2501a0c866390b6115008456b9f0e7cde1"}, - {file = "charset_normalizer-3.5.1-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:2bced4061f000f7187254a02ad3433ae17eaf991747ceea2f478422590a5bba9"}, - {file = "charset_normalizer-3.5.1-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:9eea3ab2597a5e65fe65296e2d6a84570845a6b55532d90333d740d48bbc850a"}, - {file = "charset_normalizer-3.5.1-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:496846868fea80e479324862fa877f02411f2fd0f83b79ccee2607aa68b2a032"}, - {file = "charset_normalizer-3.5.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:85d5855daafc240cc045c026d7a15fd198a09b0fc8ff6f5ecbb5297b509cb11e"}, - {file = "charset_normalizer-3.5.1-cp314-cp314t-win32.whl", hash = "sha256:58d3e12c88e0950bca850ae1f7c256055c097639c2edb9eb123af9807d8b15e4"}, - {file = "charset_normalizer-3.5.1-cp314-cp314t-win_amd64.whl", hash = "sha256:acaf604462bf330b0d07e7a07c1d6e4adac79e5fb13e9c5140590542cafacc00"}, - {file = "charset_normalizer-3.5.1-cp314-cp314t-win_arm64.whl", hash = "sha256:fdb8a068947befafba9952162645dc2fecaeb400e64584829ed5e9b2fbe21a7f"}, - {file = "charset_normalizer-3.5.1-cp315-cp315-macosx_10_15_universal2.whl", hash = "sha256:9085f87b0e38a2b92b8923059b4e8789fe40d9279712d15dcc670048d77079af"}, - {file = "charset_normalizer-3.5.1-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:2679de311c7946dde5d3b6f44941844133ff5c7cb86099c0061ab1e8901c20a8"}, - {file = "charset_normalizer-3.5.1-cp315-cp315-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:baf3775a2635e5a11fbd5e4e64ee69c7e86875d224a5c72aca4c141064589a90"}, - {file = "charset_normalizer-3.5.1-cp315-cp315-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:8ac8c94b6539074e0f40899301273ac8402b9b3e01c7b7ba269ff30340aaaf20"}, - {file = "charset_normalizer-3.5.1-cp315-cp315-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:8fe532b3c966d1fb794e0698e4589d0444017ae77fc0b31edea13c0e35bcc449"}, - {file = "charset_normalizer-3.5.1-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5c84bec0ab5ae0c64bfe73a7d2adcb5ce73b467523fc27fd6a28ab2aa6cbe35a"}, - {file = "charset_normalizer-3.5.1-cp315-cp315-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:854066be00447fa8de2ccbbe893e2ffc4b123ef16d897af794c1e18bd4a714b0"}, - {file = "charset_normalizer-3.5.1-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:21b82d8082f6f5e7f456ef0bd16323d08de1266efbfeb476e64b2a91d1471a4e"}, - {file = "charset_normalizer-3.5.1-cp315-cp315-musllinux_1_2_armv7l.whl", hash = "sha256:838648accb3a7fd9803fd45c87bce8509648eb0c11bc34e216141300977244f2"}, - {file = "charset_normalizer-3.5.1-cp315-cp315-musllinux_1_2_ppc64le.whl", hash = "sha256:195ce897c6153c0700078142cf8efe3e6454ca4cf4357499e4078dfd83396626"}, - {file = "charset_normalizer-3.5.1-cp315-cp315-musllinux_1_2_riscv64.whl", hash = "sha256:978eab16f55b4ab2c2a745be9a0a840bf8f09a7f227d9c76eb30214d078865a5"}, - {file = "charset_normalizer-3.5.1-cp315-cp315-musllinux_1_2_s390x.whl", hash = "sha256:cc0329df4caaceb950d2f580b5ac716a377f7059624a0bafaeaf8a218c6ed774"}, - {file = "charset_normalizer-3.5.1-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:687c9ca3035544b113bea2055e180af96fb63c0c476e22a9180f51925186e7b7"}, - {file = "charset_normalizer-3.5.1-cp315-cp315-win32.whl", hash = "sha256:706bfd38730a5ac7a365793269a00f4e988178cec121391f4248d84ad8c972e9"}, - {file = "charset_normalizer-3.5.1-cp315-cp315-win_amd64.whl", hash = "sha256:92caef967d287a407085d61176fce4012b1dd62daed4eb6d5ceb26d3d2538712"}, - {file = "charset_normalizer-3.5.1-cp315-cp315-win_arm64.whl", hash = "sha256:5fc45d653ea8c9a20479167e11d4a0f8cb2fa3470737ab6f9c827532313187b7"}, - {file = "charset_normalizer-3.5.1-cp315-cp315t-macosx_10_15_universal2.whl", hash = "sha256:59171c6e45bf07d0d5cab3b0bf81d945035530f6873398b3b531c31184d46663"}, - {file = "charset_normalizer-3.5.1-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9dbdd9205662134957cf0c324f639bdc5031c0ca056e2369e238db75187c0f11"}, - {file = "charset_normalizer-3.5.1-cp315-cp315t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:e4b018dc5a0eee4676e38fe84a47a427816c590b93b55d9025274ec4d6ffc2dc"}, - {file = "charset_normalizer-3.5.1-cp315-cp315t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:ced3fdd71aaa83ce593746c2edb42b7a59cb4c19c8b5c407781c72e493aae55a"}, - {file = "charset_normalizer-3.5.1-cp315-cp315t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:19a3dd5aa73cef1c99687c4fc57db016a9c17104ae1185da88ba566a5d3bebe4"}, - {file = "charset_normalizer-3.5.1-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:cc5d36d96478aa9c60654bd932525bf32964c62a7281eafdf16d85003a8d6004"}, - {file = "charset_normalizer-3.5.1-cp315-cp315t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:04368edf83514385ffc3e1cfd4546e595f4f1272dd23ba437a93a9cc3741d47b"}, - {file = "charset_normalizer-3.5.1-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:9b5db6052055d34d41230fb78d7c439c23dc536a9896f6cb039e8dd92cfc1263"}, - {file = "charset_normalizer-3.5.1-cp315-cp315t-musllinux_1_2_armv7l.whl", hash = "sha256:252d099029bcbea642f2a06c4ed5046bdf8b5a8150b64afa5e027e88b106e5ee"}, - {file = "charset_normalizer-3.5.1-cp315-cp315t-musllinux_1_2_ppc64le.whl", hash = "sha256:6199d5606e2bbf2b096cf64d03f8b6790c91081d5ac866b8e7bb6422738cc60c"}, - {file = "charset_normalizer-3.5.1-cp315-cp315t-musllinux_1_2_riscv64.whl", hash = "sha256:77efcff2b23071c349402ac1066667a3d011f62398d81408c9b88ad991747c9e"}, - {file = "charset_normalizer-3.5.1-cp315-cp315t-musllinux_1_2_s390x.whl", hash = "sha256:a5cbd90ecf0fc62e64726917ad083b73001f0563657a87ec3c0b504e277dc90d"}, - {file = "charset_normalizer-3.5.1-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:4d26f14f041e83dd8edfd61f4cd4fa7285d31798b5bf1f28e70c367ba6c41d61"}, - {file = "charset_normalizer-3.5.1-cp315-cp315t-win32.whl", hash = "sha256:ac13b004224fb341e1e25a1ed5e19d32f57cdb2a403e01f003b46f051a550f6f"}, - {file = "charset_normalizer-3.5.1-cp315-cp315t-win_amd64.whl", hash = "sha256:35aea775dc2bd5f54cd84a1cd2696cc3207c479cb9cf0bd346f0d343e4300ddb"}, - {file = "charset_normalizer-3.5.1-cp315-cp315t-win_arm64.whl", hash = "sha256:fb78f6e7fcd8ad785d28cd577168bc1aaee827b25bb8755638f694794ea98f0a"}, - {file = "charset_normalizer-3.5.1-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:41876ee62a3dddf48ff1121ad8f0798032aa03f2fd35f21f34a4cab14f18d8d2"}, - {file = "charset_normalizer-3.5.1-cp37-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:a6dac12ff6b846103483683f60c5f8fee205121adc58ffd87e90a90a3af69e99"}, - {file = "charset_normalizer-3.5.1-cp37-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:cee5dd7c6fb5dd52a0fe2a740f9bc6e3593f5f8b1788bde49de02086f30182b2"}, - {file = "charset_normalizer-3.5.1-cp37-abi3-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:343fb4f2821043bd87095f7b08a1a181febc8e36ac64212143bbfd0a0e1bc235"}, - {file = "charset_normalizer-3.5.1-cp37-abi3-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:ae4a097991662cd4fff0ddc74e0fe7874f82e00042fa0ea00855645ed0c79598"}, - {file = "charset_normalizer-3.5.1-cp37-abi3-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:4b599739b93b2cbeded49645ae3c8d1405c29ddfbceac1545c87a3f9580a9e96"}, - {file = "charset_normalizer-3.5.1-cp37-abi3-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:b39b69b347e5e47a3b5b8cfc005c68c1ba347474e3960236c4944a8ecd174962"}, - {file = "charset_normalizer-3.5.1-cp37-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:a2028475ba855475b8b4d3cfeb4994269c967aea8b9892dfba907f4263a863a3"}, - {file = "charset_normalizer-3.5.1-cp37-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:36047af20e17097c3bb9476c2b7655f2f7aa51322c0ba58c07695bedf755a950"}, - {file = "charset_normalizer-3.5.1-cp37-abi3-musllinux_1_2_ppc64le.whl", hash = "sha256:4c4fb141a727957c93edfe5c32a26ceb6b5f6461d67146e2d39f51e16170bea8"}, - {file = "charset_normalizer-3.5.1-cp37-abi3-musllinux_1_2_riscv64.whl", hash = "sha256:2f293479cce755c75f1697e87c409b7ae4c555c7dfecb6e988ad13abba943031"}, - {file = "charset_normalizer-3.5.1-cp37-abi3-musllinux_1_2_s390x.whl", hash = "sha256:3588e376b3ea2eea84976f67273d679f229e24c66dce7b82ae45aef04ff6e072"}, - {file = "charset_normalizer-3.5.1-cp37-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:e199fb99720074809a7720f1c0b4d919eea8b87e88713e0f8f602f7bef543d9d"}, - {file = "charset_normalizer-3.5.1-cp37-abi3-win32.whl", hash = "sha256:dd732602a7009217f658d5863d12d79d373a4de0eebc111094bcdd3bb8e0a6cc"}, - {file = "charset_normalizer-3.5.1-cp37-abi3-win_amd64.whl", hash = "sha256:70055ff39b97c99e7ae40ea3e393fb62aa2e44dbd9b29f8d14f42fb0025c3959"}, - {file = "charset_normalizer-3.5.1-cp37-abi3-win_arm64.whl", hash = "sha256:87e4f41d375c0b9be2fb5251aee4b8a689169e134535aed81bf085c3b647451e"}, - {file = "charset_normalizer-3.5.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:85de3134b5379856e323ba37c19c9256d39425f7b76a63af52b09fb4664c2e8f"}, - {file = "charset_normalizer-3.5.1-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:3e5e1224c0a6a90e05843e07adfec669edebec17801c67072f51e59561d63c0b"}, - {file = "charset_normalizer-3.5.1-cp39-cp39-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:5e2d0e146dcb57034f8b97dc58d2d512cb90aba253960ce449f695fec6a82c6f"}, - {file = "charset_normalizer-3.5.1-cp39-cp39-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:e06efa066f7dbadbc84ebc126a97c452a6451dfcf589d89d788484949e1cf795"}, - {file = "charset_normalizer-3.5.1-cp39-cp39-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:994e883d17c559cdfd38c84003c8b27d25424a1077272a17e7cd27bfe0bf57b2"}, - {file = "charset_normalizer-3.5.1-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:789b8982559ae28dad2356519f841655756cdcd96616410590ae0b17454ee64f"}, - {file = "charset_normalizer-3.5.1-cp39-cp39-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:a951ad59cad9145664a730d3036b40b844e74d2d3683da40111463cd3a83845d"}, - {file = "charset_normalizer-3.5.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:55261ac0d2941c42f196dd576f543d87a8ee03cd6f5e30dfb4d807b2e3b9121a"}, - {file = "charset_normalizer-3.5.1-cp39-cp39-musllinux_1_2_armv7l.whl", hash = "sha256:5ca0555312ae2fe82715cada7fac375530c2f3349e1eaa1bcb33d0283ac79a18"}, - {file = "charset_normalizer-3.5.1-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:2e9cf9253119d8e5d111f05d71626786fd3d6193817316eab1ca088cdb8593cf"}, - {file = "charset_normalizer-3.5.1-cp39-cp39-musllinux_1_2_riscv64.whl", hash = "sha256:433c5a81eade63b47e522303bad236f59dba55ea6951746f5558355eeed8c75d"}, - {file = "charset_normalizer-3.5.1-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:13e3afe97712e8887cd516e960c63f0b93122971e5b5e4b2622fe7701771e838"}, - {file = "charset_normalizer-3.5.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:eb12fb2ba69ffa05f8695f61c69e591dc4b4a12ac3757ac8af8adb259bf56d17"}, - {file = "charset_normalizer-3.5.1-cp39-cp39-win32.whl", hash = "sha256:56490c595a28b1bb27dfc583e816152a9767721ef58b2c03b13f954d2f707420"}, - {file = "charset_normalizer-3.5.1-cp39-cp39-win_amd64.whl", hash = "sha256:012a22b88a77ca2e59b98ac5889b0deb604147666032f45e6d6e217634d2550d"}, - {file = "charset_normalizer-3.5.1-cp39-cp39-win_arm64.whl", hash = "sha256:29880d17a8eb0b5cfdfd8944b468322928059aa35f1f5fa8ff22b149ec0b42f8"}, - {file = "charset_normalizer-3.5.1-py3-none-any.whl", hash = "sha256:6df0ec430f9a831772c23ca5a224cba36517a58a84bb32c32bb59a9fa67c47f6"}, - {file = "charset_normalizer-3.5.1.tar.gz", hash = "sha256:6117b84ea48435e5356dc737f5121485c30920ba43375fa7b434fd753df0eac3"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:195c26fb65950f8fce54e26349852b7bdd7c5f120aeefbcc440b8a20faaed4a3"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9373ad13ef0d2c0fb761e04e55bfdee5a08b52cef2c882c8fbe9935b1517152e"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:ddf19c062bea7a0cc80f519243d2c01dd091be0cf952a0750d4ad576709559f5"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:3d14b50de6bf4d0edf857a9386836846f982b8f524e188e2e68b96d702bcf4aa"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:28a15fdad492a99b6eccfaaed66ef3f74050680545ea61ec8b2f4c538f1f1320"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8a893cc101149f80a653f82062ebc95b34525a2614382e1da5458fe7c6997249"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:619799369eeef6366ed3e8755a5670f4f2f0fb6b30a0fd7264dc0fdc2357058e"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:447441e76ec720b15e64418d32e092297340387053047c7c694f579efb0ee1d9"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-musllinux_1_2_armv7l.whl", hash = "sha256:62588a277bfb59def052abd940703fa35107152bf479781a878617d60faf8fb5"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:44bd4fbb29dfbeba60e7d2bd000c59e4b21ddb3cc53912b14048d37092706d7c"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:30fcd120b732aa79317f08dee04d7de0847822e4cf7ee0e9f445bb958832252c"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:50e3adfb96fc189eb27b1cf62d3b598b89b4bb0420d93a3d3e42e137409011be"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:b736353c0a625bbd5fcec108576e2385db3496f4f771f785ff32e108d3c3bc45"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-win32.whl", hash = "sha256:f5833ad231be5eb6553de524a70f48d71b2c8563101750531e0b80184e175cd4"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-win_amd64.whl", hash = "sha256:1461ac396c4fdb983a675f20aa555624f0ee18ac83d832b9244ffff3d8055275"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-win_arm64.whl", hash = "sha256:c6708715abcf3c73b99508253e961a9967f02fe536532834149574eda6de0d1c"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:3d21b8b13c7592db2ac5e544a6d83187b995257472b0c9e8351b6d507ae37ed6"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d760fe2a4d7c3b226cb9026d6a842868d52a7901bd98420e1baf14e80da85cf5"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:c9790464842f85f437dbbb54417eda1e0e6bfc52dd8d22d6fd1c994b73b2dc74"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:4685902cf26edf013ed7a3da0f426ebba7a00ebb9541386d835afbf002c11cab"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:4495c5002a7b28557e7e222e77e0b661183e432b7d6d2e788101e3f240e05b8c"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:211d5a3eb6af8f513b8d4ca19a8c1b7accab1b5f0d3175f9826b03c1a920dc1f"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:ef4fcbf3327382cd4c9f540babd61248208af7b93eec4de397b4d5f58a09e288"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:bd16aabe4a02a297c23417aa17ac6299dbd8c49f673bcd645b4929b11f5a4400"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:fb9e68df06293761f9fe66ade60a9bc6d0f5e42b8acf2939a9158af86ab0e5bd"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:59f63901b0031c3136cf64704dcb21de0bbae62ce2c9529bc39d27665463de37"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:304d5463e65a35d7bb0850550e0780395395f6fcf452f04db7d5ca7cecc425ac"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:9cf9b1a857e25c4baceeb3624e92a56df3668f398c4acba74e174d81fb4d1d3a"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:114e4d0c92d618409ed82a99e22b5c5e768fe995f2973f78265f4524f49d4640"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-win32.whl", hash = "sha256:2625388c6c754520c37abaf3b41eb34d1cc4a373f457898f08606c8e362b891d"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-win_amd64.whl", hash = "sha256:87e50a3e7cb90af586b6c5faf23e302a970415ac73bd7bd90a515a04b427ef96"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-win_arm64.whl", hash = "sha256:254eb48b9fa5ee9898a3c445825a1f340fe53712a098904b39b0bddba8ea3cb1"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:ed2a239c0ea213acc1908150a3037257083c7c083128f1a4cec2ec4b97dca491"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b91363207bd9dc966a691e959bb47f64b30f7ac4b072be9968b366982f7db77c"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:38a873987f3be698494da8b2e3085e29da02da7b633dce73e79c699a113d7bf0"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:355ad8011081dec5412240c087a9a0c9d4d5039f3ed11a3f13e18c2b29b56c51"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:ee21e28f0430bd6dc9086c6e525d5e818a44a5ad19720c8a0ef766792f3eb5e5"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:3d31298449090ab8d47b7b1b2a555ff73cac7ed438a08b7ac160980c7ebed649"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:5cde776b7cc66e4f6c99612cea4aa7269aa65863f7a15841b2c264f103822f4e"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:ae4f5fea5b8b8ccff88238cc8569303e5ee95efae67fa62922a311397a71f346"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:f7d486c83842422badd511868fd8a9a20e9407ace71564b6af47ce7e60a336c1"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:11a4d68a6ecda3292cb1e50239e111543ba5d709bb62a6b4ea1afcfa729d8875"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:d6734d2ef8a50fbf8445c139477da401f50d62a0606bf00e20ec6d87773fefb1"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:a815775b6c38d4e0ff7bcffbeba67feded90202bb6a226b8dd35f1c855217413"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:23851fb4e1b85ed3f6c2a27b777cdfe2e19fb5b38429a8faf38c7542b7665869"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-win32.whl", hash = "sha256:db19d07e2e0129e974a0e65d0064fc222a446cd5122c2fd4184d2af9fc734a9e"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-win_amd64.whl", hash = "sha256:780fbe7cab297b81dad9fb8dc5eb003c0468ffb0d9e5f65068c53a34661a96bc"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-win_arm64.whl", hash = "sha256:e2af3aad578aa6bd1384bcf4750fc285e5a9de53f40b7d41e5a0bf748edeb2b3"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-android_24_arm64_v8a.whl", hash = "sha256:ed905975ab14056a2e5eb1c376cb2e1ebc5396baf84163939c518556fccde9f5"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-android_24_x86_64.whl", hash = "sha256:a66c3bc5ab1f0ff2164fc9965ddd611ff0802173f4b9d24554c563f6ab7e1d6e"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-ios_13_0_arm64_iphoneos.whl", hash = "sha256:d2374b62878abb00cd8309b32af6c0b715cd02dec0ca74ef12e5069bdc64144a"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:d376bbd28b3a8999db1a103b3b388aee6f1ddeb3e51bc2172993efdcd86e064d"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:6045373d5a89a5ec71afde535db987ca28e76dfa276c2d4c818265b375d4b055"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:849df64e889b2e17230d58410a03dba311a65b163508fd33679b2b737d4b7858"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:15c44f7edfd477b06f517a5cc317fc1707edb9de2c865f43d4b6513907473234"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:a89012d6d5476ee112d20d998570ed58df2260a852afb1758809cd6900411d21"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:0c951d5e6dd9c2ff60609476752bee49da4206adde960ebc247766937f72e718"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7218e8f32b0956cfcd048fd42d9d5779809745ca1d86113ca56f66e7ae1549c4"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:a19a731138fc27d5682277d3b9df22855cea1239bce7fcec5f78f42ef2d1f3c3"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:62603db9a7caa0802eaa28c1c46fecd7b3a263a774069c24c3c28c302448721c"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:b6856554c4f44d79fc2307d5768854310a8f0096e501c75637542c82292b0429"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:1bc0baf5ef96b6ede57d47f4b8fe4d9d84019c3bfcbeb20a41edc6a6ee341f1f"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:56bc200a365efb37383b7852e4cc5898d3b2da5987289b543956cf8cad71018a"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:2c9ad19a6cfcd5ea5c0d41161d22f9df1dcc277e9bef2751391334546a314c00"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:e243bd13217235fc7290c621941c3f5cc8b66e4872495be821d7436ba2fb838d"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-pyemscripten_2025_0_wasm32.whl", hash = "sha256:a090bb2c68df85450502e3e20d665e3a5af9c65a84d6508ed477badd49166fd3"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-win32.whl", hash = "sha256:2b7b3bbfb4fe8ef40600792d762fbaa9057559f9d3fad209525b7a22b99e91fd"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-win_amd64.whl", hash = "sha256:78456a747de8dc58360ffa581f30a002baf5aa28cb262536545e91f113ed7639"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-win_arm64.whl", hash = "sha256:11912e4bb14baae7c5d8791aa55ba0a3a03ec6729073307b0f57270abaa713d3"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-android_24_arm64_v8a.whl", hash = "sha256:1afb975bd5d68d5ce9f6b6d44fdf2f7e34b895a35e95708a7a91b20a3b51d187"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-android_24_x86_64.whl", hash = "sha256:bbbfc8e28816f19d7c0f1816664980c0a9875d01b27cdf8eedddb639d9e108ad"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-ios_13_0_arm64_iphoneos.whl", hash = "sha256:7967d08cf06dee78443b874f98c98036f624f3a4e73e11f9f64f5be4d25393cf"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:4c2b5031f63e331e3839b40aed2dd6f191e9c07edbde303e7876846ea1946995"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:fcff63213e8e6e47770541a4607175404f47cbb3ebea7b6058cc82d524a0e424"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:8d86d6fc60743dc916eb79e2eb1ec4818e21e427731543af40a3021851174a13"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:7a881931aa470808df94a8c380eed2bbbc76cd9dc622310f99665658c821eb6d"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:8024d00c3faf3fc0c16e07a69f4405e8eac7cc0ab15f65fe6cf43827c4cf72b4"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:4d48f2d08b9de5864e2c8744d4461b862fb149a18274abc8b698c45975573438"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:34276fd796040bf0993ab33a369aa572e6979c7aab225a88893667ad8eac8f7a"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:0521c5665880b33d603717defa76c094048900010897909952397feb3039da56"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:eff0ac9dbe711a4aee69bf04a83896aa9b85f19641264053a9f6d48573abb7dd"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:1503bccbeb36d5527790c3930327704c39af22de3112f1b1666a9f3ce15ee204"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:52aa6992700996af31f375de0c6bacd402b0097fe40b53c426b9f51a90ebabc7"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:e09a3942ecbdee5cce73ea9d42da82b81b72ac1bf031ce069b93b5adf4eac8cd"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:c7c9ab723cde841fefb34efbad91e87f00a674b1fe1cd0784fde742bf2c154dc"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:ddc7dacc8ece3a182e7f15cb862d1fd616b46d076cb1ae9dd232b2c38b655874"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-pyemscripten_2026_0_wasm32.whl", hash = "sha256:ee43c17b173d46a3212baa6ead3ae258eeabdae48c263a01ccf0218c366dd655"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-win32.whl", hash = "sha256:4f87960d57feabfb618e4e0af6e7371645fa26a277860739d6e5d6e0012c92f0"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-win_amd64.whl", hash = "sha256:e4e81e09c1578b8df602e3db08b0b3ea0a6947ad612f52bf8dc5ea8d47691f0c"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-win_arm64.whl", hash = "sha256:80d02b6f04e92601a081dd97b23d3128033098bff5d35d392ddcc0476ea11253"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:dca9ab98072a5a54ebacebdc45f53e645336b320c667410b061be1ca588ae709"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f0aa869112ef88429ae17820d99c3dd9504c9e9c671d3c246f3d7442cb051084"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:c0afc6800ba57ccc350374c5bd6150419915d95ce93cdbab2d783d75eaf30ecb"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:7dcd882da75ef9adf94903b1e3b9419e8aa8fb4c7396822b834b9ef7fb96954f"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:2e06a3a98f916dd41d27f3105e02e7a40181c98c94b9158733d03a6f80506c09"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6bd128f206a7752ae1f2ab6c61bf8a24ba28913a10df8b14c2637b973ff97a80"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:c8f3d67aeaf55f017982b73683f0e7342ba2f6635a78f69ce89ebb26aa411e5c"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:fe9753dfee015c570d73df76f899f18444d41388bffcde097deba51c4fadbb9f"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:92888bb3187c5ba50500b00b3b310c9f2c651709d28036077680cb5255450a03"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:d008d90a7f2471519aef0c90dfbe73b3e6e4d5e66ac48e19154c17e89e98b604"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:31f3930700408d211f13378ccbe1c40845d8da54bd0681fac3a9b5aae81c7aa8"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:2a925889534b3748302dae5dead07cc13480de1dac3aea80a941b729b471ef93"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:f5ec61164adcec446f8969a3358ec3f9b26bbda3b9213e5586d219afa8df2915"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-win32.whl", hash = "sha256:598a11a2c7ebaa5334bf698bf29568c9c390abac6a154d8170fedecd1cea38c5"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-win_amd64.whl", hash = "sha256:7fdde2c9fd9e3eca40631e024664cf2584272cc8f96308cbe5fdfc930f51d8bc"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-win_arm64.whl", hash = "sha256:d1befeed746d247c81127bb14de9dc3d30edb6e5976d34f83f86ed262b1d9105"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-macosx_10_15_universal2.whl", hash = "sha256:87475fabc8d9996fd9c27debb395e642e8c838d78a00b6e932227a0e06b81e26"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9409a8bf35cf78353942504b24a57de3d75b708997a1e4bd8db71ac8633ce364"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:498dc3188ca05a68231ac3fdbfc7f57eb67e1343c30e0fea17f8218c1599b253"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:e242bb1c5e76e97dfa9e7f209a71e93a01d7f19ffdd5cfbb2e2d55b4f08f8ab0"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:def79fa35ef0cef8d2accec024f4fdc7ead3012ff02f5215c783f39f03ef8cfc"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:3df041de8887954562c9b261cba85ca0e9ded74048daf125f45edcfaa4832229"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:04851f73ae72b8413dddadb16a49dfee95263553741fd42d546f7d66907e6be5"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:183b88127acdb4fabe59d951ab424faf1af7b63cdbb5f776186c1ea2ffcaed98"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-musllinux_1_2_armv7l.whl", hash = "sha256:16fa0eccf81304b79c5cd87f9271c3b85dd9dd99245e4422ae9c0dd45e0f99d3"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-musllinux_1_2_ppc64le.whl", hash = "sha256:7441d755b7ab94f8d4eb3e43ec05482d760842fd263d003a99102d742cd835e2"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-musllinux_1_2_riscv64.whl", hash = "sha256:ca403d7e4798f525fdfc78e258820419cbbd0f0ecbab9de7840e3c017cf6b8cf"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-musllinux_1_2_s390x.whl", hash = "sha256:df29a0a7107f7011e77f4eebdddec4c7331e24d787a0b21a46d63bdf7445da95"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:f3c96f633825733f735c5a9cf21d21a257d8e1edf0b1cee0a064b9c424ca0f7d"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-win32.whl", hash = "sha256:281cb91036248400f4cc957495cccd44c275c2e0c5854f7e45ac5cf7dc193847"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-win_amd64.whl", hash = "sha256:89b53f3cda69831909888e0494f4fa0bcd3537e3e138dabeb620bd6ad946bae8"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-win_arm64.whl", hash = "sha256:6be488a102b8cf28d0391d8c4ba7748938ae28b78ad901f8585520fca33ead1a"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-macosx_10_15_universal2.whl", hash = "sha256:915563965d418f986e7e145accc592eae9e1a1be3566ff98a05d7a9ec42a76e1"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:65cd72beeeca9d3aaea1201e5923859f308f952f9c71de93f06063c79f0f7a3b"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:b7fd005a73d9e657273b7a10dc71a9e03c8fb9ee6999798d6918ce095b81ac7f"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:e54da4baf05720032d527874d40b65fa4d7e5c6c6a43d0c3adbeffcaf275a2b3"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:124fbf1a8ff966d87ae05bb8bd45a71f966055ed8bba320d0c7cf450bc5f4d0e"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:28b4f0d66fb834ff90f28209ac7bce77868c45d8c93e26f906709d9b7c2e1af9"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:58ca3755ee7ff7f59b57789ec9833c9de9ea275405cdd240eda1f193112e398a"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:443eae2bf318abeaf6f15d785138f71fd6de770e99a92158b8b814265e079115"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-musllinux_1_2_armv7l.whl", hash = "sha256:58f361dcbab699cf8f42db3f47c8e7fd1036f138c23a5d08de9fde5f425a730c"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-musllinux_1_2_ppc64le.whl", hash = "sha256:1b4cbc7c3491ccb4aa17fcd8165649d01cf39f76de1696da8631b5f71b85401d"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-musllinux_1_2_riscv64.whl", hash = "sha256:ba0b1d2620edf869789c3879223f52bf2afc5d31b3cb47cc57b3a12c05e2aa9d"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-musllinux_1_2_s390x.whl", hash = "sha256:5e2b6b57e9733d39f0c9fd3185efa6b8e29652c4cd8fe94180272cf6ed9a78c4"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:51cf45226a9b588d0d2b4880c62d686934b63ab0bd79ca23ab0e9762eb27441b"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-win32.whl", hash = "sha256:5fb29fb8cd1a46c27a1bf9613ad5ec2599310d46b4025d9556404a6b6a292800"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-win_amd64.whl", hash = "sha256:a192e2c40070d92c3ccf777e3a5c4ff515573cd2bb7ed0c537fdadbbec5bbf21"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-win_arm64.whl", hash = "sha256:749e97e1b32313717a565abbe321bc2190bc8b35f1a67e4cdbc7c56c8d8ffe58"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:4275811936e2f06feff5e598fb42a1b7ae852da8e39605211892b56b81a34efd"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:1c50fe28bbc2ced33386f298650d91218076c05420e6cbd790b913adc41659e7"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d19fbd981a488e22cd04883659ca6b08f50b5974f9fd7c95655ef6a043e5893f"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:0fed1d06615f022ee3b13caf5e8b180cfea32bb2c5aded8a9d44277afc040f93"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:838dcc90063569a0448120554591a1d6c4a4ffe11babf048908793154ab86ade"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:2ce45c6627b22c47e390bc91a41c3d13032192e699fa0bea96e9671b373d69b0"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:0774bf9bf620249fee3e0b8b9fd3065de213be30f3aa94ce2494b3b638949e26"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:1db38f4c5496827c1a501846d64d14c3b80c7e6714e406cd7dc36a9899fa1011"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:304d8e4d493af723536393eee0c689eb7813f4a474c8b479dee63f1fdd98f621"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-musllinux_1_2_ppc64le.whl", hash = "sha256:9b7f416ff0978e2f2249330527f0ad6fa02f4932e6199692d3b52da2048c19e4"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-musllinux_1_2_riscv64.whl", hash = "sha256:01077390b03f7988f11d700a2194e69b119741a86b1a638b1db88891e3eced8e"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-musllinux_1_2_s390x.whl", hash = "sha256:7e841fb9010836c992c9f12fcbd43a831de93a5f726fc1ccd8ca1d0268c5014c"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:9cae88599c7219005d879f98e5ed53341e9a122af585e1091200358a3003d2a0"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-win32.whl", hash = "sha256:01b0c0d2262a9e28e8484a278c7e1b5d650e3ac8cf2683d2967e25899f208bdf"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-win_amd64.whl", hash = "sha256:9f56f72050826f63dcee7a7f55b0a77168cb3bfc553fd405e7f8f9ece75a4036"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-win_arm64.whl", hash = "sha256:40ab6bffa02ae10a0581e6c198be7d2d8ca5c2a0c64e4ed3465d766df457573e"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:75a3ceed0724d625d64b86ca20aba182e4df462e04c2414fc941c0f523f06aac"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0891b9d3903c5571c03771ca669a4b0ec5618ca722a5c957d3d29cd4e5062848"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:fc14a032f813bf5fe624d991960ea83e9715adc27e4c1830a2361eb1d02ac341"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:8b2bfab86aa71ae13aa41a6a26aab338e0db2b8bc75434b05aea89e011ff35a4"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:9bde855991b7e362c146535e3136a50bfaffc0487d38b33ca7e5edefc6e23849"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:55ea99acb17b9325618de155a0cd6a2e8f5d10be008113e1d433bbb58db543b2"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:68eb192d85ab8e5f6ec69c2bc6ac0179fbf04a5ac1569d12fbef74883fe102d0"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:d913de495d90407cd859d263bee2e5d1a4ed3eb6573c04e70d9ec619a7cbed7f"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-musllinux_1_2_armv7l.whl", hash = "sha256:3ddacd27458c45bdacd6bd6db644bfb730efbf9e830310186e3045c9c5be8fb2"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:588461c2e8384d309bd63e5826019b6977bc66d629b99ac8737bb795d7b2cb5a"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-musllinux_1_2_riscv64.whl", hash = "sha256:e80e6c2f55656b4824d72065abb4ddd6a525c74bd78a0aab5d9fc2cf4fb5af50"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:d4a7319f304a774bed22115bc891618e45f85065ab44ea6acd07d274e750519a"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:fd1fbe0f116b6e55da77aca2c6ddcddcfac2186cbf78bdebf40fc156efca389d"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-win32.whl", hash = "sha256:93223adc95033dd47133a46ccfc316a0139176fd79085762e27202ec56018f03"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-win_amd64.whl", hash = "sha256:15bb4005af6320d259dc7593ca84a38d7fe06a421dbcf7b910ae23979101e787"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-win_arm64.whl", hash = "sha256:2cc961b171b3f3440f410489ab3573e86aea8736134ebbb40ea1338b7f0831bc"}, + {file = "charset_normalizer-3.5.2-py3-none-any.whl", hash = "sha256:b6b751274acb69d77b3323d6b7dbaa3c7fdfc1eb829b7eb61d262f32e1af9685"}, + {file = "charset_normalizer-3.5.2.tar.gz", hash = "sha256:39de2a259fc954455c57274dc94c79d5842774e1247a016aff30bc0efed0f4ef"}, ] [[package]] @@ -454,133 +454,133 @@ files = [ [[package]] name = "coverage" -version = "7.16.1" +version = "7.16.2" description = "Code coverage measurement for Python" optional = false python-versions = ">=3.10" groups = ["dev"] files = [ - {file = "coverage-7.16.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:4f12a9e27ca7b65e40a8475d27899b2d45064d9020e6a89148939e01987b5853"}, - {file = "coverage-7.16.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8f590d46c30d9e4c1fda3efefe5443f4c2f6a4192c5ca2ba403653e9ebadf097"}, - {file = "coverage-7.16.1-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:3df82f0a3cef4e1bcfc799436056f0b978dda319d0bfd4460c6e479b2802d98a"}, - {file = "coverage-7.16.1-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:bb462d59146656e278d1e8ed913ce374d0ba68a4e081acde1867f6d3377fc881"}, - {file = "coverage-7.16.1-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d7db888dd0a1df1a653cae7f99d4047430d2187a3626eda51bc847b0fd6b9b43"}, - {file = "coverage-7.16.1-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:38a7e16f061504ac2b45370bf5bf97e8250d8d3f25e37385bae884978166554b"}, - {file = "coverage-7.16.1-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:2b26b55b18e1a53e1a159dd743728c4ddbbef28ba19000a91aaff5ce023197ec"}, - {file = "coverage-7.16.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:fdb2f528b50953e29d22033b3256c396a700193c6e45b2490222ef9c333cbbf9"}, - {file = "coverage-7.16.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:3284754371dc78592aa3ae4d661d30ee20e02b2b6b0de3590a181a936d0d3b38"}, - {file = "coverage-7.16.1-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:802d1246c540e07486d4ee1adfa19a797e4b33529ffc371dc140644e8f27da0a"}, - {file = "coverage-7.16.1-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:6fc735d6fe6d57f803e7ba021be4dde48e43e6aff94e6954350555d5332b0594"}, - {file = "coverage-7.16.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:ed5ade1bb18f62edace1bd198c66f9d4c75a8385d5fd24e87d917ea1a5958773"}, - {file = "coverage-7.16.1-cp310-cp310-win32.whl", hash = "sha256:0c309096926b119543dc16438a11ef4c80783d2f4e59ff94f7f462651a944cdc"}, - {file = "coverage-7.16.1-cp310-cp310-win_amd64.whl", hash = "sha256:7562f8067ed9360e8b9739e5703403a7686dd1b36bf0f89fc538047c54cdea90"}, - {file = "coverage-7.16.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:72e013665e25cf9d44779f01f340af26319756f9a76822b7c94ce6b1d93813da"}, - {file = "coverage-7.16.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:cb05c0ff98b56ba6969adf35556bc43bcb8d094df8bc9cb403acff53460c4e07"}, - {file = "coverage-7.16.1-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:0d0ececb32090e3fbb03e0d352b973a0485879b4de6c58daf47227b9988b99e5"}, - {file = "coverage-7.16.1-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:f0ba3892d81aacf36996c52f16bca04e39af31a6c5de930b7688ab617f4a6475"}, - {file = "coverage-7.16.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a6410b75fe07d5271eaa95fc24bd0a9177ed588d9d1c10c0cf67829adb8f0567"}, - {file = "coverage-7.16.1-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:d1039cb2de093225d597109342ce1675626bd127565e80b3044f4eca07c15b2e"}, - {file = "coverage-7.16.1-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:cf047bc39fde5425be2628666d0f435ed8817859111c3aacc84b32d858069f5d"}, - {file = "coverage-7.16.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:2c05913d0d5badf7ac83200f35dcf9514cce5df16a7cc89e7d1d7fff0461813b"}, - {file = "coverage-7.16.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:4027bf6d7bc0a16df058ce913b69f10c5687f8e1ca668f08caa659ce101744bf"}, - {file = "coverage-7.16.1-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:4f48b345f831eaf4402ab6333c2dc3e2e2b5bc7b9c1b8fe12680dee3f0538f01"}, - {file = "coverage-7.16.1-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:8643baeb590726c558b2faed6cd59b0917480f9367fcc692026f1a86d824fd08"}, - {file = "coverage-7.16.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:d06dcc420b570bf683cdb647cc8fe62b672d9e429ef711c3cbbb7a6880ca1572"}, - {file = "coverage-7.16.1-cp311-cp311-win32.whl", hash = "sha256:946f58aa59b08bcd6afcc6a7bd0ff54ed5eee844f32ad69fe6814836d15856a2"}, - {file = "coverage-7.16.1-cp311-cp311-win_amd64.whl", hash = "sha256:684c7ee9b4c04358fe6ac8b517ab51ec35fcd79d08ff0f105dd8bcd96885bbb7"}, - {file = "coverage-7.16.1-cp311-cp311-win_arm64.whl", hash = "sha256:1b24f79e25bcf6c73931aeca7a3dfc7595c0cb5e9364aba3fdf387a3de4b1c22"}, - {file = "coverage-7.16.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:b7f2c26ce6ce0b1e0ca0d5fae96ea510e3a2e78b7207f06e76b7f2c87fa3d0af"}, - {file = "coverage-7.16.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:070acb9da788dff743a4d36fc015feee12d68f0349959017542017c79f59c21c"}, - {file = "coverage-7.16.1-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:e366587b370bc9b8b51b7b7272c610c56db5d5b4795b9e4a29d28ff2f440f809"}, - {file = "coverage-7.16.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:e82e10b9d290f60b63459cfb245a841aec347603997206296b93881463a93dcf"}, - {file = "coverage-7.16.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:3d73bb1f85c4150ac208fb0755beb04b2e44897bad81414de9380f98dd74729f"}, - {file = "coverage-7.16.1-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:3397b9032553d281ad6a9253b12675b65e0cc8cd7a3b0633cf48872c9eb13360"}, - {file = "coverage-7.16.1-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:77890395cf37026a5907d3ad32376aa51f41c0f163b7477fdbd4f94966cc1d08"}, - {file = "coverage-7.16.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:b0944dc3bee3091039bf970d73caaf930c906013128a421bdc132e797494d941"}, - {file = "coverage-7.16.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:b89d22a89d5bc05dd95b64e08295b8394aa96dc88e08f8ba210c9ebfebbe0489"}, - {file = "coverage-7.16.1-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:550a2a1faf7559f13d5344f12d1eb886ad87955155d7dfab2a3fe5c8ec8fe776"}, - {file = "coverage-7.16.1-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:55eb268e5b81aefac759766c9162625b06c1bedb7b77d936225bafc4f038a6f6"}, - {file = "coverage-7.16.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:65a8fc80898c9ce59f04349fe8b4849b1f9787f14e52ead990e5f849ff4727a0"}, - {file = "coverage-7.16.1-cp312-cp312-win32.whl", hash = "sha256:528a61be40977c340cf201d23b69bd6a6bab507da60e9dbda85f8b30e935d70d"}, - {file = "coverage-7.16.1-cp312-cp312-win_amd64.whl", hash = "sha256:d0f02c633630e2b74522108ee95a84ad6e1204a8016a6cca5297f335ea27147e"}, - {file = "coverage-7.16.1-cp312-cp312-win_arm64.whl", hash = "sha256:2959978f9d1d20a2c0c15d0a68baaeccf615ac1aa214cf4a05a10d6f568926c8"}, - {file = "coverage-7.16.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:ee5465db6e9152a7d09f3215309326878c6aa3ac509195a369f9d264ff4bfbd9"}, - {file = "coverage-7.16.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:2b8256f8b525ba233d2e4cdcdce0d6673c66fc9bf70df1fd5e67c54a74e2d245"}, - {file = "coverage-7.16.1-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:d57cc400275b9a2892e905fc893f732b21ddb95271bf96406c88e2f6367848b5"}, - {file = "coverage-7.16.1-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:6b3fd0f3435ebb7a7183b32a6062a8b755f08242ced1f3f22761d30b56b3c2a5"}, - {file = "coverage-7.16.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e5eb1762e7eb5fad34ef913e8107c7788a66f19d328e598ce95bf7217f9e5c8f"}, - {file = "coverage-7.16.1-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:46cd3a73e9140410de62cceb66214bce0e08fb3922b9176fbfc1522fec151b41"}, - {file = "coverage-7.16.1-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:d1ba5142d68dd2cb775cbd0ac8601819298152047803c8efe4eec6d7d7aa7878"}, - {file = "coverage-7.16.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:c389c6f9d1d518e1249ddcb8a7f158135644ce2c508fa6cc17b680777dad5bf2"}, - {file = "coverage-7.16.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:cdc57746c7ac0ea063351b4d651c3bb4dd4fd35e64dbb8e90c10e14eb03c4080"}, - {file = "coverage-7.16.1-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:5597180ed7670cc94c04c65347418a467d3a43d5f0cf52fcac647f5425f42037"}, - {file = "coverage-7.16.1-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:a9647a0ac46255b8fef59a433a2161f03e5483f3a35e1cbd9dfe4600baff0c6b"}, - {file = "coverage-7.16.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:e306e98186b9cd109121f3583aeb7978797ad21d948f22944c5c08845cd554d0"}, - {file = "coverage-7.16.1-cp313-cp313-win32.whl", hash = "sha256:48a78a66fcce49d7f6156524bf979c0ac633d584199717c68c6ffa949fc14e6a"}, - {file = "coverage-7.16.1-cp313-cp313-win_amd64.whl", hash = "sha256:7af03247d598a353bbbbe1b925deb735276e4d845e7197c4073dc89352b236fa"}, - {file = "coverage-7.16.1-cp313-cp313-win_arm64.whl", hash = "sha256:166adae25b05b04c9a84135912066d9c97482115af38df1a419a38aacc6b6f5d"}, - {file = "coverage-7.16.1-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:cc0b37fe6f5ce5f1ccc62ad4fa9b1ad201d8e9b6027fd5e0170877beee4b2d15"}, - {file = "coverage-7.16.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:6618f481053b63fc6121faf8fc676bd9b7163c2a19d9e984a2e850002c28ab57"}, - {file = "coverage-7.16.1-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:fa02d561eb1d8d2f8ba43ba6e3cef4c6c402a3b632a9460fa329fcadcd5df6a3"}, - {file = "coverage-7.16.1-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:bc5354a124799f1f87b7637bbe6f18cd4bc66a1f37f6aa2b5db40f9adad531dc"}, - {file = "coverage-7.16.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:34bafe9f4094315248573e6223e11af0ec1b25f9cbca43bf0e9a26a189ba2751"}, - {file = "coverage-7.16.1-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:29c4d3e32a3b5efa420a3dc627c7e570deb80ef997def52c7686a474f5edc7ab"}, - {file = "coverage-7.16.1-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:f2066c447fdd0bca39a9633a082d8ce67bf9a539a203b85059a364a405dc9fe9"}, - {file = "coverage-7.16.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:fd8ac10cd2458b3c6343aac082fb9bd0e3fa806cb2c4975f2280153474b88412"}, - {file = "coverage-7.16.1-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:9d8c54ec32e5c102b9241f75d88ae26538b53662868ca491736611db448d9c7a"}, - {file = "coverage-7.16.1-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:6dd8dda3402a01a1a8fe8b753a282466f615128574a5590a9108acd07b1f8540"}, - {file = "coverage-7.16.1-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:79afa9726438912e5cddd1fe541815cea9763c92935f594835e4c432565b68a9"}, - {file = "coverage-7.16.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:3db3978211c3cead5437a80136ca0556bab8bc7828de15a762884b0598c41361"}, - {file = "coverage-7.16.1-cp314-cp314-win32.whl", hash = "sha256:49c39c7068a494f8eb427155f5682f44feee43f9b3107fd54b1e52465379c54b"}, - {file = "coverage-7.16.1-cp314-cp314-win_amd64.whl", hash = "sha256:c510dad19552d912058e4c3e3cbec3fb155dbe8d0ce0ceb7e7dbf5c5822bae0b"}, - {file = "coverage-7.16.1-cp314-cp314-win_arm64.whl", hash = "sha256:b7d4d7e6dcaf33e85f1919f03346403bdcc27437c420a78835f3805bca0ab71f"}, - {file = "coverage-7.16.1-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:3d0a3681c12d3e0bcdea3d9414b04087828d6c1a482802d6f7f42c37ed530152"}, - {file = "coverage-7.16.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:3f3b4469d3da3ecced775d1a8c9c5d9fc80f259e30b7b89f9fed0700d6035ecb"}, - {file = "coverage-7.16.1-cp314-cp314t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:c08ae35c1be2fe1ce4b4c628df5c6fc0dc9a87f8e5fe8e20238d249678984741"}, - {file = "coverage-7.16.1-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:8ee71a38c54bb2676bbe762b8b0943a79ccb1c2fd6a52054f66e63eda392f8c1"}, - {file = "coverage-7.16.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:76491917771f179f9772efe218c5ccc65950dbdb35f4439298d8a8dfc6ec1f72"}, - {file = "coverage-7.16.1-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:f4aa0b0a6f81fa3deb211e643f6954e78b4376b62b9c218271236cfa757664e8"}, - {file = "coverage-7.16.1-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:756ba2d96d073c5a2a55d67fa22784763710fadbe22c41adde2d9cfa4dd78a8c"}, - {file = "coverage-7.16.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:99bf9ea435cefcefd220f8687c3ddbbf78dc2de0bd11b57c3ae9fbbdf8d5561a"}, - {file = "coverage-7.16.1-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:35cbc81f937fc402971df45c897d2df2bfb2014efcd990360032aa0a651635da"}, - {file = "coverage-7.16.1-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:8fae08e85b334ac6ac886002b5041396a31bcf805225bbe19847627203da99e2"}, - {file = "coverage-7.16.1-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:83362b64e215ef00b0ba33fcf13655ace6c9fdd144d5ad2ab59ac86c2daf166e"}, - {file = "coverage-7.16.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:33300f2e140ccf26af3d8152e62bff71993f9310cfc63ba7a20940b0d246a0ae"}, - {file = "coverage-7.16.1-cp314-cp314t-win32.whl", hash = "sha256:5539304fdbb2cc144df684d35a33b81145334d23e1c2367b5a923d25107f70b2"}, - {file = "coverage-7.16.1-cp314-cp314t-win_amd64.whl", hash = "sha256:715dcb72c3280c428c3a20134b87e42c29acec9669136e899ab2de69ca86218d"}, - {file = "coverage-7.16.1-cp314-cp314t-win_arm64.whl", hash = "sha256:dac8b84c03e6029d272b8249c77018db83de59ca009a9adef7c144b4a62ee5e6"}, - {file = "coverage-7.16.1-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:a337dc2d54c74430cd2febb8ee04f7c508ba8b3b412bf0463f077a66cfc73743"}, - {file = "coverage-7.16.1-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:3acd1d78397dead78dd1b011b5fc19cc823c190349acd549e63856dff649c80e"}, - {file = "coverage-7.16.1-cp315-cp315-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:73a32694603a34ad01d7e51a481a4023410d8099e1d0757e067945695c10f0ae"}, - {file = "coverage-7.16.1-cp315-cp315-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:fbbe8265736659a6be2e6042b6a35be13545d14b243cc1d7ecf65f90d788a370"}, - {file = "coverage-7.16.1-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4b0359eb4c62f9993e176bc8f50450fc736a6b90dbcc05bb8584e948812699ae"}, - {file = "coverage-7.16.1-cp315-cp315-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:da506e669a8a851b59e122b4b219ea70996a6296f44f3a9348a852526ff961de"}, - {file = "coverage-7.16.1-cp315-cp315-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:64a2a5985d81810ed605ff0dc4ccd6555efcb5700353825532a9a0aea65826e1"}, - {file = "coverage-7.16.1-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:66d70132b69b861805dc1ca46cdd733e54c416890e8f1371d2fd103f70b59c9c"}, - {file = "coverage-7.16.1-cp315-cp315-musllinux_1_2_i686.whl", hash = "sha256:db651a9cf325a542bc2b7b8cc8f1b2bdc6492739bae3103731b2f1c85b96cff6"}, - {file = "coverage-7.16.1-cp315-cp315-musllinux_1_2_ppc64le.whl", hash = "sha256:4184e78a4465dcda359fb403172b8951dd220929cb0984c02fabca1742fff06f"}, - {file = "coverage-7.16.1-cp315-cp315-musllinux_1_2_riscv64.whl", hash = "sha256:bc53c3f3adaa939b7a063533ffe0ae1259e7073393c618043a99a6970a87e3df"}, - {file = "coverage-7.16.1-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:b44308854ef210b9b78df9cdfd4e159513382a859f5ef8464306d14a54c2a040"}, - {file = "coverage-7.16.1-cp315-cp315-win32.whl", hash = "sha256:dccc142614d3419ed71857deb43f1d757829a4c7fce9994464b71e7e38309827"}, - {file = "coverage-7.16.1-cp315-cp315-win_amd64.whl", hash = "sha256:961fc424e9d5229a99f8f1189942d8e7f4e1519147c3af64842f944aca03914d"}, - {file = "coverage-7.16.1-cp315-cp315-win_arm64.whl", hash = "sha256:681a9488c5a234397c4f013da065aa9e53eb7af4c78f1f80c6f15e7208acb855"}, - {file = "coverage-7.16.1-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:8bb09a2d19b04db1fa0e087a7ca4f12458f7e0e7364cfcd838441d86fb1c61f6"}, - {file = "coverage-7.16.1-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:2270a794600b635ca9452ce4c32e2fe81a35f9caa17ffac0eba99f14f275bd4d"}, - {file = "coverage-7.16.1-cp315-cp315t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:a4eff405b545dfcf79cf0d9d3ff750e5c5a887aa066114175193a81d249c5ee6"}, - {file = "coverage-7.16.1-cp315-cp315t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:ee1d5fc9e3bd6a217906929cc97880239a91d20dae7746f538eb0eefee705ab1"}, - {file = "coverage-7.16.1-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d4ec944947de098ad5a1738413f9364689a57067ecbc328e9de37218aa1e5cc1"}, - {file = "coverage-7.16.1-cp315-cp315t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:3f73ee3956fde2d461c9e2955dd48166e4821fc8587d135e8780fb84da2a098b"}, - {file = "coverage-7.16.1-cp315-cp315t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:1ec9a4ee989c0d06ad95add0dbfdbb72b00ef53f43431ca0b612384e7878e5de"}, - {file = "coverage-7.16.1-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:7e5727b2508f817f3126d6c33327dda32fe69d15514badfcd61db8bc4209ecef"}, - {file = "coverage-7.16.1-cp315-cp315t-musllinux_1_2_i686.whl", hash = "sha256:19a3ea2f364012ef06678118fffdc92442a16bef4a5c8ad4f4019dd8f9ac8876"}, - {file = "coverage-7.16.1-cp315-cp315t-musllinux_1_2_ppc64le.whl", hash = "sha256:996c2b891b441ec2b39725ee3e8386e2f11b4894b92be225fdfd54a3eeada2c8"}, - {file = "coverage-7.16.1-cp315-cp315t-musllinux_1_2_riscv64.whl", hash = "sha256:a125fac1f6b1e88488d208a86b578e1790e3c4937f2e1568d23356141d236220"}, - {file = "coverage-7.16.1-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:b10095528b866d322d33d6bf1709b7f8cbf959f12e8cb2ba22fc59c8717866b0"}, - {file = "coverage-7.16.1-cp315-cp315t-win32.whl", hash = "sha256:531d9be377fdcc05593b974656872eb82e808ebeb42a72515e3aaeb8bb7166f5"}, - {file = "coverage-7.16.1-cp315-cp315t-win_amd64.whl", hash = "sha256:46a88f51770df7c9bc376bd57d3f86cdc7624b8e16ac4b585a655c22b7a1b4db"}, - {file = "coverage-7.16.1-cp315-cp315t-win_arm64.whl", hash = "sha256:7580432cbe1e8b762660ae5806f04f869e1c02e519836a43f8094437e561e9f0"}, - {file = "coverage-7.16.1-py3-none-any.whl", hash = "sha256:3d8bd4e58b6a5c2018d808f297905393c6c61da466a48c3f0596a76a4900ebe4"}, - {file = "coverage-7.16.1.tar.gz", hash = "sha256:f83981779bcf9dfa06fa0a8d4cb43e0faec1706328ce07aa3e7b665b4ac0f210"}, + {file = "coverage-7.16.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:23219888477edd736b6fcaec1272d47d93b926e999641ffea7e53a1738e70b2b"}, + {file = "coverage-7.16.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:40c0f00899fe6181ae7f434ceb200e51f5ee4b8ed10e3b5f0b605f0cae15da87"}, + {file = "coverage-7.16.2-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:a4624f80732f6b427ac58f1f59c577a0994a12e8174b5af6a027b4b58795d4c3"}, + {file = "coverage-7.16.2-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:191803c4996b499fcd78c2ad5e5f767dcc53cb4dc6de6d6a741b443a1821ef02"}, + {file = "coverage-7.16.2-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9fd670ac43b709c575aefc25bf52d8a598a3bc5017bddfd0a179152ab06a2deb"}, + {file = "coverage-7.16.2-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:705e5af11d34647efdc170c7840b6857c81cf74be96419a553f237e68e62cb72"}, + {file = "coverage-7.16.2-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:8afd9bf35cc6a1f22eb3634808fa8e0b91902459c5721ef2e4461dfe771d7f08"}, + {file = "coverage-7.16.2-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:3f43bac1856ba269b905302778d4df433d6006489a192174ad77ac528e395032"}, + {file = "coverage-7.16.2-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:f8475460aa33ee28ac896ab1156d0bb3b6c639f7f8383c2677d3359eb35f8205"}, + {file = "coverage-7.16.2-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:d6276d78f6fca7d0ac066d5da4165c5acd07829e8305c2cb900b738fb3a75a72"}, + {file = "coverage-7.16.2-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:736fde09ea39646d11f8e3b76bd3425c075aa4dd45f24891970bb77c14ff20f5"}, + {file = "coverage-7.16.2-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:c85d54e7e8a2ca932fe8399301af9b8d5907ea2a455ffaff6e7d1208db83b943"}, + {file = "coverage-7.16.2-cp310-cp310-win32.whl", hash = "sha256:5139009b5efd2194fc168ee9362f0e191ba612ef5d29242f9269c22f9b8f80c7"}, + {file = "coverage-7.16.2-cp310-cp310-win_amd64.whl", hash = "sha256:c3305c38a2fa21a4254f2ace7dd9ef5fc569c9a558b66e7017650b3d637fb95e"}, + {file = "coverage-7.16.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:732d950e51f3ba4fb6209c73250f3e8924fefca42953ee04a9e65d8c02414d7d"}, + {file = "coverage-7.16.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:5dca0bb66b4c3d624ba047887bf70270030c150692d543cb501293dc38a9f4b5"}, + {file = "coverage-7.16.2-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:af2a2a8c7c74de0559e0c368d94c8def9e16c58faaee33a0bf081057c4227e3b"}, + {file = "coverage-7.16.2-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:db5f8394e17f877a625b257f2ba0ce8e728a499c2c1579ad66220272cd3df510"}, + {file = "coverage-7.16.2-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5b3146d2317c75f70df2509066d979dadd941f7021cdf9b5db4bcd8568258e25"}, + {file = "coverage-7.16.2-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:9e1d0ced76318bab499693ff25f64faa343415187cb2e4d7befdfdd391a1cf6a"}, + {file = "coverage-7.16.2-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:af98ad5ed9d6daaca956201e00bb429a7eb2b080426686f70a20353e0f9839f5"}, + {file = "coverage-7.16.2-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:1d56e4d21c56d2046447733f8b118409597db48c01efe898ee9ac24e858ec2d6"}, + {file = "coverage-7.16.2-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:1d5d0e3b660506fb84f995814e3118a21efdc0c8eb80127da1be627d90093c17"}, + {file = "coverage-7.16.2-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:17228fbca0f22976f797be94e975dcd237799c657d49551c7de1e0654d1202e9"}, + {file = "coverage-7.16.2-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:bc0b0ac781d489304b741269857f1f8338b7a26b1b89c06c0344658001ec0035"}, + {file = "coverage-7.16.2-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:bf1bd822ec4e387ed245bed0d71151582cf7be9e5309bc4145eefe36083d5878"}, + {file = "coverage-7.16.2-cp311-cp311-win32.whl", hash = "sha256:7ed238d227e23cc300c3d464babdaf9f6ddc740aa1b15a77ae96136e6a7c4516"}, + {file = "coverage-7.16.2-cp311-cp311-win_amd64.whl", hash = "sha256:a90700f743e29aa3d75a6ff5f01953176a889c00e526194bc4d281731b88d99d"}, + {file = "coverage-7.16.2-cp311-cp311-win_arm64.whl", hash = "sha256:a336eec40e3520d369b8a6cdabb4f596e69a8b42927ca074aa1452fed943238a"}, + {file = "coverage-7.16.2-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:218d742afca2b5ad5ca759e93eddedfbcc6eadf8322f080dcefc40b7bd4e2d48"}, + {file = "coverage-7.16.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a9a638be322a8d76a41cdb17781c7f82aaee6a66493d8ffb7e2c09ee22423d99"}, + {file = "coverage-7.16.2-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:724bd0f1e81856b35e59fc98cf7b4e544a3cb662e4e0864dca73d4326ee9d808"}, + {file = "coverage-7.16.2-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:5375ebd99038021b35e99dc88255022912c06565d316212f4a576e4b08d30f5d"}, + {file = "coverage-7.16.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:7a076277ca9f5750cc230f0f578ebd2620cec60255b25707361699fef6fb465c"}, + {file = "coverage-7.16.2-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:58d4a54c6ea672afef66d49be922a2c69826c5ae1a42a9cd94f0c9c2bacdf800"}, + {file = "coverage-7.16.2-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:0dcbcfcc059117284c603ff8cb61a65872512882f84a8cf0339241f7f7c2f148"}, + {file = "coverage-7.16.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:afdf43b72ef3876c1fe66423b91466e37877c9e81e8cec70542b7e8525b9d1b7"}, + {file = "coverage-7.16.2-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:9acc7f7ec4a1b5f89bd929fde5b8a714f6fafdc6cc18725413d510aa082b47ad"}, + {file = "coverage-7.16.2-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:80d3f7b48d43ee8fc5e8707a8adb43d743a5a1a85256c25a24f9d6d0e2238fa6"}, + {file = "coverage-7.16.2-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:126d1af8804d7224421fe991ff65d3ce649081560df7a98b1a5ffff07f9923bd"}, + {file = "coverage-7.16.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:c19cd6d025c1673f22afcd22c7df8a662d779e05d8e3fa6820c22afb895b0206"}, + {file = "coverage-7.16.2-cp312-cp312-win32.whl", hash = "sha256:152877cdc8a07264882cfcd503ba56a3ef6cba56a70e8c70f6eb8ffd7384789a"}, + {file = "coverage-7.16.2-cp312-cp312-win_amd64.whl", hash = "sha256:e6c52d3307824ff93b39efd99e4185d557db40bd841452abfb32e5d9151ca162"}, + {file = "coverage-7.16.2-cp312-cp312-win_arm64.whl", hash = "sha256:a678c0b6b22086ec2427359d22e37445d4a792f5fdbbc744112c7dade65cad02"}, + {file = "coverage-7.16.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:1a37c6e478cf687e1aa30a593d19c92c02fad9d122b51ab73f51b8dc7a0c0fc9"}, + {file = "coverage-7.16.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:0993d0e90858c03943d3cb152e068a20dd4707924deec84dd2230261baae3b1b"}, + {file = "coverage-7.16.2-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:bb2fc905bbf4e6b7f40806ea79e31515abf6349594cdf0adf27c4215f0463204"}, + {file = "coverage-7.16.2-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:4358b9c8c0125b460407f3017c6cce8156e904b32772c5630d27112f52bdbfe5"}, + {file = "coverage-7.16.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1f15254427c9b33eedac4f198eaf9e356eb4f6214551afb43da6194a2c088ad7"}, + {file = "coverage-7.16.2-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:9a75a4704ff640e46170042eec1f984385a121227c505d5a16ad8e495f452541"}, + {file = "coverage-7.16.2-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:14253fc7bb15749b849795a06f5d3b6d8bc3fb8a4b5ddc341faf7a89dce205fc"}, + {file = "coverage-7.16.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:921415102a90637fcc2e3f169f61dad7699ecf690e8639fc21b813acbedc0967"}, + {file = "coverage-7.16.2-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:cce2bc991293f15cc4084ca116827b5900c5f34e1a54dfe83f10ab5c43162eb7"}, + {file = "coverage-7.16.2-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:e1fa594c887365b69745f25a416806e61085dd07b94c9eae68a6e20730629b23"}, + {file = "coverage-7.16.2-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:11e597173af1dc33d5f8a7332ada544199269a223af1ee1770ddd5e245ad0fe8"}, + {file = "coverage-7.16.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:3e7f99698ba3a7d13988bdd984b7ebf13af4dbe2166dc8502eef90d77603b0a4"}, + {file = "coverage-7.16.2-cp313-cp313-win32.whl", hash = "sha256:f80bd9f9633eafc73d0a913ba2645c96ba58bba1befc30590f7c0fbfde59d865"}, + {file = "coverage-7.16.2-cp313-cp313-win_amd64.whl", hash = "sha256:8be099e979fc42559328a21828281b4578304191ae46ed4e80a407048a82eee6"}, + {file = "coverage-7.16.2-cp313-cp313-win_arm64.whl", hash = "sha256:28ff850182a67d117990fa2ce5ea1032836d8c9630dae867e8bdd3bff4533b79"}, + {file = "coverage-7.16.2-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:4ee546b9e4872ffa194bf07ac87bfa1202ebb824d0795dc1ef22f175545ca90a"}, + {file = "coverage-7.16.2-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:a2fac6895eb299a2e52d7bbb8fb3903502b9da8d3f5309ceb16ec40c646b58ee"}, + {file = "coverage-7.16.2-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:57ff3783f99d75a1e81dd56a9737eb5665e6736a5d93258ba596b6dcad8fd05b"}, + {file = "coverage-7.16.2-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:35f37886699cb9abd29958247d718628d5bc6f39e623dff66a09e546c42a7e03"}, + {file = "coverage-7.16.2-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0fd7a86fdda7cb6d616d178654bd0ad6bc0f3f33c2e478aa598500a1a9e34eda"}, + {file = "coverage-7.16.2-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:ac0f3b379c94acc2f7dce5f5f0b24d44fa1cc6a509717ef83dfee07450c2117c"}, + {file = "coverage-7.16.2-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:7d0732c83746bc24123c581a85d9dd96b70ddb538c9076020aa1a041790361e9"}, + {file = "coverage-7.16.2-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:7b451c68218c150f616bc9649783ec8de76a59792c759b43aa0c9c0466a465e4"}, + {file = "coverage-7.16.2-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:a56ac4fa5a75c7e182e8f62600cfb4aff43c5ed7356a034f3557659c3bec1d90"}, + {file = "coverage-7.16.2-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:4cc4f73aa3fabc36e32046d6cd2971405948d8a903636508a3d3b2f9128b3a95"}, + {file = "coverage-7.16.2-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:723dcdab91357159b722935b500ee8abc0a66c8c432e1e9fabf4cc7598952de8"}, + {file = "coverage-7.16.2-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:5397e21a90dde0e9c6896b77ded8f0be26b66f8b22b33aed41f6043ed95d55e6"}, + {file = "coverage-7.16.2-cp314-cp314-win32.whl", hash = "sha256:848893e1d361448c113dc2f0913503522a6f7be231d0e38333d2a22d9698a011"}, + {file = "coverage-7.16.2-cp314-cp314-win_amd64.whl", hash = "sha256:5a27b731c171e43dc8b5f32b76a5051dde2ec9b9366c87028f08a7088ebc2c7b"}, + {file = "coverage-7.16.2-cp314-cp314-win_arm64.whl", hash = "sha256:1c569a9fd25505f1cd6bea90588818f90373ce90e2632e2cacf19ddbd6e14fdb"}, + {file = "coverage-7.16.2-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:d93db87adb6b1c1b408dce4763314b55d76a9f589e96783a84ac9e7689e48bdf"}, + {file = "coverage-7.16.2-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:aa62c85046473959c13ba9edca9dc90a77d5c1095b1ba313556314d77fe5b036"}, + {file = "coverage-7.16.2-cp314-cp314t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:db76506aa5416081f3e8974ae0f7965c58ada0bb0ef7339ac86099588dbb20d3"}, + {file = "coverage-7.16.2-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:a0f2285329dac10ab08f79cb11f5692c497018e6c7c511f95e6fd63a70b8f831"}, + {file = "coverage-7.16.2-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:382d3346d56b0eec1b793d53a4c88799c8053f516aa3a8d7c44315696954bacf"}, + {file = "coverage-7.16.2-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:648352b94507179d82637292e7ae8802508d95f78e2f00a705a50b6c48011681"}, + {file = "coverage-7.16.2-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:fb2bde05838fffae1a1bf75e5d411a6cac3e4e9bb97e6640fed8cd47888b33f0"}, + {file = "coverage-7.16.2-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:6a75180829efb8ae62b4aded25be6ddca1c888d138d2d82e21d93bfbd88f41cb"}, + {file = "coverage-7.16.2-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:99704f73721e23859112072d522076e11c31744fc96b5652e5dd2018aa4359f7"}, + {file = "coverage-7.16.2-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:29309ccc86b7f33df7db12813c299f215bbbc470ed6292d0bedd63ffae1ebf64"}, + {file = "coverage-7.16.2-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:30c1b65d529e46569899fadca59e4a87c1faf2886923f1307ba61e654d4f3c20"}, + {file = "coverage-7.16.2-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:dcf4bc2aab4e16b1c4c0c2005918f23a7dd5d7821ddae82caed9e3342dc2fcce"}, + {file = "coverage-7.16.2-cp314-cp314t-win32.whl", hash = "sha256:a9cd3de0a5bfe7b0e21ee10e1a14e3d61bf52efc88217ab1d95d6ace6970bd46"}, + {file = "coverage-7.16.2-cp314-cp314t-win_amd64.whl", hash = "sha256:611a44e5229a59d7483ce830160e1a0e85f700562c7a5651c7c63fb8f4eb528c"}, + {file = "coverage-7.16.2-cp314-cp314t-win_arm64.whl", hash = "sha256:22957cef43ce038641de78ba995de7568d2d6a37c6ddbf7fa0fd7d1ae2344d91"}, + {file = "coverage-7.16.2-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:414c26dfdb96aac2d570a54e03008f001e32eb2d413705365503648c6bd361d8"}, + {file = "coverage-7.16.2-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:00d3eb96e9988c45f50cccd1f1496571ac5c1f91386ac02c4d55516eeda19a24"}, + {file = "coverage-7.16.2-cp315-cp315-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:4dbbd1155ca46e6e0b6b89d204428c56ef6a459af21333f365d135a2820e5a09"}, + {file = "coverage-7.16.2-cp315-cp315-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:8fc15cc8d0d06e873c00ef18e1372d605f9aaf3de27d8c24e50782e75bc8b843"}, + {file = "coverage-7.16.2-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9c6afdd69218202bc1758c9a14b86b8cf1084f37ed2ca143e567a103772b16d1"}, + {file = "coverage-7.16.2-cp315-cp315-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:aba5c63b7afdc749cc9eae943d5b868cba2b261a176378fa1c5a30bc8bc89982"}, + {file = "coverage-7.16.2-cp315-cp315-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:9174f0af24e5eff248b9dbfe76ec5275a3d19d37edbc2810543f12cf97347a34"}, + {file = "coverage-7.16.2-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:80e9fdb4c3d926b6ba721d4bf7435bdb869c3527ae7803290361d0ab73db13b6"}, + {file = "coverage-7.16.2-cp315-cp315-musllinux_1_2_i686.whl", hash = "sha256:7b3bce4a0d05401d70b7d0d5ca783e686bc9d30e81dbd7d980d532609bf809e4"}, + {file = "coverage-7.16.2-cp315-cp315-musllinux_1_2_ppc64le.whl", hash = "sha256:44f21e407b278efdfc1ee5e481e00518bd1d500310a30a5fbf2bcbedfef4aaf0"}, + {file = "coverage-7.16.2-cp315-cp315-musllinux_1_2_riscv64.whl", hash = "sha256:59c3926585e1cd1f2190f4b2ac9014de1bbeaf0d5d0587b0dc6b0aa90d17896a"}, + {file = "coverage-7.16.2-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:066429634299e14dd2d511e1e85f8f9cecc500781f6b41907c0dd6f1baea7e63"}, + {file = "coverage-7.16.2-cp315-cp315-win32.whl", hash = "sha256:893ea9cf86cb8d2546812ac93d973aaf2ee1fb45110a873b014214fd23e3725e"}, + {file = "coverage-7.16.2-cp315-cp315-win_amd64.whl", hash = "sha256:01c6908bc613b420c26c818fe948e1b97dfd041a53c98b01c63bd8321f5c9aae"}, + {file = "coverage-7.16.2-cp315-cp315-win_arm64.whl", hash = "sha256:967d72c835d7a8cf0af99ec813a2d06e3db6df706402f1fe85b31b437645f495"}, + {file = "coverage-7.16.2-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:98d9c97f51b334b0adce7b964442a9af33c1a00c6ac856984cc5dc8d18f81c75"}, + {file = "coverage-7.16.2-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:3e861f1071dcc2fec1e88bef0920f6b1eaa66a143555b4f8ab79ba2b0f30ef55"}, + {file = "coverage-7.16.2-cp315-cp315t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:fb9d92ecfe2d5b494367c67f7446f8b75b68d8d0c8cf3bc3e6997478be25d9e2"}, + {file = "coverage-7.16.2-cp315-cp315t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:eb57acff4a74246ae513c142d4b36e18c389c3aed8661914a53f7cd0071031b2"}, + {file = "coverage-7.16.2-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:444889f7f66b74e4455c0a97e0e166dd41177f1dca8c0239a47cff25e05ba7e1"}, + {file = "coverage-7.16.2-cp315-cp315t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:a740ea6f083c6db7b926534d159508f80ba275ab35e722522de0d18d0f56e55f"}, + {file = "coverage-7.16.2-cp315-cp315t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:8e209591f7c41ae4a9171335cf6156afda0b21de73b02f73f5aa95b2d5fbb08d"}, + {file = "coverage-7.16.2-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:396bb16e04ce04efbb3df91456ae4e3da918e69ecdf67fb711b0a0fdf35ccce0"}, + {file = "coverage-7.16.2-cp315-cp315t-musllinux_1_2_i686.whl", hash = "sha256:9cdf19874e0d247f32f03609200370343c3c7aa260b191d8c2bb251d36198283"}, + {file = "coverage-7.16.2-cp315-cp315t-musllinux_1_2_ppc64le.whl", hash = "sha256:fd3d72233eb8b48acc94fa57d44e2d32ce8e7abed02882ccb6d855ccc4ed33ec"}, + {file = "coverage-7.16.2-cp315-cp315t-musllinux_1_2_riscv64.whl", hash = "sha256:bb4ffe96aa663cee727659db5a2afeb38c95f8677b747d447b90d6d4874ea2c5"}, + {file = "coverage-7.16.2-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:dba2edfb054f6d4a08df9d1637c39a5aa3865bca6617c13c86be21e45658a59c"}, + {file = "coverage-7.16.2-cp315-cp315t-win32.whl", hash = "sha256:251aed777c47c77aba047096d4542889db089227655711dfc2b9c54ef0e15e35"}, + {file = "coverage-7.16.2-cp315-cp315t-win_amd64.whl", hash = "sha256:2aca0bdfa9e91621d5b09d815357bf63def4fc0e9cb66da67bf2cf93f3b1a6f5"}, + {file = "coverage-7.16.2-cp315-cp315t-win_arm64.whl", hash = "sha256:b88841e654f09732804809e435b3e005a929ffd9998b872b7b213957b8759cb8"}, + {file = "coverage-7.16.2-py3-none-any.whl", hash = "sha256:11d28e9123a9156cb405d8d27b44256c9a58fb5decc2073a8f17862057e3aa0f"}, + {file = "coverage-7.16.2.tar.gz", hash = "sha256:ca64d9f1f384f151b9511bec01126072acd2f313439f8ed015a22d8790aab6fa"}, ] [package.dependencies] diff --git a/pyproject.toml b/pyproject.toml index 5e7bfadf..081ecfe4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ dynamic = ["version"] [tool.poetry] name = "deepgram-sdk" -version = "7.11.0" +version = "7.11.1" description = "" readme = "README.md" authors = [] diff --git a/src/deepgram/__init__.py b/src/deepgram/__init__.py index f143f308..55e59d41 100644 --- a/src/deepgram/__init__.py +++ b/src/deepgram/__init__.py @@ -199,18 +199,14 @@ ReadV1ResponseResultsSummaryResults, ReadV1ResponseResultsSummaryResultsSummary, SharedIntents, - SharedIntentsResults, - SharedIntentsResultsIntents, - SharedIntentsResultsIntentsSegmentsItem, - SharedIntentsResultsIntentsSegmentsItemIntentsItem, + SharedIntentsSegmentsItem, + SharedIntentsSegmentsItemIntentsItem, SharedSentiments, SharedSentimentsAverage, SharedSentimentsSegmentsItem, SharedTopics, - SharedTopicsResults, - SharedTopicsResultsTopics, - SharedTopicsResultsTopicsSegmentsItem, - SharedTopicsResultsTopicsSegmentsItemTopicsItem, + SharedTopicsSegmentsItem, + SharedTopicsSegmentsItemTopicsItem, SpeakSettingsV1, SpeakSettingsV1Endpoint, SpeakSettingsV1Provider, @@ -391,18 +387,14 @@ ReadV1ResponseResultsSummaryResultsParams, ReadV1ResponseResultsSummaryResultsSummaryParams, SharedIntentsParams, - SharedIntentsResultsIntentsParams, - SharedIntentsResultsIntentsSegmentsItemIntentsItemParams, - SharedIntentsResultsIntentsSegmentsItemParams, - SharedIntentsResultsParams, + SharedIntentsSegmentsItemIntentsItemParams, + SharedIntentsSegmentsItemParams, SharedSentimentsAverageParams, SharedSentimentsParams, SharedSentimentsSegmentsItemParams, SharedTopicsParams, - SharedTopicsResultsParams, - SharedTopicsResultsTopicsParams, - SharedTopicsResultsTopicsSegmentsItemParams, - SharedTopicsResultsTopicsSegmentsItemTopicsItemParams, + SharedTopicsSegmentsItemParams, + SharedTopicsSegmentsItemTopicsItemParams, SpeakSettingsV1EndpointParams, SpeakSettingsV1Params, SpeakSettingsV1ProviderParams, @@ -435,10 +427,6 @@ 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", @@ -766,14 +754,10 @@ "ReadV1ResponseResultsSummaryResultsSummaryParams": ".requests", "SharedIntents": ".types", "SharedIntentsParams": ".requests", - "SharedIntentsResults": ".types", - "SharedIntentsResultsIntents": ".types", - "SharedIntentsResultsIntentsParams": ".requests", - "SharedIntentsResultsIntentsSegmentsItem": ".types", - "SharedIntentsResultsIntentsSegmentsItemIntentsItem": ".types", - "SharedIntentsResultsIntentsSegmentsItemIntentsItemParams": ".requests", - "SharedIntentsResultsIntentsSegmentsItemParams": ".requests", - "SharedIntentsResultsParams": ".requests", + "SharedIntentsSegmentsItem": ".types", + "SharedIntentsSegmentsItemIntentsItem": ".types", + "SharedIntentsSegmentsItemIntentsItemParams": ".requests", + "SharedIntentsSegmentsItemParams": ".requests", "SharedSentiments": ".types", "SharedSentimentsAverage": ".types", "SharedSentimentsAverageParams": ".requests", @@ -782,14 +766,10 @@ "SharedSentimentsSegmentsItemParams": ".requests", "SharedTopics": ".types", "SharedTopicsParams": ".requests", - "SharedTopicsResults": ".types", - "SharedTopicsResultsParams": ".requests", - "SharedTopicsResultsTopics": ".types", - "SharedTopicsResultsTopicsParams": ".requests", - "SharedTopicsResultsTopicsSegmentsItem": ".types", - "SharedTopicsResultsTopicsSegmentsItemParams": ".requests", - "SharedTopicsResultsTopicsSegmentsItemTopicsItem": ".types", - "SharedTopicsResultsTopicsSegmentsItemTopicsItemParams": ".requests", + "SharedTopicsSegmentsItem": ".types", + "SharedTopicsSegmentsItemParams": ".requests", + "SharedTopicsSegmentsItemTopicsItem": ".types", + "SharedTopicsSegmentsItemTopicsItemParams": ".requests", "SpeakSettingsV1": ".types", "SpeakSettingsV1Endpoint": ".types", "SpeakSettingsV1EndpointParams": ".requests", @@ -874,17 +854,6 @@ "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", } @@ -1236,14 +1205,10 @@ def __dir__(): "ReadV1ResponseResultsSummaryResultsSummaryParams", "SharedIntents", "SharedIntentsParams", - "SharedIntentsResults", - "SharedIntentsResultsIntents", - "SharedIntentsResultsIntentsParams", - "SharedIntentsResultsIntentsSegmentsItem", - "SharedIntentsResultsIntentsSegmentsItemIntentsItem", - "SharedIntentsResultsIntentsSegmentsItemIntentsItemParams", - "SharedIntentsResultsIntentsSegmentsItemParams", - "SharedIntentsResultsParams", + "SharedIntentsSegmentsItem", + "SharedIntentsSegmentsItemIntentsItem", + "SharedIntentsSegmentsItemIntentsItemParams", + "SharedIntentsSegmentsItemParams", "SharedSentiments", "SharedSentimentsAverage", "SharedSentimentsAverageParams", @@ -1252,14 +1217,10 @@ def __dir__(): "SharedSentimentsSegmentsItemParams", "SharedTopics", "SharedTopicsParams", - "SharedTopicsResults", - "SharedTopicsResultsParams", - "SharedTopicsResultsTopics", - "SharedTopicsResultsTopicsParams", - "SharedTopicsResultsTopicsSegmentsItem", - "SharedTopicsResultsTopicsSegmentsItemParams", - "SharedTopicsResultsTopicsSegmentsItemTopicsItem", - "SharedTopicsResultsTopicsSegmentsItemTopicsItemParams", + "SharedTopicsSegmentsItem", + "SharedTopicsSegmentsItemParams", + "SharedTopicsSegmentsItemTopicsItem", + "SharedTopicsSegmentsItemTopicsItemParams", "SpeakSettingsV1", "SpeakSettingsV1Endpoint", "SpeakSettingsV1EndpointParams", @@ -1344,15 +1305,4 @@ def __dir__(): "self_hosted", "speak", "voice_agent", - "AnthropicThinkProviderModel", - "CartesiaSpeakProviderModelId", - "CartesiaSpeakProviderVoice", - "CartesiaSpeakProviderVoiceParams", - "CreateKeyV1RequestOne", - "DeepgramListenProviderV2LanguageHint", - "DeepgramListenProviderV2LanguageHintParams", - "DeepgramSpeakProviderModel", - "GoogleThinkProviderModel", - "GoogleThinkProviderVersion", - "GroqThinkProviderReasoningMode", ] diff --git a/src/deepgram/agent/__init__.py b/src/deepgram/agent/__init__.py index 7a372700..25e41996 100644 --- a/src/deepgram/agent/__init__.py +++ b/src/deepgram/agent/__init__.py @@ -135,37 +135,6 @@ 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", @@ -294,35 +263,6 @@ "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", } @@ -475,33 +415,4 @@ 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/v1/__init__.py b/src/deepgram/agent/v1/__init__.py index ef258d66..6a71fce2 100644 --- a/src/deepgram/agent/v1/__init__.py +++ b/src/deepgram/agent/v1/__init__.py @@ -137,39 +137,6 @@ 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", @@ -298,35 +265,6 @@ "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", } @@ -479,33 +417,4 @@ 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/requests/__init__.py b/src/deepgram/agent/v1/requests/__init__.py index 16e50f9d..d8b280c0 100644 --- a/src/deepgram/agent/v1/requests/__init__.py +++ b/src/deepgram/agent/v1/requests/__init__.py @@ -74,19 +74,6 @@ 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", @@ -148,19 +135,6 @@ "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", } @@ -246,17 +220,4 @@ 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/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 98076e89..20d1c3b2 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 @@ -42,17 +44,6 @@ except ImportError: from websockets import WebSocketClientProtocol # type: ignore - -def _sanitize_numeric_types(obj: typing.Any) -> typing.Any: - """Convert whole-number floats to integers for wire-compatible JSON. See: internal-api-specs/issues/205.""" - 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, @@ -121,7 +112,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) @@ -175,12 +166,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: """ @@ -189,12 +180,12 @@ async def send_update_prompt(self, message: AgentV1UpdatePrompt) -> None: """ await self._send_model(message) - async def send_force_end_turn(self, message: typing.Optional[AgentV1ForceEndTurn] = None) -> None: + async def send_force_end_turn(self, message: AgentV1ForceEndTurn) -> None: """ Send a message to the websocket connection. The message will be sent as a AgentV1ForceEndTurn. """ - await self._send_model(message or AgentV1ForceEndTurn(type="ForceEndTurn")) + await self._send_model(message) async def send_media(self, message: bytes) -> None: """ @@ -229,7 +220,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 +266,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 +320,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,12 +334,12 @@ def send_update_prompt(self, message: AgentV1UpdatePrompt) -> None: """ self._send_model(message) - def send_force_end_turn(self, message: typing.Optional[AgentV1ForceEndTurn] = None) -> None: + def send_force_end_turn(self, message: AgentV1ForceEndTurn) -> None: """ Send a message to the websocket connection. The message will be sent as a AgentV1ForceEndTurn. """ - self._send_model(message or AgentV1ForceEndTurn(type="ForceEndTurn")) + self._send_model(message) def send_media(self, message: bytes) -> None: """ @@ -383,4 +374,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 d33043f2..756308da 100644 --- a/src/deepgram/agent/v1/types/__init__.py +++ b/src/deepgram/agent/v1/types/__init__.py @@ -78,22 +78,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", @@ -161,22 +145,6 @@ "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", } @@ -268,20 +236,4 @@ 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/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 fae21e75..c1483c35 100644 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent.py +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent.py @@ -2,61 +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): - # 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 +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 827aad63..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,30 +30,6 @@ 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_listen_provider.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py index 222c18a3..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,38 +33,15 @@ class AgentV1SettingsAgentContextListenProvider_V2(UncheckedBaseModel): type: typing.Literal["deepgram"] = "deepgram" model: str language_hints: typing.Optional[typing.List[str]] = None - language_hint: typing.Optional[typing.Union[str, typing.List[str]]] = pydantic.Field(default=None, exclude=True) eot_threshold: typing.Optional[float] = None eager_eot_threshold: typing.Optional[float] = None eot_timeout_ms: typing.Optional[int] = None keyterms: typing.Optional[typing.List[str]] = None if IS_PYDANTIC_V2: - - @pydantic.model_validator(mode="before") - @classmethod - def _migrate_language_hint(cls, values: typing.Any) -> typing.Any: - if not isinstance(values, dict) or "language_hint" not in values: - return values - values = dict(values) - hint = values.pop("language_hint") - if hint is not None and values.get("language_hints") is None: - values["language_hints"] = [hint] if isinstance(hint, str) else list(hint) - return values - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: - @pydantic.root_validator(pre=True) # type: ignore[deprecated] - def _migrate_language_hint(cls, values: typing.Any) -> typing.Any: # type: ignore[no-redef] - if not isinstance(values, dict) or "language_hint" not in values: - return values - values = dict(values) - hint = values.pop("language_hint") - if hint is not None and values.get("language_hints") is None: - values["language_hints"] = [hint] if isinstance(hint, str) else list(hint) - return values - class Config: frozen = True smart_union = True diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py index d225e261..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,38 +33,15 @@ class AgentV1SettingsAgentListenProvider_V2(UncheckedBaseModel): type: typing.Literal["deepgram"] = "deepgram" model: str language_hints: typing.Optional[typing.List[str]] = None - language_hint: typing.Optional[typing.Union[str, typing.List[str]]] = pydantic.Field(default=None, exclude=True) eot_threshold: typing.Optional[float] = None eager_eot_threshold: typing.Optional[float] = None eot_timeout_ms: typing.Optional[int] = None keyterms: typing.Optional[typing.List[str]] = None if IS_PYDANTIC_V2: - - @pydantic.model_validator(mode="before") - @classmethod - def _migrate_language_hint(cls, values: typing.Any) -> typing.Any: - if not isinstance(values, dict) or "language_hint" not in values: - return values - values = dict(values) - hint = values.pop("language_hint") - if hint is not None and values.get("language_hints") is None: - values["language_hints"] = [hint] if isinstance(hint, str) else list(hint) - return values - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: - @pydantic.root_validator(pre=True) # type: ignore[deprecated] - def _migrate_language_hint(cls, values: typing.Any) -> typing.Any: # type: ignore[no-redef] - if not isinstance(values, dict) or "language_hint" not in values: - return values - values = dict(values) - hint = values.pop("language_hint") - if hint is not None and values.get("language_hints") is None: - values["language_hints"] = [hint] if isinstance(hint, str) else list(hint) - return values - class Config: frozen = True smart_union = True diff --git a/src/deepgram/agent/v1/types/agent_v1update_listen_listen.py b/src/deepgram/agent/v1/types/agent_v1update_listen_listen.py index 57f0751a..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,35 +5,8 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 from ....core.unchecked_base_model import UncheckedBaseModel -from ....types.deepgram_listen_provider_v1 import DeepgramListenProviderV1 -from ....types.deepgram_listen_provider_v2 import DeepgramListenProviderV2 from .agent_v1update_listen_listen_provider import AgentV1UpdateListenListenProvider -_V1_ONLY_KEYS = frozenset({"language", "smart_format"}) - - -def _coerce_legacy_update_listen_provider(values: typing.Any) -> typing.Any: - """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): """ @@ -43,19 +16,9 @@ class AgentV1UpdateListenListen(UncheckedBaseModel): provider: AgentV1UpdateListenListenProvider if IS_PYDANTIC_V2: - - @pydantic.model_validator(mode="before") - @classmethod - def _migrate_legacy_provider(cls, values: typing.Any) -> typing.Any: - return _coerce_legacy_update_listen_provider(values) - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: - @pydantic.root_validator(pre=True) # type: ignore[deprecated] - def _migrate_legacy_provider(cls, values: typing.Any) -> typing.Any: # type: ignore[no-redef] - return _coerce_legacy_update_listen_provider(values) - class Config: frozen = True smart_union = True diff --git a/src/deepgram/core/api_error.py b/src/deepgram/core/api_error.py index 2aa93914..6f850a60 100644 --- a/src/deepgram/core/api_error.py +++ b/src/deepgram/core/api_error.py @@ -2,8 +2,6 @@ from typing import Any, Dict, Optional -from .._secure_logging import redact_sensitive_headers - class ApiError(Exception): headers: Optional[Dict[str, str]] @@ -17,7 +15,7 @@ def __init__( status_code: Optional[int] = None, body: Any = None, ) -> None: - self.headers = redact_sensitive_headers(headers) + self.headers = headers self.status_code = status_code self.body = body diff --git a/src/deepgram/core/client_wrapper.py b/src/deepgram/core/client_wrapper.py index 775720e0..856d14d6 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.10.0" + _sdk_version = "7.11.1" headers: typing.Dict[str, str] = { "User-Agent": "deepgram-sdk/" + _sdk_version, diff --git a/src/deepgram/core/parse_error.py b/src/deepgram/core/parse_error.py index c510c0e8..4527c6a8 100644 --- a/src/deepgram/core/parse_error.py +++ b/src/deepgram/core/parse_error.py @@ -2,8 +2,6 @@ from typing import Any, Dict, Optional -from .._secure_logging import redact_sensitive_headers - class ParsingError(Exception): """ @@ -25,7 +23,7 @@ def __init__( body: Any = None, cause: Optional[Exception] = None, ) -> None: - self.headers = redact_sensitive_headers(headers) + self.headers = headers self.status_code = status_code self.body = body self.cause = cause diff --git a/src/deepgram/core/query_encoder.py b/src/deepgram/core/query_encoder.py index 58088258..3183001d 100644 --- a/src/deepgram/core/query_encoder.py +++ b/src/deepgram/core/query_encoder.py @@ -5,13 +5,6 @@ import pydantic -def _coerce_query_value(value: Any) -> Any: - # urllib.parse.urlencode would otherwise turn bools into "True"/"False". - if isinstance(value, bool): - return "true" if value else "false" - return value - - # Flattens dicts to be of the form {"key[subkey][subkey2]": value} where value is not a dict def traverse_query_dict(dict_flat: Dict[str, Any], key_prefix: Optional[str] = None) -> List[Tuple[str, Any]]: result = [] @@ -24,9 +17,9 @@ def traverse_query_dict(dict_flat: Dict[str, Any], key_prefix: Optional[str] = N if isinstance(arr_v, dict): result.extend(traverse_query_dict(arr_v, key)) else: - result.append((key, _coerce_query_value(arr_v))) + result.append((key, arr_v)) else: - result.append((key, _coerce_query_value(v))) + result.append((key, v)) return result @@ -48,11 +41,11 @@ def single_query_encoder(query_key: str, query_value: Any) -> List[Tuple[str, An encoded_values.extend(single_query_encoder(query_key, obj_dict)) else: - encoded_values.append((query_key, _coerce_query_value(value))) + encoded_values.append((query_key, value)) return encoded_values - return [(query_key, _coerce_query_value(query_value))] + return [(query_key, query_value)] def encode_query(query: Optional[Dict[str, Any]]) -> Optional[List[Tuple[str, Any]]]: diff --git a/src/deepgram/listen/__init__.py b/src/deepgram/listen/__init__.py index 54752b7b..b3e4e227 100644 --- a/src/deepgram/listen/__init__.py +++ b/src/deepgram/listen/__init__.py @@ -65,8 +65,9 @@ ListenV2TurnInfoParams, ListenV2TurnInfoWordsItem, ListenV2TurnInfoWordsItemParams, + ListenV2Warning, + ListenV2WarningParams, ) - from .v2 import ListenV2CloseStreamType _dynamic_imports: typing.Dict[str, str] = { "DiarizeModel": ".v1", "ListenV1CloseStream": ".v1", @@ -102,7 +103,6 @@ "ListenV1UtteranceEndParams": ".v1", "ListenV2CloseStream": ".v2", "ListenV2CloseStreamParams": ".v2", - "ListenV2CloseStreamType": ".v2", "ListenV2Configure": ".v2", "ListenV2ConfigureFailure": ".v2", "ListenV2ConfigureFailureParams": ".v2", @@ -124,6 +124,8 @@ "ListenV2TurnInfoParams": ".v2", "ListenV2TurnInfoWordsItem": ".v2", "ListenV2TurnInfoWordsItemParams": ".v2", + "ListenV2Warning": ".v2", + "ListenV2WarningParams": ".v2", "v1": ".v1", "v2": ".v2", } @@ -185,7 +187,6 @@ def __dir__(): "ListenV1UtteranceEndParams", "ListenV2CloseStream", "ListenV2CloseStreamParams", - "ListenV2CloseStreamType", "ListenV2Configure", "ListenV2ConfigureFailure", "ListenV2ConfigureFailureParams", @@ -207,6 +208,8 @@ def __dir__(): "ListenV2TurnInfoParams", "ListenV2TurnInfoWordsItem", "ListenV2TurnInfoWordsItemParams", + "ListenV2Warning", + "ListenV2WarningParams", "v1", "v2", ] 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..8dea11db 100644 --- a/src/deepgram/listen/v2/__init__.py +++ b/src/deepgram/listen/v2/__init__.py @@ -19,6 +19,7 @@ ListenV2TurnInfo, ListenV2TurnInfoEvent, ListenV2TurnInfoWordsItem, + ListenV2Warning, ) from .requests import ( ListenV2CloseStreamParams, @@ -32,12 +33,11 @@ ListenV2ForceEndTurnParams, ListenV2TurnInfoParams, ListenV2TurnInfoWordsItemParams, + ListenV2WarningParams, ) - from .types import ListenV2CloseStreamType _dynamic_imports: typing.Dict[str, str] = { "ListenV2CloseStream": ".types", "ListenV2CloseStreamParams": ".requests", - "ListenV2CloseStreamType": ".types", "ListenV2Configure": ".types", "ListenV2ConfigureFailure": ".types", "ListenV2ConfigureFailureParams": ".requests", @@ -59,6 +59,8 @@ "ListenV2TurnInfoParams": ".requests", "ListenV2TurnInfoWordsItem": ".types", "ListenV2TurnInfoWordsItemParams": ".requests", + "ListenV2Warning": ".types", + "ListenV2WarningParams": ".requests", } @@ -86,7 +88,6 @@ def __dir__(): __all__ = [ "ListenV2CloseStream", "ListenV2CloseStreamParams", - "ListenV2CloseStreamType", "ListenV2Configure", "ListenV2ConfigureFailure", "ListenV2ConfigureFailureParams", @@ -108,4 +109,6 @@ def __dir__(): "ListenV2TurnInfoParams", "ListenV2TurnInfoWordsItem", "ListenV2TurnInfoWordsItemParams", + "ListenV2Warning", + "ListenV2WarningParams", ] diff --git a/src/deepgram/listen/v2/requests/__init__.py b/src/deepgram/listen/v2/requests/__init__.py index 2f5e8b72..ab7a6516 100644 --- a/src/deepgram/listen/v2/requests/__init__.py +++ b/src/deepgram/listen/v2/requests/__init__.py @@ -17,6 +17,7 @@ from .listen_v2force_end_turn import ListenV2ForceEndTurnParams from .listen_v2turn_info import ListenV2TurnInfoParams from .listen_v2turn_info_words_item import ListenV2TurnInfoWordsItemParams + from .listen_v2warning import ListenV2WarningParams _dynamic_imports: typing.Dict[str, str] = { "ListenV2CloseStreamParams": ".listen_v2close_stream", "ListenV2ConfigureFailureParams": ".listen_v2configure_failure", @@ -29,6 +30,7 @@ "ListenV2ForceEndTurnParams": ".listen_v2force_end_turn", "ListenV2TurnInfoParams": ".listen_v2turn_info", "ListenV2TurnInfoWordsItemParams": ".listen_v2turn_info_words_item", + "ListenV2WarningParams": ".listen_v2warning", } @@ -65,4 +67,5 @@ def __dir__(): "ListenV2ForceEndTurnParams", "ListenV2TurnInfoParams", "ListenV2TurnInfoWordsItemParams", + "ListenV2WarningParams", ] diff --git a/src/deepgram/listen/v2/requests/listen_v2configure_failure.py b/src/deepgram/listen/v2/requests/listen_v2configure_failure.py index 4799ff6a..332aead3 100644 --- a/src/deepgram/listen/v2/requests/listen_v2configure_failure.py +++ b/src/deepgram/listen/v2/requests/listen_v2configure_failure.py @@ -22,3 +22,13 @@ class ListenV2ConfigureFailureParams(typing_extensions.TypedDict): to the client. This includes messages of other types, like `TurnInfo` messages. """ + + code: typing_extensions.NotRequired[str] + """ + Failure code identifying the rejected configuration + """ + + description: typing_extensions.NotRequired[str] + """ + A human-readable description of the configuration failure + """ diff --git a/src/deepgram/listen/v2/requests/listen_v2configure_success.py b/src/deepgram/listen/v2/requests/listen_v2configure_success.py index b74b9752..b875582c 100644 --- a/src/deepgram/listen/v2/requests/listen_v2configure_success.py +++ b/src/deepgram/listen/v2/requests/listen_v2configure_success.py @@ -4,6 +4,7 @@ import typing_extensions from ....requests.listen_v2keyterm import ListenV2KeytermParams +from ....types.listen_v2configure_numerals import ListenV2ConfigureNumerals from .listen_v2configure_success_thresholds import ListenV2ConfigureSuccessThresholdsParams @@ -30,6 +31,11 @@ class ListenV2ConfigureSuccessParams(typing_extensions.TypedDict): The currently active language hints. Only applicable to the flux-general-multi model. """ + numerals: typing_extensions.NotRequired[ListenV2ConfigureNumerals] + """ + Whether numeral formatting is enabled for transcripts Flux STT sends after it processes the update. + """ + sequence_id: int """ Starts at `0` and increments for each message the server sends diff --git a/src/deepgram/listen/v2/requests/listen_v2warning.py b/src/deepgram/listen/v2/requests/listen_v2warning.py new file mode 100644 index 00000000..f9670b45 --- /dev/null +++ b/src/deepgram/listen/v2/requests/listen_v2warning.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import typing_extensions + + +class ListenV2WarningParams(typing_extensions.TypedDict): + type: typing.Literal["Warning"] + """ + Message type identifier + """ + + request_id: str + """ + The unique identifier of the request + """ + + sequence_id: int + """ + Starts at `0` and increments for each message the server sends + to the client. This includes messages of other types, like + `TurnInfo` messages. + """ + + code: str + """ + Warning code identifying the condition, in `SCREAMING_SNAKE_CASE` + """ + + description: str + """ + A human-readable description of the warning + """ diff --git a/src/deepgram/listen/v2/socket_client.py b/src/deepgram/listen/v2/socket_client.py index e4e09468..d1b20890 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 @@ -15,6 +17,7 @@ from .types.listen_v2fatal_error import ListenV2FatalError from .types.listen_v2force_end_turn import ListenV2ForceEndTurn from .types.listen_v2turn_info import ListenV2TurnInfo +from .types.listen_v2warning import ListenV2Warning try: from websockets.legacy.client import WebSocketClientProtocol # type: ignore @@ -23,7 +26,12 @@ _logger = logging.getLogger(__name__) V2SocketClientResponse = typing.Union[ - ListenV2Connected, ListenV2TurnInfo, ListenV2ConfigureSuccess, ListenV2ConfigureFailure, ListenV2FatalError + ListenV2Connected, + ListenV2TurnInfo, + ListenV2ConfigureSuccess, + ListenV2ConfigureFailure, + ListenV2Warning, + ListenV2FatalError, ] @@ -70,7 +78,7 @@ async def start_listening(self): ) continue await self._emit_async(EventType.MESSAGE, parsed) - except Exception as exc: + except (websockets.WebSocketException, JSONDecodeError) as exc: await self._emit_async(EventType.ERROR, exc) finally: await self._emit_async(EventType.CLOSE, None) @@ -82,31 +90,26 @@ async def send_media(self, message: bytes) -> None: """ await self._send(message) - async def send_close_stream(self, message: typing.Optional[ListenV2CloseStream] = None) -> None: + async def send_close_stream(self, message: ListenV2CloseStream) -> None: """ Send a message to the websocket connection. The message will be sent as a ListenV2CloseStream. """ - await self._send_model(message or ListenV2CloseStream(type="CloseStream")) + await self._send_model(message) - async def send_force_end_turn(self, message: typing.Optional[ListenV2ForceEndTurn] = None) -> None: + async def send_force_end_turn(self, message: ListenV2ForceEndTurn) -> None: """ Send a message to the websocket connection. The message will be sent as a ListenV2ForceEndTurn. - This requires server-side enablement. On deployments without the feature, the server returns - UNPARSABLE_CLIENT_MESSAGE and closes the connection. """ - await self._send_model(message or ListenV2ForceEndTurn(type="ForceEndTurn")) + await self._send_model(message) - async def send_configure(self, message: typing.Union[ListenV2Configure, typing.Dict[str, typing.Any]]) -> None: + async def send_configure(self, message: ListenV2Configure) -> None: """ Send a message to the websocket connection. The message will be sent as a ListenV2Configure. """ - if isinstance(message, dict): - await self._send(message) - else: - await self._send_model(message) + await self._send_model(message) async def recv(self) -> V2SocketClientResponse: """ @@ -180,7 +183,7 @@ def start_listening(self): ) continue self._emit(EventType.MESSAGE, parsed) - except Exception as exc: + except (websockets.WebSocketException, JSONDecodeError) as exc: self._emit(EventType.ERROR, exc) finally: self._emit(EventType.CLOSE, None) @@ -192,31 +195,26 @@ def send_media(self, message: bytes) -> None: """ self._send(message) - def send_close_stream(self, message: typing.Optional[ListenV2CloseStream] = None) -> None: + def send_close_stream(self, message: ListenV2CloseStream) -> None: """ Send a message to the websocket connection. The message will be sent as a ListenV2CloseStream. """ - self._send_model(message or ListenV2CloseStream(type="CloseStream")) + self._send_model(message) - def send_force_end_turn(self, message: typing.Optional[ListenV2ForceEndTurn] = None) -> None: + def send_force_end_turn(self, message: ListenV2ForceEndTurn) -> None: """ Send a message to the websocket connection. The message will be sent as a ListenV2ForceEndTurn. - This requires server-side enablement. On deployments without the feature, the server returns - UNPARSABLE_CLIENT_MESSAGE and closes the connection. """ - self._send_model(message or ListenV2ForceEndTurn(type="ForceEndTurn")) + self._send_model(message) - def send_configure(self, message: typing.Union[ListenV2Configure, typing.Dict[str, typing.Any]]) -> None: + def send_configure(self, message: ListenV2Configure) -> None: """ Send a message to the websocket connection. The message will be sent as a ListenV2Configure. """ - if isinstance(message, dict): - self._send(message) - else: - self._send_model(message) + self._send_model(message) def recv(self) -> V2SocketClientResponse: """ diff --git a/src/deepgram/listen/v2/types/__init__.py b/src/deepgram/listen/v2/types/__init__.py index 7f084d96..7f4ffc34 100644 --- a/src/deepgram/listen/v2/types/__init__.py +++ b/src/deepgram/listen/v2/types/__init__.py @@ -18,10 +18,9 @@ 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 + from .listen_v2warning import ListenV2Warning _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", @@ -33,6 +32,7 @@ "ListenV2TurnInfo": ".listen_v2turn_info", "ListenV2TurnInfoEvent": ".listen_v2turn_info_event", "ListenV2TurnInfoWordsItem": ".listen_v2turn_info_words_item", + "ListenV2Warning": ".listen_v2warning", } @@ -59,7 +59,6 @@ def __dir__(): __all__ = [ "ListenV2CloseStream", - "ListenV2CloseStreamType", "ListenV2Configure", "ListenV2ConfigureFailure", "ListenV2ConfigureSuccess", @@ -71,4 +70,5 @@ def __dir__(): "ListenV2TurnInfo", "ListenV2TurnInfoEvent", "ListenV2TurnInfoWordsItem", + "ListenV2Warning", ] diff --git a/src/deepgram/listen/v2/types/listen_v2configure_failure.py b/src/deepgram/listen/v2/types/listen_v2configure_failure.py index bf30e353..7b3772d6 100644 --- a/src/deepgram/listen/v2/types/listen_v2configure_failure.py +++ b/src/deepgram/listen/v2/types/listen_v2configure_failure.py @@ -4,10 +4,10 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 -from ._dict_compat import ListenV2ResponseDictCompatModel +from ....core.unchecked_base_model import UncheckedBaseModel -class ListenV2ConfigureFailure(ListenV2ResponseDictCompatModel): +class ListenV2ConfigureFailure(UncheckedBaseModel): type: typing.Literal["ConfigureFailure"] = pydantic.Field(default="ConfigureFailure") """ Message type identifier @@ -25,6 +25,16 @@ class ListenV2ConfigureFailure(ListenV2ResponseDictCompatModel): `TurnInfo` messages. """ + code: typing.Optional[str] = pydantic.Field(default=None) + """ + Failure code identifying the rejected configuration + """ + + description: typing.Optional[str] = pydantic.Field(default=None) + """ + A human-readable description of the configuration failure + """ + if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: diff --git a/src/deepgram/listen/v2/types/listen_v2configure_success.py b/src/deepgram/listen/v2/types/listen_v2configure_success.py index bde84d6f..38cf07cc 100644 --- a/src/deepgram/listen/v2/types/listen_v2configure_success.py +++ b/src/deepgram/listen/v2/types/listen_v2configure_success.py @@ -4,12 +4,13 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel +from ....types.listen_v2configure_numerals import ListenV2ConfigureNumerals from ....types.listen_v2keyterm import ListenV2Keyterm -from ._dict_compat import ListenV2ResponseDictCompatModel from .listen_v2configure_success_thresholds import ListenV2ConfigureSuccessThresholds -class ListenV2ConfigureSuccess(ListenV2ResponseDictCompatModel): +class ListenV2ConfigureSuccess(UncheckedBaseModel): type: typing.Literal["ConfigureSuccess"] = pydantic.Field(default="ConfigureSuccess") """ Message type identifier @@ -32,6 +33,11 @@ class ListenV2ConfigureSuccess(ListenV2ResponseDictCompatModel): The currently active language hints. Only applicable to the flux-general-multi model. """ + numerals: typing.Optional[ListenV2ConfigureNumerals] = pydantic.Field(default=None) + """ + Whether numeral formatting is enabled for transcripts Flux STT sends after it processes the update. + """ + sequence_id: int = pydantic.Field() """ Starts at `0` and increments for each message the server sends diff --git a/src/deepgram/listen/v2/types/listen_v2configure_success_thresholds.py b/src/deepgram/listen/v2/types/listen_v2configure_success_thresholds.py index e0353ec9..6c719233 100644 --- a/src/deepgram/listen/v2/types/listen_v2configure_success_thresholds.py +++ b/src/deepgram/listen/v2/types/listen_v2configure_success_thresholds.py @@ -4,13 +4,13 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel from ....types.listen_v2eager_eot_threshold import ListenV2EagerEotThreshold from ....types.listen_v2eot_threshold import ListenV2EotThreshold from ....types.listen_v2eot_timeout_ms import ListenV2EotTimeoutMs -from ._dict_compat import ListenV2ResponseDictCompatModel -class ListenV2ConfigureSuccessThresholds(ListenV2ResponseDictCompatModel): +class ListenV2ConfigureSuccessThresholds(UncheckedBaseModel): """ Updates each parameter, if it is supplied. If a particular threshold parameter is not supplied, the configuration continues using the currently configured value. diff --git a/src/deepgram/listen/v2/types/listen_v2connected.py b/src/deepgram/listen/v2/types/listen_v2connected.py index b253d86c..cefc0236 100644 --- a/src/deepgram/listen/v2/types/listen_v2connected.py +++ b/src/deepgram/listen/v2/types/listen_v2connected.py @@ -4,10 +4,10 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 -from ._dict_compat import ListenV2ResponseDictCompatModel +from ....core.unchecked_base_model import UncheckedBaseModel -class ListenV2Connected(ListenV2ResponseDictCompatModel): +class ListenV2Connected(UncheckedBaseModel): type: typing.Literal["Connected"] = pydantic.Field(default="Connected") """ Message type identifier diff --git a/src/deepgram/listen/v2/types/listen_v2fatal_error.py b/src/deepgram/listen/v2/types/listen_v2fatal_error.py index 2202c82e..c5106f07 100644 --- a/src/deepgram/listen/v2/types/listen_v2fatal_error.py +++ b/src/deepgram/listen/v2/types/listen_v2fatal_error.py @@ -4,10 +4,10 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 -from ._dict_compat import ListenV2ResponseDictCompatModel +from ....core.unchecked_base_model import UncheckedBaseModel -class ListenV2FatalError(ListenV2ResponseDictCompatModel): +class ListenV2FatalError(UncheckedBaseModel): type: typing.Literal["Error"] = pydantic.Field(default="Error") """ Message type identifier diff --git a/src/deepgram/listen/v2/types/listen_v2turn_info.py b/src/deepgram/listen/v2/types/listen_v2turn_info.py index 969d6d0c..d87a1032 100644 --- a/src/deepgram/listen/v2/types/listen_v2turn_info.py +++ b/src/deepgram/listen/v2/types/listen_v2turn_info.py @@ -4,12 +4,12 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 -from ._dict_compat import ListenV2ResponseDictCompatModel +from ....core.unchecked_base_model import UncheckedBaseModel from .listen_v2turn_info_event import ListenV2TurnInfoEvent from .listen_v2turn_info_words_item import ListenV2TurnInfoWordsItem -class ListenV2TurnInfo(ListenV2ResponseDictCompatModel): +class ListenV2TurnInfo(UncheckedBaseModel): """ Describes the current turn and latest state of the turn """ diff --git a/src/deepgram/listen/v2/types/listen_v2turn_info_words_item.py b/src/deepgram/listen/v2/types/listen_v2turn_info_words_item.py index 88240cd9..07ada673 100644 --- a/src/deepgram/listen/v2/types/listen_v2turn_info_words_item.py +++ b/src/deepgram/listen/v2/types/listen_v2turn_info_words_item.py @@ -4,10 +4,10 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 -from ._dict_compat import ListenV2ResponseDictCompatModel +from ....core.unchecked_base_model import UncheckedBaseModel -class ListenV2TurnInfoWordsItem(ListenV2ResponseDictCompatModel): +class ListenV2TurnInfoWordsItem(UncheckedBaseModel): word: str = pydantic.Field() """ The individual punctuated, properly-cased word from the transcript diff --git a/src/deepgram/listen/v2/types/listen_v2warning.py b/src/deepgram/listen/v2/types/listen_v2warning.py new file mode 100644 index 00000000..c392cd25 --- /dev/null +++ b/src/deepgram/listen/v2/types/listen_v2warning.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel + + +class ListenV2Warning(UncheckedBaseModel): + type: typing.Literal["Warning"] = pydantic.Field(default="Warning") + """ + Message type identifier + """ + + request_id: str = pydantic.Field() + """ + The unique identifier of the request + """ + + sequence_id: int = pydantic.Field() + """ + Starts at `0` and increments for each message the server sends + to the client. This includes messages of other types, like + `TurnInfo` messages. + """ + + code: str = pydantic.Field() + """ + Warning code identifying the condition, in `SCREAMING_SNAKE_CASE` + """ + + description: str = pydantic.Field() + """ + A human-readable description of the warning + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/deepgram/requests/__init__.py b/src/deepgram/requests/__init__.py index f3ac75bd..6a2285be 100644 --- a/src/deepgram/requests/__init__.py +++ b/src/deepgram/requests/__init__.py @@ -168,22 +168,14 @@ 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_intents_segments_item import SharedIntentsSegmentsItemParams + from .shared_intents_segments_item_intents_item import SharedIntentsSegmentsItemIntentsItemParams from .shared_sentiments import SharedSentimentsParams from .shared_sentiments_average import SharedSentimentsAverageParams from .shared_sentiments_segments_item import SharedSentimentsSegmentsItemParams from .shared_topics import SharedTopicsParams - from .shared_topics_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 .shared_topics_segments_item import SharedTopicsSegmentsItemParams + from .shared_topics_segments_item_topics_item import SharedTopicsSegmentsItemTopicsItemParams from .speak_settings_v1 import SpeakSettingsV1Params from .speak_settings_v1endpoint import SpeakSettingsV1EndpointParams from .speak_settings_v1provider import ( @@ -218,9 +210,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", @@ -350,18 +339,14 @@ "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", + "SharedIntentsSegmentsItemIntentsItemParams": ".shared_intents_segments_item_intents_item", + "SharedIntentsSegmentsItemParams": ".shared_intents_segments_item", "SharedSentimentsAverageParams": ".shared_sentiments_average", "SharedSentimentsParams": ".shared_sentiments", "SharedSentimentsSegmentsItemParams": ".shared_sentiments_segments_item", "SharedTopicsParams": ".shared_topics", - "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", + "SharedTopicsSegmentsItemParams": ".shared_topics_segments_item", + "SharedTopicsSegmentsItemTopicsItemParams": ".shared_topics_segments_item_topics_item", "SpeakSettingsV1EndpointParams": ".speak_settings_v1endpoint", "SpeakSettingsV1Params": ".speak_settings_v1", "SpeakSettingsV1ProviderParams": ".speak_settings_v1provider", @@ -392,9 +377,6 @@ "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", } @@ -548,18 +530,14 @@ def __dir__(): "ReadV1ResponseResultsSummaryResultsParams", "ReadV1ResponseResultsSummaryResultsSummaryParams", "SharedIntentsParams", - "SharedIntentsResultsIntentsParams", - "SharedIntentsResultsIntentsSegmentsItemIntentsItemParams", - "SharedIntentsResultsIntentsSegmentsItemParams", - "SharedIntentsResultsParams", + "SharedIntentsSegmentsItemIntentsItemParams", + "SharedIntentsSegmentsItemParams", "SharedSentimentsAverageParams", "SharedSentimentsParams", "SharedSentimentsSegmentsItemParams", "SharedTopicsParams", - "SharedTopicsResultsParams", - "SharedTopicsResultsTopicsParams", - "SharedTopicsResultsTopicsSegmentsItemParams", - "SharedTopicsResultsTopicsSegmentsItemTopicsItemParams", + "SharedTopicsSegmentsItemParams", + "SharedTopicsSegmentsItemTopicsItemParams", "SpeakSettingsV1EndpointParams", "SpeakSettingsV1Params", "SpeakSettingsV1ProviderParams", @@ -590,7 +568,4 @@ def __dir__(): "UsageFieldsV1ResponseParams", "UsageV1ResponseParams", "UsageV1ResponseResolutionParams", - "CartesiaSpeakProviderVoiceParams", - "CreateKeyV1RequestOneParams", - "DeepgramListenProviderV2LanguageHintParams", ] diff --git a/src/deepgram/requests/shared_intents.py b/src/deepgram/requests/shared_intents.py index 4dee008d..7a618c13 100644 --- a/src/deepgram/requests/shared_intents.py +++ b/src/deepgram/requests/shared_intents.py @@ -1,7 +1,9 @@ # This file was auto-generated by Fern from our API Definition. +import typing + import typing_extensions -from .shared_intents_results import SharedIntentsResultsParams +from .shared_intents_segments_item import SharedIntentsSegmentsItemParams class SharedIntentsParams(typing_extensions.TypedDict): @@ -9,4 +11,4 @@ class SharedIntentsParams(typing_extensions.TypedDict): Output whenever `intents=true` is used """ - results: typing_extensions.NotRequired[SharedIntentsResultsParams] + segments: typing_extensions.NotRequired[typing.Sequence[SharedIntentsSegmentsItemParams]] diff --git a/src/deepgram/requests/shared_intents_results.py b/src/deepgram/requests/shared_intents_results.py deleted file mode 100644 index f64b242f..00000000 --- a/src/deepgram/requests/shared_intents_results.py +++ /dev/null @@ -1,8 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from .shared_intents_results_intents import SharedIntentsResultsIntentsParams - - -class SharedIntentsResultsParams(typing_extensions.TypedDict): - intents: typing_extensions.NotRequired[SharedIntentsResultsIntentsParams] diff --git a/src/deepgram/requests/shared_intents_results_intents.py b/src/deepgram/requests/shared_intents_results_intents.py deleted file mode 100644 index 59a37dd3..00000000 --- a/src/deepgram/requests/shared_intents_results_intents.py +++ /dev/null @@ -1,10 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -from .shared_intents_results_intents_segments_item import SharedIntentsResultsIntentsSegmentsItemParams - - -class SharedIntentsResultsIntentsParams(typing_extensions.TypedDict): - segments: typing_extensions.NotRequired[typing.Sequence[SharedIntentsResultsIntentsSegmentsItemParams]] diff --git a/src/deepgram/requests/shared_intents_results_intents_segments_item.py b/src/deepgram/requests/shared_intents_segments_item.py similarity index 53% rename from src/deepgram/requests/shared_intents_results_intents_segments_item.py rename to src/deepgram/requests/shared_intents_segments_item.py index 444533ff..8a60ba80 100644 --- a/src/deepgram/requests/shared_intents_results_intents_segments_item.py +++ b/src/deepgram/requests/shared_intents_segments_item.py @@ -3,13 +3,11 @@ import typing import typing_extensions -from .shared_intents_results_intents_segments_item_intents_item import ( - SharedIntentsResultsIntentsSegmentsItemIntentsItemParams, -) +from .shared_intents_segments_item_intents_item import SharedIntentsSegmentsItemIntentsItemParams -class SharedIntentsResultsIntentsSegmentsItemParams(typing_extensions.TypedDict): +class SharedIntentsSegmentsItemParams(typing_extensions.TypedDict): text: typing_extensions.NotRequired[str] start_word: typing_extensions.NotRequired[float] end_word: typing_extensions.NotRequired[float] - intents: typing_extensions.NotRequired[typing.Sequence[SharedIntentsResultsIntentsSegmentsItemIntentsItemParams]] + intents: typing_extensions.NotRequired[typing.Sequence[SharedIntentsSegmentsItemIntentsItemParams]] diff --git a/src/deepgram/requests/shared_intents_results_intents_segments_item_intents_item.py b/src/deepgram/requests/shared_intents_segments_item_intents_item.py similarity index 68% rename from src/deepgram/requests/shared_intents_results_intents_segments_item_intents_item.py rename to src/deepgram/requests/shared_intents_segments_item_intents_item.py index aabe4510..6d16e5f4 100644 --- a/src/deepgram/requests/shared_intents_results_intents_segments_item_intents_item.py +++ b/src/deepgram/requests/shared_intents_segments_item_intents_item.py @@ -3,6 +3,6 @@ import typing_extensions -class SharedIntentsResultsIntentsSegmentsItemIntentsItemParams(typing_extensions.TypedDict): +class SharedIntentsSegmentsItemIntentsItemParams(typing_extensions.TypedDict): intent: typing_extensions.NotRequired[str] confidence_score: typing_extensions.NotRequired[float] diff --git a/src/deepgram/requests/shared_topics.py b/src/deepgram/requests/shared_topics.py index 0e7347b4..4965005e 100644 --- a/src/deepgram/requests/shared_topics.py +++ b/src/deepgram/requests/shared_topics.py @@ -1,7 +1,9 @@ # This file was auto-generated by Fern from our API Definition. +import typing + import typing_extensions -from .shared_topics_results import SharedTopicsResultsParams +from .shared_topics_segments_item import SharedTopicsSegmentsItemParams class SharedTopicsParams(typing_extensions.TypedDict): @@ -9,4 +11,4 @@ class SharedTopicsParams(typing_extensions.TypedDict): Output whenever `topics=true` is used """ - results: typing_extensions.NotRequired[SharedTopicsResultsParams] + segments: typing_extensions.NotRequired[typing.Sequence[SharedTopicsSegmentsItemParams]] diff --git a/src/deepgram/requests/shared_topics_results.py b/src/deepgram/requests/shared_topics_results.py deleted file mode 100644 index d5456918..00000000 --- a/src/deepgram/requests/shared_topics_results.py +++ /dev/null @@ -1,8 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from .shared_topics_results_topics import SharedTopicsResultsTopicsParams - - -class SharedTopicsResultsParams(typing_extensions.TypedDict): - topics: typing_extensions.NotRequired[SharedTopicsResultsTopicsParams] diff --git a/src/deepgram/requests/shared_topics_results_topics.py b/src/deepgram/requests/shared_topics_results_topics.py deleted file mode 100644 index 9aa6b2d7..00000000 --- a/src/deepgram/requests/shared_topics_results_topics.py +++ /dev/null @@ -1,10 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -from .shared_topics_results_topics_segments_item import SharedTopicsResultsTopicsSegmentsItemParams - - -class SharedTopicsResultsTopicsParams(typing_extensions.TypedDict): - segments: typing_extensions.NotRequired[typing.Sequence[SharedTopicsResultsTopicsSegmentsItemParams]] diff --git a/src/deepgram/requests/shared_topics_results_topics_segments_item.py b/src/deepgram/requests/shared_topics_segments_item.py similarity index 55% rename from src/deepgram/requests/shared_topics_results_topics_segments_item.py rename to src/deepgram/requests/shared_topics_segments_item.py index b24a89d0..134b948d 100644 --- a/src/deepgram/requests/shared_topics_results_topics_segments_item.py +++ b/src/deepgram/requests/shared_topics_segments_item.py @@ -3,13 +3,11 @@ import typing import typing_extensions -from .shared_topics_results_topics_segments_item_topics_item import ( - SharedTopicsResultsTopicsSegmentsItemTopicsItemParams, -) +from .shared_topics_segments_item_topics_item import SharedTopicsSegmentsItemTopicsItemParams -class SharedTopicsResultsTopicsSegmentsItemParams(typing_extensions.TypedDict): +class SharedTopicsSegmentsItemParams(typing_extensions.TypedDict): text: typing_extensions.NotRequired[str] start_word: typing_extensions.NotRequired[float] end_word: typing_extensions.NotRequired[float] - topics: typing_extensions.NotRequired[typing.Sequence[SharedTopicsResultsTopicsSegmentsItemTopicsItemParams]] + topics: typing_extensions.NotRequired[typing.Sequence[SharedTopicsSegmentsItemTopicsItemParams]] diff --git a/src/deepgram/requests/shared_topics_results_topics_segments_item_topics_item.py b/src/deepgram/requests/shared_topics_segments_item_topics_item.py similarity index 68% rename from src/deepgram/requests/shared_topics_results_topics_segments_item_topics_item.py rename to src/deepgram/requests/shared_topics_segments_item_topics_item.py index 465fc4ed..22a5ce50 100644 --- a/src/deepgram/requests/shared_topics_results_topics_segments_item_topics_item.py +++ b/src/deepgram/requests/shared_topics_segments_item_topics_item.py @@ -3,6 +3,6 @@ import typing_extensions -class SharedTopicsResultsTopicsSegmentsItemTopicsItemParams(typing_extensions.TypedDict): +class SharedTopicsSegmentsItemTopicsItemParams(typing_extensions.TypedDict): topic: typing_extensions.NotRequired[str] confidence_score: typing_extensions.NotRequired[float] 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 7750a65b..b38c1137 100644 --- a/src/deepgram/speak/v2/audio/client.py +++ b/src/deepgram/speak/v2/audio/client.py @@ -55,7 +55,7 @@ def generate( Flux TTS model used to synthesize the submitted text, in the form `flux-{voice}-{language}` (for example, `flux-alexis-en`). Required; unlike the v1 (Aura) endpoint there is no default and only flux models are accepted. English-only at launch. text : str - The text content to be converted to speech. The server normalizes and preprocesses the text before synthesis. Inline pause and pronunciation controls are not yet applied; they are stripped from the text before synthesis. + The text content to be converted to speech. The server normalizes and preprocesses the text before synthesis. May contain inline pause controls (`\\{pause:500ms\\}`, 500-3000 ms in 100 ms steps, at most 8 per request) and inline pronunciation controls (`\\{"word": "...", "pronounce": ""\\}`, Early Access). Pronunciation cannot be combined with pause or with a `speed` other than `1.0`, and `speed` is capped at `1.15` when a pause is present. See [Speed, Pause, Pronunciation](/docs/tts-voice-controls). callback : typing.Optional[str] URL to which we'll make the callback request @@ -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.5` to `1.5` 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. When the text contains an inline pause marker, speed is capped at `1.15` (`PAUSE_SPEED_CAP_EXCEEDED` above that). A value other than `1.0` cannot be combined with inline pronunciation controls (`CONTROL_COMBINATION_INVALID`). priority : typing.Optional[typing.Literal["low"]] Processing priority for asynchronous (callback) requests. The only supported value is low. @@ -171,7 +171,7 @@ async def generate( Flux TTS model used to synthesize the submitted text, in the form `flux-{voice}-{language}` (for example, `flux-alexis-en`). Required; unlike the v1 (Aura) endpoint there is no default and only flux models are accepted. English-only at launch. text : str - The text content to be converted to speech. The server normalizes and preprocesses the text before synthesis. Inline pause and pronunciation controls are not yet applied; they are stripped from the text before synthesis. + The text content to be converted to speech. The server normalizes and preprocesses the text before synthesis. May contain inline pause controls (`\\{pause:500ms\\}`, 500-3000 ms in 100 ms steps, at most 8 per request) and inline pronunciation controls (`\\{"word": "...", "pronounce": ""\\}`, Early Access). Pronunciation cannot be combined with pause or with a `speed` other than `1.0`, and `speed` is capped at `1.15` when a pause is present. See [Speed, Pause, Pronunciation](/docs/tts-voice-controls). callback : typing.Optional[str] URL to which we'll make the callback request @@ -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.5` to `1.5` 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. When the text contains an inline pause marker, speed is capped at `1.15` (`PAUSE_SPEED_CAP_EXCEEDED` above that). A value other than `1.0` cannot be combined with inline pronunciation controls (`CONTROL_COMBINATION_INVALID`). 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 c26b37e4..5be32662 100644 --- a/src/deepgram/speak/v2/audio/raw_client.py +++ b/src/deepgram/speak/v2/audio/raw_client.py @@ -52,7 +52,7 @@ def generate( Flux TTS model used to synthesize the submitted text, in the form `flux-{voice}-{language}` (for example, `flux-alexis-en`). Required; unlike the v1 (Aura) endpoint there is no default and only flux models are accepted. English-only at launch. text : str - The text content to be converted to speech. The server normalizes and preprocesses the text before synthesis. Inline pause and pronunciation controls are not yet applied; they are stripped from the text before synthesis. + The text content to be converted to speech. The server normalizes and preprocesses the text before synthesis. May contain inline pause controls (`\\{pause:500ms\\}`, 500-3000 ms in 100 ms steps, at most 8 per request) and inline pronunciation controls (`\\{"word": "...", "pronounce": ""\\}`, Early Access). Pronunciation cannot be combined with pause or with a `speed` other than `1.0`, and `speed` is capped at `1.15` when a pause is present. See [Speed, Pause, Pronunciation](/docs/tts-voice-controls). callback : typing.Optional[str] URL to which we'll make the callback request @@ -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.5` to `1.5` 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. When the text contains an inline pause marker, speed is capped at `1.15` (`PAUSE_SPEED_CAP_EXCEEDED` above that). A value other than `1.0` cannot be combined with inline pronunciation controls (`CONTROL_COMBINATION_INVALID`). priority : typing.Optional[typing.Literal["low"]] Processing priority for asynchronous (callback) requests. The only supported value is low. @@ -191,7 +191,7 @@ async def generate( Flux TTS model used to synthesize the submitted text, in the form `flux-{voice}-{language}` (for example, `flux-alexis-en`). Required; unlike the v1 (Aura) endpoint there is no default and only flux models are accepted. English-only at launch. text : str - The text content to be converted to speech. The server normalizes and preprocesses the text before synthesis. Inline pause and pronunciation controls are not yet applied; they are stripped from the text before synthesis. + The text content to be converted to speech. The server normalizes and preprocesses the text before synthesis. May contain inline pause controls (`\\{pause:500ms\\}`, 500-3000 ms in 100 ms steps, at most 8 per request) and inline pronunciation controls (`\\{"word": "...", "pronounce": ""\\}`, Early Access). Pronunciation cannot be combined with pause or with a `speed` other than `1.0`, and `speed` is capped at `1.15` when a pause is present. See [Speed, Pause, Pronunciation](/docs/tts-voice-controls). callback : typing.Optional[str] URL to which we'll make the callback request @@ -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.5` to `1.5` 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. When the text contains an inline pause marker, speed is capped at `1.15` (`PAUSE_SPEED_CAP_EXCEEDED` above that). A value other than `1.0` cannot be combined with inline pronunciation controls (`CONTROL_COMBINATION_INVALID`). 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 97ea557c..f805c97f 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 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. + 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. `CONTROL_COMBINATION_INVALID`: `speed` was set while a turn buffered behind the active one still carries a pronunciation control; pronunciation and speed cannot be combined, so flush that turn before setting speed (pronunciations in the active turn do not block the change). `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/requests/speak_v2error.py b/src/deepgram/speak/v2/requests/speak_v2error.py index 83ff05b1..b5c4fbb7 100644 --- a/src/deepgram/speak/v2/requests/speak_v2error.py +++ b/src/deepgram/speak/v2/requests/speak_v2error.py @@ -14,7 +14,7 @@ class SpeakV2ErrorParams(typing_extensions.TypedDict): code: SpeakV2ErrorCode """ - A code identifying the error, e.g. `MESSAGE-0000` or `NET-0000`. + A code identifying the error, e.g. `MESSAGE-0000` or `NET-0000`. `DATA-0002` covers invalid inline controls and speed, including an inline pause marker (pause is batch-only) and a pronunciation control combined with a `speed` other than `1.0`; `description` names the specific rule. """ description: str diff --git a/src/deepgram/speak/v2/requests/speak_v2speak.py b/src/deepgram/speak/v2/requests/speak_v2speak.py index 14665cca..c77d5fa7 100644 --- a/src/deepgram/speak/v2/requests/speak_v2speak.py +++ b/src/deepgram/speak/v2/requests/speak_v2speak.py @@ -13,5 +13,5 @@ class SpeakV2SpeakParams(typing_extensions.TypedDict): text: str """ - The input text to synthesize. Inline pause and pronunciation controls are not yet applied; they are stripped from the text before synthesis. + The input text to synthesize. May contain inline pronunciation controls (`\\{"word": "...", "pronounce": ""\\}`), which are in Early Access. Inline pause controls are supported on the batch (REST) transport only; a pause marker sent over the WebSocket fails the connection with `DATA-0002`. Pronunciation cannot be combined with a `speed` other than `1.0`: text carrying a pronunciation control on a session opened with `speed`, or after a `Configure` that set it, also fails the connection with `DATA-0002`. See [Speed, Pause, Pronunciation](/docs/tts-voice-controls). """ diff --git a/src/deepgram/speak/v2/requests/speak_v2speech_interrupted_metadata.py b/src/deepgram/speak/v2/requests/speak_v2speech_interrupted_metadata.py index 431919c7..12ee193d 100644 --- a/src/deepgram/speak/v2/requests/speak_v2speech_interrupted_metadata.py +++ b/src/deepgram/speak/v2/requests/speak_v2speech_interrupted_metadata.py @@ -31,5 +31,5 @@ class SpeakV2SpeechInterruptedMetadataParams(typing_extensions.TypedDict): controls_applied: SpeakV2SpeechInterruptedMetadataControlsAppliedParams """ - Counts of the inline controls the server acted on during the turn. Inline pause and pronunciation controls are not applied at launch — support is coming soon — so every count is currently `0`. + Counts of the inline controls the server acted on during the turn. A pronunciation override that triggers an IPA warning is still applied best-effort and counted in `pronunciations_applied`; the warning is reported separately through a `Warning` and `pronunciation_warnings`. """ diff --git a/src/deepgram/speak/v2/requests/speak_v2speech_interrupted_metadata_controls_applied.py b/src/deepgram/speak/v2/requests/speak_v2speech_interrupted_metadata_controls_applied.py index dd47def1..b2de45f7 100644 --- a/src/deepgram/speak/v2/requests/speak_v2speech_interrupted_metadata_controls_applied.py +++ b/src/deepgram/speak/v2/requests/speak_v2speech_interrupted_metadata_controls_applied.py @@ -5,20 +5,20 @@ class SpeakV2SpeechInterruptedMetadataControlsAppliedParams(typing_extensions.TypedDict): """ - Counts of the inline controls the server acted on during the turn. Inline pause and pronunciation controls are not applied at launch — support is coming soon — so every count is currently `0`. + Counts of the inline controls the server acted on during the turn. A pronunciation override that triggers an IPA warning is still applied best-effort and counted in `pronunciations_applied`; the warning is reported separately through a `Warning` and `pronunciation_warnings`. """ pronunciations_applied: int """ - Pronunciation overrides successfully applied. Mirrors the Aura-2 `dg-pronunciations-applied` REST header. Currently always `0`. + Pronunciation overrides successfully applied. Mirrors the Aura-2 `dg-pronunciations-applied` REST header. """ breaks_applied: int """ - Pause (break) controls successfully applied. Mirrors the Aura-2 `dg-breaks-applied` REST header. Currently always `0`. + Pause (break) controls successfully applied. Mirrors the Aura-2 `dg-breaks-applied` REST header. Always `0` on the WebSocket, where inline pause controls are not supported. """ pronunciation_warnings: int """ - Pronunciation entries that triggered a warning (invalid IPA, word too long). Mirrors the Aura-2 `dg-pronunciation-warnings` REST header. Currently always `0`. + Pronunciation entries that triggered a warning (invalid IPA, word too long). On batch requests the corresponding `PRON-NNN` codes are returned in the `dg-warnings` response header. """ diff --git a/src/deepgram/speak/v2/requests/speak_v2speech_metadata.py b/src/deepgram/speak/v2/requests/speak_v2speech_metadata.py index 2848762d..fc0c49de 100644 --- a/src/deepgram/speak/v2/requests/speak_v2speech_metadata.py +++ b/src/deepgram/speak/v2/requests/speak_v2speech_metadata.py @@ -34,5 +34,5 @@ class SpeakV2SpeechMetadataParams(typing_extensions.TypedDict): controls_applied: SpeakV2SpeechMetadataControlsAppliedParams """ - Counts of the inline controls the server acted on during the turn. Inline pause and pronunciation controls are not applied at launch — support is coming soon — so every count is currently `0`. + Counts of the inline controls the server acted on during the turn. A pronunciation override that triggers an IPA warning is still applied best-effort and counted in `pronunciations_applied`; the warning is reported separately through a `Warning` and `pronunciation_warnings`. """ diff --git a/src/deepgram/speak/v2/requests/speak_v2speech_metadata_controls_applied.py b/src/deepgram/speak/v2/requests/speak_v2speech_metadata_controls_applied.py index ace2e3ef..ef2cdc9c 100644 --- a/src/deepgram/speak/v2/requests/speak_v2speech_metadata_controls_applied.py +++ b/src/deepgram/speak/v2/requests/speak_v2speech_metadata_controls_applied.py @@ -5,20 +5,20 @@ class SpeakV2SpeechMetadataControlsAppliedParams(typing_extensions.TypedDict): """ - Counts of the inline controls the server acted on during the turn. Inline pause and pronunciation controls are not applied at launch — support is coming soon — so every count is currently `0`. + Counts of the inline controls the server acted on during the turn. A pronunciation override that triggers an IPA warning is still applied best-effort and counted in `pronunciations_applied`; the warning is reported separately through a `Warning` and `pronunciation_warnings`. """ pronunciations_applied: int """ - Pronunciation overrides successfully applied. Mirrors the Aura-2 `dg-pronunciations-applied` REST header. Currently always `0`. + Pronunciation overrides successfully applied. Mirrors the Aura-2 `dg-pronunciations-applied` REST header. """ breaks_applied: int """ - Pause (break) controls successfully applied. Mirrors the Aura-2 `dg-breaks-applied` REST header. Currently always `0`. + Pause (break) controls successfully applied. Mirrors the Aura-2 `dg-breaks-applied` REST header. Always `0` on the WebSocket, where inline pause controls are not supported. """ pronunciation_warnings: int """ - Pronunciation entries that triggered a warning (invalid IPA, word too long). Mirrors the Aura-2 `dg-pronunciation-warnings` REST header. Currently always `0`. + Pronunciation entries that triggered a warning (invalid IPA, word too long). On batch requests the corresponding `PRON-NNN` codes are returned in the `dg-warnings` response header. """ diff --git a/src/deepgram/speak/v2/requests/speak_v2warning.py b/src/deepgram/speak/v2/requests/speak_v2warning.py index 043986a7..e16df4d6 100644 --- a/src/deepgram/speak/v2/requests/speak_v2warning.py +++ b/src/deepgram/speak/v2/requests/speak_v2warning.py @@ -17,7 +17,9 @@ class SpeakV2WarningParams(typing_extensions.TypedDict): Turn-scoped codes: `NO_ACTIVE_SPEECH` (a speech-scoped message arrived with no active turn), `NO_SYNTHESIZABLE_TEXT` (the turn's text was entirely whitespace or punctuation, so it produced no audio and is completed with a zero-duration `SpeechMetadata`), and `SYNTHESIS_RETRYING` (a synthesis request failed and is being retried). - Inline-control codes are reserved and not currently emitted, because inline pause and pronunciation controls are not yet applied: `BREAKS_LIMIT_EXCEEDED` (too many pause controls, or two pauses with no intervening text), `BREAK_TOKENS_OUT_OF_RANGE` (pause durations outside the range the model supports), `BREAK_TOKENS_WITH_INVALID_INCREMENTS` (pause durations off the model's supported increment), `PRONUNCIATION_WARNINGS` (a pronunciation override contained invalid IPA), `PRONUNCIATION_TOO_LONG` (an IPA string exceeded the length limit), `PRONUNCIATIONS_LIMIT_EXCEEDED` (too many pronunciation controls in one turn). + Pronunciation codes: `PRONUNCIATION_WARNINGS` (a pronunciation override contained invalid IPA; it is still applied best-effort and counted in `pronunciations_applied`), `PRONUNCIATION_TOO_LONG` (an IPA string exceeded the length limit), `PRONUNCIATIONS_LIMIT_EXCEEDED` (too many pronunciation controls in one turn). + + Pause codes (`BREAKS_LIMIT_EXCEEDED`, `BREAK_TOKENS_OUT_OF_RANGE`, `BREAK_TOKENS_WITH_INVALID_INCREMENTS`) are reserved and not emitted: inline pause controls are batch-only, and a pause marker on the WebSocket fails the connection instead. Interrupt-scoped codes, each meaning the `Interrupt` was ignored: `NO_AUDIO_GENERATED` (the session has produced no audio yet, so there is nothing to interrupt), `INTERRUPT_IN_PROGRESS` (an earlier `Interrupt` is still being processed — at most one is handled at a time), `INVALID_INTERRUPT_OFFSET` (the `playback_offset` did not advance past the position a prior interrupt established). """ diff --git a/src/deepgram/speak/v2/socket_client.py b/src/deepgram/speak/v2/socket_client.py index 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 76d5a202..6911378b 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 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. + 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. `CONTROL_COMBINATION_INVALID`: `speed` was set while a turn buffered behind the active one still carries a pronunciation control; pronunciation and speed cannot be combined, so flush that turn before setting speed (pronunciations in the active turn do not block the change). `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/speak/v2/types/speak_v2configure_failure_code.py b/src/deepgram/speak/v2/types/speak_v2configure_failure_code.py index 80a46f9c..5f1acd95 100644 --- a/src/deepgram/speak/v2/types/speak_v2configure_failure_code.py +++ b/src/deepgram/speak/v2/types/speak_v2configure_failure_code.py @@ -3,5 +3,12 @@ import typing SpeakV2ConfigureFailureCode = typing.Union[ - typing.Literal["SPEED_OUT_OF_RANGE", "SPEED_INCREMENT_INVALID", "SPEED_NOT_SUPPORTED", "INTERNAL_ERROR"], typing.Any + typing.Literal[ + "SPEED_OUT_OF_RANGE", + "SPEED_INCREMENT_INVALID", + "SPEED_NOT_SUPPORTED", + "CONTROL_COMBINATION_INVALID", + "INTERNAL_ERROR", + ], + typing.Any, ] diff --git a/src/deepgram/speak/v2/types/speak_v2error.py b/src/deepgram/speak/v2/types/speak_v2error.py index 9bb02c21..7153674f 100644 --- a/src/deepgram/speak/v2/types/speak_v2error.py +++ b/src/deepgram/speak/v2/types/speak_v2error.py @@ -16,7 +16,7 @@ class SpeakV2Error(UncheckedBaseModel): code: SpeakV2ErrorCode = pydantic.Field() """ - A code identifying the error, e.g. `MESSAGE-0000` or `NET-0000`. + A code identifying the error, e.g. `MESSAGE-0000` or `NET-0000`. `DATA-0002` covers invalid inline controls and speed, including an inline pause marker (pause is batch-only) and a pronunciation control combined with a `speed` other than `1.0`; `description` names the specific rule. """ description: str = pydantic.Field() diff --git a/src/deepgram/speak/v2/types/speak_v2speak.py b/src/deepgram/speak/v2/types/speak_v2speak.py index dc180777..e8332d6d 100644 --- a/src/deepgram/speak/v2/types/speak_v2speak.py +++ b/src/deepgram/speak/v2/types/speak_v2speak.py @@ -15,7 +15,7 @@ class SpeakV2Speak(UncheckedBaseModel): text: str = pydantic.Field() """ - The input text to synthesize. Inline pause and pronunciation controls are not yet applied; they are stripped from the text before synthesis. + The input text to synthesize. May contain inline pronunciation controls (`\\{"word": "...", "pronounce": ""\\}`), which are in Early Access. Inline pause controls are supported on the batch (REST) transport only; a pause marker sent over the WebSocket fails the connection with `DATA-0002`. Pronunciation cannot be combined with a `speed` other than `1.0`: text carrying a pronunciation control on a session opened with `speed`, or after a `Configure` that set it, also fails the connection with `DATA-0002`. See [Speed, Pause, Pronunciation](/docs/tts-voice-controls). """ if IS_PYDANTIC_V2: diff --git a/src/deepgram/speak/v2/types/speak_v2speech_interrupted_metadata.py b/src/deepgram/speak/v2/types/speak_v2speech_interrupted_metadata.py index 45787d7c..7eed5311 100644 --- a/src/deepgram/speak/v2/types/speak_v2speech_interrupted_metadata.py +++ b/src/deepgram/speak/v2/types/speak_v2speech_interrupted_metadata.py @@ -35,7 +35,7 @@ class SpeakV2SpeechInterruptedMetadata(UncheckedBaseModel): controls_applied: SpeakV2SpeechInterruptedMetadataControlsApplied = pydantic.Field() """ - Counts of the inline controls the server acted on during the turn. Inline pause and pronunciation controls are not applied at launch — support is coming soon — so every count is currently `0`. + Counts of the inline controls the server acted on during the turn. A pronunciation override that triggers an IPA warning is still applied best-effort and counted in `pronunciations_applied`; the warning is reported separately through a `Warning` and `pronunciation_warnings`. """ if IS_PYDANTIC_V2: diff --git a/src/deepgram/speak/v2/types/speak_v2speech_interrupted_metadata_controls_applied.py b/src/deepgram/speak/v2/types/speak_v2speech_interrupted_metadata_controls_applied.py index 1d6776f3..20af50dc 100644 --- a/src/deepgram/speak/v2/types/speak_v2speech_interrupted_metadata_controls_applied.py +++ b/src/deepgram/speak/v2/types/speak_v2speech_interrupted_metadata_controls_applied.py @@ -9,22 +9,22 @@ class SpeakV2SpeechInterruptedMetadataControlsApplied(UncheckedBaseModel): """ - Counts of the inline controls the server acted on during the turn. Inline pause and pronunciation controls are not applied at launch — support is coming soon — so every count is currently `0`. + Counts of the inline controls the server acted on during the turn. A pronunciation override that triggers an IPA warning is still applied best-effort and counted in `pronunciations_applied`; the warning is reported separately through a `Warning` and `pronunciation_warnings`. """ pronunciations_applied: int = pydantic.Field() """ - Pronunciation overrides successfully applied. Mirrors the Aura-2 `dg-pronunciations-applied` REST header. Currently always `0`. + Pronunciation overrides successfully applied. Mirrors the Aura-2 `dg-pronunciations-applied` REST header. """ breaks_applied: int = pydantic.Field() """ - Pause (break) controls successfully applied. Mirrors the Aura-2 `dg-breaks-applied` REST header. Currently always `0`. + Pause (break) controls successfully applied. Mirrors the Aura-2 `dg-breaks-applied` REST header. Always `0` on the WebSocket, where inline pause controls are not supported. """ pronunciation_warnings: int = pydantic.Field() """ - Pronunciation entries that triggered a warning (invalid IPA, word too long). Mirrors the Aura-2 `dg-pronunciation-warnings` REST header. Currently always `0`. + Pronunciation entries that triggered a warning (invalid IPA, word too long). On batch requests the corresponding `PRON-NNN` codes are returned in the `dg-warnings` response header. """ if IS_PYDANTIC_V2: diff --git a/src/deepgram/speak/v2/types/speak_v2speech_metadata.py b/src/deepgram/speak/v2/types/speak_v2speech_metadata.py index 23aabd74..2bcf39bf 100644 --- a/src/deepgram/speak/v2/types/speak_v2speech_metadata.py +++ b/src/deepgram/speak/v2/types/speak_v2speech_metadata.py @@ -36,7 +36,7 @@ class SpeakV2SpeechMetadata(UncheckedBaseModel): controls_applied: SpeakV2SpeechMetadataControlsApplied = pydantic.Field() """ - Counts of the inline controls the server acted on during the turn. Inline pause and pronunciation controls are not applied at launch — support is coming soon — so every count is currently `0`. + Counts of the inline controls the server acted on during the turn. A pronunciation override that triggers an IPA warning is still applied best-effort and counted in `pronunciations_applied`; the warning is reported separately through a `Warning` and `pronunciation_warnings`. """ if IS_PYDANTIC_V2: diff --git a/src/deepgram/speak/v2/types/speak_v2speech_metadata_controls_applied.py b/src/deepgram/speak/v2/types/speak_v2speech_metadata_controls_applied.py index 124099af..ed46d2f4 100644 --- a/src/deepgram/speak/v2/types/speak_v2speech_metadata_controls_applied.py +++ b/src/deepgram/speak/v2/types/speak_v2speech_metadata_controls_applied.py @@ -9,22 +9,22 @@ class SpeakV2SpeechMetadataControlsApplied(UncheckedBaseModel): """ - Counts of the inline controls the server acted on during the turn. Inline pause and pronunciation controls are not applied at launch — support is coming soon — so every count is currently `0`. + Counts of the inline controls the server acted on during the turn. A pronunciation override that triggers an IPA warning is still applied best-effort and counted in `pronunciations_applied`; the warning is reported separately through a `Warning` and `pronunciation_warnings`. """ pronunciations_applied: int = pydantic.Field() """ - Pronunciation overrides successfully applied. Mirrors the Aura-2 `dg-pronunciations-applied` REST header. Currently always `0`. + Pronunciation overrides successfully applied. Mirrors the Aura-2 `dg-pronunciations-applied` REST header. """ breaks_applied: int = pydantic.Field() """ - Pause (break) controls successfully applied. Mirrors the Aura-2 `dg-breaks-applied` REST header. Currently always `0`. + Pause (break) controls successfully applied. Mirrors the Aura-2 `dg-breaks-applied` REST header. Always `0` on the WebSocket, where inline pause controls are not supported. """ pronunciation_warnings: int = pydantic.Field() """ - Pronunciation entries that triggered a warning (invalid IPA, word too long). Mirrors the Aura-2 `dg-pronunciation-warnings` REST header. Currently always `0`. + Pronunciation entries that triggered a warning (invalid IPA, word too long). On batch requests the corresponding `PRON-NNN` codes are returned in the `dg-warnings` response header. """ if IS_PYDANTIC_V2: diff --git a/src/deepgram/speak/v2/types/speak_v2warning.py b/src/deepgram/speak/v2/types/speak_v2warning.py index c4a06db4..e142f323 100644 --- a/src/deepgram/speak/v2/types/speak_v2warning.py +++ b/src/deepgram/speak/v2/types/speak_v2warning.py @@ -19,7 +19,9 @@ class SpeakV2Warning(UncheckedBaseModel): Turn-scoped codes: `NO_ACTIVE_SPEECH` (a speech-scoped message arrived with no active turn), `NO_SYNTHESIZABLE_TEXT` (the turn's text was entirely whitespace or punctuation, so it produced no audio and is completed with a zero-duration `SpeechMetadata`), and `SYNTHESIS_RETRYING` (a synthesis request failed and is being retried). - Inline-control codes are reserved and not currently emitted, because inline pause and pronunciation controls are not yet applied: `BREAKS_LIMIT_EXCEEDED` (too many pause controls, or two pauses with no intervening text), `BREAK_TOKENS_OUT_OF_RANGE` (pause durations outside the range the model supports), `BREAK_TOKENS_WITH_INVALID_INCREMENTS` (pause durations off the model's supported increment), `PRONUNCIATION_WARNINGS` (a pronunciation override contained invalid IPA), `PRONUNCIATION_TOO_LONG` (an IPA string exceeded the length limit), `PRONUNCIATIONS_LIMIT_EXCEEDED` (too many pronunciation controls in one turn). + Pronunciation codes: `PRONUNCIATION_WARNINGS` (a pronunciation override contained invalid IPA; it is still applied best-effort and counted in `pronunciations_applied`), `PRONUNCIATION_TOO_LONG` (an IPA string exceeded the length limit), `PRONUNCIATIONS_LIMIT_EXCEEDED` (too many pronunciation controls in one turn). + + Pause codes (`BREAKS_LIMIT_EXCEEDED`, `BREAK_TOKENS_OUT_OF_RANGE`, `BREAK_TOKENS_WITH_INVALID_INCREMENTS`) are reserved and not emitted: inline pause controls are batch-only, and a pause marker on the WebSocket fails the connection instead. Interrupt-scoped codes, each meaning the `Interrupt` was ignored: `NO_AUDIO_GENERATED` (the session has produced no audio yet, so there is nothing to interrupt), `INTERRUPT_IN_PROGRESS` (an earlier `Interrupt` is still being processed — at most one is handled at a time), `INVALID_INTERRUPT_OFFSET` (the `playback_offset` did not advance past the position a prior interrupt established). """ diff --git a/src/deepgram/types/__init__.py b/src/deepgram/types/__init__.py index 57674025..800bd48e 100644 --- a/src/deepgram/types/__init__.py +++ b/src/deepgram/types/__init__.py @@ -230,20 +230,14 @@ 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_intents_segments_item import SharedIntentsSegmentsItem + from .shared_intents_segments_item_intents_item import SharedIntentsSegmentsItemIntentsItem from .shared_sentiments import SharedSentiments from .shared_sentiments_average import SharedSentimentsAverage from .shared_sentiments_segments_item import SharedSentimentsSegmentsItem from .shared_topics import SharedTopics - from .shared_topics_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 .shared_topics_segments_item import SharedTopicsSegmentsItem + from .shared_topics_segments_item_topics_item import SharedTopicsSegmentsItemTopicsItem from .speak_settings_v1 import SpeakSettingsV1 from .speak_settings_v1endpoint import SpeakSettingsV1Endpoint from .speak_settings_v1provider import ( @@ -293,15 +287,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", @@ -495,18 +480,14 @@ "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", + "SharedIntentsSegmentsItem": ".shared_intents_segments_item", + "SharedIntentsSegmentsItemIntentsItem": ".shared_intents_segments_item_intents_item", "SharedSentiments": ".shared_sentiments", "SharedSentimentsAverage": ".shared_sentiments_average", "SharedSentimentsSegmentsItem": ".shared_sentiments_segments_item", "SharedTopics": ".shared_topics", - "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", + "SharedTopicsSegmentsItem": ".shared_topics_segments_item", + "SharedTopicsSegmentsItemTopicsItem": ".shared_topics_segments_item_topics_item", "SpeakSettingsV1": ".speak_settings_v1", "SpeakSettingsV1Endpoint": ".speak_settings_v1endpoint", "SpeakSettingsV1Provider": ".speak_settings_v1provider", @@ -552,15 +533,6 @@ "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", } @@ -778,18 +750,14 @@ def __dir__(): "ReadV1ResponseResultsSummaryResults", "ReadV1ResponseResultsSummaryResultsSummary", "SharedIntents", - "SharedIntentsResults", - "SharedIntentsResultsIntents", - "SharedIntentsResultsIntentsSegmentsItem", - "SharedIntentsResultsIntentsSegmentsItemIntentsItem", + "SharedIntentsSegmentsItem", + "SharedIntentsSegmentsItemIntentsItem", "SharedSentiments", "SharedSentimentsAverage", "SharedSentimentsSegmentsItem", "SharedTopics", - "SharedTopicsResults", - "SharedTopicsResultsTopics", - "SharedTopicsResultsTopicsSegmentsItem", - "SharedTopicsResultsTopicsSegmentsItemTopicsItem", + "SharedTopicsSegmentsItem", + "SharedTopicsSegmentsItemTopicsItem", "SpeakSettingsV1", "SpeakSettingsV1Endpoint", "SpeakSettingsV1Provider", @@ -835,13 +803,4 @@ def __dir__(): "UsageFieldsV1ResponseModelsItem", "UsageV1Response", "UsageV1ResponseResolution", - "AnthropicThinkProviderModel", - "CartesiaSpeakProviderModelId", - "CartesiaSpeakProviderVoice", - "CreateKeyV1RequestOne", - "DeepgramListenProviderV2LanguageHint", - "DeepgramSpeakProviderModel", - "GoogleThinkProviderModel", - "GoogleThinkProviderVersion", - "GroqThinkProviderReasoningMode", ] diff --git a/src/deepgram/types/deepgram.py b/src/deepgram/types/deepgram.py index 994f7a2c..ec242762 100644 --- a/src/deepgram/types/deepgram.py +++ b/src/deepgram/types/deepgram.py @@ -29,7 +29,7 @@ class Deepgram(UncheckedBaseModel): Speaking rate multiplier that adjusts the pace of generated speech while preserving natural prosody and voice quality. Aura (version v1) accepts any value from 0.7 to 1.5. Flux TTS (version v2) accepts values from 0.5 to 1.5 in 0.05 increments; a value the family does not accept ends the session with FAILED_TO_SPEAK. Not yet supported in all languages. """ - expressivity: typing.Optional[pydantic.StrictInt] = pydantic.Field(default=None) + expressivity: typing.Optional[int] = pydantic.Field(default=None) """ Delivery register of the generated speech, on a calm-to-animated axis. Flux TTS (version v2) only, on every Flux voice. Accepts the whole numbers -2 to 2, where 0 (the default) is the voice's tuned delivery and the only value validated for production, -2 the calm end of the range and 2 the animated end. Fixed for the session. Beta: behavior may change in future model versions, and non-default values increase the risk of hallucinations and pronunciation errors. See [Expressivity](/docs/tts-expressivity). """ diff --git a/src/deepgram/types/deepgram_listen_provider_v2.py b/src/deepgram/types/deepgram_listen_provider_v2.py index 4eacc10e..f7a155fb 100644 --- a/src/deepgram/types/deepgram_listen_provider_v2.py +++ b/src/deepgram/types/deepgram_listen_provider_v2.py @@ -28,12 +28,6 @@ class DeepgramListenProviderV2(UncheckedBaseModel): An array of one or more BCP-47 language codes to bias the model toward specific languages. Only supported when model is flux-general-multi. Without hints, the model auto-detects the spoken language. See the Language Prompting guide for details. """ - language_hint: typing.Optional[typing.Union[str, typing.List[str]]] = pydantic.Field(default=None, exclude=True) - """ - Deprecated. Use `language_hints`. Accepted for backward compatibility and - remapped before serialization so the singular field never reaches the API. - """ - eot_threshold: typing.Optional[float] = pydantic.Field(default=None) """ End-of-turn confidence required to finish a turn. Valid range: 0.5 - 1.0. Defaults to 0.7. Set to 1.0 to fully suppress confidence-based end-of-turn detection. `eot_timeout_ms` still ends idle turns; increase it when using ForceEndTurn for full manual turn control. @@ -54,30 +48,6 @@ 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/listen_v2configure_numerals.py b/src/deepgram/types/listen_v2configure_numerals.py index 9c4299b1..4665dcb0 100644 --- a/src/deepgram/types/listen_v2configure_numerals.py +++ b/src/deepgram/types/listen_v2configure_numerals.py @@ -2,5 +2,5 @@ ListenV2ConfigureNumerals = bool """ -Numerals converts numbers from written format to numerical format. Applies to turns transcribed after the update. +Numerals converts numbers from written format to numerical format. Applies to transcripts Flux STT sends after it processes the update. """ diff --git a/src/deepgram/types/shared_intents.py b/src/deepgram/types/shared_intents.py index 01aae29a..f03d4225 100644 --- a/src/deepgram/types/shared_intents.py +++ b/src/deepgram/types/shared_intents.py @@ -5,7 +5,7 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2 from ..core.unchecked_base_model import UncheckedBaseModel -from .shared_intents_results import SharedIntentsResults +from .shared_intents_segments_item import SharedIntentsSegmentsItem class SharedIntents(UncheckedBaseModel): @@ -13,7 +13,7 @@ class SharedIntents(UncheckedBaseModel): Output whenever `intents=true` is used """ - results: typing.Optional[SharedIntentsResults] = None + segments: typing.Optional[typing.List[SharedIntentsSegmentsItem]] = 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/shared_intents_results.py b/src/deepgram/types/shared_intents_results.py deleted file mode 100644 index a227c096..00000000 --- a/src/deepgram/types/shared_intents_results.py +++ /dev/null @@ -1,21 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.unchecked_base_model import UncheckedBaseModel -from .shared_intents_results_intents import SharedIntentsResultsIntents - - -class SharedIntentsResults(UncheckedBaseModel): - intents: typing.Optional[SharedIntentsResultsIntents] = 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/types/shared_intents_results_intents.py b/src/deepgram/types/shared_intents_results_intents.py deleted file mode 100644 index 4415cc73..00000000 --- a/src/deepgram/types/shared_intents_results_intents.py +++ /dev/null @@ -1,21 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.unchecked_base_model import UncheckedBaseModel -from .shared_intents_results_intents_segments_item import SharedIntentsResultsIntentsSegmentsItem - - -class SharedIntentsResultsIntents(UncheckedBaseModel): - segments: typing.Optional[typing.List[SharedIntentsResultsIntentsSegmentsItem]] = 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/types/shared_topics_results_topics_segments_item.py b/src/deepgram/types/shared_intents_segments_item.py similarity index 69% rename from src/deepgram/types/shared_topics_results_topics_segments_item.py rename to src/deepgram/types/shared_intents_segments_item.py index 884dc4c3..75071133 100644 --- a/src/deepgram/types/shared_topics_results_topics_segments_item.py +++ b/src/deepgram/types/shared_intents_segments_item.py @@ -5,14 +5,14 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2 from ..core.unchecked_base_model import UncheckedBaseModel -from .shared_topics_results_topics_segments_item_topics_item import SharedTopicsResultsTopicsSegmentsItemTopicsItem +from .shared_intents_segments_item_intents_item import SharedIntentsSegmentsItemIntentsItem -class SharedTopicsResultsTopicsSegmentsItem(UncheckedBaseModel): +class SharedIntentsSegmentsItem(UncheckedBaseModel): text: typing.Optional[str] = None start_word: typing.Optional[float] = None end_word: typing.Optional[float] = None - topics: typing.Optional[typing.List[SharedTopicsResultsTopicsSegmentsItemTopicsItem]] = None + intents: typing.Optional[typing.List[SharedIntentsSegmentsItemIntentsItem]] = 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/shared_intents_results_intents_segments_item_intents_item.py b/src/deepgram/types/shared_intents_segments_item_intents_item.py similarity index 88% rename from src/deepgram/types/shared_intents_results_intents_segments_item_intents_item.py rename to src/deepgram/types/shared_intents_segments_item_intents_item.py index 7b1fb0c5..9c8bf3cd 100644 --- a/src/deepgram/types/shared_intents_results_intents_segments_item_intents_item.py +++ b/src/deepgram/types/shared_intents_segments_item_intents_item.py @@ -7,7 +7,7 @@ from ..core.unchecked_base_model import UncheckedBaseModel -class SharedIntentsResultsIntentsSegmentsItemIntentsItem(UncheckedBaseModel): +class SharedIntentsSegmentsItemIntentsItem(UncheckedBaseModel): intent: typing.Optional[str] = None confidence_score: typing.Optional[float] = None diff --git a/src/deepgram/types/shared_topics.py b/src/deepgram/types/shared_topics.py index 2641bed6..0f6a4a76 100644 --- a/src/deepgram/types/shared_topics.py +++ b/src/deepgram/types/shared_topics.py @@ -5,7 +5,7 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2 from ..core.unchecked_base_model import UncheckedBaseModel -from .shared_topics_results import SharedTopicsResults +from .shared_topics_segments_item import SharedTopicsSegmentsItem class SharedTopics(UncheckedBaseModel): @@ -13,7 +13,7 @@ class SharedTopics(UncheckedBaseModel): Output whenever `topics=true` is used """ - results: typing.Optional[SharedTopicsResults] = None + segments: typing.Optional[typing.List[SharedTopicsSegmentsItem]] = 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/shared_topics_results.py b/src/deepgram/types/shared_topics_results.py deleted file mode 100644 index ec0f7574..00000000 --- a/src/deepgram/types/shared_topics_results.py +++ /dev/null @@ -1,21 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.unchecked_base_model import UncheckedBaseModel -from .shared_topics_results_topics import SharedTopicsResultsTopics - - -class SharedTopicsResults(UncheckedBaseModel): - topics: typing.Optional[SharedTopicsResultsTopics] = 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/types/shared_topics_results_topics.py b/src/deepgram/types/shared_topics_results_topics.py deleted file mode 100644 index 3983e13a..00000000 --- a/src/deepgram/types/shared_topics_results_topics.py +++ /dev/null @@ -1,21 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.unchecked_base_model import UncheckedBaseModel -from .shared_topics_results_topics_segments_item import SharedTopicsResultsTopicsSegmentsItem - - -class SharedTopicsResultsTopics(UncheckedBaseModel): - segments: typing.Optional[typing.List[SharedTopicsResultsTopicsSegmentsItem]] = 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/types/shared_intents_results_intents_segments_item.py b/src/deepgram/types/shared_topics_segments_item.py similarity index 67% rename from src/deepgram/types/shared_intents_results_intents_segments_item.py rename to src/deepgram/types/shared_topics_segments_item.py index 583b7f49..d70909a4 100644 --- a/src/deepgram/types/shared_intents_results_intents_segments_item.py +++ b/src/deepgram/types/shared_topics_segments_item.py @@ -5,16 +5,14 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2 from ..core.unchecked_base_model import UncheckedBaseModel -from .shared_intents_results_intents_segments_item_intents_item import ( - SharedIntentsResultsIntentsSegmentsItemIntentsItem, -) +from .shared_topics_segments_item_topics_item import SharedTopicsSegmentsItemTopicsItem -class SharedIntentsResultsIntentsSegmentsItem(UncheckedBaseModel): +class SharedTopicsSegmentsItem(UncheckedBaseModel): text: typing.Optional[str] = None start_word: typing.Optional[float] = None end_word: typing.Optional[float] = None - intents: typing.Optional[typing.List[SharedIntentsResultsIntentsSegmentsItemIntentsItem]] = None + topics: typing.Optional[typing.List[SharedTopicsSegmentsItemTopicsItem]] = 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/shared_topics_results_topics_segments_item_topics_item.py b/src/deepgram/types/shared_topics_segments_item_topics_item.py similarity index 88% rename from src/deepgram/types/shared_topics_results_topics_segments_item_topics_item.py rename to src/deepgram/types/shared_topics_segments_item_topics_item.py index b2cf2d27..83095f96 100644 --- a/src/deepgram/types/shared_topics_results_topics_segments_item_topics_item.py +++ b/src/deepgram/types/shared_topics_segments_item_topics_item.py @@ -7,7 +7,7 @@ from ..core.unchecked_base_model import UncheckedBaseModel -class SharedTopicsResultsTopicsSegmentsItemTopicsItem(UncheckedBaseModel): +class SharedTopicsSegmentsItemTopicsItem(UncheckedBaseModel): topic: typing.Optional[str] = None confidence_score: typing.Optional[float] = None diff --git a/src/deepgram/types/speak_settings_v1provider.py b/src/deepgram/types/speak_settings_v1provider.py index 3fbef168..305cdba8 100644 --- a/src/deepgram/types/speak_settings_v1provider.py +++ b/src/deepgram/types/speak_settings_v1provider.py @@ -24,7 +24,7 @@ class SpeakSettingsV1Provider_Deepgram(UncheckedBaseModel): version: typing.Optional[str] = None model: DeepgramModel speed: typing.Optional[float] = None - expressivity: typing.Optional[pydantic.StrictInt] = None + expressivity: typing.Optional[int] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/src/deepgram/types/speak_v2speed.py b/src/deepgram/types/speak_v2speed.py index c829c072..d15c10de 100644 --- a/src/deepgram/types/speak_v2speed.py +++ b/src/deepgram/types/speak_v2speed.py @@ -2,5 +2,5 @@ SpeakV2Speed = float """ -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`. +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`. A speed other than `1.0` cannot be combined with inline pronunciation controls; see [Speed, Pause, Pronunciation](/docs/tts-voice-controls). """ diff --git a/src/deepgram/types/speak_v2speed_value.py b/src/deepgram/types/speak_v2speed_value.py index 8a8e7bc4..327d419c 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.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`. +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`. A speed other than `1.0` cannot be combined with inline pronunciation controls; see [Speed, Pause, Pronunciation](/docs/tts-voice-controls). """ diff --git a/tests/wire/test_listen_v1_media.py b/tests/wire/test_listen_v1_media.py index d46dbc2a..e4264985 100644 --- a/tests/wire/test_listen_v1_media.py +++ b/tests/wire/test_listen_v1_media.py @@ -9,94 +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 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_manage_v1_projects_keys.py b/tests/wire/test_manage_v1_projects_keys.py index db30e0e0..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,15 +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 f95ac71c..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,43 +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 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/wiremock/wiremock-mappings.json b/wiremock/wiremock-mappings.json index f400cb61..dfb887ec 100644 --- a/wiremock/wiremock-mappings.json +++ b/wiremock/wiremock-mappings.json @@ -1585,7 +1585,7 @@ }, "response": { "status": 200, - "body": "{\n \"metadata\": {\n \"metadata\": {\n \"request_id\": \"d04af392-db11-4c1d-83e1-20e34f0b8999\",\n \"created\": \"2024-11-18T23:47:44Z\",\n \"language\": \"en\"\n }\n },\n \"results\": {\n \"summary\": {\n \"results\": {\n \"summary\": {\n \"text\": \"The summary of the text submitted.\"\n }\n }\n },\n \"topics\": {\n \"results\": {\n \"topics\": {\n \"segments\": [\n {\n \"text\": \"And, um, I think if it signifies anything, it is, uh, to honor the the women who came before us who, um, were skilled and qualified, um, and didn't get the the same opportunities that we have today.\",\n \"start_word\": 32,\n \"end_word\": 69,\n \"topics\": [\n {\n \"topic\": \"Spacewalk\",\n \"confidence_score\": 0.91581345\n }\n ]\n }\n ]\n }\n }\n },\n \"intents\": {\n \"results\": {\n \"intents\": {\n \"segments\": [\n {\n \"text\": \"If you found this valuable, you can subscribe to the show on spotify or your favorite podcast app.\",\n \"start_word\": 354,\n \"end_word\": 414,\n \"intents\": [\n {\n \"intent\": \"Encourage podcasting\",\n \"confidence_score\": 0.0038975573\n }\n ]\n }\n ]\n }\n }\n },\n \"sentiments\": {\n \"segments\": [\n {\n \"text\": \"Yeah. As as much as, um, it's worth celebrating, uh, the first, uh, spacewalk, um, with an all-female team, I think many of us are looking forward to it just being normal. And, um, I think if it signifies anything, it is, uh, to honor the the women who came before us who, um, were skilled and qualified, um, and didn't get the the same opportunities that we have today.\",\n \"start_word\": 0,\n \"end_word\": 69,\n \"sentiment\": \"positive\",\n \"sentiment_score\": 0.5810546875\n }\n ],\n \"average\": {\n \"sentiment\": \"positive\",\n \"sentiment_score\": 0.5810185185185185\n }\n }\n }\n}", + "body": "{\n \"metadata\": {\n \"metadata\": {\n \"request_id\": \"d04af392-db11-4c1d-83e1-20e34f0b8999\",\n \"created\": \"2024-11-18T23:47:44Z\",\n \"language\": \"en\"\n }\n },\n \"results\": {\n \"summary\": {\n \"results\": {\n \"summary\": {\n \"text\": \"The summary of the text submitted.\"\n }\n }\n },\n \"topics\": {\n \"segments\": [\n {\n \"text\": \"And, um, I think if it signifies anything, it is, uh, to honor the the women who came before us who, um, were skilled and qualified, um, and didn't get the the same opportunities that we have today.\",\n \"start_word\": 32,\n \"end_word\": 69,\n \"topics\": [\n {\n \"topic\": \"Spacewalk\",\n \"confidence_score\": 0.91581345\n }\n ]\n }\n ]\n },\n \"intents\": {\n \"segments\": [\n {\n \"text\": \"If you found this valuable, you can subscribe to the show on spotify or your favorite podcast app.\",\n \"start_word\": 354,\n \"end_word\": 414,\n \"intents\": [\n {\n \"intent\": \"Encourage podcasting\",\n \"confidence_score\": 0.0038975573\n }\n ]\n }\n ]\n },\n \"sentiments\": {\n \"segments\": [\n {\n \"text\": \"Yeah. As as much as, um, it's worth celebrating, uh, the first, uh, spacewalk, um, with an all-female team, I think many of us are looking forward to it just being normal. And, um, I think if it signifies anything, it is, uh, to honor the the women who came before us who, um, were skilled and qualified, um, and didn't get the the same opportunities that we have today.\",\n \"start_word\": 0,\n \"end_word\": 69,\n \"sentiment\": \"positive\",\n \"sentiment_score\": 0.5810546875\n }\n ],\n \"average\": {\n \"sentiment\": \"positive\",\n \"sentiment_score\": 0.5810185185185185\n }\n }\n }\n}", "headers": { "Content-Type": "application/json" } From b81b138a511e1dde85f55a5f105a7330190b818e Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Thu, 1 Oct 2026 10:20:36 +0100 Subject: [PATCH 04/15] chore: re-apply manual patches after regen --- .fern/metadata.json | 4 +- .fernignore | 105 +- .gitignore | 3 + .gitignore.bak | 8 - AGENTS.md | 3 + README.md | 1 + docs/FluxTtsControls.md | 21 + pyproject.toml | 2 +- src/deepgram/__init__.py | 54 + src/deepgram/__init__.py.bak | 1358 ----------------- src/deepgram/agent/__init__.py | 58 + src/deepgram/agent/__init__.py.bak | 507 ------ src/deepgram/agent/v1/__init__.py | 58 + src/deepgram/agent/v1/__init__.py.bak | 511 ------- src/deepgram/agent/v1/requests/__init__.py | 28 + .../agent/v1/requests/__init__.py.bak | 262 ---- .../agent/v1/requests/agent_v1settings.py | 3 +- .../agent/v1/requests/agent_v1settings.py.bak | 31 - .../v1/requests/agent_v1settings_agent.py | 15 +- .../v1/requests/agent_v1settings_agent.py.bak | 27 - .../agent_v1settings_agent_context.py | 5 + .../agent_v1settings_agent_context.py.bak | 35 - src/deepgram/agent/v1/socket_client.py | 34 +- src/deepgram/agent/v1/socket_client.py.bak | 386 ----- src/deepgram/agent/v1/types/__init__.py | 32 + src/deepgram/agent/v1/types/__init__.py.bak | 287 ---- .../agent/v1/types/agent_v1settings.py | 3 +- .../agent/v1/types/agent_v1settings.py.bak | 42 - .../agent/v1/types/agent_v1settings_agent.py | 51 +- .../v1/types/agent_v1settings_agent.py.bak | 62 - .../types/agent_v1settings_agent_context.py | 23 + .../agent_v1settings_agent_context.py.bak | 65 - ...1settings_agent_context_listen_provider.py | 23 + ...tings_agent_context_listen_provider.py.bak | 77 - .../agent_v1settings_agent_listen_provider.py | 23 + ...nt_v1settings_agent_listen_provider.py.bak | 77 - .../v1/types/agent_v1update_listen_listen.py | 36 + .../types/agent_v1update_listen_listen.py.bak | 62 - src/deepgram/core/api_error.py | 4 +- src/deepgram/core/api_error.py.bak | 25 - src/deepgram/core/parse_error.py | 4 +- src/deepgram/core/parse_error.py.bak | 38 - src/deepgram/core/query_encoder.py | 14 +- src/deepgram/core/query_encoder.py.bak | 65 - src/deepgram/helpers/text_builder.py | 19 +- src/deepgram/listen/__init__.py | 2 + 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 | 2 + src/deepgram/listen/v2/__init__.py.bak | 111 -- src/deepgram/listen/v2/socket_client.py | 36 +- src/deepgram/listen/v2/socket_client.py.bak | 247 --- src/deepgram/listen/v2/types/__init__.py | 2 + 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 - .../listen/v2/types/listen_v2warning.py | 4 +- src/deepgram/requests/__init__.py | 22 + src/deepgram/requests/__init__.py.bak | 596 -------- .../requests/shared_intents_results.py | 8 + .../shared_intents_results_intents.py | 10 + ...d_intents_results_intents_segments_item.py | 5 + ...ults_intents_segments_item_intents_item.py | 5 + .../requests/shared_topics_results.py | 8 + .../requests/shared_topics_results_topics.py | 10 + ...red_topics_results_topics_segments_item.py | 5 + ...esults_topics_segments_item_topics_item.py | 5 + 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 | 34 + src/deepgram/types/__init__.py.bak | 847 ---------- src/deepgram/types/deepgram.py | 2 +- src/deepgram/types/deepgram.py.bak | 44 - .../types/deepgram_listen_provider_v2.py | 24 + .../types/deepgram_listen_provider_v2.py.bak | 88 -- src/deepgram/types/shared_intents.py | 7 + src/deepgram/types/shared_intents_results.py | 21 + .../types/shared_intents_results_intents.py | 21 + ...d_intents_results_intents_segments_item.py | 5 + ...ults_intents_segments_item_intents_item.py | 5 + src/deepgram/types/shared_topics.py | 7 + src/deepgram/types/shared_topics_results.py | 21 + .../types/shared_topics_results_topics.py | 21 + ...red_topics_results_topics_segments_item.py | 5 + ...esults_topics_segments_item_topics_item.py | 5 + .../types/speak_settings_v1provider.py | 2 +- .../types/speak_settings_v1provider.py.bak | 117 -- tests/custom/test_flux_tts_controls.py | 69 + tests/custom/test_model_dict_compat.py | 25 + tests/custom/test_text_builder.py | 25 +- tests/custom/test_topics_intents_v7_compat.py | 67 + tests/manual/speak/v2/controls/main.py | 64 + tests/wire/test_listen_v1_media.py | 90 ++ tests/wire/test_listen_v1_media.py.bak | 102 -- tests/wire/test_manage_v1_projects_keys.py | 10 + .../wire/test_manage_v1_projects_keys.py.bak | 60 - .../wire/test_manage_v1_projects_requests.py | 38 + .../test_manage_v1_projects_requests.py.bak | 67 - 113 files changed, 1262 insertions(+), 7730 deletions(-) delete mode 100644 .gitignore.bak create mode 100644 docs/FluxTtsControls.md 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 create mode 100644 src/deepgram/requests/shared_intents_results.py create mode 100644 src/deepgram/requests/shared_intents_results_intents.py create mode 100644 src/deepgram/requests/shared_intents_results_intents_segments_item.py create mode 100644 src/deepgram/requests/shared_intents_results_intents_segments_item_intents_item.py create mode 100644 src/deepgram/requests/shared_topics_results.py create mode 100644 src/deepgram/requests/shared_topics_results_topics.py create mode 100644 src/deepgram/requests/shared_topics_results_topics_segments_item.py create mode 100644 src/deepgram/requests/shared_topics_results_topics_segments_item_topics_item.py 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.py.bak delete mode 100644 src/deepgram/types/deepgram_listen_provider_v2.py.bak create mode 100644 src/deepgram/types/shared_intents_results.py create mode 100644 src/deepgram/types/shared_intents_results_intents.py create mode 100644 src/deepgram/types/shared_intents_results_intents_segments_item.py create mode 100644 src/deepgram/types/shared_intents_results_intents_segments_item_intents_item.py create mode 100644 src/deepgram/types/shared_topics_results.py create mode 100644 src/deepgram/types/shared_topics_results_topics.py create mode 100644 src/deepgram/types/shared_topics_results_topics_segments_item.py create mode 100644 src/deepgram/types/shared_topics_results_topics_segments_item_topics_item.py delete mode 100644 src/deepgram/types/speak_settings_v1provider.py.bak create mode 100644 tests/custom/test_flux_tts_controls.py create mode 100644 tests/custom/test_topics_intents_v7_compat.py create mode 100644 tests/manual/speak/v2/controls/main.py 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/.fern/metadata.json b/.fern/metadata.json index bf9d5758..a18824a9 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -24,5 +24,5 @@ "originGitCommit": "e252995bcdb25f3e12d46ae342a2b93d0c1085f9", "originGitCommitIsDirty": true, "invokedBy": "manual", - "sdkVersion": "7.11.1" -} \ No newline at end of file + "sdkVersion": "7.11.0" +} diff --git a/.fernignore b/.fernignore index f89dab66..489d94f5 100644 --- a/.fernignore +++ b/.fernignore @@ -19,6 +19,27 @@ src/deepgram/_secure_logging.py # transition from raw dict responses to typed models. No Fern counterpart. src/deepgram/listen/v2/types/_dict_compat.py +# Hand-written v7 compatibility wrappers for the pre-regen Topics and Intents +# response and request paths. The generated response now exposes direct +# ``segments``; these modules preserve the deprecated ``results.*.segments`` +# imports while the generated direct models provide runtime facades. +src/deepgram/types/shared_topics_results.py +src/deepgram/types/shared_topics_results_topics.py +src/deepgram/types/shared_topics_results_topics_segments_item.py +src/deepgram/types/shared_topics_results_topics_segments_item_topics_item.py +src/deepgram/types/shared_intents_results.py +src/deepgram/types/shared_intents_results_intents.py +src/deepgram/types/shared_intents_results_intents_segments_item.py +src/deepgram/types/shared_intents_results_intents_segments_item_intents_item.py +src/deepgram/requests/shared_topics_results.py +src/deepgram/requests/shared_topics_results_topics.py +src/deepgram/requests/shared_topics_results_topics_segments_item.py +src/deepgram/requests/shared_topics_results_topics_segments_item_topics_item.py +src/deepgram/requests/shared_intents_results.py +src/deepgram/requests/shared_intents_results_intents.py +src/deepgram/requests/shared_intents_results_intents_segments_item.py +src/deepgram/requests/shared_intents_results_intents_segments_item_intents_item.py + # WebSocket socket clients: # - except Exception broad catch (supports custom transports, generator narrows to WebSocketException) # - _sanitize_numeric_types in agent socket client (float→int for API) @@ -27,17 +48,17 @@ 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 # Agent TTS provider expressivity must reject fractional values rather than # allowing Pydantic v1 to truncate them before the API sees the request. # [temporarily frozen — remove when Fern emits a strict integer] -src/deepgram/types/speak_settings_v1provider.py.bak -src/deepgram/types/deepgram.py.bak +src/deepgram/types/speak_settings_v1provider.py +src/deepgram/types/deepgram.py # Backward-compat patch: AgentV1SettingsAgentContext schema restructure as of # 2026-05-05. The new schema nests messages under .context.messages; this file @@ -45,12 +66,12 @@ src/deepgram/types/deepgram.py.bak # kwarg and remaps it to `context={"messages": ...}` so existing callers keep # producing the correct wire payload, plus a read-side `.messages` property so # existing attribute access keeps working. -src/deepgram/agent/v1/types/agent_v1settings_agent_context.py.bak -src/deepgram/agent/v1/types/agent_v1settings_agent.py.bak -src/deepgram/agent/v1/types/agent_v1settings.py.bak -src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py.bak -src/deepgram/agent/v1/requests/agent_v1settings_agent.py.bak -src/deepgram/agent/v1/requests/agent_v1settings.py.bak +src/deepgram/agent/v1/types/agent_v1settings_agent_context.py +src/deepgram/agent/v1/types/agent_v1settings_agent.py +src/deepgram/agent/v1/types/agent_v1settings.py +src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py +src/deepgram/agent/v1/requests/agent_v1settings_agent.py +src/deepgram/agent/v1/requests/agent_v1settings.py # Backward-compatibility alias shims for renamed generated public types/params. # These are hand-written wrappers around the current generated names and must not be regenerated. @@ -125,9 +146,9 @@ src/deepgram/requests/deepgram_listen_provider_v2language_hint.py # remaps a legacy `language_hint=` kwarg to `language_hints` and drops the dead singular # key. Remove and unfreeze these shims when the singular alias is intentionally retired in a # future major release. -src/deepgram/types/deepgram_listen_provider_v2.py.bak -src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py.bak -src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py.bak +src/deepgram/types/deepgram_listen_provider_v2.py +src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py +src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py # Backward-compat patch for the 2026-07-31 AgentV1UpdateListen provider retype. The # generated `provider` field is now the required discriminated union @@ -136,7 +157,7 @@ src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py.ba # that coerces a legacy DeepgramListenProviderV1/V2 (or a dict lacking the version # discriminant) into the new shape so existing callers keep working. Remove and unfreeze # when the old provider payloads are retired in a future major. -src/deepgram/agent/v1/types/agent_v1update_listen_listen.py.bak +src/deepgram/agent/v1/types/agent_v1update_listen_listen.py # Hand-written compat shim recreating ListenV2CloseStreamType, which Fern removed in the # 2026-06-15 regen (docs #946). The original generated type wrongly allowed @@ -149,17 +170,17 @@ src/deepgram/listen/v2/types/listen_v2close_stream_type.py # Temporarily frozen generated package barrels that carry hand-applied legacy alias # re-exports. Before each regen, swap these originals to .bak paths so Fern can add new # exports; then restore the aliases alongside every genuine generated addition. -src/deepgram/__init__.py.bak -src/deepgram/agent/__init__.py.bak -src/deepgram/agent/v1/__init__.py.bak -src/deepgram/agent/v1/types/__init__.py.bak -src/deepgram/agent/v1/requests/__init__.py.bak -src/deepgram/types/__init__.py.bak -src/deepgram/requests/__init__.py.bak +src/deepgram/__init__.py +src/deepgram/agent/__init__.py +src/deepgram/agent/v1/__init__.py +src/deepgram/agent/v1/types/__init__.py +src/deepgram/agent/v1/requests/__init__.py +src/deepgram/types/__init__.py +src/deepgram/requests/__init__.py # listen __init__.py files re-export the ListenV2CloseStreamType shim above. -src/deepgram/listen/__init__.py.bak -src/deepgram/listen/v2/__init__.py.bak -src/deepgram/listen/v2/types/__init__.py.bak +src/deepgram/listen/__init__.py +src/deepgram/listen/v2/__init__.py +src/deepgram/listen/v2/types/__init__.py # Coerces Python bools to lowercase "true"/"false" before urlencode, which # otherwise stringifies via str() and produces "True"/"False" — rejected by @@ -176,23 +197,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 @@ -223,19 +244,21 @@ tests/custom/test_speak_v2_interrupt_configure.py tests/custom/test_speak_v2_coverage.py tests/custom/test_speak_v2_socket.py tests/custom/test_text_builder.py +tests/custom/test_flux_tts_controls.py +tests/custom/test_topics_intents_v7_compat.py tests/custom/test_transport.py 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 @@ -244,7 +267,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 @@ -294,7 +317,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 08f519bb..f25339f1 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -25,6 +25,7 @@ Current permanently frozen files: - `src/deepgram/client.py` — entirely custom (Bearer auth, session ID, `transport_factory`, `reconnect` parity flag); no Fern equivalent - `src/deepgram/_secure_logging.py` — hand-written security utility that installs a `logging.Filter` on the `websockets` client/server loggers to mask the `Authorization` header in DEBUG handshake logs; called from `client.py`; no Fern equivalent - `src/deepgram/listen/v2/types/_dict_compat.py` — hand-written read-side compatibility base for Listen V2 response models. It provides read-only wire-key subscript access during the SDK 7.x transition from raw dict responses to typed models; no Fern counterpart. Remove in the next major release after restoring the temporarily frozen response models below to inherit `UncheckedBaseModel` directly. +- `src/deepgram/types/shared_{topics,intents}_results*.py`, `src/deepgram/requests/shared_{topics,intents}_results*.py` — hand-written compatibility wrappers preserving the pre-7.12 Topics and Intents `results.{topics,intents}.segments` types and Params imports. Fern now generates direct `segments` models; those generated models expose deprecated runtime `results` facades, while these modules preserve old public import paths. Keep these wrappers permanently frozen until the next major release retires the legacy surface. - `src/deepgram/helpers/` — hand-written TextBuilder helpers - `src/deepgram/agent/v1/types/agent_v1history_content.py`, `src/deepgram/agent/v1/types/agent_v1history_function_calls.py`, `src/deepgram/agent/v1/types/agent_v1settings_agent_context_messages_item.py`, `src/deepgram/agent/v1/types/agent_v1settings_agent_context_messages_item_content.py`, `src/deepgram/agent/v1/types/agent_v1settings_agent_context_messages_item_content_role.py`, `src/deepgram/agent/v1/types/agent_v1settings_agent_context_messages_item_function_calls.py`, `src/deepgram/agent/v1/types/agent_v1settings_agent_context_messages_item_function_calls_function_calls_item.py` — hand-written compatibility aliases preserving old public Agent History type imports after regen renames - `src/deepgram/agent/v1/requests/agent_v1history_content.py`, `src/deepgram/agent/v1/requests/agent_v1history_function_calls.py`, `src/deepgram/agent/v1/requests/agent_v1settings_agent_context_messages_item.py`, `src/deepgram/agent/v1/requests/agent_v1settings_agent_context_messages_item_content.py`, `src/deepgram/agent/v1/requests/agent_v1settings_agent_context_messages_item_function_calls.py`, `src/deepgram/agent/v1/requests/agent_v1settings_agent_context_messages_item_function_calls_function_calls_item.py` — hand-written compatibility aliases preserving old public Agent History request-param imports after regen renames @@ -43,6 +44,7 @@ Current permanently frozen files: - `tests/custom/test_secure_logging.py` — hand-written regression test that the `websockets` Authorization-header DEBUG logs are redacted (API key never logged in clear text) - `tests/custom/test_speak_v2_interrupt_configure.py` — hand-written coverage for the Speak V2 barge-in / mid-stream reconfigure surface (`send_interrupt`, `send_configure`, `SpeechInterrupted`, `ConfigureSuccess`/`ConfigureFailure`, and the `speed`/`expressivity` connect params) - `tests/custom/test_text_builder.py`, `tests/custom/test_transport.py` — hand-written tests +- `tests/custom/test_flux_tts_controls.py`, `tests/custom/test_topics_intents_v7_compat.py` — hand-written regression coverage for Flux TTS controls and direct Topics/Intents response compatibility - `tests/typecheck/compat_aliases.py` — hand-written mypy `assert_type` coverage for backward-compatible alias TypedDicts - `tests/manual/` — manual standalone tests - `.coveragerc` — hand-written coverage configuration (branch coverage on, scoped to `deepgram`, generated data models and package plumbing excluded, `fail_under` gate). Deliberately kept out of `pyproject.toml`, which Fern regenerates: freezing `pyproject.toml` would also block generator dependency updates (see `5c1e845`, where a `pydantic-core` bound fix for issue #701 shipped as a `pyproject.toml`-only regen change). No Fern counterpart, so it never needs unfreezing. @@ -71,6 +73,7 @@ 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 the language alias when it is retired in a future major. +- `src/deepgram/types/shared_topics.py`, `src/deepgram/types/shared_intents.py`, and the generated root/type/request barrels — direct Topics and Intents segments plus their generated exports remain Fern-owned, but carry the v7 deprecated `results` facade and re-exports for the hand-written wrappers above. Freeze these generated files during the parent reconciliation; retain all direct generated segments and exports alongside the compatibility surface. - `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/README.md b/README.md index 628d1ff7..ff9442ee 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ pip install deepgram-sdk ## Reference - **[API Reference](./reference.md)** - Complete reference for all SDK methods, parameters, and WebSocket connections +- **[Flux TTS controls](./docs/FluxTtsControls.md)** - Batch and streaming pronunciation, pause, and speed behavior ## Usage diff --git a/docs/FluxTtsControls.md b/docs/FluxTtsControls.md new file mode 100644 index 00000000..23969225 --- /dev/null +++ b/docs/FluxTtsControls.md @@ -0,0 +1,21 @@ +# Flux TTS Controls + +Flux TTS supports inline pronunciation and pause controls for batch REST synthesis. These controls are English-only at launch. + +## Batch REST + +Use `client.speak.v2.audio.generate()` for complete text. A pause is written as `{pause:500}` through `{pause:3000}` in 100 ms increments. A request accepts at most eight pauses. `TextBuilder` emits and validates this Flux batch syntax. + +Pronunciation uses `{"word": "...", "pronounce": ""}` and is Early Access. A pronunciation cannot be combined with any pause or with `speed` other than `1.0`. When a pause is present, `speed` cannot exceed `1.15`. Invalid combinations return a batch error, including `CONTROL_COMBINATION_INVALID` or `PAUSE_SPEED_CAP_EXCEEDED`. + +Read batch control outcomes from raw response headers: `dg-pronunciations-applied`, `dg-breaks-applied`, and `dg-warnings`. Warnings report best-effort pronunciation handling. + +## WebSocket + +Use `client.speak.v2.connect()` for streaming Flux synthesis. WebSocket turns support pronunciation controls only. A pause marker, or a pronunciation combined with non-default speed, closes the connection with `DATA-0002`. + +`Configure` changes are buffered. Setting speed while a buffered turn contains pronunciation returns `ConfigureFailure` with `CONTROL_COMBINATION_INVALID`; flush that turn before changing speed. + +`SpeechMetadata.controls_applied` reports pronunciation, pause, and warning counters. `Warning` messages report the associated warning code and description. WebSocket pauses are unsupported, so `breaks_applied` is always zero. + +`TextBuilder` is intended for Flux batch requests. Do not use its pause output with the Flux WebSocket or assume these limits apply to non-Flux TTS endpoints. diff --git a/pyproject.toml b/pyproject.toml index 081ecfe4..5e7bfadf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ dynamic = ["version"] [tool.poetry] name = "deepgram-sdk" -version = "7.11.1" +version = "7.11.0" description = "" readme = "README.md" authors = [] diff --git a/src/deepgram/__init__.py b/src/deepgram/__init__.py index 55e59d41..6f846796 100644 --- a/src/deepgram/__init__.py +++ b/src/deepgram/__init__.py @@ -754,6 +754,14 @@ "ReadV1ResponseResultsSummaryResultsSummaryParams": ".requests", "SharedIntents": ".types", "SharedIntentsParams": ".requests", + "SharedIntentsResults": ".types", + "SharedIntentsResultsIntents": ".types", + "SharedIntentsResultsIntentsParams": ".requests", + "SharedIntentsResultsIntentsSegmentsItem": ".types", + "SharedIntentsResultsIntentsSegmentsItemIntentsItem": ".types", + "SharedIntentsResultsIntentsSegmentsItemIntentsItemParams": ".requests", + "SharedIntentsResultsIntentsSegmentsItemParams": ".requests", + "SharedIntentsResultsParams": ".requests", "SharedIntentsSegmentsItem": ".types", "SharedIntentsSegmentsItemIntentsItem": ".types", "SharedIntentsSegmentsItemIntentsItemParams": ".requests", @@ -766,6 +774,14 @@ "SharedSentimentsSegmentsItemParams": ".requests", "SharedTopics": ".types", "SharedTopicsParams": ".requests", + "SharedTopicsResults": ".types", + "SharedTopicsResultsParams": ".requests", + "SharedTopicsResultsTopics": ".types", + "SharedTopicsResultsTopicsParams": ".requests", + "SharedTopicsResultsTopicsSegmentsItem": ".types", + "SharedTopicsResultsTopicsSegmentsItemParams": ".requests", + "SharedTopicsResultsTopicsSegmentsItemTopicsItem": ".types", + "SharedTopicsResultsTopicsSegmentsItemTopicsItemParams": ".requests", "SharedTopicsSegmentsItem": ".types", "SharedTopicsSegmentsItemParams": ".requests", "SharedTopicsSegmentsItemTopicsItem": ".types", @@ -854,6 +870,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", } @@ -1205,6 +1232,14 @@ def __dir__(): "ReadV1ResponseResultsSummaryResultsSummaryParams", "SharedIntents", "SharedIntentsParams", + "SharedIntentsResults", + "SharedIntentsResultsIntents", + "SharedIntentsResultsIntentsParams", + "SharedIntentsResultsIntentsSegmentsItem", + "SharedIntentsResultsIntentsSegmentsItemIntentsItem", + "SharedIntentsResultsIntentsSegmentsItemIntentsItemParams", + "SharedIntentsResultsIntentsSegmentsItemParams", + "SharedIntentsResultsParams", "SharedIntentsSegmentsItem", "SharedIntentsSegmentsItemIntentsItem", "SharedIntentsSegmentsItemIntentsItemParams", @@ -1217,6 +1252,14 @@ def __dir__(): "SharedSentimentsSegmentsItemParams", "SharedTopics", "SharedTopicsParams", + "SharedTopicsResults", + "SharedTopicsResultsParams", + "SharedTopicsResultsTopics", + "SharedTopicsResultsTopicsParams", + "SharedTopicsResultsTopicsSegmentsItem", + "SharedTopicsResultsTopicsSegmentsItemParams", + "SharedTopicsResultsTopicsSegmentsItemTopicsItem", + "SharedTopicsResultsTopicsSegmentsItemTopicsItemParams", "SharedTopicsSegmentsItem", "SharedTopicsSegmentsItemParams", "SharedTopicsSegmentsItemTopicsItem", @@ -1305,4 +1348,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 f143f308..00000000 --- a/src/deepgram/__init__.py.bak +++ /dev/null @@ -1,1358 +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, - ListenV2ConfigureNumerals, - ListenV2EagerEotThreshold, - ListenV2Encoding, - ListenV2EotThreshold, - ListenV2EotTimeoutMs, - ListenV2Keyterm, - ListenV2LanguageHint, - ListenV2MipOptOut, - ListenV2Model, - ListenV2Numerals, - ListenV2ProfanityFilter, - ListenV2Redact, - ListenV2SampleRate, - ListenV2Tag, - OpenAiSpeakProvider, - OpenAiSpeakProviderModel, - OpenAiSpeakProviderVoice, - OpenAiThinkProvider, - OpenAiThinkProviderModel, - OpenAiThinkProviderReasoningMode, - ProjectRequestResponse, - ReadV1Request, - ReadV1RequestText, - ReadV1RequestUrl, - ReadV1Response, - ReadV1ResponseMetadata, - ReadV1ResponseMetadataMetadata, - ReadV1ResponseMetadataMetadataIntentsInfo, - ReadV1ResponseMetadataMetadataSentimentInfo, - ReadV1ResponseMetadataMetadataSummaryInfo, - ReadV1ResponseMetadataMetadataTopicsInfo, - ReadV1ResponseResults, - ReadV1ResponseResultsSummary, - ReadV1ResponseResultsSummaryResults, - ReadV1ResponseResultsSummaryResultsSummary, - SharedIntents, - 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, 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", - "AgentThinkModelsV1Response": ".types", - "AgentThinkModelsV1ResponseModelsItem": ".types", - "AgentThinkModelsV1ResponseModelsItemId": ".types", - "AgentThinkModelsV1ResponseModelsItemIdParams": ".requests", - "AgentThinkModelsV1ResponseModelsItemOne": ".types", - "AgentThinkModelsV1ResponseModelsItemOneId": ".types", - "AgentThinkModelsV1ResponseModelsItemOneParams": ".requests", - "AgentThinkModelsV1ResponseModelsItemParams": ".requests", - "AgentThinkModelsV1ResponseModelsItemThree": ".types", - "AgentThinkModelsV1ResponseModelsItemThreeParams": ".requests", - "AgentThinkModelsV1ResponseModelsItemTwo": ".types", - "AgentThinkModelsV1ResponseModelsItemTwoId": ".types", - "AgentThinkModelsV1ResponseModelsItemTwoParams": ".requests", - "AgentThinkModelsV1ResponseModelsItemZero": ".types", - "AgentThinkModelsV1ResponseModelsItemZeroId": ".types", - "AgentThinkModelsV1ResponseModelsItemZeroParams": ".requests", - "AgentThinkModelsV1ResponseParams": ".requests", - "AgentVariableV1": ".types", - "AgentVariableV1Params": ".requests", - "Anthropic": ".types", - "AnthropicModel": ".types", - "AnthropicParams": ".requests", - "AsyncDeepgramClient": ".client", - "AwsBedrockThinkProvider": ".types", - "AwsBedrockThinkProviderCredentials": ".types", - "AwsBedrockThinkProviderCredentialsParams": ".requests", - "AwsBedrockThinkProviderCredentialsType": ".types", - "AwsBedrockThinkProviderModel": ".types", - "AwsBedrockThinkProviderParams": ".requests", - "AwsPollySpeakProvider": ".types", - "AwsPollySpeakProviderCredentials": ".types", - "AwsPollySpeakProviderCredentialsParams": ".requests", - "AwsPollySpeakProviderCredentialsType": ".types", - "AwsPollySpeakProviderEngine": ".types", - "AwsPollySpeakProviderParams": ".requests", - "AwsPollySpeakProviderVoice": ".types", - "BadRequestError": ".errors", - "BillingBreakdownV1Response": ".types", - "BillingBreakdownV1ResponseParams": ".requests", - "BillingBreakdownV1ResponseResolution": ".types", - "BillingBreakdownV1ResponseResolutionParams": ".requests", - "BillingBreakdownV1ResponseResultsItem": ".types", - "BillingBreakdownV1ResponseResultsItemGrouping": ".types", - "BillingBreakdownV1ResponseResultsItemGroupingParams": ".requests", - "BillingBreakdownV1ResponseResultsItemParams": ".requests", - "Cartesia": ".types", - "CartesiaModelId": ".types", - "CartesiaParams": ".requests", - "CartesiaVoice": ".types", - "CartesiaVoiceParams": ".requests", - "CreateAgentConfigurationV1Response": ".types", - "CreateAgentConfigurationV1ResponseParams": ".requests", - "CreateKeyV1Request": ".types", - "CreateKeyV1RequestParams": ".requests", - "CreateKeyV1Response": ".types", - "CreateKeyV1ResponseParams": ".requests", - "CreateProjectDistributionCredentialsV1Response": ".types", - "CreateProjectDistributionCredentialsV1ResponseDistributionCredentials": ".types", - "CreateProjectDistributionCredentialsV1ResponseDistributionCredentialsParams": ".requests", - "CreateProjectDistributionCredentialsV1ResponseMember": ".types", - "CreateProjectDistributionCredentialsV1ResponseMemberParams": ".requests", - "CreateProjectDistributionCredentialsV1ResponseParams": ".requests", - "CreateProjectInviteV1Response": ".types", - "CreateProjectInviteV1ResponseParams": ".requests", - "Deepgram": ".types", - "DeepgramClient": ".client", - "DeepgramClientEnvironment": ".environment", - "DeepgramListenProviderV1": ".types", - "DeepgramListenProviderV1Params": ".requests", - "DeepgramListenProviderV2": ".types", - "DeepgramListenProviderV2Params": ".requests", - "DeepgramModel": ".types", - "DeepgramParams": ".requests", - "DefaultAioHttpClient": "._default_clients", - "DefaultAsyncHttpxClient": "._default_clients", - "DeleteAgentConfigurationV1Response": ".types", - "DeleteAgentVariableV1Response": ".types", - "DeleteProjectInviteV1Response": ".types", - "DeleteProjectInviteV1ResponseParams": ".requests", - "DeleteProjectKeyV1Response": ".types", - "DeleteProjectKeyV1ResponseParams": ".requests", - "DeleteProjectMemberV1Response": ".types", - "DeleteProjectMemberV1ResponseParams": ".requests", - "DeleteProjectV1Response": ".types", - "DeleteProjectV1ResponseParams": ".requests", - "ElevenLabsSpeakProvider": ".types", - "ElevenLabsSpeakProviderModelId": ".types", - "ElevenLabsSpeakProviderParams": ".requests", - "ErrorResponse": ".types", - "ErrorResponseLegacyError": ".types", - "ErrorResponseLegacyErrorParams": ".requests", - "ErrorResponseModernError": ".types", - "ErrorResponseModernErrorParams": ".requests", - "ErrorResponseParams": ".requests", - "ErrorResponseTextError": ".types", - "GetModelV1Response": ".types", - "GetModelV1ResponseBatch": ".types", - "GetModelV1ResponseBatchParams": ".requests", - "GetModelV1ResponseMetadata": ".types", - "GetModelV1ResponseMetadataMetadata": ".types", - "GetModelV1ResponseMetadataMetadataParams": ".requests", - "GetModelV1ResponseMetadataParams": ".requests", - "GetModelV1ResponseParams": ".requests", - "GetProjectBalanceV1Response": ".types", - "GetProjectBalanceV1ResponseParams": ".requests", - "GetProjectDistributionCredentialsV1Response": ".types", - "GetProjectDistributionCredentialsV1ResponseDistributionCredentials": ".types", - "GetProjectDistributionCredentialsV1ResponseDistributionCredentialsParams": ".requests", - "GetProjectDistributionCredentialsV1ResponseMember": ".types", - "GetProjectDistributionCredentialsV1ResponseMemberParams": ".requests", - "GetProjectDistributionCredentialsV1ResponseParams": ".requests", - "GetProjectKeyV1Response": ".types", - "GetProjectKeyV1ResponseItem": ".types", - "GetProjectKeyV1ResponseItemMember": ".types", - "GetProjectKeyV1ResponseItemMemberApiKey": ".types", - "GetProjectKeyV1ResponseItemMemberApiKeyParams": ".requests", - "GetProjectKeyV1ResponseItemMemberParams": ".requests", - "GetProjectKeyV1ResponseItemParams": ".requests", - "GetProjectKeyV1ResponseParams": ".requests", - "GetProjectRequestV1Response": ".types", - "GetProjectRequestV1ResponseParams": ".requests", - "GetProjectV1Response": ".types", - "GetProjectV1ResponseParams": ".requests", - "Google": ".types", - "GoogleModel": ".types", - "GoogleParams": ".requests", - "GoogleVersion": ".types", - "GrantV1Response": ".types", - "GrantV1ResponseParams": ".requests", - "Groq": ".types", - "GroqParams": ".requests", - "GroqReasoningMode": ".types", - "LeaveProjectV1Response": ".types", - "LeaveProjectV1ResponseParams": ".requests", - "ListAgentConfigurationsV1Response": ".types", - "ListAgentConfigurationsV1ResponseParams": ".requests", - "ListAgentVariablesV1Response": ".types", - "ListAgentVariablesV1ResponseParams": ".requests", - "ListBillingFieldsV1Response": ".types", - "ListBillingFieldsV1ResponseDeploymentsItem": ".types", - "ListBillingFieldsV1ResponseParams": ".requests", - "ListModelsV1Response": ".types", - "ListModelsV1ResponseParams": ".requests", - "ListModelsV1ResponseSttModels": ".types", - "ListModelsV1ResponseSttModelsParams": ".requests", - "ListModelsV1ResponseTtsModels": ".types", - "ListModelsV1ResponseTtsModelsMetadata": ".types", - "ListModelsV1ResponseTtsModelsMetadataParams": ".requests", - "ListModelsV1ResponseTtsModelsParams": ".requests", - "ListProjectBalancesV1Response": ".types", - "ListProjectBalancesV1ResponseBalancesItem": ".types", - "ListProjectBalancesV1ResponseBalancesItemParams": ".requests", - "ListProjectBalancesV1ResponseParams": ".requests", - "ListProjectDistributionCredentialsV1Response": ".types", - "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem": ".types", - "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials": ".types", - "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentialsParams": ".requests", - "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember": ".types", - "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMemberParams": ".requests", - "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemParams": ".requests", - "ListProjectDistributionCredentialsV1ResponseParams": ".requests", - "ListProjectInvitesV1Response": ".types", - "ListProjectInvitesV1ResponseInvitesItem": ".types", - "ListProjectInvitesV1ResponseInvitesItemParams": ".requests", - "ListProjectInvitesV1ResponseParams": ".requests", - "ListProjectKeysV1Response": ".types", - "ListProjectKeysV1ResponseApiKeysItem": ".types", - "ListProjectKeysV1ResponseApiKeysItemApiKey": ".types", - "ListProjectKeysV1ResponseApiKeysItemApiKeyParams": ".requests", - "ListProjectKeysV1ResponseApiKeysItemMember": ".types", - "ListProjectKeysV1ResponseApiKeysItemMemberParams": ".requests", - "ListProjectKeysV1ResponseApiKeysItemParams": ".requests", - "ListProjectKeysV1ResponseParams": ".requests", - "ListProjectMemberScopesV1Response": ".types", - "ListProjectMemberScopesV1ResponseParams": ".requests", - "ListProjectMembersV1Response": ".types", - "ListProjectMembersV1ResponseMembersItem": ".types", - "ListProjectMembersV1ResponseMembersItemParams": ".requests", - "ListProjectMembersV1ResponseParams": ".requests", - "ListProjectPurchasesV1Response": ".types", - "ListProjectPurchasesV1ResponseOrdersItem": ".types", - "ListProjectPurchasesV1ResponseOrdersItemParams": ".requests", - "ListProjectPurchasesV1ResponseParams": ".requests", - "ListProjectRequestsV1Response": ".types", - "ListProjectRequestsV1ResponseParams": ".requests", - "ListProjectsV1Response": ".types", - "ListProjectsV1ResponseParams": ".requests", - "ListProjectsV1ResponseProjectsItem": ".types", - "ListProjectsV1ResponseProjectsItemParams": ".requests", - "ListenV1AcceptedResponse": ".types", - "ListenV1AcceptedResponseParams": ".requests", - "ListenV1Callback": ".types", - "ListenV1CallbackMethod": ".types", - "ListenV1Channels": ".types", - "ListenV1DetectEntities": ".types", - "ListenV1Diarize": ".types", - "ListenV1Dictation": ".types", - "ListenV1Encoding": ".types", - "ListenV1Endpointing": ".types", - "ListenV1Extra": ".types", - "ListenV1InterimResults": ".types", - "ListenV1Keyterm": ".types", - "ListenV1Keywords": ".types", - "ListenV1Language": ".types", - "ListenV1MipOptOut": ".types", - "ListenV1Model": ".types", - "ListenV1Multichannel": ".types", - "ListenV1Numerals": ".types", - "ListenV1ProfanityFilter": ".types", - "ListenV1Punctuate": ".types", - "ListenV1Redact": ".types", - "ListenV1Replace": ".types", - "ListenV1RequestFile": ".types", - "ListenV1Response": ".types", - "ListenV1ResponseMetadata": ".types", - "ListenV1ResponseMetadataDiarizeInfo": ".types", - "ListenV1ResponseMetadataDiarizeInfoParams": ".requests", - "ListenV1ResponseMetadataIntentsInfo": ".types", - "ListenV1ResponseMetadataIntentsInfoParams": ".requests", - "ListenV1ResponseMetadataParams": ".requests", - "ListenV1ResponseMetadataSentimentInfo": ".types", - "ListenV1ResponseMetadataSentimentInfoParams": ".requests", - "ListenV1ResponseMetadataSummaryInfo": ".types", - "ListenV1ResponseMetadataSummaryInfoParams": ".requests", - "ListenV1ResponseMetadataTopicsInfo": ".types", - "ListenV1ResponseMetadataTopicsInfoParams": ".requests", - "ListenV1ResponseParams": ".requests", - "ListenV1ResponseResults": ".types", - "ListenV1ResponseResultsChannels": ".types", - "ListenV1ResponseResultsChannelsItem": ".types", - "ListenV1ResponseResultsChannelsItemAlternativesItem": ".types", - "ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem": ".types", - "ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItemParams": ".requests", - "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs": ".types", - "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem": ".types", - "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemParams": ".requests", - "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem": ".types", - "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItemParams": ".requests", - "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParams": ".requests", - "ListenV1ResponseResultsChannelsItemAlternativesItemParams": ".requests", - "ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem": ".types", - "ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItemParams": ".requests", - "ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem": ".types", - "ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItemParams": ".requests", - "ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem": ".types", - "ListenV1ResponseResultsChannelsItemAlternativesItemWordsItemParams": ".requests", - "ListenV1ResponseResultsChannelsItemParams": ".requests", - "ListenV1ResponseResultsChannelsItemSearchItem": ".types", - "ListenV1ResponseResultsChannelsItemSearchItemHitsItem": ".types", - "ListenV1ResponseResultsChannelsItemSearchItemHitsItemParams": ".requests", - "ListenV1ResponseResultsChannelsItemSearchItemParams": ".requests", - "ListenV1ResponseResultsChannelsParams": ".requests", - "ListenV1ResponseResultsParams": ".requests", - "ListenV1ResponseResultsSummary": ".types", - "ListenV1ResponseResultsSummaryParams": ".requests", - "ListenV1ResponseResultsUtterances": ".types", - "ListenV1ResponseResultsUtterancesItem": ".types", - "ListenV1ResponseResultsUtterancesItemParams": ".requests", - "ListenV1ResponseResultsUtterancesItemWordsItem": ".types", - "ListenV1ResponseResultsUtterancesItemWordsItemParams": ".requests", - "ListenV1ResponseResultsUtterancesParams": ".requests", - "ListenV1SampleRate": ".types", - "ListenV1Search": ".types", - "ListenV1SmartFormat": ".types", - "ListenV1Tag": ".types", - "ListenV1UtteranceEndMs": ".types", - "ListenV1VadEvents": ".types", - "ListenV1Version": ".types", - "ListenV2ConfigureNumerals": ".types", - "ListenV2EagerEotThreshold": ".types", - "ListenV2Encoding": ".types", - "ListenV2EotThreshold": ".types", - "ListenV2EotTimeoutMs": ".types", - "ListenV2Keyterm": ".types", - "ListenV2KeytermParams": ".requests", - "ListenV2LanguageHint": ".types", - "ListenV2LanguageHintParams": ".requests", - "ListenV2MipOptOut": ".types", - "ListenV2Model": ".types", - "ListenV2Numerals": ".types", - "ListenV2ProfanityFilter": ".types", - "ListenV2Redact": ".types", - "ListenV2SampleRate": ".types", - "ListenV2Tag": ".types", - "OpenAiSpeakProvider": ".types", - "OpenAiSpeakProviderModel": ".types", - "OpenAiSpeakProviderParams": ".requests", - "OpenAiSpeakProviderVoice": ".types", - "OpenAiThinkProvider": ".types", - "OpenAiThinkProviderModel": ".types", - "OpenAiThinkProviderParams": ".requests", - "OpenAiThinkProviderReasoningMode": ".types", - "ProjectRequestResponse": ".types", - "ProjectRequestResponseParams": ".requests", - "ReadV1Request": ".types", - "ReadV1RequestParams": ".requests", - "ReadV1RequestText": ".types", - "ReadV1RequestTextParams": ".requests", - "ReadV1RequestUrl": ".types", - "ReadV1RequestUrlParams": ".requests", - "ReadV1Response": ".types", - "ReadV1ResponseMetadata": ".types", - "ReadV1ResponseMetadataMetadata": ".types", - "ReadV1ResponseMetadataMetadataIntentsInfo": ".types", - "ReadV1ResponseMetadataMetadataIntentsInfoParams": ".requests", - "ReadV1ResponseMetadataMetadataParams": ".requests", - "ReadV1ResponseMetadataMetadataSentimentInfo": ".types", - "ReadV1ResponseMetadataMetadataSentimentInfoParams": ".requests", - "ReadV1ResponseMetadataMetadataSummaryInfo": ".types", - "ReadV1ResponseMetadataMetadataSummaryInfoParams": ".requests", - "ReadV1ResponseMetadataMetadataTopicsInfo": ".types", - "ReadV1ResponseMetadataMetadataTopicsInfoParams": ".requests", - "ReadV1ResponseMetadataParams": ".requests", - "ReadV1ResponseParams": ".requests", - "ReadV1ResponseResults": ".types", - "ReadV1ResponseResultsParams": ".requests", - "ReadV1ResponseResultsSummary": ".types", - "ReadV1ResponseResultsSummaryParams": ".requests", - "ReadV1ResponseResultsSummaryResults": ".types", - "ReadV1ResponseResultsSummaryResultsParams": ".requests", - "ReadV1ResponseResultsSummaryResultsSummary": ".types", - "ReadV1ResponseResultsSummaryResultsSummaryParams": ".requests", - "SharedIntents": ".types", - "SharedIntentsParams": ".requests", - "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", - "AnthropicThinkProviderModel": ".types", - "CartesiaSpeakProviderModelId": ".types", - "CartesiaSpeakProviderVoice": ".types", - "CartesiaSpeakProviderVoiceParams": ".requests", - "CreateKeyV1RequestOne": ".types", - "DeepgramListenProviderV2LanguageHint": ".types", - "DeepgramListenProviderV2LanguageHintParams": ".requests", - "DeepgramSpeakProviderModel": ".types", - "GoogleThinkProviderModel": ".types", - "GoogleThinkProviderVersion": ".types", - "GroqThinkProviderReasoningMode": ".types", -} - - -def __getattr__(attr_name: str) -> typing.Any: - module_name = _dynamic_imports.get(attr_name) - if module_name is None: - raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") - try: - module = import_module(module_name, __package__) - if module_name == f".{attr_name}": - return module - else: - return getattr(module, attr_name) - except ImportError as e: - raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e - except AttributeError as e: - raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e - - -def __dir__(): - lazy_attrs = list(_dynamic_imports.keys()) - return sorted(lazy_attrs) - - -__all__ = [ - "AgentConfigurationV1", - "AgentConfigurationV1Params", - "AgentThinkModelsV1Response", - "AgentThinkModelsV1ResponseModelsItem", - "AgentThinkModelsV1ResponseModelsItemId", - "AgentThinkModelsV1ResponseModelsItemIdParams", - "AgentThinkModelsV1ResponseModelsItemOne", - "AgentThinkModelsV1ResponseModelsItemOneId", - "AgentThinkModelsV1ResponseModelsItemOneParams", - "AgentThinkModelsV1ResponseModelsItemParams", - "AgentThinkModelsV1ResponseModelsItemThree", - "AgentThinkModelsV1ResponseModelsItemThreeParams", - "AgentThinkModelsV1ResponseModelsItemTwo", - "AgentThinkModelsV1ResponseModelsItemTwoId", - "AgentThinkModelsV1ResponseModelsItemTwoParams", - "AgentThinkModelsV1ResponseModelsItemZero", - "AgentThinkModelsV1ResponseModelsItemZeroId", - "AgentThinkModelsV1ResponseModelsItemZeroParams", - "AgentThinkModelsV1ResponseParams", - "AgentVariableV1", - "AgentVariableV1Params", - "Anthropic", - "AnthropicModel", - "AnthropicParams", - "AsyncDeepgramClient", - "AwsBedrockThinkProvider", - "AwsBedrockThinkProviderCredentials", - "AwsBedrockThinkProviderCredentialsParams", - "AwsBedrockThinkProviderCredentialsType", - "AwsBedrockThinkProviderModel", - "AwsBedrockThinkProviderParams", - "AwsPollySpeakProvider", - "AwsPollySpeakProviderCredentials", - "AwsPollySpeakProviderCredentialsParams", - "AwsPollySpeakProviderCredentialsType", - "AwsPollySpeakProviderEngine", - "AwsPollySpeakProviderParams", - "AwsPollySpeakProviderVoice", - "BadRequestError", - "BillingBreakdownV1Response", - "BillingBreakdownV1ResponseParams", - "BillingBreakdownV1ResponseResolution", - "BillingBreakdownV1ResponseResolutionParams", - "BillingBreakdownV1ResponseResultsItem", - "BillingBreakdownV1ResponseResultsItemGrouping", - "BillingBreakdownV1ResponseResultsItemGroupingParams", - "BillingBreakdownV1ResponseResultsItemParams", - "Cartesia", - "CartesiaModelId", - "CartesiaParams", - "CartesiaVoice", - "CartesiaVoiceParams", - "CreateAgentConfigurationV1Response", - "CreateAgentConfigurationV1ResponseParams", - "CreateKeyV1Request", - "CreateKeyV1RequestParams", - "CreateKeyV1Response", - "CreateKeyV1ResponseParams", - "CreateProjectDistributionCredentialsV1Response", - "CreateProjectDistributionCredentialsV1ResponseDistributionCredentials", - "CreateProjectDistributionCredentialsV1ResponseDistributionCredentialsParams", - "CreateProjectDistributionCredentialsV1ResponseMember", - "CreateProjectDistributionCredentialsV1ResponseMemberParams", - "CreateProjectDistributionCredentialsV1ResponseParams", - "CreateProjectInviteV1Response", - "CreateProjectInviteV1ResponseParams", - "Deepgram", - "DeepgramClient", - "DeepgramClientEnvironment", - "DeepgramListenProviderV1", - "DeepgramListenProviderV1Params", - "DeepgramListenProviderV2", - "DeepgramListenProviderV2Params", - "DeepgramModel", - "DeepgramParams", - "DefaultAioHttpClient", - "DefaultAsyncHttpxClient", - "DeleteAgentConfigurationV1Response", - "DeleteAgentVariableV1Response", - "DeleteProjectInviteV1Response", - "DeleteProjectInviteV1ResponseParams", - "DeleteProjectKeyV1Response", - "DeleteProjectKeyV1ResponseParams", - "DeleteProjectMemberV1Response", - "DeleteProjectMemberV1ResponseParams", - "DeleteProjectV1Response", - "DeleteProjectV1ResponseParams", - "ElevenLabsSpeakProvider", - "ElevenLabsSpeakProviderModelId", - "ElevenLabsSpeakProviderParams", - "ErrorResponse", - "ErrorResponseLegacyError", - "ErrorResponseLegacyErrorParams", - "ErrorResponseModernError", - "ErrorResponseModernErrorParams", - "ErrorResponseParams", - "ErrorResponseTextError", - "GetModelV1Response", - "GetModelV1ResponseBatch", - "GetModelV1ResponseBatchParams", - "GetModelV1ResponseMetadata", - "GetModelV1ResponseMetadataMetadata", - "GetModelV1ResponseMetadataMetadataParams", - "GetModelV1ResponseMetadataParams", - "GetModelV1ResponseParams", - "GetProjectBalanceV1Response", - "GetProjectBalanceV1ResponseParams", - "GetProjectDistributionCredentialsV1Response", - "GetProjectDistributionCredentialsV1ResponseDistributionCredentials", - "GetProjectDistributionCredentialsV1ResponseDistributionCredentialsParams", - "GetProjectDistributionCredentialsV1ResponseMember", - "GetProjectDistributionCredentialsV1ResponseMemberParams", - "GetProjectDistributionCredentialsV1ResponseParams", - "GetProjectKeyV1Response", - "GetProjectKeyV1ResponseItem", - "GetProjectKeyV1ResponseItemMember", - "GetProjectKeyV1ResponseItemMemberApiKey", - "GetProjectKeyV1ResponseItemMemberApiKeyParams", - "GetProjectKeyV1ResponseItemMemberParams", - "GetProjectKeyV1ResponseItemParams", - "GetProjectKeyV1ResponseParams", - "GetProjectRequestV1Response", - "GetProjectRequestV1ResponseParams", - "GetProjectV1Response", - "GetProjectV1ResponseParams", - "Google", - "GoogleModel", - "GoogleParams", - "GoogleVersion", - "GrantV1Response", - "GrantV1ResponseParams", - "Groq", - "GroqParams", - "GroqReasoningMode", - "LeaveProjectV1Response", - "LeaveProjectV1ResponseParams", - "ListAgentConfigurationsV1Response", - "ListAgentConfigurationsV1ResponseParams", - "ListAgentVariablesV1Response", - "ListAgentVariablesV1ResponseParams", - "ListBillingFieldsV1Response", - "ListBillingFieldsV1ResponseDeploymentsItem", - "ListBillingFieldsV1ResponseParams", - "ListModelsV1Response", - "ListModelsV1ResponseParams", - "ListModelsV1ResponseSttModels", - "ListModelsV1ResponseSttModelsParams", - "ListModelsV1ResponseTtsModels", - "ListModelsV1ResponseTtsModelsMetadata", - "ListModelsV1ResponseTtsModelsMetadataParams", - "ListModelsV1ResponseTtsModelsParams", - "ListProjectBalancesV1Response", - "ListProjectBalancesV1ResponseBalancesItem", - "ListProjectBalancesV1ResponseBalancesItemParams", - "ListProjectBalancesV1ResponseParams", - "ListProjectDistributionCredentialsV1Response", - "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem", - "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials", - "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentialsParams", - "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember", - "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMemberParams", - "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemParams", - "ListProjectDistributionCredentialsV1ResponseParams", - "ListProjectInvitesV1Response", - "ListProjectInvitesV1ResponseInvitesItem", - "ListProjectInvitesV1ResponseInvitesItemParams", - "ListProjectInvitesV1ResponseParams", - "ListProjectKeysV1Response", - "ListProjectKeysV1ResponseApiKeysItem", - "ListProjectKeysV1ResponseApiKeysItemApiKey", - "ListProjectKeysV1ResponseApiKeysItemApiKeyParams", - "ListProjectKeysV1ResponseApiKeysItemMember", - "ListProjectKeysV1ResponseApiKeysItemMemberParams", - "ListProjectKeysV1ResponseApiKeysItemParams", - "ListProjectKeysV1ResponseParams", - "ListProjectMemberScopesV1Response", - "ListProjectMemberScopesV1ResponseParams", - "ListProjectMembersV1Response", - "ListProjectMembersV1ResponseMembersItem", - "ListProjectMembersV1ResponseMembersItemParams", - "ListProjectMembersV1ResponseParams", - "ListProjectPurchasesV1Response", - "ListProjectPurchasesV1ResponseOrdersItem", - "ListProjectPurchasesV1ResponseOrdersItemParams", - "ListProjectPurchasesV1ResponseParams", - "ListProjectRequestsV1Response", - "ListProjectRequestsV1ResponseParams", - "ListProjectsV1Response", - "ListProjectsV1ResponseParams", - "ListProjectsV1ResponseProjectsItem", - "ListProjectsV1ResponseProjectsItemParams", - "ListenV1AcceptedResponse", - "ListenV1AcceptedResponseParams", - "ListenV1Callback", - "ListenV1CallbackMethod", - "ListenV1Channels", - "ListenV1DetectEntities", - "ListenV1Diarize", - "ListenV1Dictation", - "ListenV1Encoding", - "ListenV1Endpointing", - "ListenV1Extra", - "ListenV1InterimResults", - "ListenV1Keyterm", - "ListenV1Keywords", - "ListenV1Language", - "ListenV1MipOptOut", - "ListenV1Model", - "ListenV1Multichannel", - "ListenV1Numerals", - "ListenV1ProfanityFilter", - "ListenV1Punctuate", - "ListenV1Redact", - "ListenV1Replace", - "ListenV1RequestFile", - "ListenV1Response", - "ListenV1ResponseMetadata", - "ListenV1ResponseMetadataDiarizeInfo", - "ListenV1ResponseMetadataDiarizeInfoParams", - "ListenV1ResponseMetadataIntentsInfo", - "ListenV1ResponseMetadataIntentsInfoParams", - "ListenV1ResponseMetadataParams", - "ListenV1ResponseMetadataSentimentInfo", - "ListenV1ResponseMetadataSentimentInfoParams", - "ListenV1ResponseMetadataSummaryInfo", - "ListenV1ResponseMetadataSummaryInfoParams", - "ListenV1ResponseMetadataTopicsInfo", - "ListenV1ResponseMetadataTopicsInfoParams", - "ListenV1ResponseParams", - "ListenV1ResponseResults", - "ListenV1ResponseResultsChannels", - "ListenV1ResponseResultsChannelsItem", - "ListenV1ResponseResultsChannelsItemAlternativesItem", - "ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem", - "ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItemParams", - "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs", - "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem", - "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemParams", - "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem", - "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItemParams", - "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParams", - "ListenV1ResponseResultsChannelsItemAlternativesItemParams", - "ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem", - "ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItemParams", - "ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem", - "ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItemParams", - "ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem", - "ListenV1ResponseResultsChannelsItemAlternativesItemWordsItemParams", - "ListenV1ResponseResultsChannelsItemParams", - "ListenV1ResponseResultsChannelsItemSearchItem", - "ListenV1ResponseResultsChannelsItemSearchItemHitsItem", - "ListenV1ResponseResultsChannelsItemSearchItemHitsItemParams", - "ListenV1ResponseResultsChannelsItemSearchItemParams", - "ListenV1ResponseResultsChannelsParams", - "ListenV1ResponseResultsParams", - "ListenV1ResponseResultsSummary", - "ListenV1ResponseResultsSummaryParams", - "ListenV1ResponseResultsUtterances", - "ListenV1ResponseResultsUtterancesItem", - "ListenV1ResponseResultsUtterancesItemParams", - "ListenV1ResponseResultsUtterancesItemWordsItem", - "ListenV1ResponseResultsUtterancesItemWordsItemParams", - "ListenV1ResponseResultsUtterancesParams", - "ListenV1SampleRate", - "ListenV1Search", - "ListenV1SmartFormat", - "ListenV1Tag", - "ListenV1UtteranceEndMs", - "ListenV1VadEvents", - "ListenV1Version", - "ListenV2ConfigureNumerals", - "ListenV2EagerEotThreshold", - "ListenV2Encoding", - "ListenV2EotThreshold", - "ListenV2EotTimeoutMs", - "ListenV2Keyterm", - "ListenV2KeytermParams", - "ListenV2LanguageHint", - "ListenV2LanguageHintParams", - "ListenV2MipOptOut", - "ListenV2Model", - "ListenV2Numerals", - "ListenV2ProfanityFilter", - "ListenV2Redact", - "ListenV2SampleRate", - "ListenV2Tag", - "OpenAiSpeakProvider", - "OpenAiSpeakProviderModel", - "OpenAiSpeakProviderParams", - "OpenAiSpeakProviderVoice", - "OpenAiThinkProvider", - "OpenAiThinkProviderModel", - "OpenAiThinkProviderParams", - "OpenAiThinkProviderReasoningMode", - "ProjectRequestResponse", - "ProjectRequestResponseParams", - "ReadV1Request", - "ReadV1RequestParams", - "ReadV1RequestText", - "ReadV1RequestTextParams", - "ReadV1RequestUrl", - "ReadV1RequestUrlParams", - "ReadV1Response", - "ReadV1ResponseMetadata", - "ReadV1ResponseMetadataMetadata", - "ReadV1ResponseMetadataMetadataIntentsInfo", - "ReadV1ResponseMetadataMetadataIntentsInfoParams", - "ReadV1ResponseMetadataMetadataParams", - "ReadV1ResponseMetadataMetadataSentimentInfo", - "ReadV1ResponseMetadataMetadataSentimentInfoParams", - "ReadV1ResponseMetadataMetadataSummaryInfo", - "ReadV1ResponseMetadataMetadataSummaryInfoParams", - "ReadV1ResponseMetadataMetadataTopicsInfo", - "ReadV1ResponseMetadataMetadataTopicsInfoParams", - "ReadV1ResponseMetadataParams", - "ReadV1ResponseParams", - "ReadV1ResponseResults", - "ReadV1ResponseResultsParams", - "ReadV1ResponseResultsSummary", - "ReadV1ResponseResultsSummaryParams", - "ReadV1ResponseResultsSummaryResults", - "ReadV1ResponseResultsSummaryResultsParams", - "ReadV1ResponseResultsSummaryResultsSummary", - "ReadV1ResponseResultsSummaryResultsSummaryParams", - "SharedIntents", - "SharedIntentsParams", - "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", - "AnthropicThinkProviderModel", - "CartesiaSpeakProviderModelId", - "CartesiaSpeakProviderVoice", - "CartesiaSpeakProviderVoiceParams", - "CreateKeyV1RequestOne", - "DeepgramListenProviderV2LanguageHint", - "DeepgramListenProviderV2LanguageHintParams", - "DeepgramSpeakProviderModel", - "GoogleThinkProviderModel", - "GoogleThinkProviderVersion", - "GroqThinkProviderReasoningMode", -] diff --git a/src/deepgram/agent/__init__.py b/src/deepgram/agent/__init__.py index 25e41996..0dc3cfc7 100644 --- a/src/deepgram/agent/__init__.py +++ b/src/deepgram/agent/__init__.py @@ -263,6 +263,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", } @@ -415,4 +444,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 7a372700..00000000 --- a/src/deepgram/agent/__init__.py.bak +++ /dev/null @@ -1,507 +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, - AgentV1ForceEndTurn, - AgentV1ForceEndTurnParams, - AgentV1FunctionCallCancelled, - AgentV1FunctionCallCancelledFunctionsItem, - AgentV1FunctionCallCancelledFunctionsItemParams, - AgentV1FunctionCallCancelledParams, - 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, - 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", - "AgentV1AgentStartedSpeaking": ".v1", - "AgentV1AgentStartedSpeakingParams": ".v1", - "AgentV1AgentThinking": ".v1", - "AgentV1AgentThinkingParams": ".v1", - "AgentV1ConversationText": ".v1", - "AgentV1ConversationTextParams": ".v1", - "AgentV1ConversationTextRole": ".v1", - "AgentV1Error": ".v1", - "AgentV1ErrorParams": ".v1", - "AgentV1ForceEndTurn": ".v1", - "AgentV1ForceEndTurnParams": ".v1", - "AgentV1FunctionCallCancelled": ".v1", - "AgentV1FunctionCallCancelledFunctionsItem": ".v1", - "AgentV1FunctionCallCancelledFunctionsItemParams": ".v1", - "AgentV1FunctionCallCancelledParams": ".v1", - "AgentV1FunctionCallRequest": ".v1", - "AgentV1FunctionCallRequestFunctionsItem": ".v1", - "AgentV1FunctionCallRequestFunctionsItemParams": ".v1", - "AgentV1FunctionCallRequestParams": ".v1", - "AgentV1History": ".v1", - "AgentV1HistoryParams": ".v1", - "AgentV1InjectAgentMessage": ".v1", - "AgentV1InjectAgentMessageBehavior": ".v1", - "AgentV1InjectAgentMessageParams": ".v1", - "AgentV1InjectUserMessage": ".v1", - "AgentV1InjectUserMessageParams": ".v1", - "AgentV1InjectionRefused": ".v1", - "AgentV1InjectionRefusedParams": ".v1", - "AgentV1KeepAlive": ".v1", - "AgentV1KeepAliveParams": ".v1", - "AgentV1LatencyReport": ".v1", - "AgentV1LatencyReportParams": ".v1", - "AgentV1ListenUpdated": ".v1", - "AgentV1ListenUpdatedParams": ".v1", - "AgentV1PromptUpdated": ".v1", - "AgentV1PromptUpdatedParams": ".v1", - "AgentV1ReceiveFunctionCallResponse": ".v1", - "AgentV1ReceiveFunctionCallResponseParams": ".v1", - "AgentV1SendFunctionCallResponse": ".v1", - "AgentV1SendFunctionCallResponseParams": ".v1", - "AgentV1Settings": ".v1", - "AgentV1SettingsAgent": ".v1", - "AgentV1SettingsAgentContext": ".v1", - "AgentV1SettingsAgentContextContext": ".v1", - "AgentV1SettingsAgentContextContextMessagesItem": ".v1", - "AgentV1SettingsAgentContextContextMessagesItemParams": ".v1", - "AgentV1SettingsAgentContextContextParams": ".v1", - "AgentV1SettingsAgentContextListen": ".v1", - "AgentV1SettingsAgentContextListenParams": ".v1", - "AgentV1SettingsAgentContextListenProvider": ".v1", - "AgentV1SettingsAgentContextListenProviderParams": ".v1", - "AgentV1SettingsAgentContextListenProvider_V1": ".v1", - "AgentV1SettingsAgentContextListenProvider_V1Params": ".v1", - "AgentV1SettingsAgentContextListenProvider_V2": ".v1", - "AgentV1SettingsAgentContextListenProvider_V2Params": ".v1", - "AgentV1SettingsAgentContextParams": ".v1", - "AgentV1SettingsAgentContextSpeak": ".v1", - "AgentV1SettingsAgentContextSpeakParams": ".v1", - "AgentV1SettingsAgentContextThink": ".v1", - "AgentV1SettingsAgentContextThinkParams": ".v1", - "AgentV1SettingsAgentListen": ".v1", - "AgentV1SettingsAgentListenParams": ".v1", - "AgentV1SettingsAgentListenProvider": ".v1", - "AgentV1SettingsAgentListenProviderParams": ".v1", - "AgentV1SettingsAgentListenProvider_V1": ".v1", - "AgentV1SettingsAgentListenProvider_V1Params": ".v1", - "AgentV1SettingsAgentListenProvider_V2": ".v1", - "AgentV1SettingsAgentListenProvider_V2Params": ".v1", - "AgentV1SettingsAgentParams": ".v1", - "AgentV1SettingsAgentSpeak": ".v1", - "AgentV1SettingsAgentSpeakParams": ".v1", - "AgentV1SettingsAgentThink": ".v1", - "AgentV1SettingsAgentThinkParams": ".v1", - "AgentV1SettingsApplied": ".v1", - "AgentV1SettingsAppliedParams": ".v1", - "AgentV1SettingsAudio": ".v1", - "AgentV1SettingsAudioInput": ".v1", - "AgentV1SettingsAudioInputEncoding": ".v1", - "AgentV1SettingsAudioInputParams": ".v1", - "AgentV1SettingsAudioOutput": ".v1", - "AgentV1SettingsAudioOutputContainer": ".v1", - "AgentV1SettingsAudioOutputEncoding": ".v1", - "AgentV1SettingsAudioOutputParams": ".v1", - "AgentV1SettingsAudioParams": ".v1", - "AgentV1SettingsFlags": ".v1", - "AgentV1SettingsFlagsParams": ".v1", - "AgentV1SettingsParams": ".v1", - "AgentV1SpeakUpdated": ".v1", - "AgentV1SpeakUpdatedParams": ".v1", - "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", - "AgentV1HistoryContent": ".v1", - "AgentV1HistoryContentParams": ".v1", - "AgentV1HistoryContentRole": ".v1", - "AgentV1HistoryFunctionCalls": ".v1", - "AgentV1HistoryFunctionCallsFunctionCallsItem": ".v1", - "AgentV1HistoryFunctionCallsFunctionCallsItemParams": ".v1", - "AgentV1HistoryFunctionCallsParams": ".v1", - "AgentV1SettingsAgentContextContextMessagesItemContentRole": ".v1", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem": ".v1", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams": ".v1", - "AgentV1SettingsAgentContextListenProviderV1": ".v1", - "AgentV1SettingsAgentContextListenProviderV1Params": ".v1", - "AgentV1SettingsAgentContextListenProviderV2": ".v1", - "AgentV1SettingsAgentContextListenProviderV2LanguageHint": ".v1", - "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams": ".v1", - "AgentV1SettingsAgentContextListenProviderV2Params": ".v1", - "AgentV1SettingsAgentContextMessagesItem": ".v1", - "AgentV1SettingsAgentContextMessagesItemContent": ".v1", - "AgentV1SettingsAgentContextMessagesItemContentParams": ".v1", - "AgentV1SettingsAgentContextMessagesItemContentRole": ".v1", - "AgentV1SettingsAgentContextMessagesItemFunctionCalls": ".v1", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem": ".v1", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams": ".v1", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams": ".v1", - "AgentV1SettingsAgentContextMessagesItemParams": ".v1", - "AgentV1SettingsAgentListenProviderV1": ".v1", - "AgentV1SettingsAgentListenProviderV1Params": ".v1", - "AgentV1SettingsAgentListenProviderV2": ".v1", - "AgentV1SettingsAgentListenProviderV2Params": ".v1", -} - - -def __getattr__(attr_name: str) -> typing.Any: - module_name = _dynamic_imports.get(attr_name) - if module_name is None: - raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") - try: - module = import_module(module_name, __package__) - if module_name == f".{attr_name}": - return module - else: - return getattr(module, attr_name) - except ImportError as e: - raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e - except AttributeError as e: - raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e - - -def __dir__(): - lazy_attrs = list(_dynamic_imports.keys()) - return sorted(lazy_attrs) - - -__all__ = [ - "AgentV1AgentAudioDone", - "AgentV1AgentAudioDoneParams", - "AgentV1AgentStartedSpeaking", - "AgentV1AgentStartedSpeakingParams", - "AgentV1AgentThinking", - "AgentV1AgentThinkingParams", - "AgentV1ConversationText", - "AgentV1ConversationTextParams", - "AgentV1ConversationTextRole", - "AgentV1Error", - "AgentV1ErrorParams", - "AgentV1ForceEndTurn", - "AgentV1ForceEndTurnParams", - "AgentV1FunctionCallCancelled", - "AgentV1FunctionCallCancelledFunctionsItem", - "AgentV1FunctionCallCancelledFunctionsItemParams", - "AgentV1FunctionCallCancelledParams", - "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", - "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/v1/__init__.py b/src/deepgram/agent/v1/__init__.py index 6a71fce2..7b0d5f88 100644 --- a/src/deepgram/agent/v1/__init__.py +++ b/src/deepgram/agent/v1/__init__.py @@ -265,6 +265,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", } @@ -417,4 +446,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 ef258d66..00000000 --- a/src/deepgram/agent/v1/__init__.py.bak +++ /dev/null @@ -1,511 +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, - AgentV1ForceEndTurn, - AgentV1FunctionCallCancelled, - AgentV1FunctionCallCancelledFunctionsItem, - 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, - AgentV1ForceEndTurnParams, - AgentV1FunctionCallCancelledFunctionsItemParams, - AgentV1FunctionCallCancelledParams, - 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, - 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", - "AgentV1AgentStartedSpeaking": ".types", - "AgentV1AgentStartedSpeakingParams": ".requests", - "AgentV1AgentThinking": ".types", - "AgentV1AgentThinkingParams": ".requests", - "AgentV1ConversationText": ".types", - "AgentV1ConversationTextParams": ".requests", - "AgentV1ConversationTextRole": ".types", - "AgentV1Error": ".types", - "AgentV1ErrorParams": ".requests", - "AgentV1ForceEndTurn": ".types", - "AgentV1ForceEndTurnParams": ".requests", - "AgentV1FunctionCallCancelled": ".types", - "AgentV1FunctionCallCancelledFunctionsItem": ".types", - "AgentV1FunctionCallCancelledFunctionsItemParams": ".requests", - "AgentV1FunctionCallCancelledParams": ".requests", - "AgentV1FunctionCallRequest": ".types", - "AgentV1FunctionCallRequestFunctionsItem": ".types", - "AgentV1FunctionCallRequestFunctionsItemParams": ".requests", - "AgentV1FunctionCallRequestParams": ".requests", - "AgentV1History": ".types", - "AgentV1HistoryParams": ".requests", - "AgentV1InjectAgentMessage": ".types", - "AgentV1InjectAgentMessageBehavior": ".types", - "AgentV1InjectAgentMessageParams": ".requests", - "AgentV1InjectUserMessage": ".types", - "AgentV1InjectUserMessageParams": ".requests", - "AgentV1InjectionRefused": ".types", - "AgentV1InjectionRefusedParams": ".requests", - "AgentV1KeepAlive": ".types", - "AgentV1KeepAliveParams": ".requests", - "AgentV1LatencyReport": ".types", - "AgentV1LatencyReportParams": ".requests", - "AgentV1ListenUpdated": ".types", - "AgentV1ListenUpdatedParams": ".requests", - "AgentV1PromptUpdated": ".types", - "AgentV1PromptUpdatedParams": ".requests", - "AgentV1ReceiveFunctionCallResponse": ".types", - "AgentV1ReceiveFunctionCallResponseParams": ".requests", - "AgentV1SendFunctionCallResponse": ".types", - "AgentV1SendFunctionCallResponseParams": ".requests", - "AgentV1Settings": ".types", - "AgentV1SettingsAgent": ".types", - "AgentV1SettingsAgentContext": ".types", - "AgentV1SettingsAgentContextContext": ".types", - "AgentV1SettingsAgentContextContextMessagesItem": ".types", - "AgentV1SettingsAgentContextContextMessagesItemParams": ".requests", - "AgentV1SettingsAgentContextContextParams": ".requests", - "AgentV1SettingsAgentContextListen": ".types", - "AgentV1SettingsAgentContextListenParams": ".requests", - "AgentV1SettingsAgentContextListenProvider": ".types", - "AgentV1SettingsAgentContextListenProviderParams": ".requests", - "AgentV1SettingsAgentContextListenProvider_V1": ".types", - "AgentV1SettingsAgentContextListenProvider_V1Params": ".requests", - "AgentV1SettingsAgentContextListenProvider_V2": ".types", - "AgentV1SettingsAgentContextListenProvider_V2Params": ".requests", - "AgentV1SettingsAgentContextParams": ".requests", - "AgentV1SettingsAgentContextSpeak": ".types", - "AgentV1SettingsAgentContextSpeakParams": ".requests", - "AgentV1SettingsAgentContextThink": ".types", - "AgentV1SettingsAgentContextThinkParams": ".requests", - "AgentV1SettingsAgentListen": ".types", - "AgentV1SettingsAgentListenParams": ".requests", - "AgentV1SettingsAgentListenProvider": ".types", - "AgentV1SettingsAgentListenProviderParams": ".requests", - "AgentV1SettingsAgentListenProvider_V1": ".types", - "AgentV1SettingsAgentListenProvider_V1Params": ".requests", - "AgentV1SettingsAgentListenProvider_V2": ".types", - "AgentV1SettingsAgentListenProvider_V2Params": ".requests", - "AgentV1SettingsAgentParams": ".requests", - "AgentV1SettingsAgentSpeak": ".types", - "AgentV1SettingsAgentSpeakParams": ".requests", - "AgentV1SettingsAgentThink": ".types", - "AgentV1SettingsAgentThinkParams": ".requests", - "AgentV1SettingsApplied": ".types", - "AgentV1SettingsAppliedParams": ".requests", - "AgentV1SettingsAudio": ".types", - "AgentV1SettingsAudioInput": ".types", - "AgentV1SettingsAudioInputEncoding": ".types", - "AgentV1SettingsAudioInputParams": ".requests", - "AgentV1SettingsAudioOutput": ".types", - "AgentV1SettingsAudioOutputContainer": ".types", - "AgentV1SettingsAudioOutputEncoding": ".types", - "AgentV1SettingsAudioOutputParams": ".requests", - "AgentV1SettingsAudioParams": ".requests", - "AgentV1SettingsFlags": ".types", - "AgentV1SettingsFlagsParams": ".requests", - "AgentV1SettingsParams": ".requests", - "AgentV1SpeakUpdated": ".types", - "AgentV1SpeakUpdatedParams": ".requests", - "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", - "AgentV1HistoryContent": ".types", - "AgentV1HistoryContentParams": ".requests", - "AgentV1HistoryContentRole": ".types", - "AgentV1HistoryFunctionCalls": ".types", - "AgentV1HistoryFunctionCallsFunctionCallsItem": ".types", - "AgentV1HistoryFunctionCallsFunctionCallsItemParams": ".requests", - "AgentV1HistoryFunctionCallsParams": ".requests", - "AgentV1SettingsAgentContextContextMessagesItemContentRole": ".types", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem": ".types", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams": ".requests", - "AgentV1SettingsAgentContextListenProviderV1": ".types", - "AgentV1SettingsAgentContextListenProviderV1Params": ".requests", - "AgentV1SettingsAgentContextListenProviderV2": ".types", - "AgentV1SettingsAgentContextListenProviderV2LanguageHint": ".types", - "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams": ".requests", - "AgentV1SettingsAgentContextListenProviderV2Params": ".requests", - "AgentV1SettingsAgentContextMessagesItem": ".types", - "AgentV1SettingsAgentContextMessagesItemContent": ".types", - "AgentV1SettingsAgentContextMessagesItemContentParams": ".requests", - "AgentV1SettingsAgentContextMessagesItemContentRole": ".types", - "AgentV1SettingsAgentContextMessagesItemFunctionCalls": ".types", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem": ".types", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams": ".requests", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams": ".requests", - "AgentV1SettingsAgentContextMessagesItemParams": ".requests", - "AgentV1SettingsAgentListenProviderV1": ".types", - "AgentV1SettingsAgentListenProviderV1Params": ".requests", - "AgentV1SettingsAgentListenProviderV2": ".types", - "AgentV1SettingsAgentListenProviderV2Params": ".requests", -} - - -def __getattr__(attr_name: str) -> typing.Any: - module_name = _dynamic_imports.get(attr_name) - if module_name is None: - raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") - try: - module = import_module(module_name, __package__) - if module_name == f".{attr_name}": - return module - else: - return getattr(module, attr_name) - except ImportError as e: - raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e - except AttributeError as e: - raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e - - -def __dir__(): - lazy_attrs = list(_dynamic_imports.keys()) - return sorted(lazy_attrs) - - -__all__ = [ - "AgentV1AgentAudioDone", - "AgentV1AgentAudioDoneParams", - "AgentV1AgentStartedSpeaking", - "AgentV1AgentStartedSpeakingParams", - "AgentV1AgentThinking", - "AgentV1AgentThinkingParams", - "AgentV1ConversationText", - "AgentV1ConversationTextParams", - "AgentV1ConversationTextRole", - "AgentV1Error", - "AgentV1ErrorParams", - "AgentV1ForceEndTurn", - "AgentV1ForceEndTurnParams", - "AgentV1FunctionCallCancelled", - "AgentV1FunctionCallCancelledFunctionsItem", - "AgentV1FunctionCallCancelledFunctionsItemParams", - "AgentV1FunctionCallCancelledParams", - "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", - "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/requests/__init__.py b/src/deepgram/agent/v1/requests/__init__.py index d8b280c0..82a9b0c0 100644 --- a/src/deepgram/agent/v1/requests/__init__.py +++ b/src/deepgram/agent/v1/requests/__init__.py @@ -74,6 +74,8 @@ 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 _dynamic_imports: typing.Dict[str, str] = { "AgentV1AgentAudioDoneParams": ".agent_v1agent_audio_done", "AgentV1AgentStartedSpeakingParams": ".agent_v1agent_started_speaking", @@ -135,6 +137,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", } @@ -220,4 +235,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 16e50f9d..00000000 --- a/src/deepgram/agent/v1/requests/__init__.py.bak +++ /dev/null @@ -1,262 +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_v1force_end_turn import AgentV1ForceEndTurnParams - from .agent_v1function_call_cancelled import AgentV1FunctionCallCancelledParams - from .agent_v1function_call_cancelled_functions_item import AgentV1FunctionCallCancelledFunctionsItemParams - from .agent_v1function_call_request import AgentV1FunctionCallRequestParams - from .agent_v1function_call_request_functions_item import AgentV1FunctionCallRequestFunctionsItemParams - from .agent_v1history import AgentV1HistoryParams - from .agent_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 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", - "AgentV1AgentThinkingParams": ".agent_v1agent_thinking", - "AgentV1ConversationTextParams": ".agent_v1conversation_text", - "AgentV1ErrorParams": ".agent_v1error", - "AgentV1ForceEndTurnParams": ".agent_v1force_end_turn", - "AgentV1FunctionCallCancelledFunctionsItemParams": ".agent_v1function_call_cancelled_functions_item", - "AgentV1FunctionCallCancelledParams": ".agent_v1function_call_cancelled", - "AgentV1FunctionCallRequestFunctionsItemParams": ".agent_v1function_call_request_functions_item", - "AgentV1FunctionCallRequestParams": ".agent_v1function_call_request", - "AgentV1HistoryParams": ".agent_v1history", - "AgentV1InjectAgentMessageParams": ".agent_v1inject_agent_message", - "AgentV1InjectUserMessageParams": ".agent_v1inject_user_message", - "AgentV1InjectionRefusedParams": ".agent_v1injection_refused", - "AgentV1KeepAliveParams": ".agent_v1keep_alive", - "AgentV1LatencyReportParams": ".agent_v1latency_report", - "AgentV1ListenUpdatedParams": ".agent_v1listen_updated", - "AgentV1PromptUpdatedParams": ".agent_v1prompt_updated", - "AgentV1ReceiveFunctionCallResponseParams": ".agent_v1receive_function_call_response", - "AgentV1SendFunctionCallResponseParams": ".agent_v1send_function_call_response", - "AgentV1SettingsAgentContextContextMessagesItemParams": ".agent_v1settings_agent_context_context_messages_item", - "AgentV1SettingsAgentContextContextParams": ".agent_v1settings_agent_context_context", - "AgentV1SettingsAgentContextListenParams": ".agent_v1settings_agent_context_listen", - "AgentV1SettingsAgentContextListenProviderParams": ".agent_v1settings_agent_context_listen_provider", - "AgentV1SettingsAgentContextListenProvider_V1Params": ".agent_v1settings_agent_context_listen_provider", - "AgentV1SettingsAgentContextListenProvider_V2Params": ".agent_v1settings_agent_context_listen_provider", - "AgentV1SettingsAgentContextParams": ".agent_v1settings_agent_context", - "AgentV1SettingsAgentContextSpeakParams": ".agent_v1settings_agent_context_speak", - "AgentV1SettingsAgentContextThinkParams": ".agent_v1settings_agent_context_think", - "AgentV1SettingsAgentListenParams": ".agent_v1settings_agent_listen", - "AgentV1SettingsAgentListenProviderParams": ".agent_v1settings_agent_listen_provider", - "AgentV1SettingsAgentListenProvider_V1Params": ".agent_v1settings_agent_listen_provider", - "AgentV1SettingsAgentListenProvider_V2Params": ".agent_v1settings_agent_listen_provider", - "AgentV1SettingsAgentParams": ".agent_v1settings_agent", - "AgentV1SettingsAgentSpeakParams": ".agent_v1settings_agent_speak", - "AgentV1SettingsAgentThinkParams": ".agent_v1settings_agent_think", - "AgentV1SettingsAppliedParams": ".agent_v1settings_applied", - "AgentV1SettingsAudioInputParams": ".agent_v1settings_audio_input", - "AgentV1SettingsAudioOutputParams": ".agent_v1settings_audio_output", - "AgentV1SettingsAudioParams": ".agent_v1settings_audio", - "AgentV1SettingsFlagsParams": ".agent_v1settings_flags", - "AgentV1SettingsParams": ".agent_v1settings", - "AgentV1SpeakUpdatedParams": ".agent_v1speak_updated", - "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", - "AgentV1HistoryContentParams": ".agent_v1history_content", - "AgentV1HistoryFunctionCallsParams": ".agent_v1history_function_calls", - "AgentV1HistoryFunctionCallsFunctionCallsItemParams": ".agent_v1history_function_calls_function_calls_item", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams": ".agent_v1settings_agent_context_context_messages_item_function_calls_function_calls_item", - "AgentV1SettingsAgentContextListenProviderV1Params": ".agent_v1settings_agent_context_listen_provider_v1", - "AgentV1SettingsAgentContextListenProviderV2Params": ".agent_v1settings_agent_context_listen_provider_v2", - "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams": ".agent_v1settings_agent_context_listen_provider_v2language_hint", - "AgentV1SettingsAgentContextMessagesItemParams": ".agent_v1settings_agent_context_messages_item", - "AgentV1SettingsAgentContextMessagesItemContentParams": ".agent_v1settings_agent_context_messages_item_content", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams": ".agent_v1settings_agent_context_messages_item_function_calls", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams": ".agent_v1settings_agent_context_messages_item_function_calls_function_calls_item", - "AgentV1SettingsAgentListenProviderV1Params": ".agent_v1settings_agent_listen_provider_v1", - "AgentV1SettingsAgentListenProviderV2Params": ".agent_v1settings_agent_listen_provider_v2", -} - - -def __getattr__(attr_name: str) -> typing.Any: - module_name = _dynamic_imports.get(attr_name) - if module_name is None: - raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") - try: - module = import_module(module_name, __package__) - if module_name == f".{attr_name}": - return module - else: - return getattr(module, attr_name) - except ImportError as e: - raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e - except AttributeError as e: - raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e - - -def __dir__(): - lazy_attrs = list(_dynamic_imports.keys()) - return sorted(lazy_attrs) - - -__all__ = [ - "AgentV1AgentAudioDoneParams", - "AgentV1AgentStartedSpeakingParams", - "AgentV1AgentThinkingParams", - "AgentV1ConversationTextParams", - "AgentV1ErrorParams", - "AgentV1ForceEndTurnParams", - "AgentV1FunctionCallCancelledFunctionsItemParams", - "AgentV1FunctionCallCancelledParams", - "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", - "AgentV1HistoryContentParams", - "AgentV1HistoryFunctionCallsParams", - "AgentV1HistoryFunctionCallsFunctionCallsItemParams", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItemParams", - "AgentV1SettingsAgentContextListenProviderV1Params", - "AgentV1SettingsAgentContextListenProviderV2Params", - "AgentV1SettingsAgentContextListenProviderV2LanguageHintParams", - "AgentV1SettingsAgentContextMessagesItemParams", - "AgentV1SettingsAgentContextMessagesItemContentParams", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams", - "AgentV1SettingsAgentListenProviderV1Params", - "AgentV1SettingsAgentListenProviderV2Params", -] 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..466b5eea 100644 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent.py +++ b/src/deepgram/agent/v1/requests/agent_v1settings_agent.py @@ -1,7 +1,16 @@ # 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 + -AgentV1SettingsAgentParams = typing.Union[AgentV1SettingsAgentContextParams, str] +class AgentV1SettingsAgentParams(typing_extensions.TypedDict): + language: typing_extensions.NotRequired[str] + context: typing_extensions.NotRequired[AgentV1SettingsAgentContextParams] + listen: typing_extensions.NotRequired[AgentV1SettingsAgentListenParams] + think: typing_extensions.NotRequired[AgentV1SettingsAgentThinkParams] + speak: typing_extensions.NotRequired[AgentV1SettingsAgentSpeakParams] + greeting: typing_extensions.NotRequired[str] diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent.py.bak b/src/deepgram/agent/v1/requests/agent_v1settings_agent.py.bak deleted file mode 100644 index 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..758c68d4 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,8 @@ class AgentV1SettingsAgentContextParams(typing_extensions.TypedDict): Deprecated. Use `listen.provider.language` and `speak.provider.language` fields instead. """ + messages: typing_extensions.NotRequired[typing.Sequence[AgentV1SettingsAgentContextMessagesItemParams]] + context: typing_extensions.NotRequired[AgentV1SettingsAgentContextContextParams] """ Conversation context including the history of messages and function calls diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py.bak b/src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py.bak deleted file mode 100644 index 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 20d1c3b2..362544f8 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 @@ -112,7 +110,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) @@ -166,12 +164,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: """ @@ -180,12 +178,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: """ @@ -220,7 +218,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): @@ -266,7 +264,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) @@ -320,12 +318,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: """ @@ -334,12 +332,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: """ @@ -374,4 +372,12 @@ 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())) +def _sanitize_numeric_types(obj: typing.Any) -> typing.Any: + 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 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 98076e89..00000000 --- a/src/deepgram/agent/v1/socket_client.py.bak +++ /dev/null @@ -1,386 +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_v1force_end_turn import AgentV1ForceEndTurn -from .types.agent_v1function_call_cancelled import AgentV1FunctionCallCancelled -from .types.agent_v1function_call_request import AgentV1FunctionCallRequest -from .types.agent_v1history import AgentV1History -from .types.agent_v1inject_agent_message import AgentV1InjectAgentMessage -from .types.agent_v1inject_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: - """Convert whole-number floats to integers for wire-compatible JSON. See: internal-api-specs/issues/205.""" - if isinstance(obj, dict): - return {key: _sanitize_numeric_types(value) for key, value in obj.items()} - if isinstance(obj, list): - return [_sanitize_numeric_types(item) for item in obj] - if isinstance(obj, float) and obj.is_integer(): - return int(obj) - return obj - -_logger = logging.getLogger(__name__) -V1SocketClientResponse = typing.Union[ - AgentV1ListenUpdated, - AgentV1ThinkUpdated, - AgentV1ReceiveFunctionCallResponse, - AgentV1PromptUpdated, - AgentV1SpeakUpdated, - AgentV1InjectionRefused, - AgentV1Welcome, - AgentV1SettingsApplied, - AgentV1ConversationText, - AgentV1UserStartedSpeaking, - AgentV1AgentThinking, - AgentV1LatencyReport, - AgentV1FunctionCallRequest, - AgentV1FunctionCallCancelled, - 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_force_end_turn(self, message: typing.Optional[AgentV1ForceEndTurn] = None) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a AgentV1ForceEndTurn. - """ - await self._send_model(message or AgentV1ForceEndTurn(type="ForceEndTurn")) - - async def send_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_force_end_turn(self, message: typing.Optional[AgentV1ForceEndTurn] = None) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a AgentV1ForceEndTurn. - """ - self._send_model(message or AgentV1ForceEndTurn(type="ForceEndTurn")) - - def send_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 756308da..0bc34044 100644 --- a/src/deepgram/agent/v1/types/__init__.py +++ b/src/deepgram/agent/v1/types/__init__.py @@ -145,6 +145,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", } @@ -236,4 +252,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 d33043f2..00000000 --- a/src/deepgram/agent/v1/types/__init__.py.bak +++ /dev/null @@ -1,287 +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_v1force_end_turn import AgentV1ForceEndTurn - from .agent_v1function_call_cancelled import AgentV1FunctionCallCancelled - from .agent_v1function_call_cancelled_functions_item import AgentV1FunctionCallCancelledFunctionsItem - from .agent_v1function_call_request import AgentV1FunctionCallRequest - from .agent_v1function_call_request_functions_item import AgentV1FunctionCallRequestFunctionsItem - from .agent_v1history import AgentV1History - from .agent_v1inject_agent_message import AgentV1InjectAgentMessage - from .agent_v1inject_agent_message_behavior import AgentV1InjectAgentMessageBehavior - from .agent_v1inject_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", - "AgentV1ForceEndTurn": ".agent_v1force_end_turn", - "AgentV1FunctionCallCancelled": ".agent_v1function_call_cancelled", - "AgentV1FunctionCallCancelledFunctionsItem": ".agent_v1function_call_cancelled_functions_item", - "AgentV1FunctionCallRequest": ".agent_v1function_call_request", - "AgentV1FunctionCallRequestFunctionsItem": ".agent_v1function_call_request_functions_item", - "AgentV1History": ".agent_v1history", - "AgentV1InjectAgentMessage": ".agent_v1inject_agent_message", - "AgentV1InjectAgentMessageBehavior": ".agent_v1inject_agent_message_behavior", - "AgentV1InjectUserMessage": ".agent_v1inject_user_message", - "AgentV1InjectionRefused": ".agent_v1injection_refused", - "AgentV1KeepAlive": ".agent_v1keep_alive", - "AgentV1LatencyReport": ".agent_v1latency_report", - "AgentV1ListenUpdated": ".agent_v1listen_updated", - "AgentV1PromptUpdated": ".agent_v1prompt_updated", - "AgentV1ReceiveFunctionCallResponse": ".agent_v1receive_function_call_response", - "AgentV1SendFunctionCallResponse": ".agent_v1send_function_call_response", - "AgentV1Settings": ".agent_v1settings", - "AgentV1SettingsAgent": ".agent_v1settings_agent", - "AgentV1SettingsAgentContext": ".agent_v1settings_agent_context", - "AgentV1SettingsAgentContextContext": ".agent_v1settings_agent_context_context", - "AgentV1SettingsAgentContextContextMessagesItem": ".agent_v1settings_agent_context_context_messages_item", - "AgentV1SettingsAgentContextListen": ".agent_v1settings_agent_context_listen", - "AgentV1SettingsAgentContextListenProvider": ".agent_v1settings_agent_context_listen_provider", - "AgentV1SettingsAgentContextListenProvider_V1": ".agent_v1settings_agent_context_listen_provider", - "AgentV1SettingsAgentContextListenProvider_V2": ".agent_v1settings_agent_context_listen_provider", - "AgentV1SettingsAgentContextSpeak": ".agent_v1settings_agent_context_speak", - "AgentV1SettingsAgentContextThink": ".agent_v1settings_agent_context_think", - "AgentV1SettingsAgentListen": ".agent_v1settings_agent_listen", - "AgentV1SettingsAgentListenProvider": ".agent_v1settings_agent_listen_provider", - "AgentV1SettingsAgentListenProvider_V1": ".agent_v1settings_agent_listen_provider", - "AgentV1SettingsAgentListenProvider_V2": ".agent_v1settings_agent_listen_provider", - "AgentV1SettingsAgentSpeak": ".agent_v1settings_agent_speak", - "AgentV1SettingsAgentThink": ".agent_v1settings_agent_think", - "AgentV1SettingsApplied": ".agent_v1settings_applied", - "AgentV1SettingsAudio": ".agent_v1settings_audio", - "AgentV1SettingsAudioInput": ".agent_v1settings_audio_input", - "AgentV1SettingsAudioInputEncoding": ".agent_v1settings_audio_input_encoding", - "AgentV1SettingsAudioOutput": ".agent_v1settings_audio_output", - "AgentV1SettingsAudioOutputContainer": ".agent_v1settings_audio_output_container", - "AgentV1SettingsAudioOutputEncoding": ".agent_v1settings_audio_output_encoding", - "AgentV1SettingsFlags": ".agent_v1settings_flags", - "AgentV1SpeakUpdated": ".agent_v1speak_updated", - "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", - "AgentV1HistoryContent": ".agent_v1history_content", - "AgentV1HistoryContentRole": ".agent_v1history_content_role", - "AgentV1HistoryFunctionCalls": ".agent_v1history_function_calls", - "AgentV1HistoryFunctionCallsFunctionCallsItem": ".agent_v1history_function_calls_function_calls_item", - "AgentV1SettingsAgentContextContextMessagesItemContentRole": ".agent_v1settings_agent_context_context_messages_item_content_role", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem": ".agent_v1settings_agent_context_context_messages_item_function_calls_function_calls_item", - "AgentV1SettingsAgentContextListenProviderV1": ".agent_v1settings_agent_context_listen_provider_v1", - "AgentV1SettingsAgentContextListenProviderV2": ".agent_v1settings_agent_context_listen_provider_v2", - "AgentV1SettingsAgentContextListenProviderV2LanguageHint": ".agent_v1settings_agent_context_listen_provider_v2language_hint", - "AgentV1SettingsAgentContextMessagesItem": ".agent_v1settings_agent_context_messages_item", - "AgentV1SettingsAgentContextMessagesItemContent": ".agent_v1settings_agent_context_messages_item_content", - "AgentV1SettingsAgentContextMessagesItemContentRole": ".agent_v1settings_agent_context_messages_item_content_role", - "AgentV1SettingsAgentContextMessagesItemFunctionCalls": ".agent_v1settings_agent_context_messages_item_function_calls", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem": ".agent_v1settings_agent_context_messages_item_function_calls_function_calls_item", - "AgentV1SettingsAgentListenProviderV1": ".agent_v1settings_agent_listen_provider_v1", - "AgentV1SettingsAgentListenProviderV2": ".agent_v1settings_agent_listen_provider_v2", -} - - -def __getattr__(attr_name: str) -> typing.Any: - module_name = _dynamic_imports.get(attr_name) - if module_name is None: - raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") - try: - module = import_module(module_name, __package__) - if module_name == f".{attr_name}": - return module - else: - return getattr(module, attr_name) - except ImportError as e: - raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e - except AttributeError as e: - raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e - - -def __dir__(): - lazy_attrs = list(_dynamic_imports.keys()) - return sorted(lazy_attrs) - - -__all__ = [ - "AgentV1AgentAudioDone", - "AgentV1AgentStartedSpeaking", - "AgentV1AgentThinking", - "AgentV1ConversationText", - "AgentV1ConversationTextRole", - "AgentV1Error", - "AgentV1ForceEndTurn", - "AgentV1FunctionCallCancelled", - "AgentV1FunctionCallCancelledFunctionsItem", - "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", - "AgentV1HistoryContent", - "AgentV1HistoryContentRole", - "AgentV1HistoryFunctionCalls", - "AgentV1HistoryFunctionCallsFunctionCallsItem", - "AgentV1SettingsAgentContextContextMessagesItemContentRole", - "AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem", - "AgentV1SettingsAgentContextListenProviderV1", - "AgentV1SettingsAgentContextListenProviderV2", - "AgentV1SettingsAgentContextListenProviderV2LanguageHint", - "AgentV1SettingsAgentContextMessagesItem", - "AgentV1SettingsAgentContextMessagesItemContent", - "AgentV1SettingsAgentContextMessagesItemContentRole", - "AgentV1SettingsAgentContextMessagesItemFunctionCalls", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem", - "AgentV1SettingsAgentListenProviderV1", - "AgentV1SettingsAgentListenProviderV2", -] diff --git a/src/deepgram/agent/v1/types/agent_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..0af41979 100644 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent.py +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent.py @@ -2,6 +2,55 @@ import typing +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 from .agent_v1settings_agent_context import AgentV1SettingsAgentContext +from .agent_v1settings_agent_listen import AgentV1SettingsAgentListen -AgentV1SettingsAgent = typing.Union[AgentV1SettingsAgentContext, str] + +class AgentV1SettingsAgent(AgentV1SettingsAgentContext): + if IS_PYDANTIC_V2: + + @pydantic.model_validator(mode="before") + @classmethod + def _migrate_legacy_nested_context(cls, values: typing.Any) -> typing.Any: + if not isinstance(values, dict): + return values + context = values.get("context") + if isinstance(context, AgentV1SettingsAgentContext) and ( + context.context is not None + and context.language is None + and context.listen is None + and context.think is None + and context.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 fae21e75..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent.py.bak +++ /dev/null @@ -1,62 +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): - # 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_context.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_context.py index fcbea2f3..88b48695 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,28 @@ class AgentV1SettingsAgentContext(UncheckedBaseModel): Optional message that agent will speak at the start """ + if IS_PYDANTIC_V2: + + @pydantic.model_validator(mode="before") + @classmethod + def _migrate_legacy_messages_to_context(cls, values: typing.Any) -> typing.Any: + if isinstance(values, dict) and "messages" in values and "context" not in values: + values = dict(values) + values["context"] = {"messages": values.pop("messages")} + return values + 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 827aad63..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_context.py.bak +++ /dev/null @@ -1,65 +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 - """ - - # 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: - - 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..222c18a3 100644 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py @@ -33,15 +33,38 @@ class AgentV1SettingsAgentContextListenProvider_V2(UncheckedBaseModel): type: typing.Literal["deepgram"] = "deepgram" model: str language_hints: typing.Optional[typing.List[str]] = None + language_hint: typing.Optional[typing.Union[str, typing.List[str]]] = pydantic.Field(default=None, exclude=True) eot_threshold: typing.Optional[float] = None eager_eot_threshold: typing.Optional[float] = None eot_timeout_ms: typing.Optional[int] = None keyterms: typing.Optional[typing.List[str]] = None if IS_PYDANTIC_V2: + + @pydantic.model_validator(mode="before") + @classmethod + def _migrate_language_hint(cls, values: typing.Any) -> typing.Any: + if not isinstance(values, dict) or "language_hint" not in values: + return values + values = dict(values) + hint = values.pop("language_hint") + if hint is not None and values.get("language_hints") is None: + values["language_hints"] = [hint] if isinstance(hint, str) else list(hint) + return values + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: + @pydantic.root_validator(pre=True) # type: ignore[deprecated] + def _migrate_language_hint(cls, values: typing.Any) -> typing.Any: # type: ignore[no-redef] + if not isinstance(values, dict) or "language_hint" not in values: + return values + values = dict(values) + hint = values.pop("language_hint") + if hint is not None and values.get("language_hints") is None: + values["language_hints"] = [hint] if isinstance(hint, str) else list(hint) + return values + class Config: frozen = True smart_union = True diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py.bak b/src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py.bak deleted file mode 100644 index 222c18a3..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py.bak +++ /dev/null @@ -1,77 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from __future__ import annotations - -import typing - -import pydantic -import typing_extensions -from ....core.pydantic_utilities import IS_PYDANTIC_V2 -from ....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata - - -class AgentV1SettingsAgentContextListenProvider_V1(UncheckedBaseModel): - version: typing.Literal["v1"] = "v1" - type: typing.Literal["deepgram"] = "deepgram" - model: typing.Optional[str] = None - language: typing.Optional[str] = None - keyterms: typing.Optional[typing.List[str]] = None - smart_format: typing.Optional[bool] = None - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -class AgentV1SettingsAgentContextListenProvider_V2(UncheckedBaseModel): - version: typing.Literal["v2"] = "v2" - type: typing.Literal["deepgram"] = "deepgram" - model: str - language_hints: typing.Optional[typing.List[str]] = None - language_hint: typing.Optional[typing.Union[str, typing.List[str]]] = pydantic.Field(default=None, exclude=True) - eot_threshold: typing.Optional[float] = None - eager_eot_threshold: typing.Optional[float] = None - eot_timeout_ms: typing.Optional[int] = None - keyterms: typing.Optional[typing.List[str]] = None - - if IS_PYDANTIC_V2: - - @pydantic.model_validator(mode="before") - @classmethod - def _migrate_language_hint(cls, values: typing.Any) -> typing.Any: - if not isinstance(values, dict) or "language_hint" not in values: - return values - values = dict(values) - hint = values.pop("language_hint") - if hint is not None and values.get("language_hints") is None: - values["language_hints"] = [hint] if isinstance(hint, str) else list(hint) - return values - - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - @pydantic.root_validator(pre=True) # type: ignore[deprecated] - def _migrate_language_hint(cls, values: typing.Any) -> typing.Any: # type: ignore[no-redef] - if not isinstance(values, dict) or "language_hint" not in values: - return values - values = dict(values) - hint = values.pop("language_hint") - if hint is not None and values.get("language_hints") is None: - values["language_hints"] = [hint] if isinstance(hint, str) else list(hint) - return values - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -AgentV1SettingsAgentContextListenProvider = typing_extensions.Annotated[ - typing.Union[AgentV1SettingsAgentContextListenProvider_V1, AgentV1SettingsAgentContextListenProvider_V2], - UnionMetadata(discriminant="version"), -] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py index d053b2b9..d225e261 100644 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py +++ b/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py @@ -33,15 +33,38 @@ class AgentV1SettingsAgentListenProvider_V2(UncheckedBaseModel): type: typing.Literal["deepgram"] = "deepgram" model: str language_hints: typing.Optional[typing.List[str]] = None + language_hint: typing.Optional[typing.Union[str, typing.List[str]]] = pydantic.Field(default=None, exclude=True) eot_threshold: typing.Optional[float] = None eager_eot_threshold: typing.Optional[float] = None eot_timeout_ms: typing.Optional[int] = None keyterms: typing.Optional[typing.List[str]] = None if IS_PYDANTIC_V2: + + @pydantic.model_validator(mode="before") + @classmethod + def _migrate_language_hint(cls, values: typing.Any) -> typing.Any: + if not isinstance(values, dict) or "language_hint" not in values: + return values + values = dict(values) + hint = values.pop("language_hint") + if hint is not None and values.get("language_hints") is None: + values["language_hints"] = [hint] if isinstance(hint, str) else list(hint) + return values + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: + @pydantic.root_validator(pre=True) # type: ignore[deprecated] + def _migrate_language_hint(cls, values: typing.Any) -> typing.Any: # type: ignore[no-redef] + if not isinstance(values, dict) or "language_hint" not in values: + return values + values = dict(values) + hint = values.pop("language_hint") + if hint is not None and values.get("language_hints") is None: + values["language_hints"] = [hint] if isinstance(hint, str) else list(hint) + return values + class Config: frozen = True smart_union = True diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py.bak b/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py.bak deleted file mode 100644 index d225e261..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py.bak +++ /dev/null @@ -1,77 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from __future__ import annotations - -import typing - -import pydantic -import typing_extensions -from ....core.pydantic_utilities import IS_PYDANTIC_V2 -from ....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata - - -class AgentV1SettingsAgentListenProvider_V1(UncheckedBaseModel): - version: typing.Literal["v1"] = "v1" - type: typing.Literal["deepgram"] = "deepgram" - model: typing.Optional[str] = None - language: typing.Optional[str] = None - keyterms: typing.Optional[typing.List[str]] = None - smart_format: typing.Optional[bool] = None - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -class AgentV1SettingsAgentListenProvider_V2(UncheckedBaseModel): - version: typing.Literal["v2"] = "v2" - type: typing.Literal["deepgram"] = "deepgram" - model: str - language_hints: typing.Optional[typing.List[str]] = None - language_hint: typing.Optional[typing.Union[str, typing.List[str]]] = pydantic.Field(default=None, exclude=True) - eot_threshold: typing.Optional[float] = None - eager_eot_threshold: typing.Optional[float] = None - eot_timeout_ms: typing.Optional[int] = None - keyterms: typing.Optional[typing.List[str]] = None - - if IS_PYDANTIC_V2: - - @pydantic.model_validator(mode="before") - @classmethod - def _migrate_language_hint(cls, values: typing.Any) -> typing.Any: - if not isinstance(values, dict) or "language_hint" not in values: - return values - values = dict(values) - hint = values.pop("language_hint") - if hint is not None and values.get("language_hints") is None: - values["language_hints"] = [hint] if isinstance(hint, str) else list(hint) - return values - - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - @pydantic.root_validator(pre=True) # type: ignore[deprecated] - def _migrate_language_hint(cls, values: typing.Any) -> typing.Any: # type: ignore[no-redef] - if not isinstance(values, dict) or "language_hint" not in values: - return values - values = dict(values) - hint = values.pop("language_hint") - if hint is not None and values.get("language_hints") is None: - values["language_hints"] = [hint] if isinstance(hint, str) else list(hint) - return values - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -AgentV1SettingsAgentListenProvider = typing_extensions.Annotated[ - typing.Union[AgentV1SettingsAgentListenProvider_V1, AgentV1SettingsAgentListenProvider_V2], - UnionMetadata(discriminant="version"), -] diff --git a/src/deepgram/agent/v1/types/agent_v1update_listen_listen.py b/src/deepgram/agent/v1/types/agent_v1update_listen_listen.py index f345904c..d7ed4fab 100644 --- a/src/deepgram/agent/v1/types/agent_v1update_listen_listen.py +++ b/src/deepgram/agent/v1/types/agent_v1update_listen_listen.py @@ -5,8 +5,34 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 from ....core.unchecked_base_model import UncheckedBaseModel +from ....types.deepgram_listen_provider_v1 import DeepgramListenProviderV1 +from ....types.deepgram_listen_provider_v2 import DeepgramListenProviderV2 from .agent_v1update_listen_listen_provider import AgentV1UpdateListenListenProvider +_V1_ONLY_KEYS = frozenset({"language", "smart_format"}) + + +def _coerce_legacy_update_listen_provider(values: typing.Any) -> typing.Any: + if not isinstance(values, dict): + return values + provider = values.get("provider") + if isinstance(provider, DeepgramListenProviderV2): + values = dict(values) + values["provider"] = {**provider.dict(), "version": "v2"} + elif isinstance(provider, DeepgramListenProviderV1): + values = dict(values) + values["provider"] = {**provider.dict(), "version": "v1"} + elif isinstance(provider, dict) and "version" not in provider: + values = dict(values) + version = "v1" if _V1_ONLY_KEYS & provider.keys() else "v2" + provider_cls = DeepgramListenProviderV1 if version == "v1" else DeepgramListenProviderV2 + try: + coerced = provider_cls(**provider).dict() + except Exception: + coerced = dict(provider) + values["provider"] = {**coerced, "version": version} + return values + class AgentV1UpdateListenListen(UncheckedBaseModel): """ @@ -16,9 +42,19 @@ class AgentV1UpdateListenListen(UncheckedBaseModel): provider: AgentV1UpdateListenListenProvider if IS_PYDANTIC_V2: + + @pydantic.model_validator(mode="before") + @classmethod + def _migrate_legacy_provider(cls, values: typing.Any) -> typing.Any: + return _coerce_legacy_update_listen_provider(values) + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: + @pydantic.root_validator(pre=True) # type: ignore[deprecated] + def _migrate_legacy_provider(cls, values: typing.Any) -> typing.Any: # type: ignore[no-redef] + return _coerce_legacy_update_listen_provider(values) + class Config: frozen = True smart_union = True diff --git a/src/deepgram/agent/v1/types/agent_v1update_listen_listen.py.bak b/src/deepgram/agent/v1/types/agent_v1update_listen_listen.py.bak deleted file mode 100644 index 57f0751a..00000000 --- a/src/deepgram/agent/v1/types/agent_v1update_listen_listen.py.bak +++ /dev/null @@ -1,62 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2 -from ....core.unchecked_base_model import UncheckedBaseModel -from ....types.deepgram_listen_provider_v1 import DeepgramListenProviderV1 -from ....types.deepgram_listen_provider_v2 import DeepgramListenProviderV2 -from .agent_v1update_listen_listen_provider import AgentV1UpdateListenListenProvider - -_V1_ONLY_KEYS = frozenset({"language", "smart_format"}) - - -def _coerce_legacy_update_listen_provider(values: typing.Any) -> typing.Any: - """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): - """ - Listen configuration to update. Contains a provider object with the same schema as Settings. The model and language can be changed mid-session. Keyterms can only be updated mid-session for Flux models. - """ - - provider: AgentV1UpdateListenListenProvider - - if IS_PYDANTIC_V2: - - @pydantic.model_validator(mode="before") - @classmethod - def _migrate_legacy_provider(cls, values: typing.Any) -> typing.Any: - return _coerce_legacy_update_listen_provider(values) - - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - @pydantic.root_validator(pre=True) # type: ignore[deprecated] - def _migrate_legacy_provider(cls, values: typing.Any) -> typing.Any: # type: ignore[no-redef] - return _coerce_legacy_update_listen_provider(values) - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/core/api_error.py b/src/deepgram/core/api_error.py index 6f850a60..2aa93914 100644 --- a/src/deepgram/core/api_error.py +++ b/src/deepgram/core/api_error.py @@ -2,6 +2,8 @@ from typing import Any, Dict, Optional +from .._secure_logging import redact_sensitive_headers + class ApiError(Exception): headers: Optional[Dict[str, str]] @@ -15,7 +17,7 @@ def __init__( status_code: Optional[int] = None, body: Any = None, ) -> None: - self.headers = headers + self.headers = redact_sensitive_headers(headers) self.status_code = status_code self.body = body diff --git a/src/deepgram/core/api_error.py.bak b/src/deepgram/core/api_error.py.bak deleted file mode 100644 index 2aa93914..00000000 --- a/src/deepgram/core/api_error.py.bak +++ /dev/null @@ -1,25 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from typing import Any, Dict, Optional - -from .._secure_logging import redact_sensitive_headers - - -class ApiError(Exception): - headers: Optional[Dict[str, str]] - status_code: Optional[int] - body: Any - - def __init__( - self, - *, - headers: Optional[Dict[str, str]] = None, - status_code: Optional[int] = None, - body: Any = None, - ) -> None: - self.headers = redact_sensitive_headers(headers) - self.status_code = status_code - self.body = body - - def __str__(self) -> str: - return f"headers: {self.headers}, status_code: {self.status_code}, body: {self.body}" diff --git a/src/deepgram/core/parse_error.py b/src/deepgram/core/parse_error.py index 4527c6a8..c510c0e8 100644 --- a/src/deepgram/core/parse_error.py +++ b/src/deepgram/core/parse_error.py @@ -2,6 +2,8 @@ from typing import Any, Dict, Optional +from .._secure_logging import redact_sensitive_headers + class ParsingError(Exception): """ @@ -23,7 +25,7 @@ def __init__( body: Any = None, cause: Optional[Exception] = None, ) -> None: - self.headers = headers + self.headers = redact_sensitive_headers(headers) self.status_code = status_code self.body = body self.cause = cause diff --git a/src/deepgram/core/parse_error.py.bak b/src/deepgram/core/parse_error.py.bak deleted file mode 100644 index c510c0e8..00000000 --- a/src/deepgram/core/parse_error.py.bak +++ /dev/null @@ -1,38 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from typing import Any, Dict, Optional - -from .._secure_logging import redact_sensitive_headers - - -class ParsingError(Exception): - """ - Raised when the SDK fails to parse/validate a response from the server. - This typically indicates that the server returned a response whose shape - does not match the expected schema. - """ - - headers: Optional[Dict[str, str]] - status_code: Optional[int] - body: Any - cause: Optional[Exception] - - def __init__( - self, - *, - headers: Optional[Dict[str, str]] = None, - status_code: Optional[int] = None, - body: Any = None, - cause: Optional[Exception] = None, - ) -> None: - self.headers = redact_sensitive_headers(headers) - self.status_code = status_code - self.body = body - self.cause = cause - super().__init__() - if cause is not None: - self.__cause__ = cause - - def __str__(self) -> str: - cause_str = f", cause: {self.cause}" if self.cause is not None else "" - return f"headers: {self.headers}, status_code: {self.status_code}, body: {self.body}{cause_str}" diff --git a/src/deepgram/core/query_encoder.py b/src/deepgram/core/query_encoder.py index 3183001d..3b32eb4b 100644 --- a/src/deepgram/core/query_encoder.py +++ b/src/deepgram/core/query_encoder.py @@ -5,6 +5,12 @@ import pydantic +def _coerce_query_value(value: Any) -> Any: + 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 +23,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 +47,11 @@ def single_query_encoder(query_key: str, query_value: Any) -> List[Tuple[str, An encoded_values.extend(single_query_encoder(query_key, obj_dict)) else: - encoded_values.append((query_key, value)) + encoded_values.append((query_key, _coerce_query_value(value))) return encoded_values - return [(query_key, query_value)] + return [(query_key, _coerce_query_value(query_value))] def encode_query(query: Optional[Dict[str, Any]]) -> Optional[List[Tuple[str, Any]]]: diff --git a/src/deepgram/core/query_encoder.py.bak b/src/deepgram/core/query_encoder.py.bak deleted file mode 100644 index 58088258..00000000 --- a/src/deepgram/core/query_encoder.py.bak +++ /dev/null @@ -1,65 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from typing import Any, Dict, List, Optional, Tuple - -import pydantic - - -def _coerce_query_value(value: Any) -> Any: - # urllib.parse.urlencode would otherwise turn bools into "True"/"False". - if isinstance(value, bool): - return "true" if value else "false" - return value - - -# Flattens dicts to be of the form {"key[subkey][subkey2]": value} where value is not a dict -def traverse_query_dict(dict_flat: Dict[str, Any], key_prefix: Optional[str] = None) -> List[Tuple[str, Any]]: - result = [] - for k, v in dict_flat.items(): - key = f"{key_prefix}[{k}]" if key_prefix is not None else k - if isinstance(v, dict): - result.extend(traverse_query_dict(v, key)) - elif isinstance(v, list): - for arr_v in v: - if isinstance(arr_v, dict): - result.extend(traverse_query_dict(arr_v, key)) - else: - result.append((key, _coerce_query_value(arr_v))) - else: - result.append((key, _coerce_query_value(v))) - return result - - -def single_query_encoder(query_key: str, query_value: Any) -> List[Tuple[str, Any]]: - if isinstance(query_value, pydantic.BaseModel) or isinstance(query_value, dict): - if isinstance(query_value, pydantic.BaseModel): - obj_dict = query_value.dict(by_alias=True) - else: - obj_dict = query_value - return traverse_query_dict(obj_dict, query_key) - elif isinstance(query_value, list): - encoded_values: List[Tuple[str, Any]] = [] - for value in query_value: - if isinstance(value, pydantic.BaseModel) or isinstance(value, dict): - if isinstance(value, pydantic.BaseModel): - obj_dict = value.dict(by_alias=True) - elif isinstance(value, dict): - obj_dict = value - - encoded_values.extend(single_query_encoder(query_key, obj_dict)) - else: - encoded_values.append((query_key, _coerce_query_value(value))) - - return encoded_values - - return [(query_key, _coerce_query_value(query_value))] - - -def encode_query(query: Optional[Dict[str, Any]]) -> Optional[List[Tuple[str, Any]]]: - if query is None: - return None - - encoded_query = [] - for k, v in query.items(): - encoded_query.extend(single_query_encoder(k, v)) - return encoded_query diff --git a/src/deepgram/helpers/text_builder.py b/src/deepgram/helpers/text_builder.py index 384b15eb..b44cdc62 100644 --- a/src/deepgram/helpers/text_builder.py +++ b/src/deepgram/helpers/text_builder.py @@ -12,7 +12,7 @@ class TextBuilder: """ - Fluent builder for constructing TTS text with pronunciation and pause controls. + Fluent builder for Flux TTS batch pronunciation and pause controls. Example: text = TextBuilder() \\ @@ -85,11 +85,12 @@ def pause(self, duration_ms: int) -> "TextBuilder": """ Add a pause in milliseconds. Formats as: {pause:duration_ms} - Valid range: 500-5000ms in 100ms increments. + Valid range: 500-3000ms in 100ms increments. Flux batch accepts at most + eight pauses per request; WebSocket synthesis does not support pauses. Returns self for chaining. Args: - duration_ms: Pause duration in milliseconds (500-5000, increments of 100) + duration_ms: Pause duration in milliseconds (500-3000, increments of 100) Returns: Self for method chaining @@ -103,8 +104,8 @@ def pause(self, duration_ms: int) -> "TextBuilder": raise ValueError(error_msg) # Check pause limit - if self._pause_count >= 50: - raise ValueError("Maximum 50 pauses per request exceeded") + if self._pause_count >= 8: + raise ValueError("Maximum 8 pauses per Flux batch request exceeded") # Format as JSON-style pause marker self._parts.append(f"{{pause:{duration_ms}}}") @@ -273,7 +274,7 @@ def replace_break(match): is_valid, error_msg = validate_pause(duration_ms) if not is_valid: # Round to nearest valid value - duration_ms = max(500, min(5000, round(duration_ms / 100) * 100)) + duration_ms = max(500, min(3000, round(duration_ms / 100) * 100)) return f"{{pause:{duration_ms}}}" @@ -316,7 +317,7 @@ def validate_ipa(ipa: str) -> Tuple[bool, str]: def validate_pause(duration_ms: int) -> Tuple[bool, str]: """ - Validate pause duration (500-5000ms, 100ms increments). + Validate a Flux batch pause duration (500-3000ms, 100ms increments). Args: duration_ms: Pause duration in milliseconds @@ -330,8 +331,8 @@ def validate_pause(duration_ms: int) -> Tuple[bool, str]: if duration_ms < 500: return False, "Pause duration must be at least 500ms" - if duration_ms > 5000: - return False, "Pause duration must not exceed 5000ms" + if duration_ms > 3000: + return False, "Pause duration must not exceed 3000ms" if duration_ms % 100 != 0: return False, "Pause duration must be in 100ms increments" diff --git a/src/deepgram/listen/__init__.py b/src/deepgram/listen/__init__.py index b3e4e227..b8cda35d 100644 --- a/src/deepgram/listen/__init__.py +++ b/src/deepgram/listen/__init__.py @@ -103,6 +103,7 @@ "ListenV1UtteranceEndParams": ".v1", "ListenV2CloseStream": ".v2", "ListenV2CloseStreamParams": ".v2", + "ListenV2CloseStreamType": ".v2", "ListenV2Configure": ".v2", "ListenV2ConfigureFailure": ".v2", "ListenV2ConfigureFailureParams": ".v2", @@ -187,6 +188,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 8dea11db..6395c90c 100644 --- a/src/deepgram/listen/v2/__init__.py +++ b/src/deepgram/listen/v2/__init__.py @@ -38,6 +38,7 @@ _dynamic_imports: typing.Dict[str, str] = { "ListenV2CloseStream": ".types", "ListenV2CloseStreamParams": ".requests", + "ListenV2CloseStreamType": ".types", "ListenV2Configure": ".types", "ListenV2ConfigureFailure": ".types", "ListenV2ConfigureFailureParams": ".requests", @@ -88,6 +89,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 d1b20890..9e3ed469 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 @@ -78,7 +76,7 @@ async def start_listening(self): ) continue await self._emit_async(EventType.MESSAGE, parsed) - except (websockets.WebSocketException, JSONDecodeError) as exc: + except Exception as exc: await self._emit_async(EventType.ERROR, exc) finally: await self._emit_async(EventType.CLOSE, None) @@ -90,26 +88,29 @@ async def send_media(self, message: bytes) -> None: """ await self._send(message) - async def send_close_stream(self, message: ListenV2CloseStream) -> None: + async def send_close_stream(self, message: typing.Optional[ListenV2CloseStream] = None) -> None: """ Send a message to the websocket connection. The message will be sent as a ListenV2CloseStream. """ - await self._send_model(message) + await self._send_model(message or ListenV2CloseStream(type="CloseStream")) - async def send_force_end_turn(self, message: ListenV2ForceEndTurn) -> None: + async def send_force_end_turn(self, message: typing.Optional[ListenV2ForceEndTurn] = None) -> None: """ Send a message to the websocket connection. The message will be sent as a ListenV2ForceEndTurn. """ - await self._send_model(message) + await self._send_model(message or ListenV2ForceEndTurn(type="ForceEndTurn")) - async def send_configure(self, message: ListenV2Configure) -> None: + async def send_configure(self, message: typing.Union[ListenV2Configure, typing.Dict[str, typing.Any]]) -> None: """ Send a message to the websocket connection. The message will be sent as a ListenV2Configure. """ - await self._send_model(message) + if isinstance(message, dict): + await self._send(message) + else: + await self._send_model(message) async def recv(self) -> V2SocketClientResponse: """ @@ -183,7 +184,7 @@ def start_listening(self): ) continue self._emit(EventType.MESSAGE, parsed) - except (websockets.WebSocketException, JSONDecodeError) as exc: + except Exception as exc: self._emit(EventType.ERROR, exc) finally: self._emit(EventType.CLOSE, None) @@ -195,26 +196,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 e4e09468..00000000 --- a/src/deepgram/listen/v2/socket_client.py.bak +++ /dev/null @@ -1,247 +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. - This requires server-side enablement. On deployments without the feature, the server returns - UNPARSABLE_CLIENT_MESSAGE and closes the connection. - """ - await self._send_model(message or ListenV2ForceEndTurn(type="ForceEndTurn")) - - async def send_configure(self, message: typing.Union[ListenV2Configure, typing.Dict[str, typing.Any]]) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a ListenV2Configure. - """ - if isinstance(message, dict): - await self._send(message) - else: - await self._send_model(message) - - async def recv(self) -> V2SocketClientResponse: - """ - Receive a message from the websocket connection. - """ - data = await self._websocket.recv() - if isinstance(data, bytes): - return data # type: ignore - json_data = json.loads(data) - try: - return construct_type(type_=V2SocketClientResponse, object_=json_data) # type: ignore - except Exception: - _logger.warning("Skipping unknown WebSocket message; update your SDK version to support new message types.") - return json_data # type: ignore - - async def _send(self, data: typing.Any) -> None: - """ - Send a message to the websocket connection. - """ - if isinstance(data, dict): - data = json.dumps(data) - await self._websocket.send(data) - - async def _send_model(self, data: typing.Any) -> None: - """ - Send a Pydantic model to the websocket connection. - """ - await self._send(data.dict()) - - -class V2SocketClient(EventEmitterMixin): - def __init__(self, *, websocket: websockets_sync_connection.Connection): - super().__init__() - self._websocket = websocket - - def __iter__(self): - 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. - This requires server-side enablement. On deployments without the feature, the server returns - UNPARSABLE_CLIENT_MESSAGE and closes the connection. - """ - self._send_model(message or ListenV2ForceEndTurn(type="ForceEndTurn")) - - def send_configure(self, message: typing.Union[ListenV2Configure, typing.Dict[str, typing.Any]]) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a ListenV2Configure. - """ - if isinstance(message, dict): - self._send(message) - else: - self._send_model(message) - - def recv(self) -> V2SocketClientResponse: - """ - Receive a message from the websocket connection. - """ - data = self._websocket.recv() - if isinstance(data, bytes): - return data # type: ignore - json_data = json.loads(data) - try: - return construct_type(type_=V2SocketClientResponse, object_=json_data) # type: ignore - except Exception: - _logger.warning("Skipping unknown WebSocket message; update your SDK version to support new message types.") - return json_data # type: ignore - - def _send(self, data: typing.Any) -> None: - """ - Send a message to the websocket connection. - """ - if isinstance(data, dict): - data = json.dumps(data) - self._websocket.send(data) - - def _send_model(self, data: typing.Any) -> None: - """ - Send a Pydantic model to the websocket connection. - """ - self._send(data.dict()) diff --git a/src/deepgram/listen/v2/types/__init__.py b/src/deepgram/listen/v2/types/__init__.py index 7f4ffc34..e230cb2f 100644 --- a/src/deepgram/listen/v2/types/__init__.py +++ b/src/deepgram/listen/v2/types/__init__.py @@ -21,6 +21,7 @@ from .listen_v2warning import ListenV2Warning _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,6 +60,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 7b3772d6..1daf8af6 100644 --- a/src/deepgram/listen/v2/types/listen_v2configure_failure.py +++ b/src/deepgram/listen/v2/types/listen_v2configure_failure.py @@ -4,10 +4,10 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 -from ....core.unchecked_base_model import UncheckedBaseModel +from ._dict_compat import ListenV2ResponseDictCompatModel -class ListenV2ConfigureFailure(UncheckedBaseModel): +class ListenV2ConfigureFailure(ListenV2ResponseDictCompatModel): type: typing.Literal["ConfigureFailure"] = pydantic.Field(default="ConfigureFailure") """ Message type identifier diff --git a/src/deepgram/listen/v2/types/listen_v2configure_failure.py.bak b/src/deepgram/listen/v2/types/listen_v2configure_failure.py.bak deleted file mode 100644 index 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 38cf07cc..cf7c1c80 100644 --- a/src/deepgram/listen/v2/types/listen_v2configure_success.py +++ b/src/deepgram/listen/v2/types/listen_v2configure_success.py @@ -4,13 +4,13 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 -from ....core.unchecked_base_model import UncheckedBaseModel from ....types.listen_v2configure_numerals import ListenV2ConfigureNumerals from ....types.listen_v2keyterm import ListenV2Keyterm +from ._dict_compat import ListenV2ResponseDictCompatModel from .listen_v2configure_success_thresholds import ListenV2ConfigureSuccessThresholds -class ListenV2ConfigureSuccess(UncheckedBaseModel): +class ListenV2ConfigureSuccess(ListenV2ResponseDictCompatModel): type: typing.Literal["ConfigureSuccess"] = pydantic.Field(default="ConfigureSuccess") """ Message type identifier diff --git a/src/deepgram/listen/v2/types/listen_v2configure_success.py.bak b/src/deepgram/listen/v2/types/listen_v2configure_success.py.bak deleted file mode 100644 index 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/listen/v2/types/listen_v2warning.py b/src/deepgram/listen/v2/types/listen_v2warning.py index c392cd25..19bfe19a 100644 --- a/src/deepgram/listen/v2/types/listen_v2warning.py +++ b/src/deepgram/listen/v2/types/listen_v2warning.py @@ -4,10 +4,10 @@ import pydantic from ....core.pydantic_utilities import IS_PYDANTIC_V2 -from ....core.unchecked_base_model import UncheckedBaseModel +from ._dict_compat import ListenV2ResponseDictCompatModel -class ListenV2Warning(UncheckedBaseModel): +class ListenV2Warning(ListenV2ResponseDictCompatModel): type: typing.Literal["Warning"] = pydantic.Field(default="Warning") """ Message type identifier diff --git a/src/deepgram/requests/__init__.py b/src/deepgram/requests/__init__.py index 6a2285be..3c33e2c0 100644 --- a/src/deepgram/requests/__init__.py +++ b/src/deepgram/requests/__init__.py @@ -339,12 +339,20 @@ "ReadV1ResponseResultsSummaryResultsParams": ".read_v1response_results_summary_results", "ReadV1ResponseResultsSummaryResultsSummaryParams": ".read_v1response_results_summary_results_summary", "SharedIntentsParams": ".shared_intents", + "SharedIntentsResultsParams": ".shared_intents_results", + "SharedIntentsResultsIntentsParams": ".shared_intents_results_intents", + "SharedIntentsResultsIntentsSegmentsItemParams": ".shared_intents_results_intents_segments_item", + "SharedIntentsResultsIntentsSegmentsItemIntentsItemParams": ".shared_intents_results_intents_segments_item_intents_item", "SharedIntentsSegmentsItemIntentsItemParams": ".shared_intents_segments_item_intents_item", "SharedIntentsSegmentsItemParams": ".shared_intents_segments_item", "SharedSentimentsAverageParams": ".shared_sentiments_average", "SharedSentimentsParams": ".shared_sentiments", "SharedSentimentsSegmentsItemParams": ".shared_sentiments_segments_item", "SharedTopicsParams": ".shared_topics", + "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", "SharedTopicsSegmentsItemParams": ".shared_topics_segments_item", "SharedTopicsSegmentsItemTopicsItemParams": ".shared_topics_segments_item_topics_item", "SpeakSettingsV1EndpointParams": ".speak_settings_v1endpoint", @@ -377,6 +385,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", } @@ -530,12 +541,20 @@ def __dir__(): "ReadV1ResponseResultsSummaryResultsParams", "ReadV1ResponseResultsSummaryResultsSummaryParams", "SharedIntentsParams", + "SharedIntentsResultsParams", + "SharedIntentsResultsIntentsParams", + "SharedIntentsResultsIntentsSegmentsItemParams", + "SharedIntentsResultsIntentsSegmentsItemIntentsItemParams", "SharedIntentsSegmentsItemIntentsItemParams", "SharedIntentsSegmentsItemParams", "SharedSentimentsAverageParams", "SharedSentimentsParams", "SharedSentimentsSegmentsItemParams", "SharedTopicsParams", + "SharedTopicsResultsParams", + "SharedTopicsResultsTopicsParams", + "SharedTopicsResultsTopicsSegmentsItemParams", + "SharedTopicsResultsTopicsSegmentsItemTopicsItemParams", "SharedTopicsSegmentsItemParams", "SharedTopicsSegmentsItemTopicsItemParams", "SpeakSettingsV1EndpointParams", @@ -568,4 +587,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 f3ac75bd..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", - "CartesiaVoiceParams": ".cartesia_voice", - "CreateAgentConfigurationV1ResponseParams": ".create_agent_configuration_v1response", - "CreateKeyV1RequestParams": ".create_key_v1request", - "CreateKeyV1ResponseParams": ".create_key_v1response", - "CreateProjectDistributionCredentialsV1ResponseDistributionCredentialsParams": ".create_project_distribution_credentials_v1response_distribution_credentials", - "CreateProjectDistributionCredentialsV1ResponseMemberParams": ".create_project_distribution_credentials_v1response_member", - "CreateProjectDistributionCredentialsV1ResponseParams": ".create_project_distribution_credentials_v1response", - "CreateProjectInviteV1ResponseParams": ".create_project_invite_v1response", - "DeepgramListenProviderV1Params": ".deepgram_listen_provider_v1", - "DeepgramListenProviderV2Params": ".deepgram_listen_provider_v2", - "DeepgramParams": ".deepgram", - "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", - "CartesiaSpeakProviderVoiceParams": ".cartesia_speak_provider_voice", - "CreateKeyV1RequestOneParams": ".create_key_v1request_one", - "DeepgramListenProviderV2LanguageHintParams": ".deepgram_listen_provider_v2language_hint", -} - - -def __getattr__(attr_name: str) -> typing.Any: - module_name = _dynamic_imports.get(attr_name) - if module_name is None: - raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") - try: - module = import_module(module_name, __package__) - if module_name == f".{attr_name}": - return module - else: - return getattr(module, attr_name) - except ImportError as e: - raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e - except AttributeError as e: - raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e - - -def __dir__(): - lazy_attrs = list(_dynamic_imports.keys()) - return sorted(lazy_attrs) - - -__all__ = [ - "AgentConfigurationV1Params", - "AgentThinkModelsV1ResponseModelsItemIdParams", - "AgentThinkModelsV1ResponseModelsItemOneParams", - "AgentThinkModelsV1ResponseModelsItemParams", - "AgentThinkModelsV1ResponseModelsItemThreeParams", - "AgentThinkModelsV1ResponseModelsItemTwoParams", - "AgentThinkModelsV1ResponseModelsItemZeroParams", - "AgentThinkModelsV1ResponseParams", - "AgentVariableV1Params", - "AnthropicParams", - "AwsBedrockThinkProviderCredentialsParams", - "AwsBedrockThinkProviderParams", - "AwsPollySpeakProviderCredentialsParams", - "AwsPollySpeakProviderParams", - "BillingBreakdownV1ResponseParams", - "BillingBreakdownV1ResponseResolutionParams", - "BillingBreakdownV1ResponseResultsItemGroupingParams", - "BillingBreakdownV1ResponseResultsItemParams", - "CartesiaParams", - "CartesiaVoiceParams", - "CreateAgentConfigurationV1ResponseParams", - "CreateKeyV1RequestParams", - "CreateKeyV1ResponseParams", - "CreateProjectDistributionCredentialsV1ResponseDistributionCredentialsParams", - "CreateProjectDistributionCredentialsV1ResponseMemberParams", - "CreateProjectDistributionCredentialsV1ResponseParams", - "CreateProjectInviteV1ResponseParams", - "DeepgramListenProviderV1Params", - "DeepgramListenProviderV2Params", - "DeepgramParams", - "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", - "CartesiaSpeakProviderVoiceParams", - "CreateKeyV1RequestOneParams", - "DeepgramListenProviderV2LanguageHintParams", -] diff --git a/src/deepgram/requests/shared_intents_results.py b/src/deepgram/requests/shared_intents_results.py new file mode 100644 index 00000000..abe92d19 --- /dev/null +++ b/src/deepgram/requests/shared_intents_results.py @@ -0,0 +1,8 @@ +# Deprecated compatibility wrapper for pre-7.12 Intents params. + +import typing_extensions +from .shared_intents_results_intents import SharedIntentsResultsIntentsParams + + +class SharedIntentsResultsParams(typing_extensions.TypedDict): + intents: typing_extensions.NotRequired[SharedIntentsResultsIntentsParams] diff --git a/src/deepgram/requests/shared_intents_results_intents.py b/src/deepgram/requests/shared_intents_results_intents.py new file mode 100644 index 00000000..6d5de29a --- /dev/null +++ b/src/deepgram/requests/shared_intents_results_intents.py @@ -0,0 +1,10 @@ +# Deprecated compatibility wrapper for pre-7.12 Intents params. + +import typing + +import typing_extensions +from .shared_intents_results_intents_segments_item import SharedIntentsResultsIntentsSegmentsItemParams + + +class SharedIntentsResultsIntentsParams(typing_extensions.TypedDict): + segments: typing_extensions.NotRequired[typing.Sequence[SharedIntentsResultsIntentsSegmentsItemParams]] diff --git a/src/deepgram/requests/shared_intents_results_intents_segments_item.py b/src/deepgram/requests/shared_intents_results_intents_segments_item.py new file mode 100644 index 00000000..da8b2918 --- /dev/null +++ b/src/deepgram/requests/shared_intents_results_intents_segments_item.py @@ -0,0 +1,5 @@ +# Deprecated compatibility alias for pre-7.12 Intents params. + +from .shared_intents_segments_item import SharedIntentsSegmentsItemParams + +SharedIntentsResultsIntentsSegmentsItemParams = SharedIntentsSegmentsItemParams diff --git a/src/deepgram/requests/shared_intents_results_intents_segments_item_intents_item.py b/src/deepgram/requests/shared_intents_results_intents_segments_item_intents_item.py new file mode 100644 index 00000000..267b6ab7 --- /dev/null +++ b/src/deepgram/requests/shared_intents_results_intents_segments_item_intents_item.py @@ -0,0 +1,5 @@ +# Deprecated compatibility alias for pre-7.12 Intents params. + +from .shared_intents_segments_item_intents_item import SharedIntentsSegmentsItemIntentsItemParams + +SharedIntentsResultsIntentsSegmentsItemIntentsItemParams = SharedIntentsSegmentsItemIntentsItemParams diff --git a/src/deepgram/requests/shared_topics_results.py b/src/deepgram/requests/shared_topics_results.py new file mode 100644 index 00000000..74dcc8a0 --- /dev/null +++ b/src/deepgram/requests/shared_topics_results.py @@ -0,0 +1,8 @@ +# Deprecated compatibility wrapper for pre-7.12 Topics params. + +import typing_extensions +from .shared_topics_results_topics import SharedTopicsResultsTopicsParams + + +class SharedTopicsResultsParams(typing_extensions.TypedDict): + topics: typing_extensions.NotRequired[SharedTopicsResultsTopicsParams] diff --git a/src/deepgram/requests/shared_topics_results_topics.py b/src/deepgram/requests/shared_topics_results_topics.py new file mode 100644 index 00000000..67434c49 --- /dev/null +++ b/src/deepgram/requests/shared_topics_results_topics.py @@ -0,0 +1,10 @@ +# Deprecated compatibility wrapper for pre-7.12 Topics params. + +import typing + +import typing_extensions +from .shared_topics_results_topics_segments_item import SharedTopicsResultsTopicsSegmentsItemParams + + +class SharedTopicsResultsTopicsParams(typing_extensions.TypedDict): + segments: typing_extensions.NotRequired[typing.Sequence[SharedTopicsResultsTopicsSegmentsItemParams]] diff --git a/src/deepgram/requests/shared_topics_results_topics_segments_item.py b/src/deepgram/requests/shared_topics_results_topics_segments_item.py new file mode 100644 index 00000000..018b3951 --- /dev/null +++ b/src/deepgram/requests/shared_topics_results_topics_segments_item.py @@ -0,0 +1,5 @@ +# Deprecated compatibility alias for pre-7.12 Topics params. + +from .shared_topics_segments_item import SharedTopicsSegmentsItemParams + +SharedTopicsResultsTopicsSegmentsItemParams = SharedTopicsSegmentsItemParams diff --git a/src/deepgram/requests/shared_topics_results_topics_segments_item_topics_item.py b/src/deepgram/requests/shared_topics_results_topics_segments_item_topics_item.py new file mode 100644 index 00000000..c9090deb --- /dev/null +++ b/src/deepgram/requests/shared_topics_results_topics_segments_item_topics_item.py @@ -0,0 +1,5 @@ +# Deprecated compatibility alias for pre-7.12 Topics params. + +from .shared_topics_segments_item_topics_item import SharedTopicsSegmentsItemTopicsItemParams + +SharedTopicsResultsTopicsSegmentsItemTopicsItemParams = SharedTopicsSegmentsItemTopicsItemParams 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 800bd48e..78cdf631 100644 --- a/src/deepgram/types/__init__.py +++ b/src/deepgram/types/__init__.py @@ -480,12 +480,20 @@ "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", "SharedIntentsSegmentsItem": ".shared_intents_segments_item", "SharedIntentsSegmentsItemIntentsItem": ".shared_intents_segments_item_intents_item", "SharedSentiments": ".shared_sentiments", "SharedSentimentsAverage": ".shared_sentiments_average", "SharedSentimentsSegmentsItem": ".shared_sentiments_segments_item", "SharedTopics": ".shared_topics", + "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", "SharedTopicsSegmentsItem": ".shared_topics_segments_item", "SharedTopicsSegmentsItemTopicsItem": ".shared_topics_segments_item_topics_item", "SpeakSettingsV1": ".speak_settings_v1", @@ -533,6 +541,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", } @@ -750,12 +767,20 @@ def __dir__(): "ReadV1ResponseResultsSummaryResults", "ReadV1ResponseResultsSummaryResultsSummary", "SharedIntents", + "SharedIntentsResults", + "SharedIntentsResultsIntents", + "SharedIntentsResultsIntentsSegmentsItem", + "SharedIntentsResultsIntentsSegmentsItemIntentsItem", "SharedIntentsSegmentsItem", "SharedIntentsSegmentsItemIntentsItem", "SharedSentiments", "SharedSentimentsAverage", "SharedSentimentsSegmentsItem", "SharedTopics", + "SharedTopicsResults", + "SharedTopicsResultsTopics", + "SharedTopicsResultsTopicsSegmentsItem", + "SharedTopicsResultsTopicsSegmentsItemTopicsItem", "SharedTopicsSegmentsItem", "SharedTopicsSegmentsItemTopicsItem", "SpeakSettingsV1", @@ -803,4 +828,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 57674025..00000000 --- a/src/deepgram/types/__init__.py.bak +++ /dev/null @@ -1,847 +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_v2configure_numerals import ListenV2ConfigureNumerals - from .listen_v2eager_eot_threshold import ListenV2EagerEotThreshold - from .listen_v2encoding import ListenV2Encoding - from .listen_v2eot_threshold import ListenV2EotThreshold - from .listen_v2eot_timeout_ms import ListenV2EotTimeoutMs - from .listen_v2keyterm import ListenV2Keyterm - from .listen_v2language_hint import ListenV2LanguageHint - from .listen_v2mip_opt_out import ListenV2MipOptOut - from .listen_v2model import ListenV2Model - from .listen_v2numerals import ListenV2Numerals - from .listen_v2profanity_filter import ListenV2ProfanityFilter - from .listen_v2redact import ListenV2Redact - from .listen_v2sample_rate import ListenV2SampleRate - from .listen_v2tag import ListenV2Tag - from .open_ai_speak_provider import OpenAiSpeakProvider - from .open_ai_speak_provider_model import OpenAiSpeakProviderModel - from .open_ai_speak_provider_voice import OpenAiSpeakProviderVoice - from .open_ai_think_provider import OpenAiThinkProvider - from .open_ai_think_provider_model import OpenAiThinkProviderModel - from .open_ai_think_provider_reasoning_mode import OpenAiThinkProviderReasoningMode - from .project_request_response import ProjectRequestResponse - from .read_v1request import ReadV1Request - from .read_v1request_text import ReadV1RequestText - from .read_v1request_url import ReadV1RequestUrl - from .read_v1response import ReadV1Response - from .read_v1response_metadata import ReadV1ResponseMetadata - from .read_v1response_metadata_metadata import ReadV1ResponseMetadataMetadata - from .read_v1response_metadata_metadata_intents_info import ReadV1ResponseMetadataMetadataIntentsInfo - from .read_v1response_metadata_metadata_sentiment_info import ReadV1ResponseMetadataMetadataSentimentInfo - from .read_v1response_metadata_metadata_summary_info import ReadV1ResponseMetadataMetadataSummaryInfo - from .read_v1response_metadata_metadata_topics_info import ReadV1ResponseMetadataMetadataTopicsInfo - from .read_v1response_results import ReadV1ResponseResults - from .read_v1response_results_summary import ReadV1ResponseResultsSummary - from .read_v1response_results_summary_results import ReadV1ResponseResultsSummaryResults - from .read_v1response_results_summary_results_summary import ReadV1ResponseResultsSummaryResultsSummary - from .shared_intents import SharedIntents - from .shared_intents_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", - "AwsBedrockThinkProvider": ".aws_bedrock_think_provider", - "AwsBedrockThinkProviderCredentials": ".aws_bedrock_think_provider_credentials", - "AwsBedrockThinkProviderCredentialsType": ".aws_bedrock_think_provider_credentials_type", - "AwsBedrockThinkProviderModel": ".aws_bedrock_think_provider_model", - "AwsPollySpeakProvider": ".aws_polly_speak_provider", - "AwsPollySpeakProviderCredentials": ".aws_polly_speak_provider_credentials", - "AwsPollySpeakProviderCredentialsType": ".aws_polly_speak_provider_credentials_type", - "AwsPollySpeakProviderEngine": ".aws_polly_speak_provider_engine", - "AwsPollySpeakProviderVoice": ".aws_polly_speak_provider_voice", - "BillingBreakdownV1Response": ".billing_breakdown_v1response", - "BillingBreakdownV1ResponseResolution": ".billing_breakdown_v1response_resolution", - "BillingBreakdownV1ResponseResultsItem": ".billing_breakdown_v1response_results_item", - "BillingBreakdownV1ResponseResultsItemGrouping": ".billing_breakdown_v1response_results_item_grouping", - "Cartesia": ".cartesia", - "CartesiaModelId": ".cartesia_model_id", - "CartesiaVoice": ".cartesia_voice", - "CreateAgentConfigurationV1Response": ".create_agent_configuration_v1response", - "CreateKeyV1Request": ".create_key_v1request", - "CreateKeyV1Response": ".create_key_v1response", - "CreateProjectDistributionCredentialsV1Response": ".create_project_distribution_credentials_v1response", - "CreateProjectDistributionCredentialsV1ResponseDistributionCredentials": ".create_project_distribution_credentials_v1response_distribution_credentials", - "CreateProjectDistributionCredentialsV1ResponseMember": ".create_project_distribution_credentials_v1response_member", - "CreateProjectInviteV1Response": ".create_project_invite_v1response", - "Deepgram": ".deepgram", - "DeepgramListenProviderV1": ".deepgram_listen_provider_v1", - "DeepgramListenProviderV2": ".deepgram_listen_provider_v2", - "DeepgramModel": ".deepgram_model", - "DeleteAgentConfigurationV1Response": ".delete_agent_configuration_v1response", - "DeleteAgentVariableV1Response": ".delete_agent_variable_v1response", - "DeleteProjectInviteV1Response": ".delete_project_invite_v1response", - "DeleteProjectKeyV1Response": ".delete_project_key_v1response", - "DeleteProjectMemberV1Response": ".delete_project_member_v1response", - "DeleteProjectV1Response": ".delete_project_v1response", - "ElevenLabsSpeakProvider": ".eleven_labs_speak_provider", - "ElevenLabsSpeakProviderModelId": ".eleven_labs_speak_provider_model_id", - "ErrorResponse": ".error_response", - "ErrorResponseLegacyError": ".error_response_legacy_error", - "ErrorResponseModernError": ".error_response_modern_error", - "ErrorResponseTextError": ".error_response_text_error", - "GetModelV1Response": ".get_model_v1response", - "GetModelV1ResponseBatch": ".get_model_v1response_batch", - "GetModelV1ResponseMetadata": ".get_model_v1response_metadata", - "GetModelV1ResponseMetadataMetadata": ".get_model_v1response_metadata_metadata", - "GetProjectBalanceV1Response": ".get_project_balance_v1response", - "GetProjectDistributionCredentialsV1Response": ".get_project_distribution_credentials_v1response", - "GetProjectDistributionCredentialsV1ResponseDistributionCredentials": ".get_project_distribution_credentials_v1response_distribution_credentials", - "GetProjectDistributionCredentialsV1ResponseMember": ".get_project_distribution_credentials_v1response_member", - "GetProjectKeyV1Response": ".get_project_key_v1response", - "GetProjectKeyV1ResponseItem": ".get_project_key_v1response_item", - "GetProjectKeyV1ResponseItemMember": ".get_project_key_v1response_item_member", - "GetProjectKeyV1ResponseItemMemberApiKey": ".get_project_key_v1response_item_member_api_key", - "GetProjectRequestV1Response": ".get_project_request_v1response", - "GetProjectV1Response": ".get_project_v1response", - "Google": ".google", - "GoogleModel": ".google_model", - "GoogleVersion": ".google_version", - "GrantV1Response": ".grant_v1response", - "Groq": ".groq", - "GroqReasoningMode": ".groq_reasoning_mode", - "LeaveProjectV1Response": ".leave_project_v1response", - "ListAgentConfigurationsV1Response": ".list_agent_configurations_v1response", - "ListAgentVariablesV1Response": ".list_agent_variables_v1response", - "ListBillingFieldsV1Response": ".list_billing_fields_v1response", - "ListBillingFieldsV1ResponseDeploymentsItem": ".list_billing_fields_v1response_deployments_item", - "ListModelsV1Response": ".list_models_v1response", - "ListModelsV1ResponseSttModels": ".list_models_v1response_stt_models", - "ListModelsV1ResponseTtsModels": ".list_models_v1response_tts_models", - "ListModelsV1ResponseTtsModelsMetadata": ".list_models_v1response_tts_models_metadata", - "ListProjectBalancesV1Response": ".list_project_balances_v1response", - "ListProjectBalancesV1ResponseBalancesItem": ".list_project_balances_v1response_balances_item", - "ListProjectDistributionCredentialsV1Response": ".list_project_distribution_credentials_v1response", - "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem": ".list_project_distribution_credentials_v1response_distribution_credentials_item", - "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials": ".list_project_distribution_credentials_v1response_distribution_credentials_item_distribution_credentials", - "ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember": ".list_project_distribution_credentials_v1response_distribution_credentials_item_member", - "ListProjectInvitesV1Response": ".list_project_invites_v1response", - "ListProjectInvitesV1ResponseInvitesItem": ".list_project_invites_v1response_invites_item", - "ListProjectKeysV1Response": ".list_project_keys_v1response", - "ListProjectKeysV1ResponseApiKeysItem": ".list_project_keys_v1response_api_keys_item", - "ListProjectKeysV1ResponseApiKeysItemApiKey": ".list_project_keys_v1response_api_keys_item_api_key", - "ListProjectKeysV1ResponseApiKeysItemMember": ".list_project_keys_v1response_api_keys_item_member", - "ListProjectMemberScopesV1Response": ".list_project_member_scopes_v1response", - "ListProjectMembersV1Response": ".list_project_members_v1response", - "ListProjectMembersV1ResponseMembersItem": ".list_project_members_v1response_members_item", - "ListProjectPurchasesV1Response": ".list_project_purchases_v1response", - "ListProjectPurchasesV1ResponseOrdersItem": ".list_project_purchases_v1response_orders_item", - "ListProjectRequestsV1Response": ".list_project_requests_v1response", - "ListProjectsV1Response": ".list_projects_v1response", - "ListProjectsV1ResponseProjectsItem": ".list_projects_v1response_projects_item", - "ListenV1AcceptedResponse": ".listen_v1accepted_response", - "ListenV1Callback": ".listen_v1callback", - "ListenV1CallbackMethod": ".listen_v1callback_method", - "ListenV1Channels": ".listen_v1channels", - "ListenV1DetectEntities": ".listen_v1detect_entities", - "ListenV1Diarize": ".listen_v1diarize", - "ListenV1Dictation": ".listen_v1dictation", - "ListenV1Encoding": ".listen_v1encoding", - "ListenV1Endpointing": ".listen_v1endpointing", - "ListenV1Extra": ".listen_v1extra", - "ListenV1InterimResults": ".listen_v1interim_results", - "ListenV1Keyterm": ".listen_v1keyterm", - "ListenV1Keywords": ".listen_v1keywords", - "ListenV1Language": ".listen_v1language", - "ListenV1MipOptOut": ".listen_v1mip_opt_out", - "ListenV1Model": ".listen_v1model", - "ListenV1Multichannel": ".listen_v1multichannel", - "ListenV1Numerals": ".listen_v1numerals", - "ListenV1ProfanityFilter": ".listen_v1profanity_filter", - "ListenV1Punctuate": ".listen_v1punctuate", - "ListenV1Redact": ".listen_v1redact", - "ListenV1Replace": ".listen_v1replace", - "ListenV1RequestFile": ".listen_v1request_file", - "ListenV1Response": ".listen_v1response", - "ListenV1ResponseMetadata": ".listen_v1response_metadata", - "ListenV1ResponseMetadataDiarizeInfo": ".listen_v1response_metadata_diarize_info", - "ListenV1ResponseMetadataIntentsInfo": ".listen_v1response_metadata_intents_info", - "ListenV1ResponseMetadataSentimentInfo": ".listen_v1response_metadata_sentiment_info", - "ListenV1ResponseMetadataSummaryInfo": ".listen_v1response_metadata_summary_info", - "ListenV1ResponseMetadataTopicsInfo": ".listen_v1response_metadata_topics_info", - "ListenV1ResponseResults": ".listen_v1response_results", - "ListenV1ResponseResultsChannels": ".listen_v1response_results_channels", - "ListenV1ResponseResultsChannelsItem": ".listen_v1response_results_channels_item", - "ListenV1ResponseResultsChannelsItemAlternativesItem": ".listen_v1response_results_channels_item_alternatives_item", - "ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem": ".listen_v1response_results_channels_item_alternatives_item_entities_item", - "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs": ".listen_v1response_results_channels_item_alternatives_item_paragraphs", - "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem": ".listen_v1response_results_channels_item_alternatives_item_paragraphs_paragraphs_item", - "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem": ".listen_v1response_results_channels_item_alternatives_item_paragraphs_paragraphs_item_sentences_item", - "ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem": ".listen_v1response_results_channels_item_alternatives_item_summaries_item", - "ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem": ".listen_v1response_results_channels_item_alternatives_item_topics_item", - "ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem": ".listen_v1response_results_channels_item_alternatives_item_words_item", - "ListenV1ResponseResultsChannelsItemSearchItem": ".listen_v1response_results_channels_item_search_item", - "ListenV1ResponseResultsChannelsItemSearchItemHitsItem": ".listen_v1response_results_channels_item_search_item_hits_item", - "ListenV1ResponseResultsSummary": ".listen_v1response_results_summary", - "ListenV1ResponseResultsUtterances": ".listen_v1response_results_utterances", - "ListenV1ResponseResultsUtterancesItem": ".listen_v1response_results_utterances_item", - "ListenV1ResponseResultsUtterancesItemWordsItem": ".listen_v1response_results_utterances_item_words_item", - "ListenV1SampleRate": ".listen_v1sample_rate", - "ListenV1Search": ".listen_v1search", - "ListenV1SmartFormat": ".listen_v1smart_format", - "ListenV1Tag": ".listen_v1tag", - "ListenV1UtteranceEndMs": ".listen_v1utterance_end_ms", - "ListenV1VadEvents": ".listen_v1vad_events", - "ListenV1Version": ".listen_v1version", - "ListenV2ConfigureNumerals": ".listen_v2configure_numerals", - "ListenV2EagerEotThreshold": ".listen_v2eager_eot_threshold", - "ListenV2Encoding": ".listen_v2encoding", - "ListenV2EotThreshold": ".listen_v2eot_threshold", - "ListenV2EotTimeoutMs": ".listen_v2eot_timeout_ms", - "ListenV2Keyterm": ".listen_v2keyterm", - "ListenV2LanguageHint": ".listen_v2language_hint", - "ListenV2MipOptOut": ".listen_v2mip_opt_out", - "ListenV2Model": ".listen_v2model", - "ListenV2Numerals": ".listen_v2numerals", - "ListenV2ProfanityFilter": ".listen_v2profanity_filter", - "ListenV2Redact": ".listen_v2redact", - "ListenV2SampleRate": ".listen_v2sample_rate", - "ListenV2Tag": ".listen_v2tag", - "OpenAiSpeakProvider": ".open_ai_speak_provider", - "OpenAiSpeakProviderModel": ".open_ai_speak_provider_model", - "OpenAiSpeakProviderVoice": ".open_ai_speak_provider_voice", - "OpenAiThinkProvider": ".open_ai_think_provider", - "OpenAiThinkProviderModel": ".open_ai_think_provider_model", - "OpenAiThinkProviderReasoningMode": ".open_ai_think_provider_reasoning_mode", - "ProjectRequestResponse": ".project_request_response", - "ReadV1Request": ".read_v1request", - "ReadV1RequestText": ".read_v1request_text", - "ReadV1RequestUrl": ".read_v1request_url", - "ReadV1Response": ".read_v1response", - "ReadV1ResponseMetadata": ".read_v1response_metadata", - "ReadV1ResponseMetadataMetadata": ".read_v1response_metadata_metadata", - "ReadV1ResponseMetadataMetadataIntentsInfo": ".read_v1response_metadata_metadata_intents_info", - "ReadV1ResponseMetadataMetadataSentimentInfo": ".read_v1response_metadata_metadata_sentiment_info", - "ReadV1ResponseMetadataMetadataSummaryInfo": ".read_v1response_metadata_metadata_summary_info", - "ReadV1ResponseMetadataMetadataTopicsInfo": ".read_v1response_metadata_metadata_topics_info", - "ReadV1ResponseResults": ".read_v1response_results", - "ReadV1ResponseResultsSummary": ".read_v1response_results_summary", - "ReadV1ResponseResultsSummaryResults": ".read_v1response_results_summary_results", - "ReadV1ResponseResultsSummaryResultsSummary": ".read_v1response_results_summary_results_summary", - "SharedIntents": ".shared_intents", - "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", - "AnthropicThinkProviderModel": ".anthropic_think_provider_model", - "CartesiaSpeakProviderModelId": ".cartesia_speak_provider_model_id", - "CartesiaSpeakProviderVoice": ".cartesia_speak_provider_voice", - "CreateKeyV1RequestOne": ".create_key_v1request_one", - "DeepgramListenProviderV2LanguageHint": ".deepgram_listen_provider_v2language_hint", - "DeepgramSpeakProviderModel": ".deepgram_speak_provider_model", - "GoogleThinkProviderModel": ".google_think_provider_model", - "GoogleThinkProviderVersion": ".google_think_provider_version", - "GroqThinkProviderReasoningMode": ".groq_think_provider_reasoning_mode", -} - - -def __getattr__(attr_name: str) -> typing.Any: - module_name = _dynamic_imports.get(attr_name) - if module_name is None: - raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") - try: - module = import_module(module_name, __package__) - if module_name == f".{attr_name}": - return module - else: - return getattr(module, attr_name) - except ImportError as e: - raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e - except AttributeError as e: - raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e - - -def __dir__(): - lazy_attrs = list(_dynamic_imports.keys()) - return sorted(lazy_attrs) - - -__all__ = [ - "AgentConfigurationV1", - "AgentThinkModelsV1Response", - "AgentThinkModelsV1ResponseModelsItem", - "AgentThinkModelsV1ResponseModelsItemId", - "AgentThinkModelsV1ResponseModelsItemOne", - "AgentThinkModelsV1ResponseModelsItemOneId", - "AgentThinkModelsV1ResponseModelsItemThree", - "AgentThinkModelsV1ResponseModelsItemTwo", - "AgentThinkModelsV1ResponseModelsItemTwoId", - "AgentThinkModelsV1ResponseModelsItemZero", - "AgentThinkModelsV1ResponseModelsItemZeroId", - "AgentVariableV1", - "Anthropic", - "AnthropicModel", - "AwsBedrockThinkProvider", - "AwsBedrockThinkProviderCredentials", - "AwsBedrockThinkProviderCredentialsType", - "AwsBedrockThinkProviderModel", - "AwsPollySpeakProvider", - "AwsPollySpeakProviderCredentials", - "AwsPollySpeakProviderCredentialsType", - "AwsPollySpeakProviderEngine", - "AwsPollySpeakProviderVoice", - "BillingBreakdownV1Response", - "BillingBreakdownV1ResponseResolution", - "BillingBreakdownV1ResponseResultsItem", - "BillingBreakdownV1ResponseResultsItemGrouping", - "Cartesia", - "CartesiaModelId", - "CartesiaVoice", - "CreateAgentConfigurationV1Response", - "CreateKeyV1Request", - "CreateKeyV1Response", - "CreateProjectDistributionCredentialsV1Response", - "CreateProjectDistributionCredentialsV1ResponseDistributionCredentials", - "CreateProjectDistributionCredentialsV1ResponseMember", - "CreateProjectInviteV1Response", - "Deepgram", - "DeepgramListenProviderV1", - "DeepgramListenProviderV2", - "DeepgramModel", - "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", - "ListenV2ConfigureNumerals", - "ListenV2EagerEotThreshold", - "ListenV2Encoding", - "ListenV2EotThreshold", - "ListenV2EotTimeoutMs", - "ListenV2Keyterm", - "ListenV2LanguageHint", - "ListenV2MipOptOut", - "ListenV2Model", - "ListenV2Numerals", - "ListenV2ProfanityFilter", - "ListenV2Redact", - "ListenV2SampleRate", - "ListenV2Tag", - "OpenAiSpeakProvider", - "OpenAiSpeakProviderModel", - "OpenAiSpeakProviderVoice", - "OpenAiThinkProvider", - "OpenAiThinkProviderModel", - "OpenAiThinkProviderReasoningMode", - "ProjectRequestResponse", - "ReadV1Request", - "ReadV1RequestText", - "ReadV1RequestUrl", - "ReadV1Response", - "ReadV1ResponseMetadata", - "ReadV1ResponseMetadataMetadata", - "ReadV1ResponseMetadataMetadataIntentsInfo", - "ReadV1ResponseMetadataMetadataSentimentInfo", - "ReadV1ResponseMetadataMetadataSummaryInfo", - "ReadV1ResponseMetadataMetadataTopicsInfo", - "ReadV1ResponseResults", - "ReadV1ResponseResultsSummary", - "ReadV1ResponseResultsSummaryResults", - "ReadV1ResponseResultsSummaryResultsSummary", - "SharedIntents", - "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", - "AnthropicThinkProviderModel", - "CartesiaSpeakProviderModelId", - "CartesiaSpeakProviderVoice", - "CreateKeyV1RequestOne", - "DeepgramListenProviderV2LanguageHint", - "DeepgramSpeakProviderModel", - "GoogleThinkProviderModel", - "GoogleThinkProviderVersion", - "GroqThinkProviderReasoningMode", -] diff --git a/src/deepgram/types/deepgram.py b/src/deepgram/types/deepgram.py index ec242762..994f7a2c 100644 --- a/src/deepgram/types/deepgram.py +++ b/src/deepgram/types/deepgram.py @@ -29,7 +29,7 @@ class Deepgram(UncheckedBaseModel): Speaking rate multiplier that adjusts the pace of generated speech while preserving natural prosody and voice quality. Aura (version v1) accepts any value from 0.7 to 1.5. Flux TTS (version v2) accepts values from 0.5 to 1.5 in 0.05 increments; a value the family does not accept ends the session with FAILED_TO_SPEAK. Not yet supported in all languages. """ - expressivity: typing.Optional[int] = pydantic.Field(default=None) + expressivity: typing.Optional[pydantic.StrictInt] = pydantic.Field(default=None) """ Delivery register of the generated speech, on a calm-to-animated axis. Flux TTS (version v2) only, on every Flux voice. Accepts the whole numbers -2 to 2, where 0 (the default) is the voice's tuned delivery and the only value validated for production, -2 the calm end of the range and 2 the animated end. Fixed for the session. Beta: behavior may change in future model versions, and non-default values increase the risk of hallucinations and pronunciation errors. See [Expressivity](/docs/tts-expressivity). """ diff --git a/src/deepgram/types/deepgram.py.bak b/src/deepgram/types/deepgram.py.bak deleted file mode 100644 index 994f7a2c..00000000 --- a/src/deepgram/types/deepgram.py.bak +++ /dev/null @@ -1,44 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.unchecked_base_model import UncheckedBaseModel -from .deepgram_model import DeepgramModel - - -class Deepgram(UncheckedBaseModel): - """ - Deepgram text-to-speech provider. Aura models use version v1 (default); Flux TTS uses version v2 and a flux-* model. Flux TTS is the default when agent.speak is omitted, using the flux-kit-en voice. - """ - - type: typing.Literal["deepgram"] = "deepgram" - version: typing.Optional[str] = pydantic.Field(default=None) - """ - The Deepgram text-to-speech model family. Accepted values: `v1` (Aura, the default) and `v2` (Flux TTS). Use `v1` with an aura-* model and `v2` with a flux-* model. Defaults to `v1` when omitted. - """ - - model: DeepgramModel = pydantic.Field() - """ - Deepgram TTS model. Aura models (version v1) use the aura-* voices; Flux TTS (version v2) uses the flux-{voice}-{language} voices (e.g. flux-alexis-en). Defaults to flux-kit-en when agent.speak is omitted. - """ - - speed: typing.Optional[float] = pydantic.Field(default=None) - """ - Speaking rate multiplier that adjusts the pace of generated speech while preserving natural prosody and voice quality. Aura (version v1) accepts any value from 0.7 to 1.5. Flux TTS (version v2) accepts values from 0.5 to 1.5 in 0.05 increments; a value the family does not accept ends the session with FAILED_TO_SPEAK. Not yet supported in all languages. - """ - - expressivity: typing.Optional[pydantic.StrictInt] = pydantic.Field(default=None) - """ - Delivery register of the generated speech, on a calm-to-animated axis. Flux TTS (version v2) only, on every Flux voice. Accepts the whole numbers -2 to 2, where 0 (the default) is the voice's tuned delivery and the only value validated for production, -2 the calm end of the range and 2 the animated end. Fixed for the session. Beta: behavior may change in future model versions, and non-default values increase the risk of hallucinations and pronunciation errors. See [Expressivity](/docs/tts-expressivity). - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/types/deepgram_listen_provider_v2.py b/src/deepgram/types/deepgram_listen_provider_v2.py index f7a155fb..92b4d7ec 100644 --- a/src/deepgram/types/deepgram_listen_provider_v2.py +++ b/src/deepgram/types/deepgram_listen_provider_v2.py @@ -28,6 +28,8 @@ 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) + eot_threshold: typing.Optional[float] = pydantic.Field(default=None) """ End-of-turn confidence required to finish a turn. Valid range: 0.5 - 1.0. Defaults to 0.7. Set to 1.0 to fully suppress confidence-based end-of-turn detection. `eot_timeout_ms` still ends idle turns; increase it when using ForceEndTurn for full manual turn control. @@ -49,9 +51,31 @@ class DeepgramListenProviderV2(UncheckedBaseModel): """ if IS_PYDANTIC_V2: + + @pydantic.model_validator(mode="before") + @classmethod + def _migrate_language_hint(cls, values: typing.Any) -> typing.Any: + if not isinstance(values, dict) or "language_hint" not in values: + return values + values = dict(values) + hint = values.pop("language_hint") + if hint is not None and values.get("language_hints") is None: + values["language_hints"] = [hint] if isinstance(hint, str) else list(hint) + return values + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: + @pydantic.root_validator(pre=True) # type: ignore[deprecated] + def _migrate_language_hint(cls, values: typing.Any) -> typing.Any: # type: ignore[no-redef] + if not isinstance(values, dict) or "language_hint" not in values: + return values + values = dict(values) + hint = values.pop("language_hint") + if hint is not None and values.get("language_hints") is None: + values["language_hints"] = [hint] if isinstance(hint, str) else list(hint) + return values + class Config: frozen = True smart_union = True diff --git a/src/deepgram/types/deepgram_listen_provider_v2.py.bak b/src/deepgram/types/deepgram_listen_provider_v2.py.bak deleted file mode 100644 index 4eacc10e..00000000 --- a/src/deepgram/types/deepgram_listen_provider_v2.py.bak +++ /dev/null @@ -1,88 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.unchecked_base_model import UncheckedBaseModel - - -class DeepgramListenProviderV2(UncheckedBaseModel): - type: typing.Literal["deepgram"] = pydantic.Field(default="deepgram") - """ - Provider type for speech-to-text - """ - - version: typing.Optional[typing.Literal["v2"]] = pydantic.Field(default=None) - """ - Specifies usage of the V2 Deepgram speech-to-text API (e.g. Flux) - """ - - model: str = pydantic.Field() - """ - Model to use for speech to text using the V2 API (e.g. flux-general-en, flux-general-multi) - """ - - language_hints: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - An array of one or more BCP-47 language codes to bias the model toward specific languages. Only supported when model is flux-general-multi. Without hints, the model auto-detects the spoken language. See the Language Prompting guide for details. - """ - - language_hint: typing.Optional[typing.Union[str, typing.List[str]]] = pydantic.Field(default=None, exclude=True) - """ - Deprecated. Use `language_hints`. Accepted for backward compatibility and - remapped before serialization so the singular field never reaches the API. - """ - - eot_threshold: typing.Optional[float] = pydantic.Field(default=None) - """ - End-of-turn confidence required to finish a turn. Valid range: 0.5 - 1.0. Defaults to 0.7. Set to 1.0 to fully suppress confidence-based end-of-turn detection. `eot_timeout_ms` still ends idle turns; increase it when using ForceEndTurn for full manual turn control. - """ - - eager_eot_threshold: typing.Optional[float] = pydantic.Field(default=None) - """ - End-of-turn confidence required to fire an eager end-of-turn event. When set, enables EagerEndOfTurn and TurnResumed events. Valid range: 0.3 - 0.9. - """ - - eot_timeout_ms: typing.Optional[int] = pydantic.Field(default=None) - """ - A turn will be finished when this much time in milliseconds has passed after speech, regardless of EOT confidence. Defaults to 5000. - """ - - keyterms: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - Prompt keyterm recognition to improve Keyword Recall Rate - """ - - if IS_PYDANTIC_V2: - - @pydantic.model_validator(mode="before") - @classmethod - def _migrate_language_hint(cls, values: typing.Any) -> typing.Any: - if not isinstance(values, dict) or "language_hint" not in values: - return values - values = dict(values) - hint = values.pop("language_hint") - if hint is not None and values.get("language_hints") is None: - values["language_hints"] = [hint] if isinstance(hint, str) else list(hint) - return values - 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: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/types/shared_intents.py b/src/deepgram/types/shared_intents.py index f03d4225..1a2c3790 100644 --- a/src/deepgram/types/shared_intents.py +++ b/src/deepgram/types/shared_intents.py @@ -5,6 +5,8 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2 from ..core.unchecked_base_model import UncheckedBaseModel +from .shared_intents_results import SharedIntentsResults +from .shared_intents_results_intents import SharedIntentsResultsIntents from .shared_intents_segments_item import SharedIntentsSegmentsItem @@ -15,6 +17,11 @@ class SharedIntents(UncheckedBaseModel): segments: typing.Optional[typing.List[SharedIntentsSegmentsItem]] = None + @property + def results(self) -> SharedIntentsResults: + """Deprecated facade for the pre-7.12 ``results.intents.segments`` path.""" + return SharedIntentsResults(intents=SharedIntentsResultsIntents(segments=self.segments)) + 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/shared_intents_results.py b/src/deepgram/types/shared_intents_results.py new file mode 100644 index 00000000..bfa41fb1 --- /dev/null +++ b/src/deepgram/types/shared_intents_results.py @@ -0,0 +1,21 @@ +# Deprecated compatibility wrapper for the pre-7.12 Intents response shape. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .shared_intents_results_intents import SharedIntentsResultsIntents + + +class SharedIntentsResults(UncheckedBaseModel): + intents: typing.Optional[SharedIntentsResultsIntents] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/deepgram/types/shared_intents_results_intents.py b/src/deepgram/types/shared_intents_results_intents.py new file mode 100644 index 00000000..175ddc7b --- /dev/null +++ b/src/deepgram/types/shared_intents_results_intents.py @@ -0,0 +1,21 @@ +# Deprecated compatibility wrapper for the pre-7.12 Intents response shape. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .shared_intents_results_intents_segments_item import SharedIntentsResultsIntentsSegmentsItem + + +class SharedIntentsResultsIntents(UncheckedBaseModel): + segments: typing.Optional[typing.List[SharedIntentsResultsIntentsSegmentsItem]] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/deepgram/types/shared_intents_results_intents_segments_item.py b/src/deepgram/types/shared_intents_results_intents_segments_item.py new file mode 100644 index 00000000..f96abe78 --- /dev/null +++ b/src/deepgram/types/shared_intents_results_intents_segments_item.py @@ -0,0 +1,5 @@ +# Deprecated compatibility alias for the pre-7.12 Intents response shape. + +from .shared_intents_segments_item import SharedIntentsSegmentsItem + +SharedIntentsResultsIntentsSegmentsItem = SharedIntentsSegmentsItem diff --git a/src/deepgram/types/shared_intents_results_intents_segments_item_intents_item.py b/src/deepgram/types/shared_intents_results_intents_segments_item_intents_item.py new file mode 100644 index 00000000..6b7dfde9 --- /dev/null +++ b/src/deepgram/types/shared_intents_results_intents_segments_item_intents_item.py @@ -0,0 +1,5 @@ +# Deprecated compatibility alias for the pre-7.12 Intents response shape. + +from .shared_intents_segments_item_intents_item import SharedIntentsSegmentsItemIntentsItem + +SharedIntentsResultsIntentsSegmentsItemIntentsItem = SharedIntentsSegmentsItemIntentsItem diff --git a/src/deepgram/types/shared_topics.py b/src/deepgram/types/shared_topics.py index 0f6a4a76..06c07db7 100644 --- a/src/deepgram/types/shared_topics.py +++ b/src/deepgram/types/shared_topics.py @@ -5,6 +5,8 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2 from ..core.unchecked_base_model import UncheckedBaseModel +from .shared_topics_results import SharedTopicsResults +from .shared_topics_results_topics import SharedTopicsResultsTopics from .shared_topics_segments_item import SharedTopicsSegmentsItem @@ -15,6 +17,11 @@ class SharedTopics(UncheckedBaseModel): segments: typing.Optional[typing.List[SharedTopicsSegmentsItem]] = None + @property + def results(self) -> SharedTopicsResults: + """Deprecated facade for the pre-7.12 ``results.topics.segments`` path.""" + return SharedTopicsResults(topics=SharedTopicsResultsTopics(segments=self.segments)) + 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/shared_topics_results.py b/src/deepgram/types/shared_topics_results.py new file mode 100644 index 00000000..29345add --- /dev/null +++ b/src/deepgram/types/shared_topics_results.py @@ -0,0 +1,21 @@ +# Deprecated compatibility wrapper for the pre-7.12 Topics response shape. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .shared_topics_results_topics import SharedTopicsResultsTopics + + +class SharedTopicsResults(UncheckedBaseModel): + topics: typing.Optional[SharedTopicsResultsTopics] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/deepgram/types/shared_topics_results_topics.py b/src/deepgram/types/shared_topics_results_topics.py new file mode 100644 index 00000000..08c788d7 --- /dev/null +++ b/src/deepgram/types/shared_topics_results_topics.py @@ -0,0 +1,21 @@ +# Deprecated compatibility wrapper for the pre-7.12 Topics response shape. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .shared_topics_results_topics_segments_item import SharedTopicsResultsTopicsSegmentsItem + + +class SharedTopicsResultsTopics(UncheckedBaseModel): + segments: typing.Optional[typing.List[SharedTopicsResultsTopicsSegmentsItem]] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/deepgram/types/shared_topics_results_topics_segments_item.py b/src/deepgram/types/shared_topics_results_topics_segments_item.py new file mode 100644 index 00000000..e4822cc3 --- /dev/null +++ b/src/deepgram/types/shared_topics_results_topics_segments_item.py @@ -0,0 +1,5 @@ +# Deprecated compatibility alias for the pre-7.12 Topics response shape. + +from .shared_topics_segments_item import SharedTopicsSegmentsItem + +SharedTopicsResultsTopicsSegmentsItem = SharedTopicsSegmentsItem diff --git a/src/deepgram/types/shared_topics_results_topics_segments_item_topics_item.py b/src/deepgram/types/shared_topics_results_topics_segments_item_topics_item.py new file mode 100644 index 00000000..d2722d9a --- /dev/null +++ b/src/deepgram/types/shared_topics_results_topics_segments_item_topics_item.py @@ -0,0 +1,5 @@ +# Deprecated compatibility alias for the pre-7.12 Topics response shape. + +from .shared_topics_segments_item_topics_item import SharedTopicsSegmentsItemTopicsItem + +SharedTopicsResultsTopicsSegmentsItemTopicsItem = SharedTopicsSegmentsItemTopicsItem diff --git a/src/deepgram/types/speak_settings_v1provider.py b/src/deepgram/types/speak_settings_v1provider.py index 305cdba8..3fbef168 100644 --- a/src/deepgram/types/speak_settings_v1provider.py +++ b/src/deepgram/types/speak_settings_v1provider.py @@ -24,7 +24,7 @@ class SpeakSettingsV1Provider_Deepgram(UncheckedBaseModel): version: typing.Optional[str] = None model: DeepgramModel speed: typing.Optional[float] = None - expressivity: typing.Optional[int] = None + expressivity: typing.Optional[pydantic.StrictInt] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/src/deepgram/types/speak_settings_v1provider.py.bak b/src/deepgram/types/speak_settings_v1provider.py.bak deleted file mode 100644 index 3fbef168..00000000 --- a/src/deepgram/types/speak_settings_v1provider.py.bak +++ /dev/null @@ -1,117 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from __future__ import annotations - -import typing - -import pydantic -import typing_extensions -from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata -from .aws_polly_speak_provider_credentials import AwsPollySpeakProviderCredentials -from .aws_polly_speak_provider_engine import AwsPollySpeakProviderEngine -from .aws_polly_speak_provider_voice import AwsPollySpeakProviderVoice -from .cartesia_model_id import CartesiaModelId -from .cartesia_voice import CartesiaVoice -from .deepgram_model import DeepgramModel -from .eleven_labs_speak_provider_model_id import ElevenLabsSpeakProviderModelId -from .open_ai_speak_provider_model import OpenAiSpeakProviderModel -from .open_ai_speak_provider_voice import OpenAiSpeakProviderVoice - - -class SpeakSettingsV1Provider_Deepgram(UncheckedBaseModel): - type: typing.Literal["deepgram"] = "deepgram" - version: typing.Optional[str] = None - model: DeepgramModel - speed: typing.Optional[float] = None - expressivity: typing.Optional[pydantic.StrictInt] = None - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -class SpeakSettingsV1Provider_ElevenLabs(UncheckedBaseModel): - type: typing.Literal["eleven_labs"] = "eleven_labs" - version: typing.Optional[typing.Literal["v1"]] = None - model_id: ElevenLabsSpeakProviderModelId - language: typing.Optional[str] = None - language_code: typing.Optional[str] = None - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -class SpeakSettingsV1Provider_Cartesia(UncheckedBaseModel): - type: typing.Literal["cartesia"] = "cartesia" - version: typing.Optional[typing.Literal["2025-03-17"]] = None - model_id: CartesiaModelId - voice: CartesiaVoice - language: typing.Optional[str] = None - volume: typing.Optional[float] = None - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -class SpeakSettingsV1Provider_OpenAi(UncheckedBaseModel): - type: typing.Literal["open_ai"] = "open_ai" - version: typing.Optional[typing.Literal["v1"]] = None - model: OpenAiSpeakProviderModel - voice: OpenAiSpeakProviderVoice - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -class SpeakSettingsV1Provider_AwsPolly(UncheckedBaseModel): - type: typing.Literal["aws_polly"] = "aws_polly" - voice: AwsPollySpeakProviderVoice - language: str - language_code: typing.Optional[str] = None - engine: AwsPollySpeakProviderEngine - credentials: AwsPollySpeakProviderCredentials - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -SpeakSettingsV1Provider = typing_extensions.Annotated[ - typing.Union[ - SpeakSettingsV1Provider_Deepgram, - SpeakSettingsV1Provider_ElevenLabs, - SpeakSettingsV1Provider_Cartesia, - SpeakSettingsV1Provider_OpenAi, - SpeakSettingsV1Provider_AwsPolly, - ], - UnionMetadata(discriminant="type"), -] diff --git a/tests/custom/test_flux_tts_controls.py b/tests/custom/test_flux_tts_controls.py new file mode 100644 index 00000000..091481d0 --- /dev/null +++ b/tests/custom/test_flux_tts_controls.py @@ -0,0 +1,69 @@ +"""Deterministic coverage for Flux batch and streaming control response shapes.""" + +import json + +import httpx +import respx + +from deepgram import DeepgramClient +from deepgram.environment import DeepgramClientEnvironment +from deepgram.speak.v2.socket_client import V2SocketClient +from deepgram.speak.v2.types import SpeakV2ConfigureFailure, SpeakV2SpeechMetadata, SpeakV2Warning + +HOST = "controls.deepgram.test" +ENVIRONMENT = DeepgramClientEnvironment( + base=f"https://{HOST}", production=f"wss://{HOST}", agent=f"wss://{HOST}", agent_rest=f"https://{HOST}" +) + + +class _FakeWebSocket: + def __init__(self, message): + self.message = json.dumps(message) + + def recv(self): + return self.message + + +def test_batch_raw_response_exposes_control_headers_and_serializes_controls() -> None: + with respx.mock: + route = respx.post(f"https://{HOST}/v2/speak").mock( + return_value=httpx.Response( + 200, + headers={"dg-pronunciations-applied": "1", "dg-breaks-applied": "1", "dg-warnings": "PRON-001"}, + content=b"audio", + ) + ) + with DeepgramClient(environment=ENVIRONMENT, api_key="test").speak.v2.audio.with_raw_response.generate( + model="flux-alexis-en", text='Hello {"word":"Deepgram","pronounce":"diːpɡræm"}' + ) as response: + assert b"".join(response.data) == b"audio" + assert response.headers["dg-pronunciations-applied"] == "1" + assert response.headers["dg-breaks-applied"] == "1" + assert response.headers["dg-warnings"] == "PRON-001" + assert json.loads(route.calls.last.request.content) == { + "text": 'Hello {"word":"Deepgram","pronounce":"diːpɡræm"}' + } + + +def test_streaming_control_failure_warning_and_counters_parse() -> None: + configure = V2SocketClient( + websocket=_FakeWebSocket( + {"type": "ConfigureFailure", "code": "CONTROL_COMBINATION_INVALID", "description": "flush the buffered turn"} + ) + ).recv() + assert isinstance(configure, SpeakV2ConfigureFailure) + assert configure.code == "CONTROL_COMBINATION_INVALID" + + warning = V2SocketClient(websocket=_FakeWebSocket({"type": "Warning", "code": "PRONUNCIATION_WARNINGS", "description": "IPA warning"})).recv() + assert isinstance(warning, SpeakV2Warning) + assert warning.code == "PRONUNCIATION_WARNINGS" + + metadata = V2SocketClient( + websocket=_FakeWebSocket( + {"type": "SpeechMetadata", "speech_id": "speech", "audio_duration_ms": 10, "input_character_count": 5, "billable_character_count": 5, "controls_applied": {"pronunciations_applied": 1, "breaks_applied": 0, "pronunciation_warnings": 1}} + ) + ).recv() + assert isinstance(metadata, SpeakV2SpeechMetadata) + assert metadata.controls_applied.pronunciations_applied == 1 + assert metadata.controls_applied.breaks_applied == 0 + assert metadata.controls_applied.pronunciation_warnings == 1 diff --git a/tests/custom/test_model_dict_compat.py b/tests/custom/test_model_dict_compat.py index 93b215bf..770c0947 100644 --- a/tests/custom/test_model_dict_compat.py +++ b/tests/custom/test_model_dict_compat.py @@ -19,6 +19,7 @@ from deepgram.listen.v2.types.listen_v2connected import ListenV2Connected from deepgram.listen.v2.types.listen_v2fatal_error import ListenV2FatalError from deepgram.listen.v2.types.listen_v2turn_info import ListenV2TurnInfo +from deepgram.listen.v2.types.listen_v2warning import ListenV2Warning from deepgram.types.get_model_v1response_metadata import GetModelV1ResponseMetadata TURN_INFO = { @@ -81,6 +82,7 @@ def test_all_listen_v2_response_models_support_subscript_access() -> None: responses: typing.List[typing.Any] = [ ListenV2Connected(type="Connected", request_id="request-id", sequence_id=0), ListenV2ConfigureFailure(type="ConfigureFailure", request_id="request-id", sequence_id=1), + ListenV2Warning(type="Warning", request_id="request-id", sequence_id=2, code="NOTICE", description="warning"), configure_success, ListenV2FatalError(type="Error", sequence_id=3, code="ERROR", description="failure"), ] @@ -90,6 +92,29 @@ def test_all_listen_v2_response_models_support_subscript_access() -> None: assert configure_success.thresholds["eot_threshold"] == 0.7 +def test_listen_v2_generated_warning_and_configure_fields_remain_typed_and_subscriptable() -> None: + warning = ListenV2Warning(type="Warning", request_id="request-id", sequence_id=3, code="NOTICE", description="warning") + failure = ListenV2ConfigureFailure( + type="ConfigureFailure", + request_id="request-id", + sequence_id=4, + code="INVALID_CONFIGURATION", + description="invalid setting", + ) + success = ListenV2ConfigureSuccess( + type="ConfigureSuccess", + request_id="request-id", + thresholds=ListenV2ConfigureSuccessThresholds(eot_threshold=0.7), + keyterms=[], + numerals=True, + sequence_id=5, + ) + + assert warning["code"] == "NOTICE" + assert failure["description"] == "invalid setting" + assert success["numerals"] is True + + def test_unrelated_models_do_not_gain_subscript_access() -> None: metadata = GetModelV1ResponseMetadata(uuid="model-id") diff --git a/tests/custom/test_text_builder.py b/tests/custom/test_text_builder.py index 43c6270e..559a86ee 100644 --- a/tests/custom/test_text_builder.py +++ b/tests/custom/test_text_builder.py @@ -3,6 +3,7 @@ """ import pytest + from deepgram.helpers import ( TextBuilder, add_pronunciation, @@ -102,15 +103,13 @@ def test_pronunciation_limit(self): builder.pronunciation("extra", "test") def test_pause_limit(self): - """Test pause count limit (50 max)""" + """Flux batch supports at most eight pauses.""" builder = TextBuilder() - # Add 50 pauses (should work) - for i in range(50): + for i in range(8): builder.pause(500) - - # 51st should raise error - with pytest.raises(ValueError, match="Maximum 50 pauses"): + + with pytest.raises(ValueError, match="Maximum 8 pauses"): builder.pause(500) def test_character_limit(self): @@ -156,8 +155,8 @@ def test_invalid_pause_duration(self): builder.pause(400) # Too long - with pytest.raises(ValueError, match="not exceed 5000ms"): - builder.pause(5001) + with pytest.raises(ValueError, match="not exceed 3000ms"): + builder.pause(3001) # Not in 100ms increments with pytest.raises(ValueError, match="100ms increments"): @@ -173,8 +172,8 @@ def test_pause_boundary_values(self): # Maximum valid builder2 = TextBuilder() - result2 = builder2.pause(5000).build() - assert "{pause:5000}" in result2 + result2 = builder2.pause(3000).build() + assert "{pause:3000}" in result2 class TestAddPronunciation: @@ -432,7 +431,7 @@ def test_valid_pauses(self): assert is_valid is True # Maximum - is_valid, msg = validate_pause(5000) + is_valid, msg = validate_pause(3000) assert is_valid is True # Mid-range @@ -447,9 +446,9 @@ def test_too_short(self): def test_too_long(self): """Test pause above maximum""" - is_valid, msg = validate_pause(5001) + is_valid, msg = validate_pause(3001) assert is_valid is False - assert "not exceed 5000ms" in msg + assert "not exceed 3000ms" in msg def test_invalid_increment(self): """Test pause not in 100ms increments""" diff --git a/tests/custom/test_topics_intents_v7_compat.py b/tests/custom/test_topics_intents_v7_compat.py new file mode 100644 index 00000000..c670ba45 --- /dev/null +++ b/tests/custom/test_topics_intents_v7_compat.py @@ -0,0 +1,67 @@ +"""Compatibility coverage for the v7 direct Topics and Intents response shape.""" + +import httpx +import respx + +from deepgram import AsyncDeepgramClient, DeepgramClient +from deepgram.environment import DeepgramClientEnvironment +from deepgram.requests import ( + SharedIntentsResultsIntentsParams, + SharedIntentsResultsParams, + SharedTopicsResultsParams, + SharedTopicsResultsTopicsParams, +) +from deepgram.types import ( + SharedIntentsResults, + SharedIntentsResultsIntents, + SharedTopicsResults, + SharedTopicsResultsTopics, +) + +HOST = "compat.deepgram.test" +ENVIRONMENT = DeepgramClientEnvironment( + base=f"https://{HOST}", production=f"wss://{HOST}", agent=f"wss://{HOST}", agent_rest=f"https://{HOST}" +) +TOPICS = {"segments": [{"text": "hello", "start_word": 0.0, "end_word": 0.5, "topics": [{"topic": "greeting", "confidence_score": 0.9}]}]} +INTENTS = {"segments": [{"text": "hello", "start_word": 0.0, "end_word": 0.5, "intents": [{"intent": "greet", "confidence_score": 0.8}]}]} +LISTEN_RESPONSE = { + "metadata": {"request_id": "request", "sha256": "hash", "created": "2026-10-01T00:00:00Z", "duration": 0.5, "channels": 1, "models": ["nova-3"], "model_info": {}}, + "results": {"channels": [], "topics": TOPICS, "intents": INTENTS}, +} +READ_RESPONSE = {"metadata": {}, "results": {"topics": TOPICS, "intents": INTENTS}} + + +def _assert_paths(response) -> None: + assert response.results.topics.segments[0].topics[0].topic == "greeting" + assert response.results.intents.segments[0].intents[0].intent == "greet" + assert response.results.topics.results.topics.segments[0].topics[0].topic == "greeting" + assert response.results.intents.results.intents.segments[0].intents[0].intent == "greet" + + +def test_sync_listen_and_read_preserve_direct_and_legacy_topics_intents_paths() -> None: + with respx.mock: + respx.post(f"https://{HOST}/v1/listen").mock(return_value=httpx.Response(200, json=LISTEN_RESPONSE)) + respx.post(f"https://{HOST}/v1/read").mock(return_value=httpx.Response(200, json=READ_RESPONSE)) + client = DeepgramClient(environment=ENVIRONMENT, api_key="test") + _assert_paths(client.listen.v1.media.transcribe_url(url="https://example.test/audio.wav", topics=True, intents=True)) + _assert_paths(client.read.v1.text.analyze(request={"text": "hello"}, topics=True, intents=True)) + + +async def test_async_listen_and_read_preserve_direct_and_legacy_topics_intents_paths() -> None: + with respx.mock: + respx.post(f"https://{HOST}/v1/listen").mock(return_value=httpx.Response(200, json=LISTEN_RESPONSE)) + respx.post(f"https://{HOST}/v1/read").mock(return_value=httpx.Response(200, json=READ_RESPONSE)) + client = AsyncDeepgramClient(environment=ENVIRONMENT, api_key="test", httpx_client=httpx.AsyncClient()) + _assert_paths(await client.listen.v1.media.transcribe_url(url="https://example.test/audio.wav", topics=True, intents=True)) + _assert_paths(await client.read.v1.text.analyze(request={"text": "hello"}, topics=True, intents=True)) + + +def test_legacy_topics_and_intents_types_and_params_are_importable() -> None: + assert SharedTopicsResults(topics=SharedTopicsResultsTopics(segments=[])).topics.segments == [] + assert SharedIntentsResults(intents=SharedIntentsResultsIntents(segments=[])).intents.segments == [] + topics: SharedTopicsResultsParams = {"topics": {"segments": []}} + intents: SharedIntentsResultsParams = {"intents": {"segments": []}} + topic_segments: SharedTopicsResultsTopicsParams = {"segments": []} + intent_segments: SharedIntentsResultsIntentsParams = {"segments": []} + assert topics["topics"] == topic_segments + assert intents["intents"] == intent_segments diff --git a/tests/manual/speak/v2/controls/main.py b/tests/manual/speak/v2/controls/main.py new file mode 100644 index 00000000..a357fc2d --- /dev/null +++ b/tests/manual/speak/v2/controls/main.py @@ -0,0 +1,64 @@ +"""Live Flux TTS control check. + +Requires ``DEEPGRAM_API_KEY``. Optionally set ``DEEPGRAM_BASE_URL`` to an +HTTP(S) or WS(S) target; the script normalizes the REST and WebSocket targets. +""" + +import asyncio +import os + +from deepgram import AsyncDeepgramClient +from deepgram.core.api_error import ApiError +from deepgram.environment import DeepgramClientEnvironment +from deepgram.speak.v2.types import SpeakV2Speak + + +def _environment() -> DeepgramClientEnvironment: + target = os.environ.get("DEEPGRAM_BASE_URL", "https://api.deepgram.com").rstrip("/") + rest = target.replace("wss://", "https://").replace("ws://", "http://") + websocket = rest.replace("https://", "wss://").replace("http://", "ws://") + print(f"REST target: {rest}/v2/speak") + print(f"WebSocket target: {websocket}/v2/speak") + return DeepgramClientEnvironment(base=rest, production=websocket, agent=websocket, agent_rest=rest) + + +async def _batch(client: AsyncDeepgramClient) -> None: + async for _ in client.speak.v2.audio.generate(model="flux-alexis-en", text="Hello {pause:500}there."): + break + async for _ in client.speak.v2.audio.generate( + model="flux-alexis-en", text='Hello {"word":"Deepgram","pronounce":"diːpɡræm"}.' + ): + break + try: + async for _ in client.speak.v2.audio.generate( + model="flux-alexis-en", text='{"word":"Deepgram","pronounce":"diːpɡræm"}', speed=1.1 + ): + pass + except ApiError as exc: + print(f"Expected batch control rejection: {exc.status_code}") + else: + raise AssertionError("batch speed plus pronunciation should be rejected") + + +async def _streaming(client: AsyncDeepgramClient) -> None: + async with client.speak.v2.connect(model="flux-alexis-en") as connection: + await connection.send_speak(SpeakV2Speak(text='{"word":"Deepgram","pronounce":"diːpɡræm"}')) + await connection.send_flush() + while True: + message = await asyncio.wait_for(connection.recv(), timeout=10) + if getattr(message, "type", None) == "SpeechMetadata": + print(f"Streaming pronunciation controls: {message.controls_applied}") + return + + +async def main() -> None: + if not os.environ.get("DEEPGRAM_API_KEY"): + print("SKIP: DEEPGRAM_API_KEY not set") + return + client = AsyncDeepgramClient(environment=_environment()) + await _batch(client) + await _streaming(client) + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/tests/wire/test_listen_v1_media.py b/tests/wire/test_listen_v1_media.py index e4264985..717cf1d1 100644 --- a/tests/wire/test_listen_v1_media.py +++ b/tests/wire/test_listen_v1_media.py @@ -9,3 +9,93 @@ def test_listen_v1_media_transcribe_url() -> None: url="https://dpgr.am/spacewalk.wav", ) verify_request_count(test_id, "POST", "/v1/listen", None, 1) + + +def test_listen_v1_media_transcribe_url_serializes_all_query_params() -> None: + test_id = "listen.v1.media.transcribe_url.query_params" + client = get_client(test_id) + client.listen.v1.media.transcribe_url( + callback="callback", + callback_method="POST", + extra=["extra"], + sentiment=True, + summarize="v2", + tag=["tag"], + topics=True, + custom_topic=["custom_topic"], + custom_topic_mode="extended", + intents=True, + custom_intent=["custom_intent"], + custom_intent_mode="extended", + detect_entities=True, + detect_language=True, + diarize=True, + diarize_model="latest", + dictation=True, + encoding="linear16", + filler_words=True, + keyterm=["keyterm"], + keywords=["keywords"], + language="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 d46dbc2a..00000000 --- a/tests/wire/test_listen_v1_media.py.bak +++ /dev/null @@ -1,102 +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 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_manage_v1_projects_keys.py b/tests/wire/test_manage_v1_projects_keys.py index 7976bf7d..4b7a8100 100644 --- a/tests/wire/test_manage_v1_projects_keys.py +++ b/tests/wire/test_manage_v1_projects_keys.py @@ -1,5 +1,7 @@ from .conftest import get_client, verify_request_count +from deepgram.requests import CreateKeyV1RequestOneParams + def test_manage_v1_projects_keys_list_() -> None: """Test list endpoint with WireMock""" @@ -23,6 +25,14 @@ def test_manage_v1_projects_keys_create() -> None: verify_request_count(test_id, "POST", "/v1/projects/project_id/keys", None, 1) +def test_manage_v1_projects_keys_create_with_old_request_alias() -> None: + test_id = "manage.v1.projects.keys.create.compat" + client = get_client(test_id) + request: CreateKeyV1RequestOneParams = {"key": "value"} + client.manage.v1.projects.keys.create(project_id="project_id", request=request) + verify_request_count(test_id, "POST", "/v1/projects/project_id/keys", None, 1) + + def test_manage_v1_projects_keys_get() -> None: """Test get endpoint with WireMock""" test_id = "manage.v1.projects.keys.get.0" diff --git a/tests/wire/test_manage_v1_projects_keys.py.bak b/tests/wire/test_manage_v1_projects_keys.py.bak deleted file mode 100644 index db30e0e0..00000000 --- a/tests/wire/test_manage_v1_projects_keys.py.bak +++ /dev/null @@ -1,60 +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..daccaba9 100644 --- a/tests/wire/test_manage_v1_projects_requests.py +++ b/tests/wire/test_manage_v1_projects_requests.py @@ -1,3 +1,5 @@ +import datetime + from .conftest import get_client, verify_request_count @@ -11,6 +13,42 @@ def test_manage_v1_projects_requests_list_() -> None: verify_request_count(test_id, "GET", "/v1/projects/12345678-90ab-cdef-1234-567890abcdef/requests", None, 1) +def test_manage_v1_projects_requests_list_serializes_all_query_params() -> None: + test_id = "manage.v1.projects.requests.list_.query_params" + client = get_client(test_id) + client.manage.v1.projects.requests.list( + project_id="12345678-90ab-cdef-1234-567890abcdef", + start=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), + end=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), + limit=1.1, + page=1.1, + accessor="12345678-1234-1234-1234-123456789012", + request_id="12345678-1234-1234-1234-123456789012", + deployment="hosted", + endpoint="listen", + method="sync", + status="succeeded", + ) + verify_request_count( + test_id, + "GET", + "/v1/projects/12345678-90ab-cdef-1234-567890abcdef/requests", + { + "start": "2024-01-15T09:30:00Z", + "end": "2024-01-15T09:30:00Z", + "limit": "1.1", + "page": "1.1", + "accessor": "12345678-1234-1234-1234-123456789012", + "request_id": "12345678-1234-1234-1234-123456789012", + "deployment": "hosted", + "endpoint": "listen", + "method": "sync", + "status": "succeeded", + }, + 1, + ) + + def test_manage_v1_projects_requests_get() -> None: """Test get endpoint with WireMock""" test_id = "manage.v1.projects.requests.get.0" diff --git a/tests/wire/test_manage_v1_projects_requests.py.bak b/tests/wire/test_manage_v1_projects_requests.py.bak deleted file mode 100644 index f95ac71c..00000000 --- a/tests/wire/test_manage_v1_projects_requests.py.bak +++ /dev/null @@ -1,67 +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 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" - 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 fa0ed20c177fa110607d90317f32b628ed4a8109 Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Thu, 1 Oct 2026 10:47:16 +0100 Subject: [PATCH 05/15] feat: add Flux TTS Controls compatibility --- .../deepgram-python-text-to-speech/SKILL.md | 12 +- .fernignore | 19 ++++ .github/release-please-config.json | 6 +- AGENTS.md | 5 +- docs/FluxTtsControls.md | 8 +- examples/22-text-builder-demo.py | 24 ++-- examples/23-text-builder-helper.py | 33 +++--- examples/24-text-builder-streaming.py | 60 +++------- examples/README.md | 2 +- src/deepgram/core/client_wrapper.py | 2 +- src/deepgram/helpers/README.md | 19 ++-- src/deepgram/helpers/text_builder.py | 107 +++++++++++------- src/deepgram/requests/shared_intents.py | 2 + src/deepgram/requests/shared_topics.py | 2 + .../speak/v2/requests/speak_v2warning.py | 6 +- .../speak/v2/types/speak_v2warning.py | 6 +- src/deepgram/types/shared_intents.py | 28 +++++ src/deepgram/types/shared_topics.py | 28 +++++ .../test_client_construction_and_helpers.py | 11 +- tests/custom/test_flux_tts_controls.py | 39 ++++++- tests/custom/test_text_builder.py | 68 ++++++----- tests/custom/test_topics_intents_v7_compat.py | 23 ++++ tests/manual/speak/v2/controls/main.py | 22 +++- tests/typecheck/compat_aliases.py | 14 ++- 24 files changed, 356 insertions(+), 190 deletions(-) diff --git a/.agents/skills/deepgram-python-text-to-speech/SKILL.md b/.agents/skills/deepgram-python-text-to-speech/SKILL.md index a8fed784..4c558018 100644 --- a/.agents/skills/deepgram-python-text-to-speech/SKILL.md +++ b/.agents/skills/deepgram-python-text-to-speech/SKILL.md @@ -75,9 +75,9 @@ with client.speak.v1.connect( In **sync** mode, `start_listening()` blocks — send all text + flush + close BEFORE calling it, OR run it in a thread. In **async** mode, run `start_listening()` as a task and send concurrently. -## TextBuilder helper (incremental text assembly) +## TextBuilder helper (Flux batch controls) -`deepgram.helpers.TextBuilder` is a hand-maintained helper (NOT Fern-generated) that assembles text incrementally — useful when streaming LLM tokens into TTS. +`deepgram.helpers.TextBuilder` is a hand-maintained helper (NOT Fern-generated) for English Flux batch requests. It is not for WebSocket turns: a pause marker is rejected with `DATA-0002`. ```python from deepgram.helpers import TextBuilder @@ -87,14 +87,14 @@ final_text = ( .text("Hello,") .text(" this is built incrementally.") .pronunciation("Deepgram", "ˈdiːpɡɹæm") - .pause(200) + .pause(500) .build() ) ``` -The fluent API is `.text(...)` (append raw text), `.pronunciation(word, ipa)` (pin pronunciation), `.pause(duration_ms)` (insert a pause), and `.build()` (return the final SSML-ish string). There is no `.add(...)` method. +The fluent API is `.text(...)` (append raw text), `.pronunciation(word, ipa)` (insert a `\\{\"word\": \"...\", \"pronounce\": \"...\"\\}` marker), `.pause(duration_ms)` (insert a `\\{pause:ms\\}` marker), and `.build()` (return the batch request text). Pauses must be 500-3000 ms in 100 ms increments, with at most eight per request. There is no `.add(...)` method. -See `examples/22-text-builder-demo.py`, `examples/23-text-builder-helper.py`, `examples/24-text-builder-streaming.py`. +Use the output with `client.speak.v2.audio.generate(model="flux-alexis-en", text=final_text)`. See `docs/FluxTtsControls.md`, `examples/22-text-builder-demo.py`, and `examples/23-text-builder-helper.py`. ## Async equivalents @@ -149,7 +149,7 @@ WSS client messages: `SpeakV1Text`, `Flush`, `Clear`, `Close`. - `examples/21-text-to-speech-streaming.py` — WSS streaming - `examples/22-text-builder-demo.py` — TextBuilder (no API key) - `examples/23-text-builder-helper.py` — TextBuilder + REST -- `examples/24-text-builder-streaming.py` — TextBuilder + WSS +- `examples/24-text-builder-streaming.py` — plain-text WSS; Flux controls are batch-only - `tests/wire/test_speak_v1_audio.py` — REST wire test - `tests/manual/speak/v1/connect/main.py` — live WSS test diff --git a/.fernignore b/.fernignore index 489d94f5..0beef822 100644 --- a/.fernignore +++ b/.fernignore @@ -40,6 +40,15 @@ src/deepgram/requests/shared_intents_results_intents.py src/deepgram/requests/shared_intents_results_intents_segments_item.py src/deepgram/requests/shared_intents_results_intents_segments_item_intents_item.py +# Generated v7 Topics and Intents compatibility surfaces. These direct models +# and Params retain the deprecated ``results`` construction shape and normalize +# it to generated ``segments`` while preserving the permanent wrappers above. +# [temporarily frozen — remove in the next major after retiring ``results``] +src/deepgram/types/shared_topics.py +src/deepgram/types/shared_intents.py +src/deepgram/requests/shared_topics.py +src/deepgram/requests/shared_intents.py + # WebSocket socket clients: # - except Exception broad catch (supports custom transports, generator narrows to WebSocketException) # - _sanitize_numeric_types in agent socket client (float→int for API) @@ -202,6 +211,16 @@ src/deepgram/core/parse_error.py src/deepgram/core/query_encoder.py +# The generated metadata fallback must match the published SDK version in source +# checkouts and carries a release-please marker so it is updated on release. +# [temporarily frozen — remove when Fern emits a release-managed fallback] +src/deepgram/core/client_wrapper.py + +# Generated Speak V2 Warning files have a local whitespace cleanup. +# [temporarily frozen — remove when Fern emits whitespace-clean docstrings] +src/deepgram/speak/v2/types/speak_v2warning.py +src/deepgram/speak/v2/requests/speak_v2warning.py + # 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 diff --git a/.github/release-please-config.json b/.github/release-please-config.json index dc3946e4..62d993d5 100644 --- a/.github/release-please-config.json +++ b/.github/release-please-config.json @@ -20,9 +20,13 @@ "type": "json", "path": ".fern/metadata.json", "jsonpath": "$.sdkVersion" + }, + { + "type": "generic", + "path": "src/deepgram/core/client_wrapper.py" } ] } }, "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" -} \ No newline at end of file +} diff --git a/AGENTS.md b/AGENTS.md index f25339f1..3c550045 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -73,7 +73,9 @@ 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 the language alias when it is retired in a future major. -- `src/deepgram/types/shared_topics.py`, `src/deepgram/types/shared_intents.py`, and the generated root/type/request barrels — direct Topics and Intents segments plus their generated exports remain Fern-owned, but carry the v7 deprecated `results` facade and re-exports for the hand-written wrappers above. Freeze these generated files during the parent reconciliation; retain all direct generated segments and exports alongside the compatibility surface. +- `src/deepgram/types/shared_topics.py`, `src/deepgram/types/shared_intents.py`, `src/deepgram/requests/shared_topics.py`, `src/deepgram/requests/shared_intents.py`, and the generated root/type/request barrels — direct Topics and Intents segments plus their generated exports remain Fern-owned, but carry the v7 deprecated `results` construction facade and Params shape for the hand-written wrappers above. The models normalize legacy `results.{topics,intents}.segments` input to direct `segments` while preserving direct fields and deprecated read facades. Freeze these generated files during the parent reconciliation; retain all direct generated segments and exports alongside the compatibility surface. +- `src/deepgram/core/client_wrapper.py` — Fern's `runtime_version: true` wrapper correctly uses installed package metadata, but its `PackageNotFoundError` fallback must remain the latest published version for source checkouts, vendored copies, zipapps, and frozen bundles. The fallback carries `# x-release-please-version` and `.github/release-please-config.json` includes the file as a generic extra file, so Release Please updates it with `pyproject.toml` and `.fern/metadata.json`. Unfreeze when Fern emits a release-managed fallback. +- `src/deepgram/speak/v2/types/speak_v2warning.py`, `src/deepgram/speak/v2/requests/speak_v2warning.py` — whitespace cleanup for generated Warning docstrings. Unfreeze when Fern emits whitespace-clean output. - `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. @@ -87,7 +89,6 @@ Files Fern now owns outright, but that carry a caveat worth knowing before the n - `src/deepgram/types/listen_v2eot_threshold.py`, `src/deepgram/requests/deepgram_listen_provider_v2.py` — Fern emits the `eot_threshold=1.0` timeout and ForceEndTurn documentation natively as of the 2026-09-23 regeneration, so the prior temporary documentation patches were removed. -- `src/deepgram/core/client_wrapper.py` — unfrozen in the 2026-08-11 regen. The generator's `runtime_version: true` mode now derives the wire version from `importlib.metadata.version("deepgram-sdk")`, which supersedes the old hand-applied `# x-release-please-version` annotations (its `generic` entry was removed from `.github/release-please-config.json` at the same time, since with the annotations gone it was a no-op). **Caveat:** the `except PackageNotFoundError` fallback is a hardcoded version literal that nothing bumps — release-please's `extra-files` now covers only `pyproject.toml` and `.fern/metadata.json`. It only applies where package metadata is undiscoverable (source checkout on `sys.path`, vendored copy, zipapp, some frozen bundles), and it is refreshed only by the next regen. Accepted deliberately rather than re-freezing the file; if that fallback ever needs to be accurate on those paths, re-add a release-please `generic` entry with an annotation on the fallback line. - `src/deepgram/agent/v1/types/agent_v1latency_report.py` and its `requests/` twin — unfrozen in the 2026-08-11 regen because the spec restored `stt_latency` natively, making the hand-added read-side field redundant. `tests/custom/test_latency_report_stt_compat.py` stays frozen and still guards the field's presence, so a future spec removal is caught rather than silently re-breaking readers. ### Prepare repo for regeneration diff --git a/docs/FluxTtsControls.md b/docs/FluxTtsControls.md index 23969225..a34d0830 100644 --- a/docs/FluxTtsControls.md +++ b/docs/FluxTtsControls.md @@ -1,18 +1,18 @@ # Flux TTS Controls -Flux TTS supports inline pronunciation and pause controls for batch REST synthesis. These controls are English-only at launch. +Flux TTS supports inline pronunciation and pause controls for English batch REST synthesis. ## Batch REST -Use `client.speak.v2.audio.generate()` for complete text. A pause is written as `{pause:500}` through `{pause:3000}` in 100 ms increments. A request accepts at most eight pauses. `TextBuilder` emits and validates this Flux batch syntax. +Use `client.speak.v2.audio.generate()` for complete text. A pause is written as `\\{pause:500ms\\}` through `\\{pause:3000ms\\}` in 100 ms increments. A request accepts at most eight pauses. `TextBuilder` emits and validates this Flux batch syntax. -Pronunciation uses `{"word": "...", "pronounce": ""}` and is Early Access. A pronunciation cannot be combined with any pause or with `speed` other than `1.0`. When a pause is present, `speed` cannot exceed `1.15`. Invalid combinations return a batch error, including `CONTROL_COMBINATION_INVALID` or `PAUSE_SPEED_CAP_EXCEEDED`. +Pronunciation uses `\\{\"word\": \"...\", \"pronounce\": \"\"\\}` and is Early Access. A pronunciation cannot be combined with any pause or with `speed` other than `1.0`. When a pause is present, `speed` cannot exceed `1.15`. Invalid combinations return a batch error, including `CONTROL_COMBINATION_INVALID` or `PAUSE_SPEED_CAP_EXCEEDED`. Read batch control outcomes from raw response headers: `dg-pronunciations-applied`, `dg-breaks-applied`, and `dg-warnings`. Warnings report best-effort pronunciation handling. ## WebSocket -Use `client.speak.v2.connect()` for streaming Flux synthesis. WebSocket turns support pronunciation controls only. A pause marker, or a pronunciation combined with non-default speed, closes the connection with `DATA-0002`. +Use `client.speak.v2.connect()` for streaming Flux synthesis. WebSocket turns support pronunciation controls only. A pause marker such as `\\{pause:500ms\\}`, or a pronunciation marker such as `\\{\"word\": \"...\", \"pronounce\": \"\"\\}` combined with non-default speed, closes the connection with `DATA-0002`. `Configure` changes are buffered. Setting speed while a buffered turn contains pronunciation returns `ConfigureFailure` with `CONTROL_COMBINATION_INVALID`; flush that turn before changing speed. diff --git a/examples/22-text-builder-demo.py b/examples/22-text-builder-demo.py index aa5a026f..a5aa4db6 100644 --- a/examples/22-text-builder-demo.py +++ b/examples/22-text-builder-demo.py @@ -33,7 +33,6 @@ def demo_basic_text_builder(): .text(" twice daily with ") .pronunciation("dupilumab", "duːˈpɪljuːmæb") .text(" injections") - .pause(500) .text(" Do not exceed prescribed dosage.") .build() ) @@ -47,7 +46,6 @@ def demo_basic_text_builder(): .text(" twice daily with ") .pronunciation("dupilumab", "duːˈpɪljuːmæb") .text(" injections") - .pause(500) .text(" Do not exceed prescribed dosage.") .build() ) @@ -76,10 +74,8 @@ def demo_ssml_conversion(): ssml = """ Welcome to your medication guide. - Take azathioprine as prescribed. - Contact your doctor if you experience side effects. """ @@ -95,12 +91,11 @@ def demo_mixed_usage(): """Demonstrate mixing SSML with builder methods""" print_section("4. Mixed SSML + Builder Methods") - ssml = 'Take medicine daily.' + ssml = 'Take medicine daily.' text = ( TextBuilder() .from_ssml(ssml) - .pause(500) .text(" Store at room temperature.") .pause(500) .text(" Keep out of reach of children.") @@ -111,7 +106,6 @@ def demo_mixed_usage(): print(f" {ssml}") print("\nAdded via builder:") - print(" .pause(500)") print(" .text(' Store at room temperature.')") print(" .pause(500)") print(" .text(' Keep out of reach of children.')") @@ -144,8 +138,8 @@ def demo_validation(): is_valid, msg = validate_pause(500) print(f" validate_pause(500): {is_valid}") - is_valid, msg = validate_pause(5000) - print(f" validate_pause(5000): {is_valid}") + is_valid, msg = validate_pause(3000) + print(f" validate_pause(3000): {is_valid}") # Invalid pauses is_valid, msg = validate_pause(400) @@ -168,10 +162,10 @@ def demo_error_handling(): except ValueError as e: print(f" ✓ Caught expected error: {e}") - print("\n▸ Pause limit (50 max)") + print("\n▸ Flux batch pause limit (8 max)") try: builder = TextBuilder() - for i in range(51): + for i in range(9): builder.pause(500) builder.build() except ValueError as e: @@ -202,9 +196,7 @@ def demo_real_world_examples(): TextBuilder() .text("Prescription for ") .pronunciation("lisinopril", "laɪˈsɪnəprɪl") - .pause(500) .text(" Take one tablet daily for hypertension.") - .pause(500) .text(" Common side effects may include ") .pronunciation("hypotension", "ˌhaɪpoʊˈtɛnʃən") .text(" or dizziness.") @@ -218,7 +210,6 @@ def demo_real_world_examples(): .text("Insert the ") .pronunciation("cannula", "ˈkænjʊlə") .text(" at a forty-five degree angle.") - .pause(1000) .text(" Ensure the ") .pronunciation("catheter", "ˈkæθɪtər") .text(" is properly secured.") @@ -233,7 +224,6 @@ def demo_real_world_examples(): .pronunciation("mitochondrial", "ˌmaɪtəˈkɑːndriəl") .text(" function in ") .pronunciation("erythrocytes", "ɪˈrɪθrəsaɪts") - .pause(500) .text(" using advanced imaging.") .build() ) @@ -247,11 +237,11 @@ def demo_api_limits(): print("\n Limit Type Maximum Unit") print(" " + "-" * 60) print(" Pronunciations per request 500 count") - print(" Pauses per request 50 count") + print(" Pauses per request 8 count (Flux batch only)") print(" Total characters 2000 characters*") print(" IPA string length 100 characters") print(" Pause duration (min) 500 milliseconds") - print(" Pause duration (max) 5000 milliseconds") + print(" Pause duration (max) 3000 milliseconds") print(" Pause increment 100 milliseconds") print("\n * Character count excludes pronunciation IPA and control syntax") diff --git a/examples/23-text-builder-helper.py b/examples/23-text-builder-helper.py index 48ab745a..8e8d1e7d 100644 --- a/examples/23-text-builder-helper.py +++ b/examples/23-text-builder-helper.py @@ -1,9 +1,9 @@ #!/usr/bin/env python3 """ -Example: TextBuilder with REST API TTS +Example: TextBuilder with Flux batch REST TTS -This example demonstrates using TextBuilder with the REST API to generate -complete audio files with custom pronunciations and pauses. +This example demonstrates using TextBuilder with English Flux batch REST +synthesis for custom pronunciations and pauses. """ import os @@ -17,16 +17,15 @@ def example_basic_text_builder(): print("Example 1: Basic TextBuilder Usage") print("-" * 50) - # Build text with pronunciations - # Note: .pause() is supported in streaming (WebSocket) mode. - # For REST API, use plain text between pronunciations. + # Pronunciation controls are supported on complete Flux batch requests. text = ( TextBuilder() .text("Take ") .pronunciation("azathioprine", "ˌæzəˈθaɪəpriːn") .text(" twice daily with ") .pronunciation("dupilumab", "duːˈpɪljuːmæb") - .text(" injections. Do not exceed prescribed dosage.") + .text(" injections.") + .text(" Do not exceed prescribed dosage.") .build() ) @@ -38,9 +37,9 @@ def example_basic_text_builder(): client = DeepgramClient(api_key=api_key) # Generate speech with custom pronunciations - response = client.speak.v1.audio.generate( + response = client.speak.v2.audio.generate( text=text, - model="aura-2-asteria-en", + model="flux-alexis-en", encoding="linear16", ) @@ -72,9 +71,9 @@ def example_add_pronunciation_function(): if api_key: client = DeepgramClient(api_key=api_key) - response = client.speak.v1.audio.generate( + response = client.speak.v2.audio.generate( text=text, - model="aura-2-asteria-en", + model="flux-alexis-en", ) with open("output_example2.wav", "wb") as f: @@ -108,9 +107,9 @@ def example_ssml_migration(): if api_key: client = DeepgramClient(api_key=api_key) - response = client.speak.v1.audio.generate( + response = client.speak.v2.audio.generate( text=text, - model="aura-2-asteria-en", + model="flux-alexis-en", ) with open("output_example3.wav", "wb") as f: @@ -145,9 +144,9 @@ def example_mixed_ssml_and_builder(): if api_key: client = DeepgramClient(api_key=api_key) - response = client.speak.v1.audio.generate( + response = client.speak.v2.audio.generate( text=text, - model="aura-2-asteria-en", + model="flux-alexis-en", ) with open("output_example4.wav", "wb") as f: @@ -186,9 +185,9 @@ def example_pharmacy_instructions(): if api_key: client = DeepgramClient(api_key=api_key) - response = client.speak.v1.audio.generate( + response = client.speak.v2.audio.generate( text=text, - model="aura-2-asteria-en", + model="flux-alexis-en", encoding="linear16", ) diff --git a/examples/24-text-builder-streaming.py b/examples/24-text-builder-streaming.py index b3608a00..a2704743 100644 --- a/examples/24-text-builder-streaming.py +++ b/examples/24-text-builder-streaming.py @@ -1,13 +1,12 @@ #!/usr/bin/env python3 """ -Example: TextBuilder with Streaming TTS (WebSocket) +Example: Streaming TTS (WebSocket) -This example demonstrates using TextBuilder with streaming text-to-speech -over WebSocket for real-time audio generation. +This example demonstrates streaming text-to-speech over WebSocket for +real-time audio generation. -The streaming API path shown here focuses on pronunciation controls. Inline -pause tokens are omitted because the WebSocket endpoint may reject them with -DATA-0002 policy violations. +Flux pause controls are batch-only. Do not use `TextBuilder` controls with the +Flux WebSocket: a pause marker is rejected with `DATA-0002`. """ import os @@ -15,29 +14,18 @@ from typing import Union from deepgram import DeepgramClient -from deepgram.helpers import TextBuilder from deepgram.core.events import EventType from deepgram.speak.v1.types import SpeakV1Text SpeakV1SocketClientResponse = Union[str, bytes] -def example_streaming_with_textbuilder(): - """Stream TTS audio using TextBuilder for pronunciation control""" - print("Example: Streaming TTS with TextBuilder") +def example_streaming(): + """Stream TTS audio without Flux batch-only controls.""" + print("Example: Streaming TTS") print("-" * 50) - # Build text with pronunciations and pauses - text = ( - TextBuilder() - .text("Take ") - .pronunciation("azathioprine", "ˌæzəˈθaɪəpriːn") - .text(" twice daily with ") - .pronunciation("dupilumab", "duːˈpɪljuːmæb") - .text(" injections.") - .text(" Do not exceed prescribed dosage.") - .build() - ) + text = "Take your medicine twice daily. Do not exceed the prescribed dosage." print(f"Generated text: {text}\n") @@ -71,7 +59,7 @@ def on_message(message: SpeakV1SocketClientResponse) -> None: connection.on(EventType.CLOSE, lambda _: (print("✓ Connection closed"), closed_event.set())) connection.on(EventType.ERROR, lambda error: print(f"✗ Error: {error}")) - # Send the TextBuilder-generated text + # Send plain text; Flux controls are batch-only. connection.send_text(SpeakV1Text(text=text)) # Flush to ensure all text is processed @@ -89,30 +77,14 @@ def on_message(message: SpeakV1SocketClientResponse) -> None: def example_multiple_messages(): - """Stream multiple TextBuilder messages sequentially""" + """Stream multiple plain-text messages sequentially.""" print("\n\nExample: Multiple Messages with Streaming") print("-" * 50) - # Build multiple text segments - intro = TextBuilder().text("Welcome to your medication guide.").build() - - instruction1 = ( - TextBuilder() - .text("First, take ") - .pronunciation("methotrexate", "mɛθəˈtrɛkseɪt") - .text(" on Mondays.") - .build() - ) - - instruction2 = ( - TextBuilder() - .text("Then, inject ") - .pronunciation("adalimumab", "ˌædəˈljuːməb") - .text(" on Fridays.") - .build() - ) - - closing = TextBuilder().text("Contact your doctor with any questions.").build() + intro = "Welcome to your medication guide." + instruction1 = "First, take your medicine on Mondays." + instruction2 = "Then, follow your injection schedule on Fridays." + closing = "Contact your doctor with any questions." api_key = os.getenv("DEEPGRAM_API_KEY") if not api_key: @@ -171,7 +143,7 @@ def main(): if os.path.exists("streaming_multi.raw"): os.remove("streaming_multi.raw") - example_streaming_with_textbuilder() + example_streaming() example_multiple_messages() print("\n" + "=" * 50) diff --git a/examples/README.md b/examples/README.md index a8cb771b..4a9137d9 100644 --- a/examples/README.md +++ b/examples/README.md @@ -27,7 +27,7 @@ This directory contains comprehensive examples demonstrating how to use the Deep - **21-text-to-speech-streaming.py** - Streaming TTS via WebSocket - **22-text-builder-demo.py** - TextBuilder demo (no API key required) - **23-text-builder-helper.py** - TextBuilder with REST API generation -- **24-text-builder-streaming.py** - TextBuilder with streaming TTS (WebSocket) +- **24-text-builder-streaming.py** - Streaming TTS via WebSocket (no Flux controls) - **25-text-to-speech-streaming-v2.py** - Streaming TTS via the Speak V2 (Flux) WebSocket ### 30-39: Voice Agent diff --git a/src/deepgram/core/client_wrapper.py b/src/deepgram/core/client_wrapper.py index 856d14d6..c0911628 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.11.1" + _sdk_version = "7.11.0" # x-release-please-version headers: typing.Dict[str, str] = { "User-Agent": "deepgram-sdk/" + _sdk_version, diff --git a/src/deepgram/helpers/README.md b/src/deepgram/helpers/README.md index b790bd16..0120fac5 100644 --- a/src/deepgram/helpers/README.md +++ b/src/deepgram/helpers/README.md @@ -4,7 +4,7 @@ This module contains custom helper utilities for working with Deepgram APIs that ## TextBuilder -The `TextBuilder` class provides a fluent interface for constructing Text-to-Speech (TTS) text with pronunciation and pause controls. +The `TextBuilder` class provides a fluent interface for constructing English Flux batch TTS text with pronunciation and pause controls. Do not use its controls with a Flux WebSocket request: pauses are rejected with `DATA-0002`. ### Quick Example @@ -17,14 +17,13 @@ text = ( TextBuilder() .text("Take ") .pronunciation("azathioprine", "ˌæzəˈθaɪəpriːn") - .pause(500) .text(" twice daily.") .build() ) -# Use with Deepgram TTS +# Use with English Flux batch TTS client = DeepgramClient(api_key="YOUR_API_KEY") -response = client.speak.v1.generate(text, model="aura-asteria-en") +audio = client.speak.v2.audio.generate(model="flux-alexis-en", text=text) ``` ### Available Functions @@ -32,25 +31,25 @@ response = client.speak.v1.generate(text, model="aura-asteria-en") #### TextBuilder Class - `text(content: str)` - Add plain text -- `pronunciation(word: str, ipa: str)` - Add word with IPA pronunciation -- `pause(duration_ms: int)` - Add pause (500-5000ms, 100ms increments) +- `pronunciation(word: str, ipa: str)` - Add an escaped `\\{\"word\": \"...\", \"pronounce\": \"...\"\\}` IPA pronunciation control +- `pause(duration_ms: int)` - Add a batch-only `\\{pause:ms\\}` pause (500-3000ms, 100ms increments; eight per request) - `from_ssml(ssml_text: str)` - Parse and convert SSML markup - `build()` - Return final formatted text #### Standalone Functions -- `add_pronunciation(text, word, ipa)` - Replace word with pronunciation -- `ssml_to_deepgram(ssml_text)` - Convert SSML to Deepgram format +- `add_pronunciation(text, word, ipa)` - Replace a word with an escaped pronunciation control +- `ssml_to_deepgram(ssml_text)` - Convert SSML to escaped Deepgram controls - `validate_ipa(ipa)` - Validate IPA pronunciation string - `validate_pause(duration_ms)` - Validate pause duration ### Documentation -See [TextBuilder-Guide.md](../../../docs/TextBuilder-Guide.md) for comprehensive documentation. +See [FluxTtsControls.md](../../../docs/FluxTtsControls.md) for control combinations, English-only batch support, and WebSocket restrictions. ### Examples -See [examples/25-text-builder-helper.py](../../../examples/25-text-builder-helper.py) for usage examples. +See [23-text-builder-helper.py](../../../examples/23-text-builder-helper.py) for a batch example and [the live controls check](../../../tests/manual/speak/v2/controls/main.py) for server validation. ## Future Helpers diff --git a/src/deepgram/helpers/text_builder.py b/src/deepgram/helpers/text_builder.py index b44cdc62..8f49a59e 100644 --- a/src/deepgram/helpers/text_builder.py +++ b/src/deepgram/helpers/text_builder.py @@ -9,6 +9,13 @@ import re from typing import Tuple +PAUSE_PATTERN = re.escape(r"\{pause:") + r"(\d+)ms" + re.escape(r"\}") +PRONUNCIATION_PATTERN = ( + re.escape(r"\{") + + r'"word":\s*"(?:[^"\\]|\\.)*",\s*"pronounce":\s*"(?:[^"\\]|\\.)*"' + + re.escape(r"\}") +) + class TextBuilder: """ @@ -21,7 +28,6 @@ class TextBuilder: .text(" twice daily with ") \\ .pronunciation("dupilumab", "duːˈpɪljuːmæb") \\ .text(" injections") \\ - .pause(500) \\ .text(" Do not exceed prescribed dosage.") \\ .build() """ @@ -44,14 +50,22 @@ def text(self, content: str) -> "TextBuilder": Self for method chaining """ if content: + pronunciation_count, pause_count = _control_counts(content) + _validate_pause_controls(content) + if self._pronunciation_count + pronunciation_count > 500: + raise ValueError("Maximum 500 pronunciations per request exceeded") + if self._pause_count + pause_count > 8: + raise ValueError("Maximum 8 pauses per Flux batch request exceeded") self._parts.append(content) - self._char_count += len(content) + self._pronunciation_count += pronunciation_count + self._pause_count += pause_count + self._char_count += len(_strip_controls(content)) return self def pronunciation(self, word: str, ipa: str) -> "TextBuilder": """ Add a word with custom pronunciation. - Formats as: {"word": "word", "pronounce":"ipa"} + Formats as: \\{\"word\": \"word\", \"pronounce\": \"ipa\"\\} Returns self for chaining. Args: @@ -73,9 +87,7 @@ def pronunciation(self, word: str, ipa: str) -> "TextBuilder": if self._pronunciation_count >= 500: raise ValueError("Maximum 500 pronunciations per request exceeded") - # Format as JSON (ensure proper escaping) - pronunciation_json = json.dumps({"word": word, "pronounce": ipa}, ensure_ascii=False) - self._parts.append(pronunciation_json) + self._parts.append(_pronunciation_control(word, ipa)) self._pronunciation_count += 1 self._char_count += len(word) # Count original word, not IPA @@ -84,7 +96,7 @@ def pronunciation(self, word: str, ipa: str) -> "TextBuilder": def pause(self, duration_ms: int) -> "TextBuilder": """ Add a pause in milliseconds. - Formats as: {pause:duration_ms} + Formats as: \\{pause:ms\\} Valid range: 500-3000ms in 100ms increments. Flux batch accepts at most eight pauses per request; WebSocket synthesis does not support pauses. Returns self for chaining. @@ -107,8 +119,7 @@ def pause(self, duration_ms: int) -> "TextBuilder": if self._pause_count >= 8: raise ValueError("Maximum 8 pauses per Flux batch request exceeded") - # Format as JSON-style pause marker - self._parts.append(f"{{pause:{duration_ms}}}") + self._parts.append(f"\\{{pause:{duration_ms}ms\\}}") self._pause_count += 1 return self @@ -131,28 +142,23 @@ def from_ssml(self, ssml_text: str) -> "TextBuilder": # Convert SSML to Deepgram format and append converted = ssml_to_deepgram(ssml_text) if converted: + pronunciation_count, pause_count = _control_counts(converted) + if self._pronunciation_count + pronunciation_count > 500: + raise ValueError("Maximum 500 pronunciations per request exceeded") + if self._pause_count + pause_count > 8: + raise ValueError("Maximum 8 pauses per Flux batch request exceeded") self._parts.append(converted) - # Update counters by parsing the converted text self._update_counts_from_text(converted) return self def _update_counts_from_text(self, text: str) -> None: """Update internal counters from parsed text.""" - # Count pronunciations (JSON objects with "word" and "pronounce") - pronunciation_pattern = r'\{"word":\s*"[^"]*",\s*"pronounce":\s*"[^"]*"\}' - pronunciations = re.findall(pronunciation_pattern, text) - self._pronunciation_count += len(pronunciations) - - # Count pauses - pause_pattern = r"\{pause:\d+\}" - pauses = re.findall(pause_pattern, text) - self._pause_count += len(pauses) + pronunciation_count, pause_count = _control_counts(text) + self._pronunciation_count += pronunciation_count + self._pause_count += pause_count - # Character count (approximate - remove control syntax) - clean_text = re.sub(pronunciation_pattern, "", text) - clean_text = re.sub(pause_pattern, "", clean_text) - self._char_count += len(clean_text) + self._char_count += len(_strip_controls(text)) def build(self) -> str: """ @@ -183,7 +189,7 @@ def add_pronunciation(text: str, word: str, ipa: str) -> str: ipa: IPA pronunciation string Returns: - Text with word replaced by {"word": "word", "pronounce":"ipa"} + Text with word replaced by \\{\"word\": \"word\", \"pronounce\": \"ipa\"\\} Example: text = "Take azathioprine twice daily with dupilumab injections." @@ -195,16 +201,37 @@ def add_pronunciation(text: str, word: str, ipa: str) -> str: if not is_valid: raise ValueError(error_msg) - # Create pronunciation JSON - pronunciation_json = json.dumps({"word": word, "pronounce": ipa}, ensure_ascii=False) + pronunciation_control = _pronunciation_control(word, ipa) # Replace word with pronunciation (case-sensitive, whole word only) pattern = r"\b" + re.escape(word) + r"\b" - result = re.sub(pattern, pronunciation_json, text, count=1) + result = re.sub(pattern, lambda _: pronunciation_control, text, count=1) return result +def _control_counts(text: str) -> Tuple[int, int]: + """Count inline controls emitted by this helper.""" + return len(re.findall(PRONUNCIATION_PATTERN, text)), len(re.findall(PAUSE_PATTERN, text)) + + +def _validate_pause_controls(text: str) -> None: + for duration in re.findall(PAUSE_PATTERN, text): + is_valid, error_msg = validate_pause(int(duration)) + if not is_valid: + raise ValueError(error_msg) + + +def _strip_controls(text: str) -> str: + return re.sub(PAUSE_PATTERN, "", re.sub(PRONUNCIATION_PATTERN, "", text)) + + +def _pronunciation_control(word: str, ipa: str) -> str: + """Format an inline pronunciation control using Flux's escaped delimiters.""" + pronunciation_json = json.dumps({"word": word, "pronounce": ipa}, ensure_ascii=False) + return "\\" + pronunciation_json[:-1] + r"\}" + + def ssml_to_deepgram(ssml_text: str) -> str: """ Convert SSML markup to Deepgram's inline JSON format. @@ -253,7 +280,7 @@ def replace_phoneme(match): if alphabet_match is None or ph_match is None: return word ipa = ph_match.group(2) - return json.dumps({"word": word, "pronounce": ipa}, ensure_ascii=False) + return _pronunciation_control(word, ipa) ssml_text = re.sub(phoneme_pattern, replace_phoneme, ssml_text) @@ -264,26 +291,28 @@ def replace_break(match): value = float(match.group(1)) unit = match.group(2) - # Convert to milliseconds - if unit == "s": - duration_ms = int(value * 1000) - else: - duration_ms = int(value) - - # Validate + duration_ms = value * 1000 if unit == "s" else value + if not duration_ms.is_integer(): + raise ValueError("Pause duration must be in 100ms increments") + duration_ms = int(duration_ms) is_valid, error_msg = validate_pause(duration_ms) if not is_valid: - # Round to nearest valid value - duration_ms = max(500, min(3000, round(duration_ms / 100) * 100)) + raise ValueError(error_msg) - return f"{{pause:{duration_ms}}}" + return f"\\{{pause:{duration_ms}ms\\}}" ssml_text = re.sub(break_pattern, replace_break, ssml_text) # Remove any remaining XML tags ssml_text = re.sub(r"<[^>]+>", "", ssml_text) - return ssml_text.strip() + ssml_text = ssml_text.strip() + pronunciation_count, pause_count = _control_counts(ssml_text) + if pronunciation_count > 500: + raise ValueError("Maximum 500 pronunciations per request exceeded") + if pause_count > 8: + raise ValueError("Maximum 8 pauses per Flux batch request exceeded") + return ssml_text def validate_ipa(ipa: str) -> Tuple[bool, str]: diff --git a/src/deepgram/requests/shared_intents.py b/src/deepgram/requests/shared_intents.py index 7a618c13..8f699d26 100644 --- a/src/deepgram/requests/shared_intents.py +++ b/src/deepgram/requests/shared_intents.py @@ -3,6 +3,7 @@ import typing import typing_extensions +from .shared_intents_results import SharedIntentsResultsParams from .shared_intents_segments_item import SharedIntentsSegmentsItemParams @@ -12,3 +13,4 @@ class SharedIntentsParams(typing_extensions.TypedDict): """ segments: typing_extensions.NotRequired[typing.Sequence[SharedIntentsSegmentsItemParams]] + results: typing_extensions.NotRequired[SharedIntentsResultsParams] diff --git a/src/deepgram/requests/shared_topics.py b/src/deepgram/requests/shared_topics.py index 4965005e..88c0816d 100644 --- a/src/deepgram/requests/shared_topics.py +++ b/src/deepgram/requests/shared_topics.py @@ -3,6 +3,7 @@ import typing import typing_extensions +from .shared_topics_results import SharedTopicsResultsParams from .shared_topics_segments_item import SharedTopicsSegmentsItemParams @@ -12,3 +13,4 @@ class SharedTopicsParams(typing_extensions.TypedDict): """ segments: typing_extensions.NotRequired[typing.Sequence[SharedTopicsSegmentsItemParams]] + results: typing_extensions.NotRequired[SharedTopicsResultsParams] diff --git a/src/deepgram/speak/v2/requests/speak_v2warning.py b/src/deepgram/speak/v2/requests/speak_v2warning.py index e16df4d6..1e45003f 100644 --- a/src/deepgram/speak/v2/requests/speak_v2warning.py +++ b/src/deepgram/speak/v2/requests/speak_v2warning.py @@ -14,11 +14,11 @@ class SpeakV2WarningParams(typing_extensions.TypedDict): code: str """ Warning code identifying the condition, in `SCREAMING_SNAKE_CASE`. - + Turn-scoped codes: `NO_ACTIVE_SPEECH` (a speech-scoped message arrived with no active turn), `NO_SYNTHESIZABLE_TEXT` (the turn's text was entirely whitespace or punctuation, so it produced no audio and is completed with a zero-duration `SpeechMetadata`), and `SYNTHESIS_RETRYING` (a synthesis request failed and is being retried). - + Pronunciation codes: `PRONUNCIATION_WARNINGS` (a pronunciation override contained invalid IPA; it is still applied best-effort and counted in `pronunciations_applied`), `PRONUNCIATION_TOO_LONG` (an IPA string exceeded the length limit), `PRONUNCIATIONS_LIMIT_EXCEEDED` (too many pronunciation controls in one turn). - + Pause codes (`BREAKS_LIMIT_EXCEEDED`, `BREAK_TOKENS_OUT_OF_RANGE`, `BREAK_TOKENS_WITH_INVALID_INCREMENTS`) are reserved and not emitted: inline pause controls are batch-only, and a pause marker on the WebSocket fails the connection instead. Interrupt-scoped codes, each meaning the `Interrupt` was ignored: `NO_AUDIO_GENERATED` (the session has produced no audio yet, so there is nothing to interrupt), `INTERRUPT_IN_PROGRESS` (an earlier `Interrupt` is still being processed — at most one is handled at a time), `INVALID_INTERRUPT_OFFSET` (the `playback_offset` did not advance past the position a prior interrupt established). diff --git a/src/deepgram/speak/v2/types/speak_v2warning.py b/src/deepgram/speak/v2/types/speak_v2warning.py index e142f323..47c92674 100644 --- a/src/deepgram/speak/v2/types/speak_v2warning.py +++ b/src/deepgram/speak/v2/types/speak_v2warning.py @@ -16,11 +16,11 @@ class SpeakV2Warning(UncheckedBaseModel): code: str = pydantic.Field() """ Warning code identifying the condition, in `SCREAMING_SNAKE_CASE`. - + Turn-scoped codes: `NO_ACTIVE_SPEECH` (a speech-scoped message arrived with no active turn), `NO_SYNTHESIZABLE_TEXT` (the turn's text was entirely whitespace or punctuation, so it produced no audio and is completed with a zero-duration `SpeechMetadata`), and `SYNTHESIS_RETRYING` (a synthesis request failed and is being retried). - + Pronunciation codes: `PRONUNCIATION_WARNINGS` (a pronunciation override contained invalid IPA; it is still applied best-effort and counted in `pronunciations_applied`), `PRONUNCIATION_TOO_LONG` (an IPA string exceeded the length limit), `PRONUNCIATIONS_LIMIT_EXCEEDED` (too many pronunciation controls in one turn). - + Pause codes (`BREAKS_LIMIT_EXCEEDED`, `BREAK_TOKENS_OUT_OF_RANGE`, `BREAK_TOKENS_WITH_INVALID_INCREMENTS`) are reserved and not emitted: inline pause controls are batch-only, and a pause marker on the WebSocket fails the connection instead. Interrupt-scoped codes, each meaning the `Interrupt` was ignored: `NO_AUDIO_GENERATED` (the session has produced no audio yet, so there is nothing to interrupt), `INTERRUPT_IN_PROGRESS` (an earlier `Interrupt` is still being processed — at most one is handled at a time), `INVALID_INTERRUPT_OFFSET` (the `playback_offset` did not advance past the position a prior interrupt established). diff --git a/src/deepgram/types/shared_intents.py b/src/deepgram/types/shared_intents.py index 1a2c3790..1be489bc 100644 --- a/src/deepgram/types/shared_intents.py +++ b/src/deepgram/types/shared_intents.py @@ -23,9 +23,37 @@ def results(self) -> SharedIntentsResults: return SharedIntentsResults(intents=SharedIntentsResultsIntents(segments=self.segments)) if IS_PYDANTIC_V2: + + @pydantic.model_validator(mode="before") + @classmethod + def _migrate_legacy_results(cls, values: typing.Any) -> typing.Any: + if not isinstance(values, dict) or "results" not in values: + return values + values = dict(values) + results = values.pop("results") + if "segments" in values: + return values + intents = results.get("intents") if isinstance(results, dict) else getattr(results, "intents", None) + if intents is not None: + values["segments"] = intents.get("segments") if isinstance(intents, dict) else intents.segments + return values + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: + @pydantic.root_validator(pre=True) # type: ignore[deprecated] + def _migrate_legacy_results(cls, values: typing.Any) -> typing.Any: # type: ignore[no-redef] + if not isinstance(values, dict) or "results" not in values: + return values + values = dict(values) + results = values.pop("results") + if "segments" in values: + return values + intents = results.get("intents") if isinstance(results, dict) else getattr(results, "intents", None) + if intents is not None: + values["segments"] = intents.get("segments") if isinstance(intents, dict) else intents.segments + return values + class Config: frozen = True smart_union = True diff --git a/src/deepgram/types/shared_topics.py b/src/deepgram/types/shared_topics.py index 06c07db7..9f752bda 100644 --- a/src/deepgram/types/shared_topics.py +++ b/src/deepgram/types/shared_topics.py @@ -23,9 +23,37 @@ def results(self) -> SharedTopicsResults: return SharedTopicsResults(topics=SharedTopicsResultsTopics(segments=self.segments)) if IS_PYDANTIC_V2: + + @pydantic.model_validator(mode="before") + @classmethod + def _migrate_legacy_results(cls, values: typing.Any) -> typing.Any: + if not isinstance(values, dict) or "results" not in values: + return values + values = dict(values) + results = values.pop("results") + if "segments" in values: + return values + topics = results.get("topics") if isinstance(results, dict) else getattr(results, "topics", None) + if topics is not None: + values["segments"] = topics.get("segments") if isinstance(topics, dict) else topics.segments + return values + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: + @pydantic.root_validator(pre=True) # type: ignore[deprecated] + def _migrate_legacy_results(cls, values: typing.Any) -> typing.Any: # type: ignore[no-redef] + if not isinstance(values, dict) or "results" not in values: + return values + values = dict(values) + results = values.pop("results") + if "segments" in values: + return values + topics = results.get("topics") if isinstance(results, dict) else getattr(results, "topics", None) + if topics is not None: + values["segments"] = topics.get("segments") if isinstance(topics, dict) else topics.segments + return values + class Config: frozen = True smart_union = True diff --git a/tests/custom/test_client_construction_and_helpers.py b/tests/custom/test_client_construction_and_helpers.py index cef2273d..e92831f4 100644 --- a/tests/custom/test_client_construction_and_helpers.py +++ b/tests/custom/test_client_construction_and_helpers.py @@ -89,7 +89,7 @@ def test_text_builder_fluent_build() -> None: .text(" daily.") .build() ) - assert "pronounce" in text and "{pause:500}" in text + assert "pronounce" in text and r"\{pause:500ms\}" in text def test_text_builder_validation_errors() -> None: @@ -118,13 +118,12 @@ def test_add_pronunciation_and_ssml() -> None: ssml = 'Take azathioprine now' converted = ssml_to_deepgram(ssml) - assert "pronounce" in converted and "{pause:500}" in converted + assert "pronounce" in converted and r"\{pause:500ms\}" in converted - # break in milliseconds + an out-of-range value that gets rounded to a valid one - rounded = ssml_to_deepgram('Wait here') - assert "{pause:" in rounded + with pytest.raises(ValueError, match="at least 500ms"): + ssml_to_deepgram('Wait here') def test_text_builder_from_ssml_updates_counts() -> None: builder = TextBuilder().from_ssml('Hi there') - assert "{pause:500}" in builder.build() + assert r"\{pause:500ms\}" in builder.build() diff --git a/tests/custom/test_flux_tts_controls.py b/tests/custom/test_flux_tts_controls.py index 091481d0..52120ef4 100644 --- a/tests/custom/test_flux_tts_controls.py +++ b/tests/custom/test_flux_tts_controls.py @@ -3,10 +3,13 @@ import json import httpx +import pytest import respx from deepgram import DeepgramClient +from deepgram.core.api_error import ApiError from deepgram.environment import DeepgramClientEnvironment +from deepgram.helpers import TextBuilder from deepgram.speak.v2.socket_client import V2SocketClient from deepgram.speak.v2.types import SpeakV2ConfigureFailure, SpeakV2SpeechMetadata, SpeakV2Warning @@ -29,22 +32,50 @@ def test_batch_raw_response_exposes_control_headers_and_serializes_controls() -> route = respx.post(f"https://{HOST}/v2/speak").mock( return_value=httpx.Response( 200, - headers={"dg-pronunciations-applied": "1", "dg-breaks-applied": "1", "dg-warnings": "PRON-001"}, + headers={"dg-pronunciations-applied": "1", "dg-breaks-applied": "0", "dg-warnings": "PRON-001"}, content=b"audio", ) ) + text = TextBuilder().text("Hello ").pronunciation("Deepgram", "diːpɡræm").text(".").build() with DeepgramClient(environment=ENVIRONMENT, api_key="test").speak.v2.audio.with_raw_response.generate( - model="flux-alexis-en", text='Hello {"word":"Deepgram","pronounce":"diːpɡræm"}' + model="flux-alexis-en", text=text ) as response: assert b"".join(response.data) == b"audio" assert response.headers["dg-pronunciations-applied"] == "1" - assert response.headers["dg-breaks-applied"] == "1" + assert response.headers["dg-breaks-applied"] == "0" assert response.headers["dg-warnings"] == "PRON-001" assert json.loads(route.calls.last.request.content) == { - "text": 'Hello {"word":"Deepgram","pronounce":"diːpɡræm"}' + "text": r'Hello \{"word": "Deepgram", "pronounce": "diːpɡræm"\}.' } +def test_batch_speed_with_pronunciation_raises_control_combination_error() -> None: + with respx.mock: + route = respx.post(f"https://{HOST}/v2/speak").mock( + return_value=httpx.Response( + 400, + json={ + "err_code": "CONTROL_COMBINATION_INVALID", + "err_msg": "pronunciation controls require speed 1.0", + }, + ) + ) + text = TextBuilder().pronunciation("Deepgram", "diːpɡræm").build() + with pytest.raises(ApiError) as excinfo: + list( + DeepgramClient(environment=ENVIRONMENT, api_key="test").speak.v2.audio.generate( + model="flux-alexis-en", text=text, speed=1.1 + ) + ) + + assert excinfo.value.status_code == 400 + assert excinfo.value.body["err_code"] == "CONTROL_COMBINATION_INVALID" + assert json.loads(route.calls.last.request.content) == { + "text": r'\{"word": "Deepgram", "pronounce": "diːpɡræm"\}' + } + assert route.calls.last.request.url.params["speed"] == "1.1" + + def test_streaming_control_failure_warning_and_counters_parse() -> None: configure = V2SocketClient( websocket=_FakeWebSocket( diff --git a/tests/custom/test_text_builder.py b/tests/custom/test_text_builder.py index 559a86ee..bd180d77 100644 --- a/tests/custom/test_text_builder.py +++ b/tests/custom/test_text_builder.py @@ -32,8 +32,7 @@ def test_pronunciation(self): """Test adding pronunciation""" builder = TextBuilder() result = builder.pronunciation("azathioprine", "ˌæzəˈθaɪəpriːn").build() - assert '"word": "azathioprine"' in result - assert '"pronounce": "ˌæzəˈθaɪəpriːn"' in result + assert result == r'\{"word": "azathioprine", "pronounce": "ˌæzəˈθaɪəpriːn"\}' def test_text_with_pronunciation(self): """Test mixing text and pronunciation""" @@ -53,7 +52,7 @@ def test_pause(self): """Test adding pause""" builder = TextBuilder() result = builder.pause(500).build() - assert result == "{pause:500}" + assert result == r"\{pause:500ms\}" def test_text_with_pause(self): """Test mixing text and pause""" @@ -65,7 +64,7 @@ def test_text_with_pause(self): .text("world") .build() ) - assert result == "Hello{pause:1000}world" + assert result == r"Hello\{pause:1000ms\}world" def test_complex_chain(self): """Test complex chaining with all features""" @@ -87,7 +86,7 @@ def test_complex_chain(self): assert " twice daily with " in result assert '"word": "dupilumab"' in result assert " injections" in result - assert "{pause:500}" in result + assert r"\{pause:500ms\}" in result assert " Do not exceed prescribed dosage." in result def test_pronunciation_limit(self): @@ -111,6 +110,19 @@ def test_pause_limit(self): with pytest.raises(ValueError, match="Maximum 8 pauses"): builder.pause(500) + + def test_text_enforces_embedded_control_limits(self): + builder = TextBuilder().text(r"\{pause:500ms\}" * 8) + with pytest.raises(ValueError, match="Maximum 8 pauses"): + builder.text(r"\{pause:500ms\}") + with pytest.raises(ValueError, match="100ms increments"): + TextBuilder().text(r"\{pause:550ms\}") + + def test_text_enforces_embedded_pronunciation_limit(self): + pronunciation = r'\{"word": "word", "pronounce": "test"\}' + builder = TextBuilder().text(pronunciation * 500) + with pytest.raises(ValueError, match="Maximum 500 pronunciations"): + builder.text(pronunciation) def test_character_limit(self): """Test character count validation (2000 max)""" @@ -168,12 +180,12 @@ def test_pause_boundary_values(self): # Minimum valid result1 = builder.pause(500).build() - assert "{pause:500}" in result1 + assert r"\{pause:500ms\}" in result1 # Maximum valid builder2 = TextBuilder() result2 = builder2.pause(3000).build() - assert "{pause:3000}" in result2 + assert r"\{pause:3000ms\}" in result2 class TestAddPronunciation: @@ -184,10 +196,7 @@ def test_basic_replacement(self): text = "Take azathioprine twice daily." result = add_pronunciation(text, "azathioprine", "ˌæzəˈθaɪəpriːn") - assert '"word": "azathioprine"' in result - assert '"pronounce": "ˌæzəˈθaɪəpriːn"' in result - assert "Take " in result - assert " twice daily." in result + assert result == r'Take \{"word": "azathioprine", "pronounce": "ˌæzəˈθaɪəpriːn"\} twice daily.' def test_multiple_replacements(self): """Test replacing multiple words""" @@ -234,8 +243,7 @@ def test_basic_phoneme(self): ssml = 'azathioprine' result = ssml_to_deepgram(ssml) - assert '"word": "azathioprine"' in result - assert '"pronounce": "ˌæzəˈθaɪəpriːn"' in result + assert result == r'\{"word": "azathioprine", "pronounce": "ˌæzəˈθaɪəpriːn"\}' def test_phoneme_attribute_order_independent(self): """ph before alphabet must work too (SSML attribute order is not significant)""" @@ -284,14 +292,14 @@ def test_basic_break(self): ssml = '' result = ssml_to_deepgram(ssml) - assert result == "{pause:500}" + assert result == r"\{pause:500ms\}" def test_break_seconds(self): """Test converting break tag (seconds)""" ssml = '' result = ssml_to_deepgram(ssml) - assert result == "{pause:500}" + assert result == r"\{pause:500ms\}" def test_speak_wrapper(self): """Test handling wrapper tag""" @@ -309,7 +317,7 @@ def test_complex_ssml(self): result = ssml_to_deepgram(ssml) assert '"word": "azathioprine"' in result - assert "{pause:500}" in result + assert r"\{pause:500ms\}" in result assert "Do not exceed dosage." in result def test_multiple_phonemes(self): @@ -329,12 +337,10 @@ def test_plain_text(self): assert result == text def test_break_out_of_range(self): - """Test break with out-of-range duration (should round to valid)""" + """SSML breaks must meet the Flux batch duration contract.""" ssml = '' - result = ssml_to_deepgram(ssml) - - # Should round to nearest valid value (500ms) - assert "{pause:" in result + with pytest.raises(ValueError, match="at least 500ms"): + ssml_to_deepgram(ssml) class TestFromSsml: @@ -361,7 +367,7 @@ def test_from_ssml_with_additional_text(self): ) assert '"word": "medicine"' in result - assert "{pause:500}" in result + assert r"\{pause:500ms\}" in result assert "Do not exceed dosage." in result def test_from_ssml_counts_pronunciations(self): @@ -380,6 +386,16 @@ def test_from_ssml_counts_pronunciations(self): with pytest.raises(ValueError, match="Maximum 500 pronunciations"): builder.pronunciation("extra", "test") + def test_from_ssml_enforces_pause_limit(self): + ssml = '' * 9 + with pytest.raises(ValueError, match="Maximum 8 pauses"): + TextBuilder().from_ssml(ssml) + + def test_from_ssml_enforces_pronunciation_limit(self): + ssml = "".join('word' for _ in range(501)) + with pytest.raises(ValueError, match="Maximum 500 pronunciations"): + TextBuilder().from_ssml(ssml) + class TestValidateIpa: """Tests for IPA validation""" @@ -488,7 +504,7 @@ def test_medical_example(self): assert '"word": "dupilumab"' in text assert '"pronounce": "duːˈpɪljuːmæb"' in text assert " injections" in text - assert "{pause:500}" in text + assert r"\{pause:500ms\}" in text assert " Do not exceed prescribed dosage." in text def test_ssml_migration(self): @@ -506,9 +522,9 @@ def test_ssml_migration(self): # Both should produce similar results assert '"word": "azathioprine"' in text1 - assert "{pause:500}" in text1 + assert r"\{pause:500ms\}" in text1 assert '"word": "azathioprine"' in text2 - assert "{pause:500}" in text2 + assert r"\{pause:500ms\}" in text2 def test_builder_with_ssml_and_additions(self): """Test the mixed usage example from the spec""" @@ -525,7 +541,7 @@ def test_builder_with_ssml_and_additions(self): ) assert '"word": "medicine"' in text - assert "{pause:500}" in text + assert r"\{pause:500ms\}" in text assert " Do not exceed prescribed dosage." in text def test_standalone_function_workflow(self): diff --git a/tests/custom/test_topics_intents_v7_compat.py b/tests/custom/test_topics_intents_v7_compat.py index c670ba45..6a04def6 100644 --- a/tests/custom/test_topics_intents_v7_compat.py +++ b/tests/custom/test_topics_intents_v7_compat.py @@ -6,14 +6,18 @@ from deepgram import AsyncDeepgramClient, DeepgramClient from deepgram.environment import DeepgramClientEnvironment from deepgram.requests import ( + SharedIntentsParams, SharedIntentsResultsIntentsParams, SharedIntentsResultsParams, + SharedTopicsParams, SharedTopicsResultsParams, SharedTopicsResultsTopicsParams, ) from deepgram.types import ( + SharedIntents, SharedIntentsResults, SharedIntentsResultsIntents, + SharedTopics, SharedTopicsResults, SharedTopicsResultsTopics, ) @@ -38,6 +42,23 @@ def _assert_paths(response) -> None: assert response.results.intents.results.intents.segments[0].intents[0].intent == "greet" +def _assert_legacy_construction_and_params() -> None: + legacy_topics: SharedTopicsParams = {"results": {"topics": TOPICS}} + legacy_intents: SharedIntentsParams = {"results": {"intents": INTENTS}} + topics = SharedTopics(results=legacy_topics["results"]) + intents = SharedIntents(results=legacy_intents["results"]) + + assert topics.segments[0].topics[0].topic == "greeting" + assert topics.results.topics.segments[0].topics[0].topic == "greeting" + assert intents.segments[0].intents[0].intent == "greet" + assert intents.results.intents.segments[0].intents[0].intent == "greet" + + direct_topics = SharedTopics(segments=TOPICS["segments"], results={"topics": {"segments": []}}) + direct_intents = SharedIntents(segments=INTENTS["segments"], results={"intents": {"segments": []}}) + assert direct_topics.results.topics.segments[0].topics[0].topic == "greeting" + assert direct_intents.results.intents.segments[0].intents[0].intent == "greet" + + def test_sync_listen_and_read_preserve_direct_and_legacy_topics_intents_paths() -> None: with respx.mock: respx.post(f"https://{HOST}/v1/listen").mock(return_value=httpx.Response(200, json=LISTEN_RESPONSE)) @@ -45,6 +66,7 @@ def test_sync_listen_and_read_preserve_direct_and_legacy_topics_intents_paths() client = DeepgramClient(environment=ENVIRONMENT, api_key="test") _assert_paths(client.listen.v1.media.transcribe_url(url="https://example.test/audio.wav", topics=True, intents=True)) _assert_paths(client.read.v1.text.analyze(request={"text": "hello"}, topics=True, intents=True)) + _assert_legacy_construction_and_params() async def test_async_listen_and_read_preserve_direct_and_legacy_topics_intents_paths() -> None: @@ -54,6 +76,7 @@ async def test_async_listen_and_read_preserve_direct_and_legacy_topics_intents_p client = AsyncDeepgramClient(environment=ENVIRONMENT, api_key="test", httpx_client=httpx.AsyncClient()) _assert_paths(await client.listen.v1.media.transcribe_url(url="https://example.test/audio.wav", topics=True, intents=True)) _assert_paths(await client.read.v1.text.analyze(request={"text": "hello"}, topics=True, intents=True)) + _assert_legacy_construction_and_params() def test_legacy_topics_and_intents_types_and_params_are_importable() -> None: diff --git a/tests/manual/speak/v2/controls/main.py b/tests/manual/speak/v2/controls/main.py index a357fc2d..c9084720 100644 --- a/tests/manual/speak/v2/controls/main.py +++ b/tests/manual/speak/v2/controls/main.py @@ -10,7 +10,7 @@ from deepgram import AsyncDeepgramClient from deepgram.core.api_error import ApiError from deepgram.environment import DeepgramClientEnvironment -from deepgram.speak.v2.types import SpeakV2Speak +from deepgram.speak.v2.types import SpeakV2Error, SpeakV2Speak def _environment() -> DeepgramClientEnvironment: @@ -23,18 +23,20 @@ def _environment() -> DeepgramClientEnvironment: async def _batch(client: AsyncDeepgramClient) -> None: - async for _ in client.speak.v2.audio.generate(model="flux-alexis-en", text="Hello {pause:500}there."): + async for _ in client.speak.v2.audio.generate(model="flux-alexis-en", text=r"Hello \{pause:500ms\}there."): break async for _ in client.speak.v2.audio.generate( - model="flux-alexis-en", text='Hello {"word":"Deepgram","pronounce":"diːpɡræm"}.' + model="flux-alexis-en", text=r'Hello \{"word": "Deepgram", "pronounce": "diːpɡræm"\}.' ): break try: async for _ in client.speak.v2.audio.generate( - model="flux-alexis-en", text='{"word":"Deepgram","pronounce":"diːpɡræm"}', speed=1.1 + model="flux-alexis-en", text=r'\{"word": "Deepgram", "pronounce": "diːpɡræm"\}', speed=1.1 ): pass except ApiError as exc: + if exc.status_code != 400 or exc.body.get("err_code") != "CONTROL_COMBINATION_INVALID": + raise AssertionError(f"expected CONTROL_COMBINATION_INVALID, received {exc}") from exc print(f"Expected batch control rejection: {exc.status_code}") else: raise AssertionError("batch speed plus pronunciation should be rejected") @@ -42,12 +44,22 @@ async def _batch(client: AsyncDeepgramClient) -> None: async def _streaming(client: AsyncDeepgramClient) -> None: async with client.speak.v2.connect(model="flux-alexis-en") as connection: - await connection.send_speak(SpeakV2Speak(text='{"word":"Deepgram","pronounce":"diːpɡræm"}')) + await connection.send_speak(SpeakV2Speak(text=r'\{"word": "Deepgram", "pronounce": "diːpɡræm"\}')) await connection.send_flush() while True: message = await asyncio.wait_for(connection.recv(), timeout=10) if getattr(message, "type", None) == "SpeechMetadata": print(f"Streaming pronunciation controls: {message.controls_applied}") + break + + await connection.send_speak(SpeakV2Speak(text=r"\{pause:500ms\}")) + await connection.send_flush() + while True: + message = await asyncio.wait_for(connection.recv(), timeout=10) + if isinstance(message, SpeakV2Error): + if message.code != "DATA-0002": + raise AssertionError(f"expected DATA-0002 for a streaming pause, received {message.code}") + print("Streaming pauses rejected with DATA-0002") return diff --git a/tests/typecheck/compat_aliases.py b/tests/typecheck/compat_aliases.py index 58f626e7..cb2cbbd2 100644 --- a/tests/typecheck/compat_aliases.py +++ b/tests/typecheck/compat_aliases.py @@ -6,7 +6,13 @@ ConversationHistoryMessageParams, FunctionCallHistoryMessageParams, ) -from deepgram.requests import CreateKeyV1RequestOneParams, CreateKeyV1RequestParams +from deepgram.requests import ( + CreateKeyV1RequestOneParams, + CreateKeyV1RequestParams, + SharedIntentsParams, + SharedTopicsParams, +) +from deepgram.types import SharedIntents, SharedTopics create_key_request: CreateKeyV1RequestOneParams = {"key": "value"} history_content: AgentV1HistoryContentParams = { @@ -40,3 +46,9 @@ _language_hint_str = DeepgramListenProviderV2(model="flux-general-multi", language_hint="en") _language_hint_list = DeepgramListenProviderV2(model="flux-general-multi", language_hint=["en", "de"]) _language_hints_plural = DeepgramListenProviderV2(model="flux-general-multi", language_hints=["fr"]) + +# Topics and Intents retain their pre-7.12 ``results`` construction and Params paths. +legacy_topics: SharedTopicsParams = {"results": {"topics": {"segments": [{"text": "hello"}]}}} +legacy_intents: SharedIntentsParams = {"results": {"intents": {"segments": [{"text": "hello"}]}}} +assert_type(SharedTopics(results=legacy_topics["results"]), SharedTopics) +assert_type(SharedIntents(results=legacy_intents["results"]), SharedIntents) From b357932a365ad72e23eb9a9e57e8b07c053498de Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Thu, 1 Oct 2026 10:55:18 +0100 Subject: [PATCH 06/15] docs: align Python Controls syntax --- docs/FluxTtsControls.md | 6 +++--- src/deepgram/speak/v2/requests/speak_v2warning.py | 2 +- src/deepgram/speak/v2/types/speak_v2warning.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/FluxTtsControls.md b/docs/FluxTtsControls.md index a34d0830..965a80a7 100644 --- a/docs/FluxTtsControls.md +++ b/docs/FluxTtsControls.md @@ -4,15 +4,15 @@ Flux TTS supports inline pronunciation and pause controls for English batch REST ## Batch REST -Use `client.speak.v2.audio.generate()` for complete text. A pause is written as `\\{pause:500ms\\}` through `\\{pause:3000ms\\}` in 100 ms increments. A request accepts at most eight pauses. `TextBuilder` emits and validates this Flux batch syntax. +Use `client.speak.v2.audio.generate()` for complete text. A pause is written as `\{pause:500ms\}` through `\{pause:3000ms\}` in 100 ms increments. A request accepts at most eight pauses. `TextBuilder` emits and validates this Flux batch syntax. -Pronunciation uses `\\{\"word\": \"...\", \"pronounce\": \"\"\\}` and is Early Access. A pronunciation cannot be combined with any pause or with `speed` other than `1.0`. When a pause is present, `speed` cannot exceed `1.15`. Invalid combinations return a batch error, including `CONTROL_COMBINATION_INVALID` or `PAUSE_SPEED_CAP_EXCEEDED`. +Pronunciation uses `\{\"word\": \"...\", \"pronounce\": \"\"\}` and is Early Access. A pronunciation cannot be combined with any pause or with `speed` other than `1.0`. When a pause is present, `speed` cannot exceed `1.15`. Invalid combinations return a batch error, including `CONTROL_COMBINATION_INVALID` or `PAUSE_SPEED_CAP_EXCEEDED`. Read batch control outcomes from raw response headers: `dg-pronunciations-applied`, `dg-breaks-applied`, and `dg-warnings`. Warnings report best-effort pronunciation handling. ## WebSocket -Use `client.speak.v2.connect()` for streaming Flux synthesis. WebSocket turns support pronunciation controls only. A pause marker such as `\\{pause:500ms\\}`, or a pronunciation marker such as `\\{\"word\": \"...\", \"pronounce\": \"\"\\}` combined with non-default speed, closes the connection with `DATA-0002`. +Use `client.speak.v2.connect()` for streaming Flux synthesis. WebSocket turns support pronunciation controls only. A pause marker such as `\{pause:500ms\}`, or a pronunciation marker such as `\{\"word\": \"...\", \"pronounce\": \"\"\}` combined with non-default speed, closes the connection with `DATA-0002`. `Configure` changes are buffered. Setting speed while a buffered turn contains pronunciation returns `ConfigureFailure` with `CONTROL_COMBINATION_INVALID`; flush that turn before changing speed. diff --git a/src/deepgram/speak/v2/requests/speak_v2warning.py b/src/deepgram/speak/v2/requests/speak_v2warning.py index 1e45003f..6686af44 100644 --- a/src/deepgram/speak/v2/requests/speak_v2warning.py +++ b/src/deepgram/speak/v2/requests/speak_v2warning.py @@ -20,7 +20,7 @@ class SpeakV2WarningParams(typing_extensions.TypedDict): Pronunciation codes: `PRONUNCIATION_WARNINGS` (a pronunciation override contained invalid IPA; it is still applied best-effort and counted in `pronunciations_applied`), `PRONUNCIATION_TOO_LONG` (an IPA string exceeded the length limit), `PRONUNCIATIONS_LIMIT_EXCEEDED` (too many pronunciation controls in one turn). Pause codes (`BREAKS_LIMIT_EXCEEDED`, `BREAK_TOKENS_OUT_OF_RANGE`, `BREAK_TOKENS_WITH_INVALID_INCREMENTS`) are reserved and not emitted: inline pause controls are batch-only, and a pause marker on the WebSocket fails the connection instead. - + Interrupt-scoped codes, each meaning the `Interrupt` was ignored: `NO_AUDIO_GENERATED` (the session has produced no audio yet, so there is nothing to interrupt), `INTERRUPT_IN_PROGRESS` (an earlier `Interrupt` is still being processed — at most one is handled at a time), `INVALID_INTERRUPT_OFFSET` (the `playback_offset` did not advance past the position a prior interrupt established). """ diff --git a/src/deepgram/speak/v2/types/speak_v2warning.py b/src/deepgram/speak/v2/types/speak_v2warning.py index 47c92674..ac771641 100644 --- a/src/deepgram/speak/v2/types/speak_v2warning.py +++ b/src/deepgram/speak/v2/types/speak_v2warning.py @@ -22,7 +22,7 @@ class SpeakV2Warning(UncheckedBaseModel): Pronunciation codes: `PRONUNCIATION_WARNINGS` (a pronunciation override contained invalid IPA; it is still applied best-effort and counted in `pronunciations_applied`), `PRONUNCIATION_TOO_LONG` (an IPA string exceeded the length limit), `PRONUNCIATIONS_LIMIT_EXCEEDED` (too many pronunciation controls in one turn). Pause codes (`BREAKS_LIMIT_EXCEEDED`, `BREAK_TOKENS_OUT_OF_RANGE`, `BREAK_TOKENS_WITH_INVALID_INCREMENTS`) are reserved and not emitted: inline pause controls are batch-only, and a pause marker on the WebSocket fails the connection instead. - + Interrupt-scoped codes, each meaning the `Interrupt` was ignored: `NO_AUDIO_GENERATED` (the session has produced no audio yet, so there is nothing to interrupt), `INTERRUPT_IN_PROGRESS` (an earlier `Interrupt` is still being processed — at most one is handled at a time), `INVALID_INTERRUPT_OFFSET` (the `playback_offset` did not advance past the position a prior interrupt established). """ From 6c3a7853d3f32cbd9df8a43c61d812fb2593b539 Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Thu, 1 Oct 2026 11:03:20 +0100 Subject: [PATCH 07/15] docs: finalize Python Controls compatibility --- .agents/skills/deepgram-python-text-to-speech/SKILL.md | 2 +- .fernignore | 1 + AGENTS.md | 2 +- docs/FluxTtsControls.md | 4 ++-- src/deepgram/helpers/README.md | 4 ++-- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.agents/skills/deepgram-python-text-to-speech/SKILL.md b/.agents/skills/deepgram-python-text-to-speech/SKILL.md index 4c558018..d28f6ac5 100644 --- a/.agents/skills/deepgram-python-text-to-speech/SKILL.md +++ b/.agents/skills/deepgram-python-text-to-speech/SKILL.md @@ -92,7 +92,7 @@ final_text = ( ) ``` -The fluent API is `.text(...)` (append raw text), `.pronunciation(word, ipa)` (insert a `\\{\"word\": \"...\", \"pronounce\": \"...\"\\}` marker), `.pause(duration_ms)` (insert a `\\{pause:ms\\}` marker), and `.build()` (return the batch request text). Pauses must be 500-3000 ms in 100 ms increments, with at most eight per request. There is no `.add(...)` method. +The fluent API is `.text(...)` (append raw text), `.pronunciation(word, ipa)` (insert a `\{\"word\": \"...\", \"pronounce\": \"...\"\}` marker), `.pause(duration_ms)` (insert a `\{pause:ms\}` marker), and `.build()` (return the batch request text). Pauses must be 500-3000 ms in 100 ms increments, with at most eight per request. There is no `.add(...)` method. Use the output with `client.speak.v2.audio.generate(model="flux-alexis-en", text=final_text)`. See `docs/FluxTtsControls.md`, `examples/22-text-builder-demo.py`, and `examples/23-text-builder-helper.py`. diff --git a/.fernignore b/.fernignore index 0beef822..74cc0cfc 100644 --- a/.fernignore +++ b/.fernignore @@ -233,6 +233,7 @@ src/deepgram/listen/v2/types/listen_v2configure_success.py src/deepgram/listen/v2/types/listen_v2configure_success_thresholds.py src/deepgram/listen/v2/types/listen_v2configure_failure.py src/deepgram/listen/v2/types/listen_v2fatal_error.py +src/deepgram/listen/v2/types/listen_v2warning.py # Hand-written custom tests tests/custom/test_api_error_redaction.py diff --git a/AGENTS.md b/AGENTS.md index 3c550045..e93ae152 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -71,7 +71,7 @@ Current temporarily frozen files: - `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-compat patches for the 2026-05-05 Agent Settings schema restructure. These preserve callable `AgentV1SettingsAgent(...)`, keep `AgentV1Settings.agent` accepting both that wrapper and `agent_id` strings, restore the legacy request TypedDict shapes, remap legacy `messages=[...]` / nested `context=AgentV1SettingsAgentContext(messages=[...])` usage into the new `context={"messages": [...]}` wire shape, and keep read-side `obj.messages` access working. - `src/deepgram/core/api_error.py`, `src/deepgram/core/parse_error.py` — credential redaction. Every websocket `connect()` path raises `ApiError(headers=dict(headers), ...)` with the full request headers, and both error types stringify that dict, so an unredacted `Authorization` reached `str(e)`, tracebacks, log aggregators and error trackers (which serialise attributes as well as the message). Both now mask credential values at construction via `_secure_logging.redact_sensitive_headers`, preserving non-sensitive headers (`dg-request-id`) for debugging. This is the same threat `_secure_logging.py` covers for the `websockets` DEBUG handshake logs, via the other path to it. Regression coverage in `tests/custom/test_api_error_redaction.py`. Unfreeze if the generator starts redacting credentials itself. - `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/listen/v2/types/listen_v2connected.py`, `src/deepgram/listen/v2/types/listen_v2turn_info.py`, `src/deepgram/listen/v2/types/listen_v2turn_info_words_item.py`, `src/deepgram/listen/v2/types/listen_v2configure_success.py`, `src/deepgram/listen/v2/types/listen_v2configure_success_thresholds.py`, `src/deepgram/listen/v2/types/listen_v2configure_failure.py`, `src/deepgram/listen/v2/types/listen_v2fatal_error.py`, `src/deepgram/listen/v2/types/listen_v2warning.py` — 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 the language alias when it is retired in a future major. - `src/deepgram/types/shared_topics.py`, `src/deepgram/types/shared_intents.py`, `src/deepgram/requests/shared_topics.py`, `src/deepgram/requests/shared_intents.py`, and the generated root/type/request barrels — direct Topics and Intents segments plus their generated exports remain Fern-owned, but carry the v7 deprecated `results` construction facade and Params shape for the hand-written wrappers above. The models normalize legacy `results.{topics,intents}.segments` input to direct `segments` while preserving direct fields and deprecated read facades. Freeze these generated files during the parent reconciliation; retain all direct generated segments and exports alongside the compatibility surface. - `src/deepgram/core/client_wrapper.py` — Fern's `runtime_version: true` wrapper correctly uses installed package metadata, but its `PackageNotFoundError` fallback must remain the latest published version for source checkouts, vendored copies, zipapps, and frozen bundles. The fallback carries `# x-release-please-version` and `.github/release-please-config.json` includes the file as a generic extra file, so Release Please updates it with `pyproject.toml` and `.fern/metadata.json`. Unfreeze when Fern emits a release-managed fallback. diff --git a/docs/FluxTtsControls.md b/docs/FluxTtsControls.md index 965a80a7..48749f29 100644 --- a/docs/FluxTtsControls.md +++ b/docs/FluxTtsControls.md @@ -6,13 +6,13 @@ Flux TTS supports inline pronunciation and pause controls for English batch REST Use `client.speak.v2.audio.generate()` for complete text. A pause is written as `\{pause:500ms\}` through `\{pause:3000ms\}` in 100 ms increments. A request accepts at most eight pauses. `TextBuilder` emits and validates this Flux batch syntax. -Pronunciation uses `\{\"word\": \"...\", \"pronounce\": \"\"\}` and is Early Access. A pronunciation cannot be combined with any pause or with `speed` other than `1.0`. When a pause is present, `speed` cannot exceed `1.15`. Invalid combinations return a batch error, including `CONTROL_COMBINATION_INVALID` or `PAUSE_SPEED_CAP_EXCEEDED`. +Pronunciation uses `\{"word": "...", "pronounce": ""\}` and is Early Access. A pronunciation cannot be combined with any pause or with `speed` other than `1.0`. When a pause is present, `speed` cannot exceed `1.15`. Invalid combinations return a batch error, including `CONTROL_COMBINATION_INVALID` or `PAUSE_SPEED_CAP_EXCEEDED`. Read batch control outcomes from raw response headers: `dg-pronunciations-applied`, `dg-breaks-applied`, and `dg-warnings`. Warnings report best-effort pronunciation handling. ## WebSocket -Use `client.speak.v2.connect()` for streaming Flux synthesis. WebSocket turns support pronunciation controls only. A pause marker such as `\{pause:500ms\}`, or a pronunciation marker such as `\{\"word\": \"...\", \"pronounce\": \"\"\}` combined with non-default speed, closes the connection with `DATA-0002`. +Use `client.speak.v2.connect()` for streaming Flux synthesis. WebSocket turns support pronunciation controls only. A pause marker such as `\{pause:500ms\}`, or a pronunciation marker such as `\{"word": "...", "pronounce": ""\}` combined with non-default speed, closes the connection with `DATA-0002`. `Configure` changes are buffered. Setting speed while a buffered turn contains pronunciation returns `ConfigureFailure` with `CONTROL_COMBINATION_INVALID`; flush that turn before changing speed. diff --git a/src/deepgram/helpers/README.md b/src/deepgram/helpers/README.md index 0120fac5..b4550b6b 100644 --- a/src/deepgram/helpers/README.md +++ b/src/deepgram/helpers/README.md @@ -31,8 +31,8 @@ audio = client.speak.v2.audio.generate(model="flux-alexis-en", text=text) #### TextBuilder Class - `text(content: str)` - Add plain text -- `pronunciation(word: str, ipa: str)` - Add an escaped `\\{\"word\": \"...\", \"pronounce\": \"...\"\\}` IPA pronunciation control -- `pause(duration_ms: int)` - Add a batch-only `\\{pause:ms\\}` pause (500-3000ms, 100ms increments; eight per request) +- `pronunciation(word: str, ipa: str)` - Add an escaped `\{"word": "...", "pronounce": "..."\}` IPA pronunciation control +- `pause(duration_ms: int)` - Add a batch-only `\{pause:ms\}` pause (500-3000ms, 100ms increments; eight per request) - `from_ssml(ssml_text: str)` - Parse and convert SSML markup - `build()` - Return final formatted text From 8b9e9a9c4b9896846701300570ae452b8388b7da Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Thu, 1 Oct 2026 11:10:13 +0100 Subject: [PATCH 08/15] docs: describe Python Controls restrictions --- reference.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/reference.md b/reference.md index c1dd4e47..71bca6b8 100644 --- a/reference.md +++ b/reference.md @@ -5992,6 +5992,7 @@ asyncio.run(main()) **`send_speak(message: SpeakV2Speak)`** — Send text to be converted to speech - `connection.send_speak(SpeakV2Speak(text="Hello, world!"))` +- `SpeakV2Speak.text` supports Early Access pronunciation controls. Pause markers are batch-only; sending `\{pause:500ms\}` over the WebSocket emits `DATA-0002` and closes the connection. A pronunciation control with a non-default speed has the same result. See [Flux TTS Controls](./docs/FluxTtsControls.md). @@ -6021,7 +6022,7 @@ asyncio.run(main()) **`send_configure(message: SpeakV2Configure)`** — Change the speech rate mid-stream -- `connection.send_configure(SpeakV2Configure(speed=1.05))` — Acknowledged by a `SpeakV2ConfigureSuccess` echoing what was applied, or a `SpeakV2ConfigureFailure` carrying a typed code such as `SPEED_OUT_OF_RANGE` +- `connection.send_configure(SpeakV2Configure(speed=1.05))` — Acknowledged by a `SpeakV2ConfigureSuccess` echoing what was applied, or a `SpeakV2ConfigureFailure` carrying a typed code such as `SPEED_OUT_OF_RANGE`. Changing speed while a buffered turn contains a pronunciation control returns `CONTROL_COMBINATION_INVALID`; flush that turn first. @@ -6070,7 +6071,7 @@ asyncio.run(main())
-**speed:** `typing.Optional[SpeakV2Speed]` — 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`. +**speed:** `typing.Optional[SpeakV2Speed]` — 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`. A non-default speed cannot be combined with a pronunciation control in the same WebSocket session; that turn fails with `DATA-0002`. See [Flux TTS Controls](./docs/FluxTtsControls.md).
From b578a40c73c7091e44ac950402b49c7dea6e7029 Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Thu, 1 Oct 2026 11:17:25 +0100 Subject: [PATCH 09/15] test: preserve Python legacy response facades --- reference.md | 2 +- src/deepgram/types/shared_intents.py | 4 +++- src/deepgram/types/shared_topics.py | 4 +++- tests/custom/test_topics_intents_v7_compat.py | 7 +++++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/reference.md b/reference.md index 71bca6b8..0ddee321 100644 --- a/reference.md +++ b/reference.md @@ -6071,7 +6071,7 @@ asyncio.run(main())
-**speed:** `typing.Optional[SpeakV2Speed]` — 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`. A non-default speed cannot be combined with a pronunciation control in the same WebSocket session; that turn fails with `DATA-0002`. See [Flux TTS Controls](./docs/FluxTtsControls.md). +**speed:** `typing.Optional[SpeakV2Speed]` — 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`. A pronunciation control on a connection opened or configured with non-default speed fails with `DATA-0002`. A `Configure` speed change is rejected only while a buffered turn contains a pronunciation control; flush that turn first. See [Flux TTS Controls](./docs/FluxTtsControls.md).
diff --git a/src/deepgram/types/shared_intents.py b/src/deepgram/types/shared_intents.py index 1be489bc..ad991bcf 100644 --- a/src/deepgram/types/shared_intents.py +++ b/src/deepgram/types/shared_intents.py @@ -18,8 +18,10 @@ class SharedIntents(UncheckedBaseModel): segments: typing.Optional[typing.List[SharedIntentsSegmentsItem]] = None @property - def results(self) -> SharedIntentsResults: + def results(self) -> typing.Optional[SharedIntentsResults]: """Deprecated facade for the pre-7.12 ``results.intents.segments`` path.""" + if self.segments is None: + return None return SharedIntentsResults(intents=SharedIntentsResultsIntents(segments=self.segments)) if IS_PYDANTIC_V2: diff --git a/src/deepgram/types/shared_topics.py b/src/deepgram/types/shared_topics.py index 9f752bda..4f26c3b7 100644 --- a/src/deepgram/types/shared_topics.py +++ b/src/deepgram/types/shared_topics.py @@ -18,8 +18,10 @@ class SharedTopics(UncheckedBaseModel): segments: typing.Optional[typing.List[SharedTopicsSegmentsItem]] = None @property - def results(self) -> SharedTopicsResults: + def results(self) -> typing.Optional[SharedTopicsResults]: """Deprecated facade for the pre-7.12 ``results.topics.segments`` path.""" + if self.segments is None: + return None return SharedTopicsResults(topics=SharedTopicsResultsTopics(segments=self.segments)) if IS_PYDANTIC_V2: diff --git a/tests/custom/test_topics_intents_v7_compat.py b/tests/custom/test_topics_intents_v7_compat.py index 6a04def6..53e89798 100644 --- a/tests/custom/test_topics_intents_v7_compat.py +++ b/tests/custom/test_topics_intents_v7_compat.py @@ -88,3 +88,10 @@ def test_legacy_topics_and_intents_types_and_params_are_importable() -> None: intent_segments: SharedIntentsResultsIntentsParams = {"segments": []} assert topics["topics"] == topic_segments assert intents["intents"] == intent_segments + + +def test_empty_legacy_topics_and_intents_results_remain_none() -> None: + assert SharedTopics().results is None + assert SharedIntents().results is None + assert SharedTopics(results=None).results is None + assert SharedIntents(results=None).results is None From 57cd44a7f6133b974bb05e9528b6a1d6424ae65e Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Thu, 1 Oct 2026 11:25:10 +0100 Subject: [PATCH 10/15] docs: support staging TextBuilder examples --- examples/23-text-builder-helper.py | 25 ++++++++++++++++++++----- examples/24-text-builder-streaming.py | 19 +++++++++++++++++-- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/examples/23-text-builder-helper.py b/examples/23-text-builder-helper.py index 8e8d1e7d..1b158363 100644 --- a/examples/23-text-builder-helper.py +++ b/examples/23-text-builder-helper.py @@ -9,9 +9,24 @@ import os from deepgram import DeepgramClient +from deepgram.environment import DeepgramClientEnvironment from deepgram.helpers import TextBuilder, add_pronunciation, ssml_to_deepgram +def build_client(api_key: str) -> DeepgramClient: + """Use staging when DEEPGRAM_BASE_URL is set; otherwise use production.""" + target = os.getenv("DEEPGRAM_BASE_URL") + if not target: + return DeepgramClient(api_key=api_key) + + rest = target.rstrip("/").replace("wss://", "https://").replace("ws://", "http://") + websocket = rest.replace("https://", "wss://").replace("http://", "ws://") + return DeepgramClient( + api_key=api_key, + environment=DeepgramClientEnvironment(base=rest, production=websocket, agent=websocket, agent_rest=rest), + ) + + def example_basic_text_builder(): """Example 1: Basic TextBuilder usage with pronunciations and pauses""" print("Example 1: Basic TextBuilder Usage") @@ -34,7 +49,7 @@ def example_basic_text_builder(): # Use with Deepgram client api_key = os.getenv("DEEPGRAM_API_KEY") if api_key: - client = DeepgramClient(api_key=api_key) + client = build_client(api_key) # Generate speech with custom pronunciations response = client.speak.v2.audio.generate( @@ -69,7 +84,7 @@ def example_add_pronunciation_function(): api_key = os.getenv("DEEPGRAM_API_KEY") if api_key: - client = DeepgramClient(api_key=api_key) + client = build_client(api_key) response = client.speak.v2.audio.generate( text=text, @@ -105,7 +120,7 @@ def example_ssml_migration(): api_key = os.getenv("DEEPGRAM_API_KEY") if api_key: - client = DeepgramClient(api_key=api_key) + client = build_client(api_key) response = client.speak.v2.audio.generate( text=text, @@ -142,7 +157,7 @@ def example_mixed_ssml_and_builder(): api_key = os.getenv("DEEPGRAM_API_KEY") if api_key: - client = DeepgramClient(api_key=api_key) + client = build_client(api_key) response = client.speak.v2.audio.generate( text=text, @@ -183,7 +198,7 @@ def example_pharmacy_instructions(): api_key = os.getenv("DEEPGRAM_API_KEY") if api_key: - client = DeepgramClient(api_key=api_key) + client = build_client(api_key) response = client.speak.v2.audio.generate( text=text, diff --git a/examples/24-text-builder-streaming.py b/examples/24-text-builder-streaming.py index a2704743..db921139 100644 --- a/examples/24-text-builder-streaming.py +++ b/examples/24-text-builder-streaming.py @@ -15,11 +15,26 @@ from deepgram import DeepgramClient from deepgram.core.events import EventType +from deepgram.environment import DeepgramClientEnvironment from deepgram.speak.v1.types import SpeakV1Text SpeakV1SocketClientResponse = Union[str, bytes] +def build_client(api_key: str) -> DeepgramClient: + """Use staging when DEEPGRAM_BASE_URL is set; otherwise use production.""" + target = os.getenv("DEEPGRAM_BASE_URL") + if not target: + return DeepgramClient(api_key=api_key) + + rest = target.rstrip("/").replace("wss://", "https://").replace("ws://", "http://") + websocket = rest.replace("https://", "wss://").replace("http://", "ws://") + return DeepgramClient( + api_key=api_key, + environment=DeepgramClientEnvironment(base=rest, production=websocket, agent=websocket, agent_rest=rest), + ) + + def example_streaming(): """Stream TTS audio without Flux batch-only controls.""" print("Example: Streaming TTS") @@ -34,7 +49,7 @@ def example_streaming(): print("ℹ Set DEEPGRAM_API_KEY to stream audio") return - client = DeepgramClient(api_key=api_key) + client = build_client(api_key) try: with client.speak.v1.connect( @@ -91,7 +106,7 @@ def example_multiple_messages(): print("ℹ Set DEEPGRAM_API_KEY to stream audio") return - client = DeepgramClient(api_key=api_key) + client = build_client(api_key) try: with client.speak.v1.connect( From 2061a9e363a5aecff4911d6f885c81ca2007cc4d Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Thu, 1 Oct 2026 14:06:36 +0100 Subject: [PATCH 11/15] fix: validate incompatible Flux TTS controls --- .../deepgram-python-text-to-speech/SKILL.md | 5 ++-- README.md | 2 +- docs/FluxTtsControls.md | 4 +-- examples/23-text-builder-helper.py | 4 +-- examples/24-text-builder-streaming.py | 8 +++--- reference.md | 6 ++++ src/deepgram/agent/v1/socket_client.py | 20 +++++++------ src/deepgram/core/query_encoder.py | 1 + src/deepgram/helpers/README.md | 2 +- src/deepgram/helpers/text_builder.py | 5 +++- .../types/deepgram_listen_provider_v2.py | 4 +++ .../test_client_construction_and_helpers.py | 3 +- tests/custom/test_text_builder.py | 28 +++++++++---------- 13 files changed, 53 insertions(+), 39 deletions(-) diff --git a/.agents/skills/deepgram-python-text-to-speech/SKILL.md b/.agents/skills/deepgram-python-text-to-speech/SKILL.md index d28f6ac5..8c94a47d 100644 --- a/.agents/skills/deepgram-python-text-to-speech/SKILL.md +++ b/.agents/skills/deepgram-python-text-to-speech/SKILL.md @@ -77,7 +77,7 @@ In **sync** mode, `start_listening()` blocks — send all text + flush + close B ## TextBuilder helper (Flux batch controls) -`deepgram.helpers.TextBuilder` is a hand-maintained helper (NOT Fern-generated) for English Flux batch requests. It is not for WebSocket turns: a pause marker is rejected with `DATA-0002`. +`deepgram.helpers.TextBuilder` is a hand-maintained helper (NOT Fern-generated) for English Flux batch requests. Pronunciation controls apply to Flux batch, Flux WebSocket, and Aura-2 `/v1/speak`; pauses are Flux batch-only and a Flux WebSocket rejects them with `DATA-0002`. ```python from deepgram.helpers import TextBuilder @@ -87,12 +87,11 @@ final_text = ( .text("Hello,") .text(" this is built incrementally.") .pronunciation("Deepgram", "ˈdiːpɡɹæm") - .pause(500) .build() ) ``` -The fluent API is `.text(...)` (append raw text), `.pronunciation(word, ipa)` (insert a `\{\"word\": \"...\", \"pronounce\": \"...\"\}` marker), `.pause(duration_ms)` (insert a `\{pause:ms\}` marker), and `.build()` (return the batch request text). Pauses must be 500-3000 ms in 100 ms increments, with at most eight per request. There is no `.add(...)` method. +The fluent API is `.text(...)` (append raw text), `.pronunciation(word, ipa)` (insert a `\{\"word\": \"...\", \"pronounce\": \"...\"\}` marker), `.pause(duration_ms)` (insert a `\{pause:ms\}` marker), and `.build()` (return the batch request text). Pauses must be 500-3000 ms in 100 ms increments, with at most eight per request. Pronunciation and pause cannot be combined in one request; Flux rejects the combination with `CONTROL_COMBINATION_INVALID`. There is no `.add(...)` method. Use the output with `client.speak.v2.audio.generate(model="flux-alexis-en", text=final_text)`. See `docs/FluxTtsControls.md`, `examples/22-text-builder-demo.py`, and `examples/23-text-builder-helper.py`. diff --git a/README.md b/README.md index ff9442ee..95d94023 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ pip install deepgram-sdk ## Reference - **[API Reference](./reference.md)** - Complete reference for all SDK methods, parameters, and WebSocket connections -- **[Flux TTS controls](./docs/FluxTtsControls.md)** - Batch and streaming pronunciation, pause, and speed behavior +- **[Flux TTS controls](./docs/FluxTtsControls.md)** - Pronunciation across Flux batch, Flux WebSocket, and Aura-2; Flux batch-only pause and speed behavior ## Usage diff --git a/docs/FluxTtsControls.md b/docs/FluxTtsControls.md index 48749f29..3720997a 100644 --- a/docs/FluxTtsControls.md +++ b/docs/FluxTtsControls.md @@ -1,6 +1,6 @@ # Flux TTS Controls -Flux TTS supports inline pronunciation and pause controls for English batch REST synthesis. +Pronunciation controls apply to Flux batch REST, Flux WebSocket, and Aura-2 `/v1/speak`. Pause controls apply to Flux batch REST only. ## Batch REST @@ -18,4 +18,4 @@ Use `client.speak.v2.connect()` for streaming Flux synthesis. WebSocket turns su `SpeechMetadata.controls_applied` reports pronunciation, pause, and warning counters. `Warning` messages report the associated warning code and description. WebSocket pauses are unsupported, so `breaks_applied` is always zero. -`TextBuilder` is intended for Flux batch requests. Do not use its pause output with the Flux WebSocket or assume these limits apply to non-Flux TTS endpoints. +`TextBuilder` validates Flux batch constraints. Its pronunciation output is usable where pronunciation controls are supported, but do not use its pause output with the Flux WebSocket or assume Flux pause limits apply to non-Flux TTS endpoints. diff --git a/examples/23-text-builder-helper.py b/examples/23-text-builder-helper.py index 1b158363..8b87bfea 100644 --- a/examples/23-text-builder-helper.py +++ b/examples/23-text-builder-helper.py @@ -3,7 +3,7 @@ Example: TextBuilder with Flux batch REST TTS This example demonstrates using TextBuilder with English Flux batch REST -synthesis for custom pronunciations and pauses. +synthesis for custom pronunciations. """ import os @@ -28,7 +28,7 @@ def build_client(api_key: str) -> DeepgramClient: def example_basic_text_builder(): - """Example 1: Basic TextBuilder usage with pronunciations and pauses""" + """Example 1: Basic TextBuilder usage with pronunciations""" print("Example 1: Basic TextBuilder Usage") print("-" * 50) diff --git a/examples/24-text-builder-streaming.py b/examples/24-text-builder-streaming.py index db921139..62412c63 100644 --- a/examples/24-text-builder-streaming.py +++ b/examples/24-text-builder-streaming.py @@ -1,12 +1,12 @@ #!/usr/bin/env python3 """ -Example: Streaming TTS (WebSocket) +Example: Streaming TTS (no Flux batch-only pauses) This example demonstrates streaming text-to-speech over WebSocket for real-time audio generation. -Flux pause controls are batch-only. Do not use `TextBuilder` controls with the -Flux WebSocket: a pause marker is rejected with `DATA-0002`. +Flux pause controls are batch-only. Flux WebSocket supports pronunciation +markers, but a pause marker is rejected with `DATA-0002`. """ import os @@ -74,7 +74,7 @@ def on_message(message: SpeakV1SocketClientResponse) -> None: connection.on(EventType.CLOSE, lambda _: (print("✓ Connection closed"), closed_event.set())) connection.on(EventType.ERROR, lambda error: print(f"✗ Error: {error}")) - # Send plain text; Flux controls are batch-only. + # Send plain text for this Aura-2 streaming example. connection.send_text(SpeakV1Text(text=text)) # Flush to ensure all text is processed diff --git a/reference.md b/reference.md index 0ddee321..21bc8a6c 100644 --- a/reference.md +++ b/reference.md @@ -5810,6 +5810,12 @@ asyncio.run(main()) +## Speak V2 Audio + +`client.speak.v2.audio.generate(model=..., text=...)` synthesizes a complete Flux batch request and returns an iterator of audio bytes. `model` and `text` are required; optional audio settings include `encoding`, `sample_rate`, `container`, `bit_rate`, `expressivity`, `speed`, `tag`, `callback`, and `priority`. + +The `text` may include English Flux batch controls: escaped pronunciation markers (`\{"word": "...", "pronounce": ""\}`) or pause markers (`\{pause:ms\}` for 500-3000 ms in 100 ms increments, at most eight per request). Do not combine pronunciation and pause markers. See [Flux TTS Controls](./docs/FluxTtsControls.md). + ## Speak V2 Connect
client.speak.v2.connect(...) diff --git a/src/deepgram/agent/v1/socket_client.py b/src/deepgram/agent/v1/socket_client.py index 362544f8..6d504d3e 100644 --- a/src/deepgram/agent/v1/socket_client.py +++ b/src/deepgram/agent/v1/socket_client.py @@ -42,6 +42,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. See: internal-api-specs/issues/205.""" + 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, @@ -373,11 +385,3 @@ def _send_model(self, data: typing.Any) -> None: Send a Pydantic model to the websocket connection. """ self._send(_sanitize_numeric_types(data.dict())) -def _sanitize_numeric_types(obj: typing.Any) -> typing.Any: - 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 diff --git a/src/deepgram/core/query_encoder.py b/src/deepgram/core/query_encoder.py index 3b32eb4b..58088258 100644 --- a/src/deepgram/core/query_encoder.py +++ b/src/deepgram/core/query_encoder.py @@ -6,6 +6,7 @@ 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 diff --git a/src/deepgram/helpers/README.md b/src/deepgram/helpers/README.md index b4550b6b..7c00e60d 100644 --- a/src/deepgram/helpers/README.md +++ b/src/deepgram/helpers/README.md @@ -4,7 +4,7 @@ This module contains custom helper utilities for working with Deepgram APIs that ## TextBuilder -The `TextBuilder` class provides a fluent interface for constructing English Flux batch TTS text with pronunciation and pause controls. Do not use its controls with a Flux WebSocket request: pauses are rejected with `DATA-0002`. +The `TextBuilder` class provides a fluent interface for constructing English Flux batch TTS text. Pronunciation controls also apply to Flux WebSocket and Aura-2 `/v1/speak`; pauses are Flux batch-only and are rejected by Flux WebSocket with `DATA-0002`. ### Quick Example diff --git a/src/deepgram/helpers/text_builder.py b/src/deepgram/helpers/text_builder.py index 8f49a59e..ee17ba0d 100644 --- a/src/deepgram/helpers/text_builder.py +++ b/src/deepgram/helpers/text_builder.py @@ -168,7 +168,7 @@ def build(self) -> str: The complete formatted text ready for TTS Raises: - ValueError: If character limit exceeded + ValueError: If character limit is exceeded or incompatible controls are combined """ result = "".join(self._parts) @@ -176,6 +176,9 @@ def build(self) -> str: if self._char_count > 2000: raise ValueError(f"Text exceeds 2000 character limit (current: {self._char_count} characters)") + if self._pronunciation_count and self._pause_count: + raise ValueError("Pronunciation and pause controls cannot be combined in one Flux batch request") + return result diff --git a/src/deepgram/types/deepgram_listen_provider_v2.py b/src/deepgram/types/deepgram_listen_provider_v2.py index 92b4d7ec..d24729a0 100644 --- a/src/deepgram/types/deepgram_listen_provider_v2.py +++ b/src/deepgram/types/deepgram_listen_provider_v2.py @@ -29,6 +29,10 @@ class DeepgramListenProviderV2(UncheckedBaseModel): """ 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) """ diff --git a/tests/custom/test_client_construction_and_helpers.py b/tests/custom/test_client_construction_and_helpers.py index e92831f4..20a083fa 100644 --- a/tests/custom/test_client_construction_and_helpers.py +++ b/tests/custom/test_client_construction_and_helpers.py @@ -85,11 +85,10 @@ def test_text_builder_fluent_build() -> None: TextBuilder() .text("Take ") .pronunciation("azathioprine", "ˌæzəˈθaɪəpriːn") - .pause(500) .text(" daily.") .build() ) - assert "pronounce" in text and r"\{pause:500ms\}" in text + assert "pronounce" in text def test_text_builder_validation_errors() -> None: diff --git a/tests/custom/test_text_builder.py b/tests/custom/test_text_builder.py index bd180d77..638dc918 100644 --- a/tests/custom/test_text_builder.py +++ b/tests/custom/test_text_builder.py @@ -65,9 +65,17 @@ def test_text_with_pause(self): .build() ) assert result == r"Hello\{pause:1000ms\}world" - + + def test_build_rejects_mixed_pronunciation_and_pause_controls(self): + """Flux batch accepts each control independently, but not together.""" + assert TextBuilder().pronunciation("Deepgram", "diːpɡræm").build() + assert TextBuilder().pause(500).build() == r"\{pause:500ms\}" + + with pytest.raises(ValueError, match="Pronunciation and pause controls cannot be combined"): + TextBuilder().pronunciation("Deepgram", "diːpɡræm").pause(500).build() + def test_complex_chain(self): - """Test complex chaining with all features""" + """Test complex chaining with multiple pronunciations""" builder = TextBuilder() result = ( builder @@ -76,7 +84,6 @@ def test_complex_chain(self): .text(" twice daily with ") .pronunciation("dupilumab", "duːˈpɪljuːmæb") .text(" injections") - .pause(500) .text(" Do not exceed prescribed dosage.") .build() ) @@ -86,7 +93,6 @@ def test_complex_chain(self): assert " twice daily with " in result assert '"word": "dupilumab"' in result assert " injections" in result - assert r"\{pause:500ms\}" in result assert " Do not exceed prescribed dosage." in result def test_pronunciation_limit(self): @@ -361,13 +367,11 @@ def test_from_ssml_with_additional_text(self): result = ( builder .from_ssml(ssml) - .pause(500) .text(" Do not exceed dosage.") .build() ) assert '"word": "medicine"' in result - assert r"\{pause:500ms\}" in result assert "Do not exceed dosage." in result def test_from_ssml_counts_pronunciations(self): @@ -491,7 +495,6 @@ def test_medical_example(self): .text(" twice daily with ") .pronunciation("dupilumab", "duːˈpɪljuːmæb") .text(" injections") - .pause(500) .text(" Do not exceed prescribed dosage.") .build() ) @@ -504,14 +507,13 @@ def test_medical_example(self): assert '"word": "dupilumab"' in text assert '"pronounce": "duːˈpɪljuːmæb"' in text assert " injections" in text - assert r"\{pause:500ms\}" in text assert " Do not exceed prescribed dosage." in text def test_ssml_migration(self): """Test SSML to Deepgram migration workflow""" ssml = ''' Take azathioprine - Do not exceed dosage. + Do not exceed dosage. ''' # Method 1: Direct conversion @@ -522,15 +524,11 @@ def test_ssml_migration(self): # Both should produce similar results assert '"word": "azathioprine"' in text1 - assert r"\{pause:500ms\}" in text1 assert '"word": "azathioprine"' in text2 - assert r"\{pause:500ms\}" in text2 def test_builder_with_ssml_and_additions(self): """Test the mixed usage example from the spec""" - some_imported_ssml = ''' - Take medicine - ''' + some_imported_ssml = "Take medicine." text = ( TextBuilder() @@ -540,7 +538,7 @@ def test_builder_with_ssml_and_additions(self): .build() ) - assert '"word": "medicine"' in text + assert "Take medicine." in text assert r"\{pause:500ms\}" in text assert " Do not exceed prescribed dosage." in text From 2c0d60dc7ed10bc5be36b80b5a4c5dd84cc24cbc Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Thu, 1 Oct 2026 14:13:23 +0100 Subject: [PATCH 12/15] fix: reject incompatible SSML controls --- src/deepgram/helpers/text_builder.py | 7 ++++++- tests/custom/test_client_construction_and_helpers.py | 4 ++-- tests/custom/test_text_builder.py | 11 ++++------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/deepgram/helpers/text_builder.py b/src/deepgram/helpers/text_builder.py index ee17ba0d..25f250b6 100644 --- a/src/deepgram/helpers/text_builder.py +++ b/src/deepgram/helpers/text_builder.py @@ -250,10 +250,13 @@ def ssml_to_deepgram(ssml_text: str) -> str: Returns: Deepgram-formatted text + Raises: + ValueError: If the SSML combines pronunciation and pause controls + Example: ssml = ''' Take azathioprine - Do not exceed dosage. + Do not exceed dosage. ''' text = ssml_to_deepgram(ssml) """ @@ -315,6 +318,8 @@ def replace_break(match): raise ValueError("Maximum 500 pronunciations per request exceeded") if pause_count > 8: raise ValueError("Maximum 8 pauses per Flux batch request exceeded") + if pronunciation_count and pause_count: + raise ValueError("Pronunciation and pause controls cannot be combined in one Flux batch request") return ssml_text diff --git a/tests/custom/test_client_construction_and_helpers.py b/tests/custom/test_client_construction_and_helpers.py index 20a083fa..eb72c9d3 100644 --- a/tests/custom/test_client_construction_and_helpers.py +++ b/tests/custom/test_client_construction_and_helpers.py @@ -116,8 +116,8 @@ def test_add_pronunciation_and_ssml() -> None: add_pronunciation("x", "x", 'bad"ipa') ssml = 'Take azathioprine now' - converted = ssml_to_deepgram(ssml) - assert "pronounce" in converted and r"\{pause:500ms\}" in converted + with pytest.raises(ValueError, match="Pronunciation and pause controls cannot be combined"): + ssml_to_deepgram(ssml) with pytest.raises(ValueError, match="at least 500ms"): ssml_to_deepgram('Wait here') diff --git a/tests/custom/test_text_builder.py b/tests/custom/test_text_builder.py index 638dc918..840547e1 100644 --- a/tests/custom/test_text_builder.py +++ b/tests/custom/test_text_builder.py @@ -314,17 +314,14 @@ def test_speak_wrapper(self): assert result == "Hello world" - def test_complex_ssml(self): - """Test complex SSML with multiple elements""" + def test_complex_ssml_rejects_mixed_controls(self): + """Flux batch cannot combine SSML phoneme and break controls.""" ssml = ''' Take azathioprine Do not exceed dosage. ''' - result = ssml_to_deepgram(ssml) - - assert '"word": "azathioprine"' in result - assert r"\{pause:500ms\}" in result - assert "Do not exceed dosage." in result + with pytest.raises(ValueError, match="Pronunciation and pause controls cannot be combined"): + ssml_to_deepgram(ssml) def test_multiple_phonemes(self): """Test multiple phoneme tags""" From f7baf969bb55cb391d0d5a71808a2a23d7527b7e Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Thu, 1 Oct 2026 14:19:30 +0100 Subject: [PATCH 13/15] fix: validate standalone Flux controls --- docs/FluxTtsControls.md | 2 +- src/deepgram/helpers/text_builder.py | 6 ++++++ tests/custom/test_text_builder.py | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/FluxTtsControls.md b/docs/FluxTtsControls.md index 3720997a..6ace0cbf 100644 --- a/docs/FluxTtsControls.md +++ b/docs/FluxTtsControls.md @@ -1,6 +1,6 @@ # Flux TTS Controls -Pronunciation controls apply to Flux batch REST, Flux WebSocket, and Aura-2 `/v1/speak`. Pause controls apply to Flux batch REST only. +Flux controls are English-only at launch. Pronunciation controls apply to Flux batch REST, Flux WebSocket, and Aura-2 `/v1/speak`. Pause controls apply to Flux batch REST only. ## Batch REST diff --git a/src/deepgram/helpers/text_builder.py b/src/deepgram/helpers/text_builder.py index 25f250b6..8886aeba 100644 --- a/src/deepgram/helpers/text_builder.py +++ b/src/deepgram/helpers/text_builder.py @@ -194,6 +194,9 @@ def add_pronunciation(text: str, word: str, ipa: str) -> str: Returns: Text with word replaced by \\{\"word\": \"word\", \"pronounce\": \"ipa\"\\} + Raises: + ValueError: If the resulting text combines pronunciation and pause controls + Example: text = "Take azathioprine twice daily with dupilumab injections." text = add_pronunciation(text, "azathioprine", "ˌæzəˈθaɪəpriːn") @@ -209,6 +212,9 @@ def add_pronunciation(text: str, word: str, ipa: str) -> str: # Replace word with pronunciation (case-sensitive, whole word only) pattern = r"\b" + re.escape(word) + r"\b" result = re.sub(pattern, lambda _: pronunciation_control, text, count=1) + pronunciation_count, pause_count = _control_counts(result) + if pronunciation_count and pause_count: + raise ValueError("Pronunciation and pause controls cannot be combined in one Flux batch request") return result diff --git a/tests/custom/test_text_builder.py b/tests/custom/test_text_builder.py index 840547e1..5f1f3083 100644 --- a/tests/custom/test_text_builder.py +++ b/tests/custom/test_text_builder.py @@ -240,6 +240,11 @@ def test_word_not_found(self): # Text should be unchanged assert result == text + def test_rejects_existing_pause_control(self): + """Flux batch cannot combine a replacement pronunciation with a pause.""" + with pytest.raises(ValueError, match="Pronunciation and pause controls cannot be combined"): + add_pronunciation(r"Take \{pause:500ms\} medicine", "medicine", "mɛdɪsɪn") + class TestSsmlToDeepgram: """Tests for SSML conversion""" From b7169a788057b64a803ce17f8699f620f3462077 Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Thu, 1 Oct 2026 14:24:40 +0100 Subject: [PATCH 14/15] feat(textbuilder): document Flux control migration TextBuilder emits escaped \{pause:ms\} markers and enforces the 500-3000 ms range with no more than eight pauses per batch request.\n\nIt raises ValueError for invalid SSML breaks and mixed pronunciation/pause controls. Flux controls are English-only at launch; pauses are Flux batch-only. --- docs/FluxTtsControls.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/FluxTtsControls.md b/docs/FluxTtsControls.md index 6ace0cbf..bb5aa83f 100644 --- a/docs/FluxTtsControls.md +++ b/docs/FluxTtsControls.md @@ -4,7 +4,7 @@ Flux controls are English-only at launch. Pronunciation controls apply to Flux b ## Batch REST -Use `client.speak.v2.audio.generate()` for complete text. A pause is written as `\{pause:500ms\}` through `\{pause:3000ms\}` in 100 ms increments. A request accepts at most eight pauses. `TextBuilder` emits and validates this Flux batch syntax. +Use `client.speak.v2.audio.generate()` for complete text. A pause is written as `\{pause:500ms\}` through `\{pause:3000ms\}` in 100 ms increments. A request accepts at most eight pauses. `TextBuilder` emits and validates this Flux batch syntax; its `from_ssml()` converter raises `ValueError` for out-of-range breaks, and its helpers reject mixed pronunciation and pause controls before sending a request. Pronunciation uses `\{"word": "...", "pronounce": ""\}` and is Early Access. A pronunciation cannot be combined with any pause or with `speed` other than `1.0`. When a pause is present, `speed` cannot exceed `1.15`. Invalid combinations return a batch error, including `CONTROL_COMBINATION_INVALID` or `PAUSE_SPEED_CAP_EXCEEDED`. From 1f17cf8ddaa6fe6ce0b6fca8e3517b63f5e14b8b Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Thu, 1 Oct 2026 14:28:26 +0100 Subject: [PATCH 15/15] docs: clarify Flux WebSocket controls --- .agents/skills/deepgram-python-text-to-speech/SKILL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.agents/skills/deepgram-python-text-to-speech/SKILL.md b/.agents/skills/deepgram-python-text-to-speech/SKILL.md index 8c94a47d..a580c70b 100644 --- a/.agents/skills/deepgram-python-text-to-speech/SKILL.md +++ b/.agents/skills/deepgram-python-text-to-speech/SKILL.md @@ -148,7 +148,7 @@ WSS client messages: `SpeakV1Text`, `Flush`, `Clear`, `Close`. - `examples/21-text-to-speech-streaming.py` — WSS streaming - `examples/22-text-builder-demo.py` — TextBuilder (no API key) - `examples/23-text-builder-helper.py` — TextBuilder + REST -- `examples/24-text-builder-streaming.py` — plain-text WSS; Flux controls are batch-only +- `examples/24-text-builder-streaming.py` — plain-text WSS; Flux pause controls are batch-only - `tests/wire/test_speak_v1_audio.py` — REST wire test - `tests/manual/speak/v1/connect/main.py` — live WSS test