Repository navigation
feat(regen): add NVIDIA think provider and typed create-key request - #840
Conversation
|
Reconciles the 2026-12-01 Fern output (generator 5.39.3, unchanged; CLI 5.95.1 -> 5.216.0) against the 55 hand patches protected as .bak during prep. The generator caught up on none of them, so all 55 are re-applied: 51 as wholesale restores whose entire diff was the patch being stripped, 3 barrels merged so the new Nvidia exports land alongside the legacy alias tails, and the create-key wire test reworked. Kept from the generator: - NVIDIA Think provider. New Nvidia, NvidiaReasoningMode and ThinkSettingsV1Provider_Nvidia types (plus Params twins), added to the ThinkSettingsV1Provider union. - Two docstring corrections from deepgram-docs #1308. AgentV1UpdatePrompt.prompt now says the text is appended to the current system prompt rather than replacing it, which is the opposite of what it said. ThinkSettingsV1.endpoint now records that a deepgram provider with an endpoint is rejected with INVALID_SETTINGS, that aws_bedrock requires one, and that headers is optional. Reverted from the generator: - manage.v1.projects.keys.create lost its opaque `request` mapping in favour of explicit keyword arguments, and CreateKeyV1Request was deleted outright. That raises TypeError for every existing caller, and the deletion also broke the two permanently frozen create_key_v1request_one.py aliases, which import it. Both modules are recreated by hand with the generator's former definition, and client.py / raw_client.py accept `request` again via _build_create_key_body. The legacy path stays an unvalidated passthrough, because the old argument was typed Any and the server decided what a valid body was; adding validation would reject payloads that used to reach the API. Explicit keyword arguments are applied on top. - The version fields Fern bumped to 7.20.1 are back at 7.20.0 in pyproject.toml, .fern/metadata.json and client_wrapper.py, with the x-release-please-version marker restored. Release Please owns the next bump. - The three coverage lines in .gitignore, and the eroded query-parameter coverage in tests/wire/test_listen_v1_media.py and tests/wire/test_manage_v1_projects_requests.py, which the generator stripped back to bare single-parameter tests again. Verified before committing: each of the 51 wholesale restores is byte-identical to its pre-regen content; the 3 merged barrels differ from that base by 15, 9 and 6 lines, every one a Nvidia addition; .fernignore gained exactly the five new entries and no other change. Gates: - poetry run mypy src/ Success: no issues found in 958 source files - poetry run mypy tests/typecheck Success: no issues found in 1 source file - poetry run pytest -q 1259 passed, 4 skipped, 1 xfailed - ruff check src/ tests/ 55 errors, identical to the pre-regen base measured in a clean worktree. No new violations; CI does not run ruff.
Two independent reviews of this branch found the same blocking defect, confirmed here by
driving 7.20 and this branch through the same 15 payloads and comparing the request bytes.
`_build_create_key_body` guarded the deprecated `request` argument with
`isinstance(request, dict)`. That argument was annotated `Any` through 7.20 and went straight
to the JSON encoder, so the guard rejected calls that used to work:
MappingProxyType main: OK branch: TypeError: `request` must be a mapping, got mappingproxy
abc.Mapping main: OK branch: TypeError
pydantic model main: OK branch: TypeError: `request` must be a mapping, got M
UserDict main: OK branch: TypeError
dataclass main: OK branch: TypeError
The error text refuted itself: it said "must be a mapping" while rejecting an instance of
`collections.abc.Mapping`. `OrderedDict` survived only by subclassing `dict`. This is the exact
regression the shim exists to prevent, and it made the minor-version claim wrong.
The shim is now a total passthrough. A mapping is merged with the explicit keyword arguments
applied on top; anything else is forwarded untouched, as the encoder received it before. All
six arguments default to the OMIT sentinel instead of None, so an explicit `None` uniformly
means a null value and `request=None` again sends the empty body it sent on 7.20, rather than
being indistinguishable from an omitted argument.
Verified: all 15 payload shapes now produce byte-identical requests on 7.20 and here, including
the five above and `str`, `list`, `None`, nested values, unknown keys and datetime encoding.
Tests rewritten, 11 cases to 40. The reviews showed 8 mutations surviving the old suite,
including dropping `tags`, `expiration_date` or `time_to_live_in_seconds` from either file while
every test still passed, which matters because both files are frozen and no regen can repair
drift in them. All 11 mutations now fail the suite. The last to be caught was the narrowing
itself: it is invisible on the passthrough path and only diverges when a non-dict mapping is
combined with a keyword argument, so that case is pinned on its own.
Documentation corrected alongside:
- `.fernignore` named `_unpack_legacy_create_key_request`, which does not exist, and described
the mapping as unpacked into the arguments rather than forwarded as the body. It also claimed
wire-test coverage that only counts requests.
- `client.py` docstrings disagreed with `raw_client.py` about the same mechanism.
- `AGENTS.md` said the runtime TypeError replaces mypy's missing-argument check. It only does
for code importing `KeysClient`/`RawKeysClient` directly: `BaseClient.manage` carries no return
annotation, so `client.manage.v1.projects.keys.create` was always `Any` to mypy.
- `reference.md` and `examples/51-management-keys.py` still showed only the deprecated form.
- `.fern/metadata.json` regained the trailing newline the generator dropped.
Gates:
- mypy src/ Success: no issues found in 958 source files
- mypy tests/typecheck Success: no issues found in 1 source file
- pytest -q 1288 passed, 4 skipped, 1 xfailed
- ruff check src/ tests/ 55, and examples/ 2, both identical to origin/main
- public surface vs main 0 exports removed, 0 methods removed, 0 params newly required
jasondielman-dg
left a comment
There was a problem hiding this comment.
Holding keys.create compatible was worth the effort. Every 7.20 payload shape I tried still sends the same body on this branch, so this can ship as a minor.
What this PR does
It regenerates the Python SDK from deepgram-docs@a70c45e4, adding the NVIDIA think provider (Nvidia, NvidiaReasoningMode, ThinkSettingsV1Provider_Nvidia) and two docstring corrections: UpdatePrompt appends to the system prompt rather than replacing it, and the think endpoint rules are now stated. The Fern CLI upgrade also turned manage.v1.projects.keys.create into keyword arguments and deleted CreateKeyV1Request. A hand patch keeps the old request={...} call working. The sibling PRs are deepgram-js-sdk#612 (shimmed, minor) and deepgram-java-sdk#148 (breaking, pre-1.0).
What I checked
- Does old code still work? Yes. I compared 7.20.0 from PyPI against this branch with a mock transport across 15+ payload shapes (dict, OrderedDict, UserDict, MappingProxyType, Mapping, pydantic model, dataclass, str, list, datetimes, async). Every body was identical, and no call that worked on 7.20 fails here.
- Do the NVIDIA types match the spec? Yes, field for field against
think-providers/nvidia.yml. Thenvidiadiscriminator is unique, so the provider union stays intact. - Did all hand patches survive? Yes. Nothing was removed from
.fernignore, the 5 new entries exist, there are no.bakfiles, and the version fields stay at 7.20.0 for Release Please. - Gates: in Docker,
mypy src/andmypy tests/typecheckare clean and pytest gives 1288 passed, 4 skipped, 1 xfailed. CI is green on 3.10–3.13.
Two small doc suggestions before merge
- S1: In
reference.md, thekeys.createusage example now usescomment=/scopes=, but the Parameters section below it still lists onlyrequest: CreateKeyV1RequestOne, and shows it as required. Could we add entries forcomment,scopes,tags,expiration_dateandtime_to_live_in_seconds, and markrequestas optional and deprecated? - S2:
commentandscopesnow show asOptionalwith empty descriptions in all fourcreatedocstrings.create(project_id="p", comment="c")raisesTypeErrorfor the missingscopes. Could those two say "Required unless the deprecatedrequestargument is supplied."?
Nits
- N1: The PR body says
request=Noneproduces a byte-identical request. The body is the same, but the branch now also sendscontent-type: application/jsonon that empty body. This makes no practical difference; only the wording needs adjusting. - N2: This one predates the PR.
AGENTS.mdstill says theclient_wrapper.pyfallback is7.16.0, but the file has7.20.0.
…rsion Add the comment, scopes, tags, expiration_date and time_to_live_in_seconds entries to the keys.create reference, mark request as deprecated, say that comment and scopes are required unless request is supplied, and correct the client_wrapper.py fallback version in AGENTS.md to 7.20.0.
jasondielman-dg
left a comment
There was a problem hiding this comment.
Thanks for the quick turn on the docs. The keys.create reference and docstrings now tell a developer exactly when comment and scopes are required, which was the one gap left from the first round.
What changed since my last review
One commit (dd1b0d6): it adds the five keyword arguments to the keys.create parameter list in reference.md, marks request as deprecated, adds "Required unless the deprecated request argument is supplied" to comment and scopes on all four surfaces, and corrects the fallback version in AGENTS.md. No executable code changed.
What I checked
- Do the documented types match the method? Yes, all six arguments match the signature in
keys/client.py. - Is "required unless
requestis supplied" true? Yes,_build_create_key_bodyraises aTypeErroronly whenrequestis omitted andcommentorscopesis missing. - Is CI green on this commit? Yes, compile and test on 3.10 to 3.13.
- Does it still merge cleanly? Yes.
mainpicked up the 7.21.0 release since this branch was cut; that touched only the version files and the changelog, and merges without conflict.
Small ones, none blocking
- Nit: the
reference.mdedit opened an extra<dl><dd>before**comment:**without closing it, so every parameter afterproject_idrenders one level deeper. Line comment has the one-click fix. - Nit: with 7.21.0 now released, could we update the branch from
mainand bump the version mentions to match?AGENTS.mdsays the retainedclient_wrapper.pyfallback is7.20.0, but after merge the file carries7.21.0. The compat notes inAGENTS.mdand the_build_create_key_bodydocstring also say the old call shape ran "through 7.20", and 7.21.0 ships it too. - Nit, PR body only: the Validation section still says
1259 passedfrom before the create-key suite grew to 40 cases (CI now runs 1288). Also "a identical request body" should be "an identical".
Approve with those nits.
| <dl> | ||
| <dd> | ||
|
|
There was a problem hiding this comment.
Nit: this adds a second <dl>/<dd> opener on top of the one at 1529-1530, and nothing closes it, so comment through request_options render one level deeper than project_id. Dropping these three lines rebalances it:
| <dl> | |
| <dd> |
…ions (#843) Follow-up to #840, covering @jasondielman-dg's non-blocking nits. - `reference.md`: removes the unclosed `<dl><dd>` opener before `**comment:**`, so the `keys.create` parameters after `project_id` render at the same depth again. - `AGENTS.md`: the `client_wrapper.py` entry no longer pins the fallback to a version number. Release Please bumps it on every release, so any hardcoded number goes stale. - `AGENTS.md`, `_build_create_key_body` docstring, `test_create_key_legacy_request.py` module docstring: "through 7.20" becomes "7.21 and earlier", since 7.21.0 still shipped the legacy `request=` shape. No executable code changes. `tests/custom/test_create_key_legacy_request.py`: 40 passed.
Summary
fernapi/fern-python-sdk5.39.3 (unchanged since feat(regen): add usage redaction, Flux volume controls, and voices #828); Fern CLI moved 5.95.1 to 5.216.0.Nvidia,NvidiaReasoningModeandThinkSettingsV1Provider_Nvidia, plus theirParamstwins, joined into theThinkSettingsV1Providerunion.deepgram-docs#1308 that change what a field does, not just how it reads.manage.v1.projects.keys.createbackward compatible after the generator replaced its singlerequestmapping with explicit keyword arguments and deletedCreateKeyV1Request.This release is a minor, not a major
No public surface was removed or narrowed. Measured by importing both
mainand this branch anddiffing every export and every public client method, sync and async:
Nvidia,NvidiaParams,NvidiaReasoningMode,ThinkSettingsV1Provider_Nvidia,ThinkSettingsV1Provider_NvidiaParamsThe only changed signature is
keys.createon its four surfaces (sync, async, and bothwith_raw_responsevariants), and the change is additive:requestwidened fromrequest: Any(required) torequest: Any | None = OMIT(optional, with a sentinel default so an explicitNonestill means null), and five optional keyword arguments were addedbeside it. Every call written against 7.20 still type-checks and still sends the same body (the
Nonecase now also carries acontent-type: application/jsonheader on its empty body).No exceptions: every payload shape that reached the server on 7.20 still produces a
identical request body here, verified across 15 shapes including
dict,OrderedDict,UserDict,MappingProxyType, a barecollections.abc.Mapping, a pydantic model, a dataclass,str,listand
None(which sends the same empty body as before, now with acontent-type: application/jsonheader).What This Enables
typeto"nvidia"with amodel, and optionallytemperature(0 to 2) andreasoning_mode(none,minimal,low,mediumorhigh, sent to the model asreasoning_effort). The Deepgram-managed model isnvidia/nemotron-3.5-lightning-30b-a3b;GET /v1/agent/settings/think/modelslists the full catalog, and a custom endpoint can serve any model.Nvidiamodel carriestype(always"nvidia"), optionalversion("v1", the OpenAI-compatible chat-completions REST version), requiredmodel, optionaltemperatureand optionalreasoning_mode. It joinsThinkSettingsV1Provideras theThinkSettingsV1Provider_Nvidiavariant, so existing provider handling keeps exhaustively matching.AgentV1UpdatePrompt.promptis now documented as text appended to the current system prompt. It previously said "the new system prompt to be used by the agent", which is the opposite. Anyone who built on the old wording was sending a replacement and getting an append.ThinkSettingsV1.endpointnow states three rules it never carried: adeepgramprovider with an endpoint is rejected withINVALID_SETTINGS,aws_bedrockrequires one, andheadersis optional rather than required.Why create-key changed
Not the spec, and not the Python generator.
CreateKeyV1Requestis byte-identical indeepgram-docsbetween the commit #828 generated from (229defd4) and this one (a70c45e4), andfernapi/fern-python-sdksat at 5.39.3 across both. The only input that moved was the Fern CLI,which
deepgram-docsjumped from 5.95.1 to 5.216.0 in a single commit.229defd4a70c45e4fern/generators.ymlThat window contains fern-api/fern#17847, an OpenAPI
importer change that preserves sibling properties when
oneOfexpresses a required-only presenceconstraint. Our schema is exactly that shape:
Before #17847 the importer dropped those sibling properties and the type collapsed to
typing.Union[typing.Any], which is why the oldcreate()took one opaquerequest. Now theproperties survive, so the endpoint gets real keyword arguments. Exactly one schema in the spec has
that shape and exactly one type in the old SDK was degraded to
Any, and they are the same type.The new output is correct. What makes it a surprise is that it arrived ungated: the equivalent
anyOfchange shipped in CLI 5.111.0 behind the opt-in settingany-of-sibling-properties-as-object, default false, so conversion output was unchanged unless youopted in.
#17847is the same class of change foroneOfand landed unconditionally.fern check --warningsreported nothing related and every generate run was clean.Keeping create-key compatible
The generator rewrote
manage.v1.projects.keys.createfromto explicit
comment,scopes,tags,expiration_dateandtime_to_live_in_secondskeywordarguments, and deleted
CreateKeyV1RequestandCreateKeyV1RequestParams. Left alone that raisesTypeErrorfor every existing caller. The deletion also broke the two permanently frozencreate_key_v1request_one.pyaliases, which import the deleted module:Both modules are recreated by hand with the generator's former definition, so the alias identity
assertions in
tests/custom/test_compat_aliases.pykeep holding.keys/client.pyandkeys/raw_client.pyacceptrequestagain through_build_create_key_body. The legacy path isdeliberately an unvalidated passthrough: the old argument was typed
Anyand the server decidedwhat a valid body was, so unknown keys are still forwarded and no field is required. Explicit
keyword arguments are applied on top and win where both supply a key.
The legacy argument is a total passthrough: a mapping of any kind is merged with the explicit
keyword arguments applied on top, and anything else is forwarded untouched, exactly as the JSON
encoder received it before. All six arguments default to the
OMITsentinel rather thanNone,so an explicit
Noneuniformly means a null value and never "omitted".The one cost:
commentandscopeshad to be widened to optional to accept the legacy form, somypy no longer flags omitting them. That only ever applied to code importing
KeysClientorRawKeysClientdirectly, becauseBaseClient.managecarries no return annotation andclient.manage.v1.projects.keys.createwas alreadyAnyto mypy. A runtimeTypeErrornaming themissing argument covers both paths.
Review history
Two independent reviews of this branch found the same blocking defect, which is fixed in
c1556faf. The shim originally guarded the legacy argument withisinstance(request, dict), whichrejected calls that worked on 7.20: a
MappingProxyType, a barecollections.abc.Mapping, aUserDict, a pydantic model and a dataclass all raisedTypeError. The error even said "must be amapping" while rejecting a
Mapping. That was the regression the shim exists to prevent, and itmade the minor claim wrong.
The reviews also showed 8 mutations surviving the original test suite, including deleting
tags,expiration_dateortime_to_live_in_secondsfrom either file with every test still green. Thatmatters because both files are frozen in
.fernignore, so no future regeneration repairs drift inthem. The suite went from 11 cases to 40 and now fails on all 11 mutations tried.
Regression coverage in
tests/custom/test_create_key_legacy_request.py: 40 cases asserting thebody actually put on the wire, with the keyword arguments and the legacy form each exercised on all
four surfaces (sync, async, and both
with_raw_responsevariants).tests/wire/test_manage_v1_projects_keys.pyadds a legacy-form case, though that file only counts requests and does not inspect bodies.
The same change in JS and Java
The importer sits upstream of every generator, so all three SDKs took this at once, each starting
from the same collapsed type:
CreateKeyV1Request = typing.Union[typing.Any]export type CreateKeyV1Request = unknown;public final class CreateKeyV1Request { private final Object value; ... }Java is the one that could not be held compatible: the type moved package and became a typed
builder class, so
of(Object),get()andvisit(...)have no replacement to forward to. Itships as a major with a migration guide. Python and JS both kept the old call shape working, so
neither needs one.
Dependency pins
poetry lockmoved nine transitive pins, includinghttpx 0.28.1 -> 0.29.0,pydantic 2.14.3 -> 2.14.4andpytest-asyncio 1.4.1.post1 -> 1.5.0. Consumers are unaffected,since
pyproject.tomlrequireshttpx = ">=0.21.2", but CI now runs against a new httpx minor.Documentation corrected
reference.mdandexamples/51-management-keys.pyshowed only the deprecated single-mapping form;both now lead with the keyword-argument form.
.fernignorenamed a helper that does not exist anddescribed the wrong mechanism, which would have misled the next regeneration.
AGENTS.mdoverstatedthe mypy cost.
.fern/metadata.jsonregained the trailing newline the generator dropped.Version fields
Fern wrote
7.20.1intopyproject.toml,.fern/metadata.jsonandcore/client_wrapper.py, anddropped the release-please marker. All three are back at
7.20.0with# x-release-please-versionrestored, matching.github/.release-please-manifest.jsononmain.No
7.20.1remains anywhere in the tree. Release Please creates the next version from this PR'stitle.
Patch reconciliation
All 55 patches were still required. 51 were wholesale restores whose entire diff versus the new
output was the patch being stripped. 3 barrels (
src/deepgram/__init__.py,types/__init__.py,requests/__init__.py) were merged so the new Nvidia exports land alongside the legacy aliastails. The create-key wire test was reworked rather than restored.
Verified before committing: each of the 51 restores is byte-identical to its pre-regen content;
the 3 merged barrels differ from that base by 15, 9 and 6 lines, every one a Nvidia addition;
.fernignoregained exactly five entries and changed in no other way.Also restored: the three coverage lines in
.gitignore, and the query-parameter coverage intests/wire/test_listen_v1_media.pyandtests/wire/test_manage_v1_projects_requests.py, whichthe generator again stripped back to bare single-parameter tests. That is the erosion pattern
AGENTS.mdflags for every cycle.Validation
mypy src/: Success: no issues found in 958 source filesmypy tests/typecheck: Success: no issues found in 1 source filepytest -q: 1259 passed, 4 skipped, 1 xfailedruff check src/ tests/: 55 errors, identical to the pre-regen base measured in a clean worktree. No new violations..fernignore: no frozen path and no.bakfile was touched by the generator run.