feat: update generated SDK models and restore agent settings compatibility#705
feat: update generated SDK models and restore agent settings compatibility#705GregHolmes merged 6 commits intomainfrom
Conversation
Re-applied the four socket-client patches (broad except, optional message
defaults, agent _sanitize_numeric_types, listen/v2 send_configure shim).
Re-applied the legacy alias re-exports to seven package __init__.py files
(top-level, agent/, agent/v1/, agent/v1/{types,requests}/, types/, requests/)
that PR #703 introduced but didn't freeze. Added those inits to .fernignore
and documented them under temporarily-frozen in AGENTS.md so the next regen
cycle protects them via the .bak swap.
…ture
The 2026-05-05 regen renamed three Fern-generated types under
AgentV1SettingsAgentContext (adding a Context infix) and restructured the
model to nest messages under .context.messages.
Adds 5 alias shim files mapping the old names to the new canonical paths,
and patches the regenerated model with a model_validator(mode="before")
that detects the legacy `messages=[...]` kwarg and remaps it into
`context={"messages": ...}` for wire compatibility. Freezes new files in
.fernignore, documents both in AGENTS.md, and adds 4 regression tests
asserting old and new construction shapes produce identical output.
There was a problem hiding this comment.
Pull request overview
This PR is an SDK regeneration update (2026-05-05) that refreshes generated models/TypedDicts and WireMock fixtures to match the latest API schema, including notable schema reshaping for the Agent v1 settings context while preserving backwards compatibility in key places.
Changes:
- Regenerated SDK types/requests, adding new fields (e.g., reasoning mode for think providers, additional model UUIDs for TTS metadata, language hints in listen v2 config success, richer project-member fields).
- Restructured Agent v1 settings context to nest message history under
context.messages, with a compatibility validator to accept legacymessages=[...]. - Updated WireMock mappings and tests to reflect schema changes; removed
uv.lockand updatedpoetry.lock.
Reviewed changes
Copilot reviewed 66 out of 68 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| wiremock/wiremock-mappings.json | Updates mocked project-members response payload shape. |
| uv.lock | Removes the uv lockfile from the repo. |
| tests/wire/test_manage_v1_projects_keys.py | Drops a WireMock test that targeted an older create-key request alias. |
| tests/custom/test_compat_aliases.py | Adds regression tests for agent-context legacy kwarg migration and renamed alias resolution. |
| src/deepgram/types/think_settings_v1provider.py | Adds reasoning_mode support for OpenAI/Groq think provider settings. |
| src/deepgram/types/open_ai_think_provider.py | Adds reasoning_mode field to the OpenAI think provider model. |
| src/deepgram/types/open_ai_think_provider_reasoning_mode.py | Introduces OpenAI reasoning mode literal/Any type alias. |
| src/deepgram/types/list_project_members_v1response_members_item.py | Adds member scopes, first_name, and last_name fields. |
| src/deepgram/types/groq.py | Adds reasoning_mode field to the Groq provider model. |
| src/deepgram/types/groq_think_provider_reasoning_mode.py | Introduces Groq reasoning mode literal/Any type alias. |
| src/deepgram/types/init.py | Re-exports new types (reasoning mode aliases). |
| src/deepgram/speak/v1/types/speak_v1metadata.py | Clarifies “primary model” wording and adds additional_model_uuids. |
| src/deepgram/speak/v1/requests/speak_v1metadata.py | Adds additional_model_uuids to metadata params and updates docstrings. |
| src/deepgram/requests/think_settings_v1provider.py | Adds reasoning_mode to think provider TypedDict params. |
| src/deepgram/requests/open_ai_think_provider.py | Adds reasoning_mode to OpenAI think provider params. |
| src/deepgram/requests/list_project_members_v1response_members_item.py | Adds member scopes, first_name, last_name params typing. |
| src/deepgram/requests/groq.py | Adds reasoning_mode to Groq params typing. |
| src/deepgram/listen/v2/types/listen_v2configure_success.py | Adds language_hints to configure-success model. |
| src/deepgram/listen/v2/requests/listen_v2configure_success.py | Adds language_hints to configure-success params. |
| src/deepgram/agent/v1/types/function_call_history_message.py | Updates function-call history typing to new nested context message item type. |
| src/deepgram/agent/v1/types/conversation_history_message.py | Updates conversation history typing to new nested context role type. |
| src/deepgram/agent/v1/types/agent_v1settings_audio_output.py | Refines container typing to use a dedicated container type alias. |
| src/deepgram/agent/v1/types/agent_v1settings_audio_output_encoding.py | Expands supported audio output encodings. |
| src/deepgram/agent/v1/types/agent_v1settings_audio_output_container.py | Adds audio output container literal/Any type alias. |
| src/deepgram/agent/v1/types/agent_v1settings_agent.py | Replaces model with a union alias (AgentV1SettingsAgentContext or str). |
| src/deepgram/agent/v1/types/agent_v1settings_agent_context.py | Reshapes agent context (nesting messages under context) and adds legacy migration validator. |
| src/deepgram/agent/v1/types/agent_v1settings_agent_context_think.py | Adds agent-context think union type. |
| src/deepgram/agent/v1/types/agent_v1settings_agent_context_speak.py | Adds agent-context speak union type. |
| src/deepgram/agent/v1/types/agent_v1settings_agent_context_messages_item.py | Keeps legacy name as an alias to the new nested context message item type. |
| src/deepgram/agent/v1/types/agent_v1settings_agent_context_messages_item_function_calls_function_calls_item.py | Keeps legacy name as alias to the new nested function-call item type. |
| src/deepgram/agent/v1/types/agent_v1settings_agent_context_messages_item_content_role.py | Keeps legacy name as alias to the new nested role type. |
| src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen.py | Adds agent-context listen model wrapper. |
| src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider.py | Adds discriminated union for agent-context listen providers (v1/v2). |
| src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider_v2language_hint.py | Adds language hint union type for agent-context v2 listen provider. |
| src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider_v2.py | Adds agent-context v2 listen provider model. |
| src/deepgram/agent/v1/types/agent_v1settings_agent_context_listen_provider_v1.py | Adds agent-context v1 listen provider model. |
| src/deepgram/agent/v1/types/agent_v1settings_agent_context_context.py | Adds nested context model containing messages. |
| src/deepgram/agent/v1/types/agent_v1settings_agent_context_context_messages_item.py | Adds nested union type for context message items. |
| src/deepgram/agent/v1/types/agent_v1settings_agent_context_context_messages_item_function_calls_function_calls_item.py | Adds nested function-call item model for context history. |
| src/deepgram/agent/v1/types/agent_v1settings_agent_context_context_messages_item_content_role.py | Adds nested role type alias for context messages. |
| src/deepgram/agent/v1/types/agent_v1conversation_text.py | Adds detected languages / hinted languages to conversation text turns. |
| src/deepgram/agent/v1/types/init.py | Re-exports newly added agent-context nested types and container type. |
| src/deepgram/agent/v1/requests/function_call_history_message.py | Updates function-call history params typing to new nested type. |
| src/deepgram/agent/v1/requests/conversation_history_message.py | Updates conversation history params role typing to new nested role type. |
| src/deepgram/agent/v1/requests/agent_v1settings_audio_output.py | Refines container param typing to use container type alias. |
| src/deepgram/agent/v1/requests/agent_v1settings_agent.py | Replaces agent params model with a union alias (AgentV1SettingsAgentContextParams or str). |
| src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py | Updates agent-context params to the new context nesting and new listen/think/speak fields. |
| src/deepgram/agent/v1/requests/agent_v1settings_agent_context_think.py | Adds agent-context think params union type. |
| src/deepgram/agent/v1/requests/agent_v1settings_agent_context_speak.py | Adds agent-context speak params union type. |
| src/deepgram/agent/v1/requests/agent_v1settings_agent_context_messages_item.py | Keeps legacy params name as alias to nested context params union. |
| src/deepgram/agent/v1/requests/agent_v1settings_agent_context_messages_item_function_calls_function_calls_item.py | Keeps legacy params name as alias to nested function-call params. |
| src/deepgram/agent/v1/requests/agent_v1settings_agent_context_listen.py | Adds agent-context listen params wrapper. |
| src/deepgram/agent/v1/requests/agent_v1settings_agent_context_listen_provider.py | Adds union for agent-context listen provider params (v1/v2). |
| src/deepgram/agent/v1/requests/agent_v1settings_agent_context_listen_provider_v2language_hint.py | Adds language hint params union type for v2 listen provider. |
| src/deepgram/agent/v1/requests/agent_v1settings_agent_context_listen_provider_v2.py | Adds v2 listen provider params TypedDict. |
| src/deepgram/agent/v1/requests/agent_v1settings_agent_context_listen_provider_v1.py | Adds v1 listen provider params TypedDict. |
| src/deepgram/agent/v1/requests/agent_v1settings_agent_context_context.py | Adds nested context params TypedDict containing messages. |
| src/deepgram/agent/v1/requests/agent_v1settings_agent_context_context_messages_item.py | Adds nested union params for context messages. |
| src/deepgram/agent/v1/requests/agent_v1settings_agent_context_context_messages_item_function_calls_function_calls_item.py | Adds nested function-call params TypedDict for context messages. |
| src/deepgram/agent/v1/requests/agent_v1conversation_text.py | Adds languages_hinted / languages params typing. |
| src/deepgram/agent/v1/requests/init.py | Re-exports newly added agent-context request param types. |
| src/deepgram/agent/v1/init.py | Re-exports newly added agent v1 types/params at package level. |
| src/deepgram/agent/init.py | Re-exports newly added agent v1 types/params at deepgram.agent level. |
| src/deepgram/init.py | Re-exports new top-level types (e.g., reasoning mode aliases). |
| poetry.lock | Bumps types-requests lock entry. |
| AGENTS.md | Updates regen guidance and frozen/temporary-frozen file lists for new compat shims. |
| .fernignore | Freezes additional compat/__init__ files and documents the agent-context legacy migration patch. |
| .fern/metadata.json | Updates Fern regeneration metadata commit reference. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| reasoning_mode: typing.Optional[GroqThinkProviderReasoningMode] = pydantic.Field(default=None) | ||
| """ | ||
| OpenAI reasoning_effort | ||
| """ |
| reasoning_mode: typing_extensions.NotRequired[GroqThinkProviderReasoningMode] | ||
| """ | ||
| OpenAI reasoning_effort | ||
| """ |
Comprehensive Interface Review — PR #705Below is each interface that changed shape, what was done for backwards-compat, and the gaps that remain. I've grouped by impact. 🚨 Tier 1 — Breaking, no compat shim1.
|
| Aspect | Before | After |
|---|---|---|
| Shape | class AgentV1SettingsAgent(UncheckedBaseModel) with fields language, context, listen, think, speak, greeting |
AgentV1SettingsAgent = Union[AgentV1SettingsAgentContext, str] (now a type alias) |
Compat attempted: None for the class itself. The fields were migrated down into AgentV1SettingsAgentContext, and the legacy messages= kwarg there gets a model_validator.
Gaps:
AgentV1SettingsAgent(language=..., listen=..., think=..., speak=..., greeting=...)raisesTypeError— it's no longer callable as a constructor.isinstance(x, AgentV1SettingsAgent)no longer works (it's aUnion, not a class).- Pydantic models that referenced it as a field type and accepted a dict in the old shape (
{"listen": ..., "think": ...}) won't auto-coerce to the new nested shape —messages=is the only kwarg the validator rescues; nothing intercepts the other five fields when they arrive at the outerAgentV1SettingsAgentboundary.
Recommendation: Either keep a thin wrapper class AgentV1SettingsAgent that subclasses AgentV1SettingsAgentContext, or extend the model_validator to also accept the legacy flat-on-Agent payloads (listen/think/speak/greeting/language).
2. AgentV1SettingsAgentParams (request TypedDict)
File: src/deepgram/agent/v1/requests/agent_v1settings_agent.py
| Aspect | Before | After |
|---|---|---|
| Shape | class AgentV1SettingsAgentParams(TypedDict) with language, context, listen, think, speak, greeting |
AgentV1SettingsAgentParams = Union[AgentV1SettingsAgentContextParams, str] |
Compat attempted: None at the type level.
Gaps:
AgentV1SettingsAgentParams(listen=..., think=..., ...)style usage is now a static-type error.- A dict literal
{"listen": {...}, "think": {...}, "greeting": "hi"}will fail at runtime because Pydantic now expects either a string or anAgentV1SettingsAgentContextParams(which nests its messages under.context). However, sincelisten/think/speak/greetingwere lifted intoAgentV1SettingsAgentContextParams, those four keys actually do still work — but only because the schema also moved them.languageis also still there. So in practice, runtime payloads constructed as dicts pass through OK; it's strictly a Python-type-checking break and anisinstancebreak.
Recommendation: Note this as a typing-only break in the changelog; runtime is mostly fine.
⚠️ Tier 2 — Schema reshape with partial compat
3. AgentV1SettingsAgentContext (response model)
File: src/deepgram/agent/v1/types/agent_v1settings_agent_context.py
| Aspect | Before | After |
|---|---|---|
| Fields | messages: Optional[List[...MessagesItem]] only |
language, context: AgentV1SettingsAgentContextContext, listen, think, speak, greeting |
Compat attempted: ✅ Excellent — model_validator(mode="before") (Pydantic v2) and root_validator(pre=True) (Pydantic v1) both detect a legacy messages=[...] kwarg with no context= and remap it to context={"messages": [...]}. Test coverage in tests/custom/test_compat_aliases.py::test_legacy_settings_agent_context_messages_kwarg_remaps_to_context. There's also a deliberate test that explicit context= wins over legacy messages= (no clobber).
Gaps:
- The validator only handles dict input. A caller doing
AgentV1SettingsAgentContext.model_validate(some_pydantic_obj)wheresome_pydantic_objhas a.messagesattribute won't be migrated — but this is an edge case. - Frozen model +
messages=no longer being a real attribute meansobj.messagesraisesAttributeErrorpost-construction. Read-side callers must migrate toobj.context.messages. No deprecation property was added.
Recommendation: Consider a @property def messages(self) returning self.context.messages if self.context else None for read-side compat.
4. AgentV1SettingsAgentContextParams (request TypedDict)
File: src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py
| Aspect | Before | After |
|---|---|---|
| Keys | messages: NotRequired[Sequence[...]] |
language, context: AgentV1SettingsAgentContextContextParams, listen, think, speak, greeting |
Compat attempted: None at the TypedDict layer (TypedDicts can't run validators).
Gaps:
- Static type checkers will flag
{"messages": [...]}as unknown key. - At runtime, when this dict is passed into Pydantic for serialization through the parent request type, the
model_validatoronAgentV1SettingsAgentContext(above) will catch and remap it — so the wire payload comes out correct. This is the primary save. But static type tooling (mypy/pyright) won't know that.
Recommendation: Either add messages: NotRequired[Sequence[...]] back to the TypedDict as a deprecated/legacy key, or document that messages is still accepted at runtime.
✅ Tier 3 — Pure renames with full alias shims
5. AgentV1SettingsAgentContextMessagesItem
Before: Union[ConversationHistoryMessage, FunctionCallHistoryMessage]
After: alias to new AgentV1SettingsAgentContextContextMessagesItem (same Union).
Compat: ✅ Type alias preserves identity (is test passes — see test_renamed_settings_context_type_aliases_resolve). __init__.py re-exports both old and new names. Frozen via .fernignore.
Gaps: None functional.
6. AgentV1SettingsAgentContextMessagesItemContentRole
Same pattern: alias to ...ContextMessagesItemContentRole. ✅ Identity-preserving alias.
7. AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem (and *Params)
Same pattern: alias to ...ContextMessagesItemFunctionCallsFunctionCallsItem. ✅ is-identity preserved by both type and request shims.
Gap: A subtle one — ConversationHistoryMessage.role and FunctionCallHistoryMessage.function_calls are now typed against the new *Context* names. Anyone subclassing those models with explicit type annotations against the old name will get a static-typing mismatch (runtime fine due to alias).
🆕 Tier 4 — Type tightening (silent break risk)
8. AgentV1SettingsAudioOutput.container
File: src/deepgram/agent/v1/types/agent_v1settings_audio_output.py
| Before | After |
|---|---|
Optional[str], docstring says defaults to 'none' |
Optional[AgentV1SettingsAudioOutputContainer] = Union[Literal["none","wav","ogg"], Any] |
Compat attempted: The new alias includes typing.Any in the union, so at the type-system level any string is still accepted. Pydantic also won't reject arbitrary strings because of the Any arm.
Gaps:
- Docstring lost the "defaults to 'none'" note — if server behavior actually changed to no default, that's a runtime behavior change worth confirming.
- IDE auto-complete now suggests only
none/wav/ogg, which may mislead users away from values the server still accepts.
9. AgentV1SettingsAudioOutputEncoding
Before: Literal["linear16","mulaw","alaw"] | Any
After: Literal["linear16","mulaw","alaw","mp3","opus","flac","aac"] | Any
Compat: ✅ Pure widening. No break.
➕ Tier 5 — Purely additive (no break)
| Interface | Change |
|---|---|
AgentV1ConversationText / Params |
Adds optional languages_hinted: Optional[List[str]], languages: Optional[List[str]] |
ListenV2ConfigureSuccess / Params |
Adds optional language_hints: Optional[List[str]] |
OpenAiThinkProvider / Params, Groq / Params, ThinkSettingsV1Provider_OpenAi, ThinkSettingsV1Provider_Groq |
Adds optional reasoning_mode: Optional[OpenAiThinkProviderReasoningMode | GroqThinkProviderReasoningMode] (Literal["none","minimal","low","medium","high"] | Any) |
SpeakV1Metadata / Params |
Adds optional additional_model_uuids: Optional[List[str]]; docstrings clarify model_version/model_uuid refer to the primary model |
ListProjectMembersV1ResponseMembersItem / Params |
Adds optional scopes: Optional[List[str]], first_name: Optional[str], last_name: Optional[str] |
All optional with defaults, all safe.
🆕 Tier 6 — Brand-new types (safe, but worth noting)
These are entirely new (no old equivalent) and only break callers if they had hand-rolled a same-named local type:
AgentV1SettingsAgentContextContext(+Params)AgentV1SettingsAgentContextContextMessagesItem(+Params)AgentV1SettingsAgentContextContextMessagesItemContentRoleAgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem(+Params)AgentV1SettingsAgentContextListen/ListenProvider/ListenProviderV1/ListenProviderV2/ListenProviderV2LanguageHint/ListenProvider_V1/ListenProvider_V2(+Params)AgentV1SettingsAgentContextSpeak(+Params) — alias toUnion[SpeakSettingsV1, List[SpeakSettingsV1]]AgentV1SettingsAgentContextThink(+Params) — alias toUnion[ThinkSettingsV1, List[ThinkSettingsV1]]AgentV1SettingsAudioOutputContainerGroqThinkProviderReasoningMode,OpenAiThinkProviderReasoningMode
All wired into both __init__.py files (frozen via .fernignore).
🧪 Test-coverage observation
A test was deleted without replacement: tests/wire/test_manage_v1_projects_keys.py::test_manage_v1_projects_keys_create_with_old_request_alias. The CreateKeyV1RequestOneParams alias still exists (it's frozen as a compat shim per AGENTS.md), but the wire-level regression test that proved it actually serializes correctly when used as a request body is gone. The unit-level alias resolution test in test_compat_aliases.py covers identity but not the wire round-trip.
Recommendation: Restore that wire test, or add an equivalent to tests/custom/test_compat_aliases.py.
📋 Summary table
| Interface | Compat? | Gap to fix |
|---|---|---|
AgentV1SettingsAgent (class) |
❌ | Add wrapper class or expand validator |
AgentV1SettingsAgentParams |
❌ (type only) | Document or restore TypedDict shape |
AgentV1SettingsAgentContext |
✅ (validator) | No .messages read-side property |
AgentV1SettingsAgentContextParams |
Add legacy messages key for static checking |
|
*MessagesItem* aliases (4 types + 4 params) |
✅✅ | None |
AudioOutput.container |
Confirm default behavior; docstring regression | |
AudioOutputEncoding |
✅ | None (widening) |
| New additive fields (7 types) | ✅ | None |
Wire test for CreateKeyV1RequestOne alias |
❌ | Restore deleted test |
The team's compat strategy is solid where it was applied — the model_validator migration on AgentV1SettingsAgentContext is the highlight. The two real gaps to flag before merging are (1) AgentV1SettingsAgent becoming a non-instantiable union and (2) the deleted wire test for the legacy create-key alias.
Reinstate legacy AgentV1SettingsAgent construction and request typing, keep read-side messages access working, and restore wire coverage for the old CreateKeyV1RequestOneParams alias.
🤖 I have created a release *beep* *boop* --- ## [7.1.0](v7.0.0...v7.1.0) (2026-05-06) ### Features * update generated SDK models and restore agent settings compatibility ([#705](#705)) ([0b820c9](0b820c9)) ### Documentation * target Context7 benchmark gaps in Python skills [no-ci] ([#699](#699)) ([a232eb8](a232eb8)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Compatibility
AgentV1SettingsAgent(...)works again as a callable wrapper classAgentV1Settings.agentaccepts the wrapper class,AgentV1SettingsAgentContext(...), or anagent_idstringmessages=[...]input is remapped into the newcontext={"messages": [...]}wire shapecontext=AgentV1SettingsAgentContext(messages=[...])input is normalized to the new nested context modelobj.messagesaccess continues to workTypedDictshapes for agent settings, including deprecatedmessagessupport onAgentV1SettingsAgentContextParams.__init__.pyfiles and added the patched files to.fernignoreso future regens preserve them.CreateKeyV1RequestOneParamsrequest alias.tests/custom/test_compat_aliases.pyfor the legacy constructor shapes, request typing, and read-side compatibility behavior.Generated Changes
context, top-levellisten/think/speak,greeting, new listen-provider variants, and related request/type exports.reasoning_modesupport for OpenAI and Groq.language_hintstoListenV2ConfigureSuccessandadditional_model_uuidstoSpeakV1Metadata.scopes,first_name, andlast_name.Manual Patches
except Exceptionhandlingagent/v1numeric sanitizationlisten/v2rawsend_configure(message: typing.Any)shim and broader response handlingaudio.output.containertyped asstrfor backward compatibility instead of the regenerated enum alias.reasoning_modedocstrings so they no longer reference OpenAI..fernignoreandAGENTS.mdso the regenerated files that still carry manual patches stay protected in the next regen cycle.uv.lockfile.Validation
185 passed, 4 skippedviaPYTHONPATH=src uv run python -m pytest.examples/27-transcription-live-sagemaker.py, which still requires the optionaldeepgram-sagemakerdependency.examples/12-transcription-prerecorded-callback.pystill uses a placeholder callback target and reports the expected callback resolution error.