feat: add effort to SpeakerIdentificationRequest - #168
Merged
Conversation
The speaker identification API accepts an `effort` field ("low" | "medium",
default "low") to trade cost for quality on harder audio, but it was missing
from the SDK types, so setting it failed to type check.
Fixes #167
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
jhazenaai
reviewed
Aug 12, 2026
| /** | ||
| * Effort level for speaker identification | ||
| */ | ||
| export type SpeakerIdentificationEffort = "low" | "medium"; |
Contributor
There was a problem hiding this comment.
effort should be for all llm speech understanding tasks, and all tasks can take it
Contributor
Author
There was a problem hiding this comment.
Should be addressed now @jhazenaai so would love another review when you have a sec
Address review: effort isn't speaker-identification specific — every LLM speech understanding task accepts it. Rename the enum to SpeechUnderstandingEffort and add the field to TranslationRequest and CustomFormattingRequest alongside SpeakerIdentificationRequest. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
jhazenaai
reviewed
Aug 12, 2026
|
|
||
| ## [4.36.6] | ||
|
|
||
| - Add `effort` to the speech understanding feature requests (`SpeakerIdentificationRequest`, `TranslationRequest`, `CustomFormattingRequest`) — `"low"` (default) or `"medium"`, set per task, typed as the new `SpeechUnderstandingEffort`. The field was already accepted by the API but missing from the SDK types, so setting it failed to type check |
Contributor
There was a problem hiding this comment.
Summarization & Action items missing. Can add in a follow up.
jhazenaai
approved these changes
Aug 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #167.
Problem
The speaker identification docs document an
effortfield underspeech_understanding.request.speaker_identification, butSpeakerIdentificationRequestdoesn't declare it, so TypeScript users can't set it without casting:Change
SpeakerIdentificationEffort("low" | "medium") and an optionaleffortfield onSpeakerIdentificationRequest, defaulting to"low"server-side, per the docs.tests/unit/speaker-identification.test.tscovering the field serializing into the request body, the field being omitted when unset, and both documented values type checking.Type-only, additive, and backward compatible —
effortis optional, so existing code is unaffected.Note for maintainers
src/types/openapi.generated.tsis generated from the internal OpenAPI spec, which I don't have access to. This edits the generated file directly, so the spec needs the same field added upstream or the nextpnpm generate:typesrun will drop it.One thing worth confirming separately (out of scope here): the docs describe the speaker list as
speakers, an array of objects ({ name }/{ role }/description/ arbitrary custom keys), while the SDK type hasknown_values?: string[]. If the docs are current, that type is stale too and users following the docs will hit the same class of error. Happy to follow up with a PR once someone confirms which shape the API takes.Testing
tests/unit/speaker-identification.test.ts— 3 passedmainand are unrelated (utils.test.tsruntime_env=Node/assertions under local Node 24, and aWritableStreamtype mismatch inrealtime.test.ts)pnpm lint(eslint + tsc + publint) andpnpm buildpass; the remainingprettier --checkwarnings are pre-existing onmainin files this PR doesn't touch🤖 Generated with Claude Code