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
@@ -1,5 +1,5 @@
{
"cliVersion": "5.95.1",
"cliVersion": "5.216.0",
"generatorName": "fernapi/fern-python-sdk",
"generatorVersion": "5.39.3",
"generatorConfig": {
Expand All @@ -21,7 +21,7 @@
"skip_validation": true
}
},
"originGitCommit": "229defd4c32f220af07902c24efca5e94b4c47a4",
"originGitCommit": "a70c45e45ad40df616f6103f8bd5e54fee0bff2a",
"originGitCommitIsDirty": true,
"invokedBy": "manual",
"sdkVersion": "7.20.0"
Expand Down
23 changes: 23 additions & 0 deletions .fernignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,28 @@ src/deepgram/agent/v1/requests/agent_v1settings_agent_context_messages_item_func
src/deepgram/types/create_key_v1request_one.py
src/deepgram/requests/create_key_v1request_one.py

# Hand-written shims recreating CreateKeyV1Request / CreateKeyV1RequestParams, which Fern deleted
# in the 2026-12-01 regen when manage.v1.projects.keys.create moved from a single opaque `request`
# mapping to explicit keyword arguments. They stay on the public import surface, and the
# permanently frozen create_key_v1request_one.py aliases above import them, so Fern must not
# delete them again. Regression coverage in tests/custom/test_compat_aliases.py.
src/deepgram/types/create_key_v1request.py
src/deepgram/requests/create_key_v1request.py

# Backward-compat patch for the 2026-12-01 create-key signature change. The generated create()
# now takes comment/scopes/tags/expiration_date/time_to_live_in_seconds as keyword arguments,
# which raises TypeError for every caller written against 7.20 and earlier. Both files carry a
# hand-added optional `request` argument, and raw_client.py carries _build_create_key_body, which
# forwards the legacy argument as the request body rather than unpacking it, so unknown keys still
# ship. Any object that reached the JSON encoder on 7.20 still does, Mapping or not; narrowing that
# check to `dict` is a silent breaking change. Explicit keyword arguments are merged over a mapping
# and win where both supply a key. Body-level coverage is tests/custom/test_create_key_legacy_request.py;
# the wire test only counts requests. Remove and unfreeze when the legacy call shape is retired in a
# future major.
# [temporarily frozen -- manual patch described above]
src/deepgram/manage/v1/projects/keys/client.py
src/deepgram/manage/v1/projects/keys/raw_client.py

# Backward-compatibility alias shims for the 2026-08-18 regen renames. The generator
# dropped the *ThinkProvider*/*SpeakProvider* prefixes from these public model/voice/
# version types (AnthropicThinkProviderModel -> AnthropicModel, CartesiaSpeakProvider* ->
Expand Down Expand Up @@ -267,6 +289,7 @@ tests/custom/test_client_construction_and_helpers.py
tests/custom/test_compat_aliases.py
tests/custom/test_core_internals_branches.py
tests/custom/test_core_utilities_coverage.py
tests/custom/test_create_key_legacy_request.py
tests/custom/test_eot_thresholds_feature.py
tests/custom/test_http_endpoints_coverage.py
tests/custom/test_http_retry_coverage.py
Expand Down
5 changes: 4 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Current permanently frozen files:
- `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
- `src/deepgram/types/create_key_v1request_one.py`, `src/deepgram/requests/create_key_v1request_one.py` — hand-written compatibility aliases preserving the old public create-key request imports after the regen rename to `CreateKeyV1Request`
- `src/deepgram/types/create_key_v1request.py`, `src/deepgram/requests/create_key_v1request.py` — hand-written shims recreating `CreateKeyV1Request` / `CreateKeyV1RequestParams`, which Fern deleted in the 2026-12-01 regen when `manage.v1.projects.keys.create` moved to explicit keyword arguments. They stay on the public import surface and the `create_key_v1request_one.py` aliases above import them, so Fern must not delete them again. Recreated with the generator's former definition so the identity assertions in `tests/custom/test_compat_aliases.py` keep holding
- `src/deepgram/types/anthropic_think_provider_model.py`, `src/deepgram/types/cartesia_speak_provider_model_id.py`, `src/deepgram/types/cartesia_speak_provider_voice.py`, `src/deepgram/types/deepgram_speak_provider_model.py`, `src/deepgram/types/google_think_provider_model.py`, `src/deepgram/types/google_think_provider_version.py`, `src/deepgram/types/groq_think_provider_reasoning_mode.py`, `src/deepgram/requests/cartesia_speak_provider_voice.py`, `src/deepgram/agent/v1/types/agent_v1history_content_role.py`, `src/deepgram/agent/v1/types/agent_v1history_function_calls_function_calls_item.py`, `src/deepgram/agent/v1/types/agent_v1settings_agent_context_context_messages_item_content_role.py`, `src/deepgram/agent/v1/types/agent_v1settings_agent_context_context_messages_item_function_calls_function_calls_item.py`, `src/deepgram/agent/v1/requests/agent_v1history_function_calls_function_calls_item.py`, `src/deepgram/agent/v1/requests/agent_v1settings_agent_context_context_messages_item_function_calls_function_calls_item.py` — hand-written compatibility aliases for the 2026-08-18 regen renames. The generator dropped the `*ThinkProvider*`/`*SpeakProvider*` prefixes from the public model/voice/version types (`AnthropicThinkProviderModel`→`AnthropicModel`, `CartesiaSpeakProvider*`→`Cartesia*`, `DeepgramSpeakProviderModel`→`DeepgramModel`, `GoogleThinkProvider*`→`Google*`, `GroqThinkProviderReasoningMode`→`GroqReasoningMode`), renamed the agent conversation-history subtypes (`AgentV1HistoryContentRole`→`ConversationHistoryMessageRole`, `AgentV1HistoryFunctionCallsFunctionCallsItem`→`FunctionCallHistoryMessageFunctionCallsItem`), and deleted the doubled `AgentV1SettingsAgentContextContextMessagesItem*` leaf modules. These aliases preserve every old public import path. (The parallel single-`Context` `agent_v1settings_agent_context_messages_item_content_role.py` / `..._function_calls_function_calls_item.py` shims, already listed in this permanently-frozen block above, were also re-pointed to the new targets in the same regen.) Regression coverage in `tests/custom/test_compat_aliases.py`.
- `src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider_v1.py`, `src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider_v2.py`, `src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider_v2language_hint.py`, `src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider_v1.py`, `src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider_v2.py`, `src/deepgram/agent/v1/requests/agent_v1settings_agent_context_listen_provider_v1.py`, `src/deepgram/agent/v1/requests/agent_v1settings_agent_context_listen_provider_v2.py`, `src/deepgram/agent/v1/requests/agent_v1settings_agent_context_listen_provider_v2language_hint.py`, `src/deepgram/agent/v1/requests/agent_v1settings_agent_listen_provider_v1.py`, `src/deepgram/agent/v1/requests/agent_v1settings_agent_listen_provider_v2.py` — hand-written compatibility aliases for the 2026-05-14 spec dedup that consolidated `AgentV1SettingsAgent[Context]ListenProviderV{1,2,V2LanguageHint}` into top-level `DeepgramListenProvider*` types
- `src/deepgram/types/deepgram_listen_provider_v2language_hint.py`, `src/deepgram/requests/deepgram_listen_provider_v2language_hint.py` — hand-written shims recreating the top-level `DeepgramListenProviderV2LanguageHint`/`...Params` type (`Union[str, List[str]]`) that Fern removed in the 2026-06-15 regen. The `*V2LanguageHint` listen-provider aliases above import from these and they remain part of the public import surface, so they are recreated by hand and frozen so Fern won't delete them again
Expand All @@ -40,6 +41,7 @@ Current permanently frozen files:
- `tests/custom/test_agent_history.py` — hand-written regression test for Agent History websocket payload parsing
- `tests/custom/test_api_key_env_resolution.py` — hand-written regression test that `DEEPGRAM_API_KEY` is resolved when the client is constructed rather than when the module is imported. The generated base client takes `os.getenv(...)` as a default argument, which Python evaluates once at import, so `load_dotenv()` placed below the imports left the default captured as `None` (issue #734). `client.py` re-reads the variable; this pins that, plus explicit-key and `access_token` precedence and the no-key-anywhere error
- `tests/custom/test_compat_aliases.py` — hand-written regression test for backward-compatible alias imports after regen renames
- `tests/custom/test_create_key_legacy_request.py` — hand-written regression coverage for the deprecated `request` mapping on `manage.v1.projects.keys.create`. The 2026-12-01 regen replaced that single opaque argument with explicit keyword arguments and deleted `CreateKeyV1Request`; `_build_create_key_body` in the temporarily frozen `keys/raw_client.py` keeps the old shape working. This pins the parts a future regen could quietly drop: the legacy mapping is forwarded verbatim rather than validated (unknown keys included, no required fields), explicit keyword arguments override it, and both shapes agree on sync, async and `with_raw_response` surfaces
- `tests/custom/test_listen_v1_configure.py` — hand-written regression coverage for Listen V1 Configure message serialization and typed Error response parsing on both synchronous and asynchronous websocket clients
- `tests/custom/test_model_dict_compat.py` — hand-written regression coverage for the read-only subscript compatibility shim on typed Listen V2 response models, including sync/async parsing, every response variant, nested objects, unknown fields, omitted-key behavior, and scope isolation from unrelated generated models
- `tests/custom/test_query_encoder.py` — hand-written regression test that `core/query_encoder.py` coerces Python bools to lowercase `"true"`/`"false"` before `urlencode` so websocket query strings stay wire-correct
Expand Down Expand Up @@ -81,8 +83,9 @@ Current temporarily frozen files:
- `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 retained `7.16.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/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.20.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`, `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/manage/v1/projects/keys/client.py`, `src/deepgram/manage/v1/projects/keys/raw_client.py` — backward-compat patch for the 2026-12-01 create-key signature change. The generated `create()` now takes `comment`/`scopes`/`tags`/`expiration_date`/`time_to_live_in_seconds` as keyword arguments, which raises `TypeError` for every caller written against 7.20 or earlier. Both files carry a hand-added optional `request` argument, and `raw_client.py` carries `_build_create_key_body`, which forwards the legacy mapping verbatim (it was typed `Any` and never validated) with explicit keyword arguments applied on top. Every argument defaults to the `OMIT` sentinel, so an explicit `None` uniformly means a null value rather than an omitted one, and `request=None` still sends the empty body it did on 7.20. `comment` and `scopes` had to be widened to optional to accept the legacy form, which costs mypy's missing-argument check, but only for code importing `KeysClient`/`RawKeysClient` directly: `BaseClient.manage` has no return annotation, so `client.manage.v1.projects.keys.create` was always `Any` to mypy. A runtime `TypeError` naming the argument covers both paths. Body-level coverage is `tests/custom/test_create_key_legacy_request.py`, which mutation-tests the merge and passthrough branches; `tests/wire/test_manage_v1_projects_keys.py` only counts requests. Remove and unfreeze when the legacy call shape is retired in a future major.
- `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
Expand Down
8 changes: 4 additions & 4 deletions examples/51-management-keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@

# Create a new API key
print("\nCreating new API key...")
# Each field is its own argument. The older single-mapping form,
# `request={"comment": ..., "scopes": ...}`, still works and is deprecated.
new_key = client.manage.v1.projects.keys.create(
project_id=project_id,
request={
"comment": "Example API key",
"scopes": ["usage:read"],
},
comment="Example API key",
scopes=["usage:read"],
)
print(f"Created key ID: {new_key.api_key_id}")
print(f"Key: {new_key.key}")
Expand Down
Loading
Loading