Skip to content

Sync from internal repo (2025-06-02) #87

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 2, 2025
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.13.0-beta.1",
"version": "4.13.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
11 changes: 10 additions & 1 deletion src/services/streaming/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,21 @@ import { StreamingTranscriber } from "./service";
import { BaseService } from "../base";

export class StreamingTranscriberFactory extends BaseService {
private baseServiceParams: BaseServiceParams;

constructor(params: BaseServiceParams) {
super(params);
this.baseServiceParams = params;
}

transcriber(params: StreamingTranscriberParams): StreamingTranscriber {
return new StreamingTranscriber(params);
const serviceParams = { ...params };

if (!serviceParams.token && !serviceParams.apiKey) {
serviceParams.apiKey = this.baseServiceParams.apiKey;
}

return new StreamingTranscriber(serviceParams);
}

async createTemporaryToken(params: StreamingTokenParams) {
Expand Down
14 changes: 2 additions & 12 deletions src/services/streaming/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,6 @@ export class StreamingTranscriber {

searchParams.set("sample_rate", this.params.sampleRate.toString());

if (this.params.wordFinalizationMaxWaitTime) {
searchParams.set(
"word_finalization_max_wait_time",
this.params.wordFinalizationMaxWaitTime.toString(),
);
}

if (this.params.endOfTurnConfidenceThreshold) {
searchParams.set(
"end_of_turn_confidence_threshold",
Expand All @@ -99,11 +92,8 @@ export class StreamingTranscriber {
);
}

if (this.params.formattedFinals) {
searchParams.set(
"formatted_finals",
this.params.formattedFinals.toString(),
);
if (this.params.formatTurns) {
searchParams.set("format_turns", this.params.formatTurns.toString());
}

url.search = searchParams.toString();
Expand Down
6 changes: 2 additions & 4 deletions src/types/streaming/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ export type StreamingTranscriberParams = {
token?: string;
sampleRate: number;

wordFinalizationMaxWaitTime?: number;
endOfTurnConfidenceThreshold?: number;
minEndOfTurnSilenceWhenConfident?: number;
maxTurnSilence?: number;
formattedFinals?: boolean;
formatTurns?: boolean;
};

export type StreamingEvents = "open" | "close" | "turn" | "error";
Expand Down Expand Up @@ -67,11 +66,10 @@ export type StreamingTerminateSession = {

export type StreamingUpdateConfiguration = {
type: "UpdateConfiguration";
word_finalization_max_wait_time?: number;
end_of_turn_confidence_threshold?: number;
min_end_of_turn_silence_when_confident?: number;
max_turn_silence?: number;
formatted_finals?: boolean;
format_turns?: boolean;
};

export type StreamingForceEndpoint = {
Expand Down
Loading