Skip to content

fix: model-catalog field mapping and legacy flags, global-option placement, and whoami source label - #108

Open
darrenapfel wants to merge 3 commits into
deepgram:mainfrom
darrenapfel:dx-reboot/wp8-cli
Open

fix: model-catalog field mapping and legacy flags, global-option placement, and whoami source label#108
darrenapfel wants to merge 3 commits into
deepgram:mainfrom
darrenapfel:dx-reboot/wp8-cli

Conversation

@darrenapfel

Copy link
Copy Markdown

This change was built by a coding agent working from a developer-experience review, and was validated as described at the end. It contains three independent fixes; they are separate commits and can be reviewed or split independently.

1. The models catalog rendered empty IDs and languages, dropped the canonical name, and presented legacy models without warning.

dg models read the API's uuid and language fields, but the Deepgram Python software development kit renames uuid to uuid_ in its generated response classes, and the API reports languages as a list — so every row displayed a blank ID and a blank language. The command also dropped canonical_name, which is the exact value a request's model parameter takes (the catalog showed "agathe" but a request needs "aura-2-agathe-fr"). This change reads both field spellings, joins the language list, and adds canonical name and architecture to the table and the JSON output.

Two related additions:

  • The legacy models named conversationalai and 2-conversationalai are now flagged deprecated, with a note steering users to nova-3 and stating that no model named nova-3-conversational exists. Support data shows paying customers composing that nonexistent name; the legacy entry in the catalog is the plausible source of the composition. The API sends no deprecation field, so the flag is a small map inside the command — if the platform later adds deprecation metadata to GET /v1/models, the map should be replaced by it.
  • When the API returns zero models in a requested category, the command now warns on the error stream instead of silently presenting half a catalog. We observed a live session in which the endpoint returned zero text-to-speech models; a user seeing that output had no way to tell it was an anomaly.

2. Global output options silently failed after the subcommand.

dg models -o json failed with "No such option '-o'" while dg -o json models worked, because the parser reads group-level options only before the subcommand name. Every generated command now carries pass-through copies of -o/--output, -q/--quiet, and -v/--verbose that apply the same effect from the subcommand position. A copy is added only when the command does not define that option itself — dg speak --output names an audio file and keeps its own meaning. For the global options that cannot safely pass through (--api-key, --profile, --timing, and the rest), the error now includes a hint naming the working placement. The published exit-code contract (1 = error, 2 = user interrupt) is unchanged and remains covered by the existing tests.

3. whoami labeled an environment-sourced key "config file", and corrupted JSON output.

The configuration loader copies DEEPGRAM_API_KEY into the active profile at load time, so whoami saw a profile key and reported "config file" for a key that came from the environment. The label now reports "DEEPGRAM_API_KEY (env)" when the profile key matches the environment value — which is also the key the authentication path actually uses in that state. Separately, whoami printed its human-readable block even in JSON output mode, breaking dg -o json whoami for scripts; the block is now guarded by the default output format, the same pattern pull request #97 applied to the other account commands.

Validation. The full test suite passes (1,109 passed, 6 skipped; the one failure, a file-timestamp test in deepctl-shared-utils, fails identically on unmodified main). Seventeen new unit tests cover the field mapping, the deprecation flags, the empty-category warning, the pass-through options and their collision rule, the placement hint, and the whoami label. ruff check, ruff format --check, and mypy pass on all 115 source files. Every changed behavior was also run live against api.deepgram.com on a test account: the catalog lists 441 speech-to-text and 102 text-to-speech models with IDs, languages, canonical names, and 7 deprecated-flagged entries; dg models -o json and dg models -t tts -o json parse cleanly; dg speak --help keeps its own --output; the misplaced-global hint renders; and dg whoami reports the environment source with clean JSON.

🤖 Generated with Claude Code

darrenapfel and others added 3 commits August 24, 2026 20:21
…nalai, and warn loudly on an empty catalog half

The catalog rendered every row with an empty ID and empty language column
because the SDK's generated response classes rename the API's uuid field to
uuid_ and report languages as a list, while the command read uuid and
language. The canonical_name and architecture fields — canonical_name is the
value a request's model parameter takes — were dropped entirely.

The legacy conversationalai / 2-conversationalai entries are now flagged
deprecated with a note steering to nova-3 and stating plainly that no
nova-3-conversational model exists (paying accounts have requested that
nonexistent composition).

A category that comes back empty (zero speech-to-text or zero text-to-speech
models) now produces a stderr warning instead of silently presenting half a
catalog as the whole one, and an explicit null category no longer crashes
the command.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… on misplaced globals

Click parses group options only before the subcommand name, so
'dg models -o json' failed with "No such option '-o'" while
'dg -o json models' worked — and the error gave no hint that the option
exists. Two changes:

1. Every generated command now carries pass-through copies of -o/--output,
   -q/--quiet and -v/--verbose that apply the same global effect from the
   subcommand position. A copy is only added when the command does not
   define the option itself (dg speak --output names an audio file and
   keeps its own meaning).

2. When a remaining global option (for example --api-key or --timing) is
   placed after the subcommand, the error now carries a hint naming the
   working placement. The published exit-code contract (1 = error) is
   unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… pure in json mode

Config merges DEEPGRAM_API_KEY into the profile at load time, so whoami's
profile check claimed "config file" for a key that actually came from the
environment. The label now reports the environment variable when the profile
key matches it, which is also the key auth actually uses in that state.

whoami also printed its human-readable block unconditionally, corrupting
'dg -o json whoami' for scripts that pipe stdout — the block is now guarded
by the default output format, the same pattern the deepgram#97 sweep applied to the
other account commands.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant