Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "assemblyai",
"version": "4.17.0",
"version": "4.18.0",
"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.",
"engines": {
"node": ">=18"
Expand Down
12 changes: 12 additions & 0 deletions src/types/openapi.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@
/**
* Only get throttled transcripts, overrides the status filter
* @defaultValue false
* @deprecated

Check warning on line 1040 in src/types/openapi.generated.ts

View workflow job for this annotation

GitHub Actions / Node.js 20 on ubuntu-latest

tsdoc-missing-deprecation-message: The @deprecated block must include a deprecation message, e.g. describing the recommended alternative

Check warning on line 1040 in src/types/openapi.generated.ts

View workflow job for this annotation

GitHub Actions / Node.js 18 on ubuntu-latest

tsdoc-missing-deprecation-message: The @deprecated block must include a deprecation message, e.g. describing the recommended alternative
*/
throttled_only?: boolean;
};
Expand Down Expand Up @@ -2622,6 +2622,14 @@
* @defaultValue "null
*/
speech_model: SpeechModel | null;
/**
* The list of speech models to use for the transcription in priority order.
*/
speech_models?: string[] | null;
/**
* The actual speech model that was used for the transcription.
*/
speech_model_used?: string | null;
/**
* Defaults to null. Reject audio files that contain less than this fraction of speech.
* Valid values are in the range [0", 1] inclusive.
Expand Down Expand Up @@ -3152,6 +3160,10 @@
* @defaultValue best
*/
speech_model?: SpeechModel | null;
/**
* The list of speech models to use for the transcription in priority order.
*/
speech_models?: string[] | null;
/**
* Reject audio files that contain less than this fraction of speech.
* Valid values are in the range [0", 1] inclusive.
Expand Down
35 changes: 35 additions & 0 deletions tests/unit/transcript.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,4 +468,39 @@ describe("transcript", () => {
expect(searchResponse.total_count).toBe(1);
expect(searchResponse.matches).toBeInstanceOf(Array);
});

it("should handle transcript response with speech_model_used field", async () => {
const transcriptWithSpeechModelUsed = {
id: transcriptId,
status: "completed",
speech_model_used: "best",
};
fetchMock.doMockOnceIf(
requestMatches({ url: `/v2/transcript/${transcriptId}`, method: "GET" }),
JSON.stringify(transcriptWithSpeechModelUsed),
);
const transcript = await assembly.transcripts.get(transcriptId);

expect(transcript.id).toBe(transcriptId);
expect(transcript.speech_model_used).toBe("best");
});

it("should handle transcript response without speech_model_used field", async () => {
// This test verifies that the SDK gracefully handles responses
// where speech_model_used is not present, as the field has not yet
// been added to the API for all users.
const transcriptWithoutSpeechModelUsed = {
id: transcriptId,
status: "completed",
// speech_model_used intentionally omitted
};
fetchMock.doMockOnceIf(
requestMatches({ url: `/v2/transcript/${transcriptId}`, method: "GET" }),
JSON.stringify(transcriptWithoutSpeechModelUsed),
);
const transcript = await assembly.transcripts.get(transcriptId);

expect(transcript.id).toBe(transcriptId);
expect(transcript.speech_model_used).toBeUndefined();
});
});