Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .fern/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"skip_validation": true
}
},
"originGitCommit": "335af96251466afae7a9f71badb65c630a48626e",
"originGitCommit": "14c0ca94fcd0279d99570389d7b688dc3a18ea41",
"originGitCommitIsDirty": true,
"invokedBy": "manual",
"sdkVersion": "7.4.1"
Expand Down
184 changes: 116 additions & 68 deletions poetry.lock

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions src/deepgram/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,11 @@
SpeakV1Response,
SpeakV1SampleRate,
SpeakV1Speed,
SpeakV2AcceptedResponse,
SpeakV2Encoding,
SpeakV2MipOptOut,
SpeakV2Model,
SpeakV2Response,
SpeakV2SampleRate,
SpeakV2Tag,
ThinkSettingsV1,
Expand Down Expand Up @@ -403,6 +405,7 @@
SpeakSettingsV1Provider_DeepgramParams,
SpeakSettingsV1Provider_ElevenLabsParams,
SpeakSettingsV1Provider_OpenAiParams,
SpeakV2AcceptedResponseParams,
ThinkSettingsV1ContextLengthParams,
ThinkSettingsV1EndpointParams,
ThinkSettingsV1FunctionsItemEndpointParams,
Expand Down Expand Up @@ -796,9 +799,12 @@
"SpeakV1Response": ".types",
"SpeakV1SampleRate": ".types",
"SpeakV1Speed": ".types",
"SpeakV2AcceptedResponse": ".types",
"SpeakV2AcceptedResponseParams": ".requests",
"SpeakV2Encoding": ".types",
"SpeakV2MipOptOut": ".types",
"SpeakV2Model": ".types",
"SpeakV2Response": ".types",
"SpeakV2SampleRate": ".types",
"SpeakV2Tag": ".types",
"ThinkSettingsV1": ".types",
Expand Down Expand Up @@ -1246,9 +1252,12 @@ def __dir__():
"SpeakV1Response",
"SpeakV1SampleRate",
"SpeakV1Speed",
"SpeakV2AcceptedResponse",
"SpeakV2AcceptedResponseParams",
"SpeakV2Encoding",
"SpeakV2MipOptOut",
"SpeakV2Model",
"SpeakV2Response",
"SpeakV2SampleRate",
"SpeakV2Tag",
"ThinkSettingsV1",
Expand Down
6 changes: 6 additions & 0 deletions src/deepgram/agent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
AgentV1InjectionRefusedParams,
AgentV1KeepAlive,
AgentV1KeepAliveParams,
AgentV1LatencyReport,
AgentV1LatencyReportParams,
AgentV1ListenUpdated,
AgentV1ListenUpdatedParams,
AgentV1PromptUpdated,
Expand Down Expand Up @@ -181,6 +183,8 @@
"AgentV1InjectionRefusedParams": ".v1",
"AgentV1KeepAlive": ".v1",
"AgentV1KeepAliveParams": ".v1",
"AgentV1LatencyReport": ".v1",
"AgentV1LatencyReportParams": ".v1",
"AgentV1ListenUpdated": ".v1",
"AgentV1ListenUpdatedParams": ".v1",
"AgentV1PromptUpdated": ".v1",
Expand Down Expand Up @@ -345,6 +349,8 @@ def __dir__():
"AgentV1InjectionRefusedParams",
"AgentV1KeepAlive",
"AgentV1KeepAliveParams",
"AgentV1LatencyReport",
"AgentV1LatencyReportParams",
"AgentV1ListenUpdated",
"AgentV1ListenUpdatedParams",
"AgentV1PromptUpdated",
Expand Down
6 changes: 6 additions & 0 deletions src/deepgram/agent/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
AgentV1InjectUserMessage,
AgentV1InjectionRefused,
AgentV1KeepAlive,
AgentV1LatencyReport,
AgentV1ListenUpdated,
AgentV1PromptUpdated,
AgentV1ReceiveFunctionCallResponse,
Expand Down Expand Up @@ -98,6 +99,7 @@
AgentV1InjectUserMessageParams,
AgentV1InjectionRefusedParams,
AgentV1KeepAliveParams,
AgentV1LatencyReportParams,
AgentV1ListenUpdatedParams,
AgentV1PromptUpdatedParams,
AgentV1ReceiveFunctionCallResponseParams,
Expand Down Expand Up @@ -183,6 +185,8 @@
"AgentV1InjectionRefusedParams": ".requests",
"AgentV1KeepAlive": ".types",
"AgentV1KeepAliveParams": ".requests",
"AgentV1LatencyReport": ".types",
"AgentV1LatencyReportParams": ".requests",
"AgentV1ListenUpdated": ".types",
"AgentV1ListenUpdatedParams": ".requests",
"AgentV1PromptUpdated": ".types",
Expand Down Expand Up @@ -347,6 +351,8 @@ def __dir__():
"AgentV1InjectionRefusedParams",
"AgentV1KeepAlive",
"AgentV1KeepAliveParams",
"AgentV1LatencyReport",
"AgentV1LatencyReportParams",
"AgentV1ListenUpdated",
"AgentV1ListenUpdatedParams",
"AgentV1PromptUpdated",
Expand Down
3 changes: 3 additions & 0 deletions src/deepgram/agent/v1/requests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
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
Expand Down Expand Up @@ -103,6 +104,7 @@
"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",
Expand Down Expand Up @@ -193,6 +195,7 @@ def __dir__():
"AgentV1InjectUserMessageParams",
"AgentV1InjectionRefusedParams",
"AgentV1KeepAliveParams",
"AgentV1LatencyReportParams",
"AgentV1ListenUpdatedParams",
"AgentV1PromptUpdatedParams",
"AgentV1ReceiveFunctionCallResponseParams",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ class AgentV1InjectAgentMessageParams(typing_extensions.TypedDict):

* `default` — The agent speaks only if neither the user nor the agent is mid-turn. If a turn is in progress, the server replies with `InjectionRefused`.
* `queue` — The message is appended after any already-queued `ConversationText` without interrupting the current agent turn or think response. If nothing is queued, the message plays immediately.
* `interrupt` — The agent immediately speaks. If the agent was already speaking, it interrupts the current speech and replaces it with the new message. If the user is speaking, the agent interrupts with the new message, but the user's continued speech triggers `UserStartedSpeaking`, which quickly interrupts the agent.
"""
47 changes: 47 additions & 0 deletions src/deepgram/agent/v1/requests/agent_v1latency_report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This file was auto-generated by Fern from our API Definition.

import typing

import typing_extensions


class AgentV1LatencyReportParams(typing_extensions.TypedDict):
type: typing.Literal["LatencyReport"]
"""
Message type identifier for the latency report
"""

stt_latency: typing_extensions.NotRequired[float]
"""
Speech-to-text: time from audio received to transcript produced, in seconds
"""

ttt_token_latency: typing_extensions.NotRequired[float]
"""
Time to first token of any type (text, tool call, or thinking), in seconds
"""

ttt_text_latency: typing_extensions.NotRequired[float]
"""
Time to first text token from the LLM, in seconds
"""

ttt_tool_latency: typing_extensions.NotRequired[float]
"""
Time to first tool-call token from the LLM, in seconds
"""

ttt_thinking_latency: typing_extensions.NotRequired[float]
"""
Time to first thinking token from the LLM, in seconds
"""

tts_latency: typing_extensions.NotRequired[float]
"""
Text-to-speech: time from first text token to first audio byte, in seconds
"""

total_latency: typing_extensions.NotRequired[float]
"""
End-to-end: time from user utterance end to first audio byte, in seconds
"""
2 changes: 2 additions & 0 deletions src/deepgram/agent/v1/socket_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
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
Expand Down Expand Up @@ -73,6 +74,7 @@ def _sanitize_numeric_types(obj: typing.Any) -> typing.Any:
AgentV1ConversationText,
AgentV1UserStartedSpeaking,
AgentV1AgentThinking,
AgentV1LatencyReport,
AgentV1FunctionCallRequest,
AgentV1AgentStartedSpeaking,
AgentV1AgentAudioDone,
Expand Down
3 changes: 3 additions & 0 deletions src/deepgram/agent/v1/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
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
Expand Down Expand Up @@ -114,6 +115,7 @@
"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",
Expand Down Expand Up @@ -212,6 +214,7 @@ def __dir__():
"AgentV1InjectUserMessage",
"AgentV1InjectionRefused",
"AgentV1KeepAlive",
"AgentV1LatencyReport",
"AgentV1ListenUpdated",
"AgentV1PromptUpdated",
"AgentV1ReceiveFunctionCallResponse",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class AgentV1InjectAgentMessage(UncheckedBaseModel):

* `default` — The agent speaks only if neither the user nor the agent is mid-turn. If a turn is in progress, the server replies with `InjectionRefused`.
* `queue` — The message is appended after any already-queued `ConversationText` without interrupting the current agent turn or think response. If nothing is queued, the message plays immediately.
* `interrupt` — The agent immediately speaks. If the agent was already speaking, it interrupts the current speech and replaces it with the new message. If the user is speaking, the agent interrupts with the new message, but the user's continued speech triggers `UserStartedSpeaking`, which quickly interrupts the agent.
"""

if IS_PYDANTIC_V2:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

import typing

AgentV1InjectAgentMessageBehavior = typing.Union[typing.Literal["default", "queue"], typing.Any]
AgentV1InjectAgentMessageBehavior = typing.Union[typing.Literal["default", "queue", "interrupt"], typing.Any]
58 changes: 58 additions & 0 deletions src/deepgram/agent/v1/types/agent_v1latency_report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This file was auto-generated by Fern from our API Definition.

import typing

import pydantic
from ....core.pydantic_utilities import IS_PYDANTIC_V2
from ....core.unchecked_base_model import UncheckedBaseModel


class AgentV1LatencyReport(UncheckedBaseModel):
type: typing.Literal["LatencyReport"] = pydantic.Field(default="LatencyReport")
"""
Message type identifier for the latency report
"""

stt_latency: typing.Optional[float] = pydantic.Field(default=None)
"""
Speech-to-text: time from audio received to transcript produced, in seconds
"""

ttt_token_latency: typing.Optional[float] = pydantic.Field(default=None)
"""
Time to first token of any type (text, tool call, or thinking), in seconds
"""

ttt_text_latency: typing.Optional[float] = pydantic.Field(default=None)
"""
Time to first text token from the LLM, in seconds
"""

ttt_tool_latency: typing.Optional[float] = pydantic.Field(default=None)
"""
Time to first tool-call token from the LLM, in seconds
"""

ttt_thinking_latency: typing.Optional[float] = pydantic.Field(default=None)
"""
Time to first thinking token from the LLM, in seconds
"""

tts_latency: typing.Optional[float] = pydantic.Field(default=None)
"""
Text-to-speech: time from first text token to first audio byte, in seconds
"""

total_latency: typing.Optional[float] = pydantic.Field(default=None)
"""
End-to-end: time from user utterance end to first audio byte, in seconds
"""

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
3 changes: 3 additions & 0 deletions src/deepgram/requests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@
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
Expand Down Expand Up @@ -368,6 +369,7 @@
"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",
Expand Down Expand Up @@ -563,6 +565,7 @@ def __dir__():
"SpeakSettingsV1Provider_DeepgramParams",
"SpeakSettingsV1Provider_ElevenLabsParams",
"SpeakSettingsV1Provider_OpenAiParams",
"SpeakV2AcceptedResponseParams",
"ThinkSettingsV1ContextLengthParams",
"ThinkSettingsV1EndpointParams",
"ThinkSettingsV1FunctionsItemEndpointParams",
Expand Down
14 changes: 14 additions & 0 deletions src/deepgram/requests/speak_v2accepted_response.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file was auto-generated by Fern from our API Definition.

import typing_extensions


class SpeakV2AcceptedResponseParams(typing_extensions.TypedDict):
"""
Accepted response returned when a callback URL is supplied; the audio is delivered asynchronously to that URL.
"""

request_id: str
"""
Unique identifier for tracking the asynchronous request
"""
10 changes: 10 additions & 0 deletions src/deepgram/speak/v2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
SpeakV2SpeechStarted,
SpeakV2Warning,
)
from . import audio
from .audio import AudioGenerateRequestCallbackMethod, AudioGenerateRequestContainer, AudioGenerateRequestEncoding
from .requests import (
SpeakV2CloseParams,
SpeakV2ConnectedParams,
Expand All @@ -34,6 +36,9 @@
SpeakV2WarningParams,
)
_dynamic_imports: typing.Dict[str, str] = {
"AudioGenerateRequestCallbackMethod": ".audio",
"AudioGenerateRequestContainer": ".audio",
"AudioGenerateRequestEncoding": ".audio",
"SpeakV2Close": ".types",
"SpeakV2CloseParams": ".requests",
"SpeakV2Connected": ".types",
Expand All @@ -57,6 +62,7 @@
"SpeakV2SpeechStartedParams": ".requests",
"SpeakV2Warning": ".types",
"SpeakV2WarningParams": ".requests",
"audio": ".audio",
}


Expand All @@ -82,6 +88,9 @@ def __dir__():


__all__ = [
"AudioGenerateRequestCallbackMethod",
"AudioGenerateRequestContainer",
"AudioGenerateRequestEncoding",
"SpeakV2Close",
"SpeakV2CloseParams",
"SpeakV2Connected",
Expand All @@ -105,4 +114,5 @@ def __dir__():
"SpeakV2SpeechStartedParams",
"SpeakV2Warning",
"SpeakV2WarningParams",
"audio",
]
Loading
Loading