SIGN IN SIGN UP

feat(regen): v2 language_hints, profanity filter, word timings, diarize_model (#730)

## SDK regeneration 2026-06-15

Fern generator output (commit `dc04625`) reconciled against
hand-maintained patches.

> **Versioning:** classified `feat` (minor). The regen adds new
fields/params (additive) and corrects the never-functional V2
`language_hint` field. No working public behavior is removed, so this is
intentionally **not** a major release.

### New / additive (non-breaking)
- **`ListenV2ProfanityFilter`** — new type, re-exported from the package
root + `types`.
- **`ListenV2TurnInfoWordsItem.start` / `.end`** — word-level timing on
streaming turn info, **`Optional[float]`** (default `None`). The API
models these as optional (`stem`: `Option<f32>` with
`skip_serializing_if`), so the server may omit them on some words/paths
and the SDK matches that contract. As a response model parsed from the
wire, this is additive and non-breaking — readers just see new optional
fields; no construction changes are required.
- **`diarize_model` param + `DiarizeModel` type** on listen/v1. The
legacy `diarize` param is now *deprecated but still present* — no break.

### Corrected (fix, not a break)
- **V2 listen provider `language_hint` → `language_hints`**
(`DeepgramListenProviderV2`, its request TypedDict, and the agent
`…ListenProviderV2` aliases). The singular `language_hint` (`Union[str,
List[str]]`) was **never accepted by the API** — the SDK serialized a
field the server discarded — so this corrects a non-functional field
rather than breaking a working one. Use a list: `language_hints=["en",
"es"]`.

### Re-applied manual patches (still needed)
- **Socket clients** (`agent/v1`, `listen/v1`, `listen/v2`, `speak/v1`):
broad `except Exception`, optional control-message params,
`_sanitize_numeric_types` (agent), and the `listen/v2 send_configure`
`typing.Any`/raw-`_send` shim.
- **`core/query_encoder.py`**: Python bool → lowercase `"true"/"false"`
coercion for websocket query strings.
- **Agent Settings 2026-05-05 backward-compat** (`agent_v1settings`,
`agent_v1settings_agent`, `agent_v1settings_agent_context`, types +
requests): callable `AgentV1SettingsAgent`, legacy `messages=` kwarg,
`.messages` property, nested-context migration.
- **Legacy alias re-exports** in the 7 package `__init__.py` files.
- **`tests/wire/test_manage_v1_projects_keys.py`**: legacy
`CreateKeyV1RequestOneParams` wire coverage.

### Dropped (generator caught up)
- **`agent_v1settings_audio_output.container`**: adopt the generated
`AgentV1SettingsAudioOutputContainer` enum. It's
`Union[Literal["none","wav","ogg"], Any]`, so arbitrary strings still
validate — runtime-non-breaking. Removed from `.fernignore`.

### New compat shims (generator regression)
- The regen **removed** `ListenV2CloseStreamType` (docs #946 narrowed
the v2 CloseStream `type` enum). The original generated type wrongly
allowed `Union[Literal["Finalize","CloseStream","KeepAlive"], Any]` — v2
had copied v1's control-message enum, but a CloseStream message's `type`
can only ever be `"CloseStream"`. Recreated by hand as the corrected
`Literal["CloseStream"]`, re-exported from the three `listen`
`__init__.py` files, and frozen in `.fernignore` — preserving the public
import path **without** resurrecting the invalid values. This removes
the only hard breaking change, so the PR stays a minor (`feat`) bump.
- The regen **removed** the top-level
`DeepgramListenProviderV2LanguageHint`/`...Params` type (`Union[str,
List[str]]`); the `→ diarize_model.py` git "rename" is a Fern
false-match (the unrelated `DiarizeModel`). Its removal broke two
**permanently-frozen** `*V2LanguageHint` listen-provider alias files.
Recreated both modules by hand and froze them in `.fernignore` so the
public import paths keep working.

### Validation
- `mypy src/` — clean (802 files) — CI gate
- `pytest` — 225 passed, 1 skipped — CI gate
- `ruff check` — `src/deepgram` clean; not run by CI. (Pre-existing
`I001` import-order nits remain in some hand-written `examples/` and
`tests/manual/` files, untouched by this regen.)

All `.bak` files removed; `.fernignore` paths restored; `AGENTS.md`
frozen-file list updated.


---

## Second reconciliation pass — Fern run `f6c1612` (origin `8dd6f48`)

A follow-up generator run landed on this branch after the first
reconciliation above. Re-ran the full review-regen flow against it.

### Re-applied — all 25 frozen patches still needed (none dropped)
Every temporarily-frozen file's diff against its `.bak` consisted *only*
of our hand-patches being stripped; the generator introduced no new
content into them (all 10 `__init__.py` diffs were pure deletions of our
legacy re-exports). All re-applied verbatim:
- 4 socket clients, 6 `agent_v1settings*` files, 3
`language_hint→language_hints` validators, 10 package `__init__.py`
re-exports, `core/query_encoder.py`, and the
`test_manage_v1_projects_keys.py` wire test.

### Generator changes flagged (judgment calls — kept our patches)
- **`listen/v2 send_configure`**: the generator now *does* emit real
`ListenV2Configure` / `ListenV2ConfigureSuccess` types and wires them in
(response Union included). **Decision: keep the `typing.Any`/raw-`_send`
shim** — no public signature change; adopting the generated types is
deferred as a separate deliberate change.
- **Socket-client `except`**: the generator now narrows to
`(websockets.WebSocketException, JSONDecodeError)` (added
`JSONDecodeError`). **Decision: keep broad `except Exception`** — custom
transports can raise non-websocket exceptions.

### Generator-owned change (auto-accepted, not frozen)
- **`ListenV2TurnInfoWordsItem.start` / `.end`** are **`Optional[float]`
(default `None`)** — matching the API contract (the upstream spec was
corrected to drop them from `required`). The file isn't frozen, so Fern
owns it; accepted as-is. The "New / additive" section above already
reflects this final optional state.

### Validation (refreshed)
- `pytest` — **237 passed, 1 skipped**
- `mypy src/deepgram` — **clean (804 files)**
- `ruff check src/deepgram` — **clean**; the 25 re-applied files also
clean. Pre-existing `I001` import-order nits remain only in hand-written
`tests/custom/` + `tests/manual/` files, untouched by this regen.

All `.bak` files removed; `.fernignore` paths restored to originals.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
G
Greg Holmes committed
da6b7ba8b5583a9dcddfd3950b4abd4d2645c9fa
Parent: 029d877
Committed by GitHub <noreply@github.com> on 6/26/2026, 8:48:55 PM