Commit ffd2e7d
fix: (regen) route think/models to env.agent_rest (#715)
## Summary
SDK regeneration 2026-05-15. All 20 temporarily frozen files reviewed;
all 20 patches re-applied (no patches dropped this cycle — see
"near-miss" note below).
## Patches re-applied
- `core/query_encoder.py` — bool→lowercase coercion for websocket query
strings (7.1.1 fix).
- `tests/wire/test_manage_v1_projects_keys.py` — wire test for legacy
`CreateKeyV1RequestOneParams` alias.
- 4 socket clients (`speak/v1`, `listen/v1`, `listen/v2`, `agent/v1`) —
broad `except Exception` (custom transports), optional `message=`
defaults on control sends.
- `agent/v1/socket_client.py` — additionally restored
`_sanitize_numeric_types` (float→int sanitizer).
- `listen/v2/socket_client.py` — additionally kept `send_configure` as
`typing.Any`/raw `_send` shim and `typing.Any` in response Union
(generator now emits `ListenV2Configure`/`ListenV2ConfigureSuccess` but
we don't yet have evidence the new typed models are wire-correct).
- 7 agent-settings types/requests preserving callable
`AgentV1SettingsAgent(...)`, `AgentV1Settings.agent` accepting both
wrapper and `agent_id` strings, legacy `messages=[...]` migration,
`.messages` read-side property, and `audio.output.container` as `str`.
- 7 package `__init__.py` files restoring compat re-exports:
`CreateKeyV1RequestOne(+Params)`, `AgentV1HistoryContent(+Params)`,
`AgentV1HistoryFunctionCalls(+Params)`,
`AgentV1SettingsAgentContextMessagesItem*(+Params)`,
`AgentV1SettingsAgent[Context]ListenProviderV1/V2/V2LanguageHint(+Params)`.
## Generator changes worth flagging
- `AgentV1SettingsAgent` is now a Union alias
(`Union[AgentV1SettingsAgentContext, str]`) in fresh generator output —
callable usage would break. We continue to patch back to a class with
`model_validator` for backward compat.
- `audio_output.container` regenerated as
`AgentV1SettingsAudioOutputContainer` enum; we keep `str`.
- `messages` field removed from `AgentV1SettingsAgentContext(Params)`;
canonical shape is `context.messages`.
- `agent/v1/settings/think/models/raw_client.py` route now hits
`environment.agent_rest`.
## `DeepgramClientEnvironment` change — intentional fix, not a break
The regen drops `DeepgramClientEnvironment.AGENT` and adds a required
`agent_rest` kwarg to `DeepgramClientEnvironment.__init__`. This is
fixing the previously broken `agent.v1.settings.think.models.list()`
route: the old `.AGENT` env routed REST traffic to the wrong host, so
any caller of that endpoint was already broken. The new `agent_rest`
slot is the dedicated REST host for agent-served endpoints.
JS SDK equivalent (deepgram-js-sdk#499 → `56b8ce5`) also needed a
`src/Client.ts` patch because `client.fetch()` passthrough started
defaulting to `agentRest` instead of `base`. The Python SDK has no
equivalent passthrough in the hand-maintained `client.py`, so no
analogous patch is needed here.
## Near miss
Initial review classified `agent/v1/types/agent_v1settings.py` and
`agent/v1/requests/agent_v1settings.py` as droppable (new generator
declares `agent: AgentV1SettingsAgent` and the new
`AgentV1SettingsAgent` is itself `Union[AgentV1SettingsAgentContext,
str]`, structurally equivalent). Pytest caught the issue: because we
patch `AgentV1SettingsAgent` back to a class (for callable backward
compat), the bare `agent: AgentV1SettingsAgent` field rejects string
values. Both patches restored to broaden to `Union[AgentV1SettingsAgent,
AgentV1SettingsAgentContext, str]`.
`tests/custom/test_compat_aliases.py` covers this regression.
## Validation
- `uv run pytest -q` → 199 passed, 4 skipped
- `uv run mypy src` → clean (801 files)
- `uv run ruff check src tests` → 57 errors, all pre-existing on main in
`tests/manual/` (untouched by regen)
## Test plan
- [x] Re-apply manual patches after regen.
- [x] Restore `.fernignore` originals; drop `.bak` shadow paths.
- [x] Delete all `.bak` files.
- [x] `pytest`, `ruff check`, `mypy` validated (with caveats above).
---------
Co-authored-by: fern-api[bot] <115122769+fern-api[bot]@users.noreply.github.com>1 parent 9d9a43d commit ffd2e7d
7 files changed
Lines changed: 19 additions & 17 deletions
File tree
- .fern
- src/deepgram
- agent/v1/settings/think/models
- core
- tests/wire
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | | - | |
| 9 | + | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
21 | 21 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
54 | | - | |
| 56 | + | |
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
| |||
0 commit comments