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
4 changes: 2 additions & 2 deletions .fern/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"skip_validation": true
}
},
"originGitCommit": "3dc7e52769409adb2a41e006ee1fc80fdf642a20",
"originGitCommitIsDirty": true,
"originGitCommit": "7d90d34144ca944bba2a570780fad2d53fdc5c4d",
"originGitCommitIsDirty": false,
"invokedBy": "manual",
"sdkVersion": "7.15.0"
}
14 changes: 13 additions & 1 deletion .fernignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ src/deepgram/types/shared_intents.py
src/deepgram/requests/shared_topics.py
src/deepgram/requests/shared_intents.py

# Agent Think Live ConversationText gained a required wire field in 2026-10.
# The runtime model defaults missing legacy response payloads to `default`, while
# the request TypedDict accepts the pre-2026-10 shape for existing typed callers.
# SDK-created runtime models still serialize the current wire-required field.
# [temporarily frozen — remove after legacy server payloads are retired]
src/deepgram/agent/v1/types/agent_v1conversation_text.py
src/deepgram/agent/v1/requests/agent_v1conversation_text.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)
Expand Down Expand Up @@ -221,10 +229,14 @@ src/deepgram/core/query_encoder.py
# [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.
# Generated docstrings have a local whitespace cleanup.
# [temporarily frozen — remove when Fern emits whitespace-clean docstrings]
src/deepgram/speak/v2/types/speak_v2warning.py
src/deepgram/speak/v2/requests/speak_v2warning.py
src/deepgram/agent/v1/types/agent_v1inject_dynamic_agent_message.py
src/deepgram/agent/v1/requests/agent_v1inject_dynamic_agent_message.py
src/deepgram/listen/v1/types/listen_v1configure_failure.py
src/deepgram/listen/v1/requests/listen_v1configure_failure.py

# 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
Expand Down
3 changes: 2 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ Current temporarily frozen files:
- `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 retained `7.15.0` 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/speak/v2/types/speak_v2warning.py`, `src/deepgram/speak/v2/requests/speak_v2warning.py`, `src/deepgram/agent/v1/types/agent_v1inject_dynamic_agent_message.py`, `src/deepgram/agent/v1/requests/agent_v1inject_dynamic_agent_message.py`, `src/deepgram/listen/v1/types/listen_v1configure_failure.py`, `src/deepgram/listen/v1/requests/listen_v1configure_failure.py` — whitespace cleanup for generated 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.
- `src/deepgram/agent/v1/types/agent_v1conversation_text.py`, `src/deepgram/agent/v1/requests/agent_v1conversation_text.py` — compatibility for the 2026-10 Think Live schema update that made `conversational_behavior` required. The runtime response model defaults an omitted field to `"default"` so older/self-hosted server payloads continue to parse, while the request TypedDict accepts the pre-update shape for typed callers. SDK-created runtime models still serialize the current wire-required field. Remove and unfreeze when those legacy payloads are retired.
- `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.
- `tests/wire/test_listen_v1_media.py` — restored query-parameter coverage for `listen.v1.media.transcribe_url`. **Third instance of the same mechanism as the two entries above**, this time on the SDK's highest-traffic endpoint: the 2026-08-18 regen simplified the upstream `/v1/listen` spec *example* (the wiremock mapping was renamed `"default"` → `"Remote File"`), so the generated wire test dropped all 37 optional query params — including the bool → lowercase `"true"`/`"false"` assertions — while the client signature still forwards every one of them. The generated test is left untouched; a second hand-written test with its own `test_id` carries the assertions, which is why no change to `wiremock/wiremock-mappings.json` is needed (`verify_request_count` matches WireMock's *recorded* requests via the `X-Test-Id` header, not the stub matcher). **Pattern to watch:** any regen that simplifies an upstream example silently erodes that endpoint's wire coverage; check `git diff` on `tests/wire/` every cycle.
Expand Down
6 changes: 2 additions & 4 deletions src/deepgram/agent/v1/types/agent_v1conversation_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ class AgentV1ConversationText(UncheckedBaseModel):
The actual statement that was spoken
"""

conversational_behavior: typing.Optional[AgentV1ConversationTextConversationalBehavior] = pydantic.Field(
default=None
)
conversational_behavior: AgentV1ConversationTextConversationalBehavior = pydantic.Field(default="default")
"""
Annotates what kind of utterance the message represents: `default` (a standard turn), `backchannel` (a short acknowledgement while the user held the floor), `presence_check` (a prompt after extended silence), or `filler` (a line covering a wait on a function call or a dynamic InjectAgentMessage). Always sent; it is `default` for every message while Think Live is off
Annotates what kind of utterance the message represents: `default` (a standard turn), `backchannel` (a short acknowledgement while the user held the floor), `presence_check` (a prompt after extended silence), or `filler` (a line covering a wait on a function call or a dynamic InjectAgentMessage). Always sent; it is `default` for every message while Think Live is off. Defaults to `default` when an older or self-hosted server omits it.
"""

languages_hinted: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
Expand Down
11 changes: 11 additions & 0 deletions tests/custom/test_agent_think_live.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,17 @@ def test_conversation_text_conversational_behaviors_parse(behavior: str) -> None
assert parsed.conversational_behavior == behavior


def test_conversation_text_without_behavior_defaults_for_legacy_responses() -> None:
parsed = construct_type(
type_=cast(Any, V1SocketClientResponse),
object_={"type": "ConversationText", "role": "assistant", "content": "I am still here."},
)

assert isinstance(parsed, AgentV1ConversationText)
assert parsed.conversational_behavior == "default"
assert parsed.dict()["conversational_behavior"] == "default"


def test_legacy_messages_and_think_live_coexist_without_unwrapping() -> None:
agent = AgentV1SettingsAgent(
messages=[{"type": "History", "role": "assistant", "content": "Welcome"}],
Expand Down
6 changes: 6 additions & 0 deletions tests/typecheck/compat_aliases.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
ListenV1LanguageHintParams as RootListenV1LanguageHintParams,
)
from deepgram.agent.v1.requests import (
AgentV1ConversationTextParams,
AgentV1HistoryContentParams,
AgentV1HistoryFunctionCallsParams,
AgentV1InjectDynamicAgentMessageParams,
Expand Down Expand Up @@ -118,6 +119,11 @@
"think_live": think_live_settings_params,
}
think_live_updated_params: AgentV1ThinkLiveUpdatedParams = {"type": "ThinkLiveUpdated"}
legacy_conversation_text_params: AgentV1ConversationTextParams = {
"type": "ConversationText",
"role": "assistant",
"content": "I am still here.",
}

think_live_provider = DeepgramThinkLiveProviderV1(presence_check_max_count=3, presence_check_interval_ms=5000)
think_live_settings = ThinkLiveSettingsV1(provider=think_live_provider)
Expand Down
Loading