From 04484131827377e2caf73094c668ac0a516f9850 Mon Sep 17 00:00:00 2001 From: AssemblyAI Date: Wed, 17 Jul 2024 17:29:41 +0900 Subject: [PATCH] Project import generated by Copybara. GitOrigin-RevId: a3be8a03d669e5738cbd181d8e8e34f7c1598c5f --- CHANGELOG.md | 5 ++++ package.json | 2 +- src/services/transcripts/index.ts | 13 -------- src/types/openapi.generated.ts | 49 ++++++++++++++++--------------- 4 files changed, 31 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de85aa9..4b5e783 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## [4.6.1] + +- Remove `conformer-2` from `SpeechModel` union type. +- Remove conformer-2 deprecation warning + ## [4.6.0] - Add more TSDoc comments for `RealtimeService` documentation diff --git a/package.json b/package.json index 6a9aa57..eb11977 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "assemblyai", - "version": "4.6.0", + "version": "4.6.1", "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" diff --git a/src/services/transcripts/index.ts b/src/services/transcripts/index.ts index 8e717d0..f3e754c 100644 --- a/src/services/transcripts/index.ts +++ b/src/services/transcripts/index.ts @@ -15,7 +15,6 @@ import { TranscribeParams, TranscribeOptions, SubmitParams, - SpeechModel, RedactedAudioFile, } from "../.."; import { FileService } from "../files"; @@ -39,7 +38,6 @@ export class TranscriptService extends BaseService { params: TranscribeParams, options?: TranscribeOptions, ): Promise { - deprecateConformer2(params); const transcript = await this.submit(params); return await this.waitUntilReady(transcript.id, options); } @@ -50,7 +48,6 @@ export class TranscriptService extends BaseService { * @returns A promise that resolves to the queued transcript. */ async submit(params: SubmitParams): Promise { - deprecateConformer2(params); let audioUrl; let transcriptParams: TranscriptParams | undefined = undefined; if ("audio" in params) { @@ -95,7 +92,6 @@ export class TranscriptService extends BaseService { params: TranscriptParams, options?: CreateTranscriptOptions, ): Promise { - deprecateConformer2(params); const path = getPath(params.audio_url); if (path !== null) { const uploadUrl = await this.files.upload(path); @@ -287,12 +283,3 @@ export class TranscriptService extends BaseService { }; } } - -function deprecateConformer2(params: { speech_model?: SpeechModel | null }) { - if (!params) return; - if (params.speech_model === "conformer-2") { - console.warn( - "The speech_model conformer-2 option is deprecated and will stop working in the near future. Use best or nano instead.", - ); - } -} diff --git a/src/types/openapi.generated.ts b/src/types/openapi.generated.ts index fde73cd..b5be12b 100644 --- a/src/types/openapi.generated.ts +++ b/src/types/openapi.generated.ts @@ -596,12 +596,7 @@ export type LemurActionItemsParams = LemurBaseParams & { * } * ``` */ -export type LemurActionItemsResponse = LemurBaseResponse & { - /** - * The response generated by LeMUR - */ - response: string; -}; +export type LemurActionItemsResponse = LemurStringResponse; /** * @example @@ -820,11 +815,27 @@ export type LemurQuestionAnswerResponse = LemurBaseResponse & { response: LemurQuestionAnswer[]; }; -export type LemurResponse = - | LemurTaskResponse - | LemurSummaryResponse - | LemurQuestionAnswerResponse - | LemurActionItemsResponse; +export type LemurResponse = LemurStringResponse | LemurQuestionAnswerResponse; + +/** + * @example + * ```js + * { + * "request_id": "5e1b27c2-691f-4414-8bc5-f14678442f9e", + * "response": "Based on the transcript, the following locations were mentioned as being affected by wildfire smoke from Canada:\n\n- Maine\n- Maryland\n- Minnesota\n- Mid Atlantic region\n- Northeast region\n- New York City\n- Baltimore\n", + * "usage": { + * "input_tokens": 27, + * "output_tokens": 3 + * } + * } + * ``` + */ +export type LemurStringResponse = { + /** + * The response generated by LeMUR. + */ + response: string; +} & LemurBaseResponse; /** * @example @@ -860,12 +871,7 @@ export type LemurSummaryParams = LemurBaseParams & { * } * ``` */ -export type LemurSummaryResponse = LemurBaseResponse & { - /** - * The response generated by LeMUR - */ - response: string; -}; +export type LemurSummaryResponse = LemurStringResponse; /** * @example @@ -902,12 +908,7 @@ export type LemurTaskParams = { * } * ``` */ -export type LemurTaskResponse = { - /** - * The response generated by LeMUR. - */ - response: string; -} & LemurBaseResponse; +export type LemurTaskResponse = LemurStringResponse; /** * The usage numbers for the LeMUR request @@ -1379,7 +1380,7 @@ export type SeverityScoreSummary = { /** * The speech model to use for the transcription. */ -export type SpeechModel = "best" | "nano" | "conformer-2"; +export type SpeechModel = "best" | "nano"; /** * The replacement logic for detected PII, can be "entity_name" or "hash". See {@link https://www.assemblyai.com/docs/models/pii-redaction | PII redaction } for more details.