Skip to content

Add language_codes to pre-recorded transcript params - #221

Draft
dvmarchuk wants to merge 1 commit into
AssemblyAI:mainfrom
dvmarchuk:fix/transcript-language-codes
Draft

dvmarchuk wants to merge 1 commit into
AssemblyAI:mainfrom
dvmarchuk:fix/transcript-language-codes

Conversation

@dvmarchuk

Copy link
Copy Markdown

Fixes #215

Summary

language_codes existed only on the Transcript response, so the request from the STT-3.7 migration guide did not compile. This adds it to the request params.

 TranscriptOptionalParams        // also TranscriptParams, TranscribeParams
   language_code?: LiteralUnion<TranscriptLanguageCode, string> | null;
+  language_codes?: LiteralUnion<TranscriptLanguageCode, string>[];
   ...
   disfluencies?: boolean;
-  // @defaultValue false
+  // true when speech_models includes assemblyai-stt-3-7, false otherwise

The language_codes doc comment says what the guide says: it can't be combined with language_code or language_detection, any number of languages on assemblyai-stt-3-7, at most two (one "en") on universal-2. Version bumped to 4.43.5 with a CHANGELOG entry.

Evidence

New test tests/unit/language-codes.test.ts, at the public transcripts.submit() / transcribe() API:

submit({ speech_models: ["assemblyai-stt-3-7"], language_codes: ["en", "es", "pt"] })
  -> type checks, POST body has language_codes, no language_code
transcribe({ ...same })
  -> returns transcript.language_codes
{ language_codes: "en" }   // @ts-expect-error: a list, not one code
  • Before: TS2561: Object literal may only specify known properties, but 'language_codes' does not exist in type 'TranscribeParams'. Did you mean to write 'language_code'? (0 tests run)
    After: Tests: 2 passed, 2 total

pnpm lint and pnpm build pass. In pnpm test:unit, 3 user-agent tests in tests/unit/utils.test.ts fail on Node 22.21.1; they fail the same way on main without this change.

Merge Danger

Door: two-way

Types and doc comments only. No runtime code changes; the SDK already sent unknown fields through.

Blast Radius: none

An optional field is added, so no existing code stops compiling.

🤖 Generated with Claude Code

@dvmarchuk
dvmarchuk marked this pull request as draft November 19, 2026 03:37
The STT-3.7 migration guide sends `language_codes` on POST /v2/transcript,
and the API accepts it, but TranscriptOptionalParams did not declare it.
TypeScript rejected the request and suggested `language_code`, which
sends a single-language request instead.

Also correct the `disfluencies` doc comment: it defaults to true when
`speech_models` includes `assemblyai-stt-3-7`.

Fixes AssemblyAI#215

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dvmarchuk
dvmarchuk force-pushed the fix/transcript-language-codes branch from 0593344 to c87dca8 Compare November 19, 2026 15:29

This branch has not been deployed

No deployments
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.

Pre-recorded types: language_codes missing from TranscriptParams (STT-3.7)

1 participant