Skip to content

Commit d65b8af

Browse files
authored
Merge pull request #108 from AssemblyAI/EA17A79D514289B819B9AE7C9AB1132F
Sync from internal repo (2025/10/16)
2 parents 0ffd2ba + 3a6b658 commit d65b8af

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "assemblyai",
3-
"version": "4.17.0",
3+
"version": "4.18.0",
44
"description": "The AssemblyAI JavaScript SDK provides an easy-to-use interface for interacting with the AssemblyAI API, which supports async and real-time transcription, as well as the latest LeMUR models.",
55
"engines": {
66
"node": ">=18"

src/types/openapi.generated.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2622,6 +2622,14 @@ export type Transcript = {
26222622
* @defaultValue "null
26232623
*/
26242624
speech_model: SpeechModel | null;
2625+
/**
2626+
* The list of speech models to use for the transcription in priority order.
2627+
*/
2628+
speech_models?: string[] | null;
2629+
/**
2630+
* The actual speech model that was used for the transcription.
2631+
*/
2632+
speech_model_used?: string | null;
26252633
/**
26262634
* Defaults to null. Reject audio files that contain less than this fraction of speech.
26272635
* Valid values are in the range [0", 1] inclusive.
@@ -3152,6 +3160,10 @@ export type TranscriptOptionalParams = {
31523160
* @defaultValue best
31533161
*/
31543162
speech_model?: SpeechModel | null;
3163+
/**
3164+
* The list of speech models to use for the transcription in priority order.
3165+
*/
3166+
speech_models?: string[] | null;
31553167
/**
31563168
* Reject audio files that contain less than this fraction of speech.
31573169
* Valid values are in the range [0", 1] inclusive.

tests/unit/transcript.test.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,4 +468,39 @@ describe("transcript", () => {
468468
expect(searchResponse.total_count).toBe(1);
469469
expect(searchResponse.matches).toBeInstanceOf(Array);
470470
});
471+
472+
it("should handle transcript response with speech_model_used field", async () => {
473+
const transcriptWithSpeechModelUsed = {
474+
id: transcriptId,
475+
status: "completed",
476+
speech_model_used: "best",
477+
};
478+
fetchMock.doMockOnceIf(
479+
requestMatches({ url: `/v2/transcript/${transcriptId}`, method: "GET" }),
480+
JSON.stringify(transcriptWithSpeechModelUsed),
481+
);
482+
const transcript = await assembly.transcripts.get(transcriptId);
483+
484+
expect(transcript.id).toBe(transcriptId);
485+
expect(transcript.speech_model_used).toBe("best");
486+
});
487+
488+
it("should handle transcript response without speech_model_used field", async () => {
489+
// This test verifies that the SDK gracefully handles responses
490+
// where speech_model_used is not present, as the field has not yet
491+
// been added to the API for all users.
492+
const transcriptWithoutSpeechModelUsed = {
493+
id: transcriptId,
494+
status: "completed",
495+
// speech_model_used intentionally omitted
496+
};
497+
fetchMock.doMockOnceIf(
498+
requestMatches({ url: `/v2/transcript/${transcriptId}`, method: "GET" }),
499+
JSON.stringify(transcriptWithoutSpeechModelUsed),
500+
);
501+
const transcript = await assembly.transcripts.get(transcriptId);
502+
503+
expect(transcript.id).toBe(transcriptId);
504+
expect(transcript.speech_model_used).toBeUndefined();
505+
});
471506
});

0 commit comments

Comments
 (0)