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
5 changes: 5 additions & 0 deletions .changeset/elevenlabs-stt-model-param.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@livekit/agents-plugin-elevenlabs': patch
---

Deprecate the ElevenLabs STT `modelId` option in favor of `model`, matching the TTS plugin. `modelId` still works as a deprecated alias.
2 changes: 1 addition & 1 deletion examples/src/elevenlabs_scribe_v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default defineAgent({
minSpeechDurationMs: 100,
minSilenceDurationMs: 300,
},
modelId: 'scribe_v2_realtime',
model: 'scribe_v2_realtime',
});

const session = new voice.AgentSession({
Expand Down
8 changes: 4 additions & 4 deletions plugins/elevenlabs/src/stt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ describe('ElevenLabs STT', () => {
baseURL,
languageCode: 'en',
tagAudioEvents: false,
modelId: 'scribe_v2',
model: 'scribe_v2',
keyterms: ['LiveKit', 'ElevenLabs'],
});

Expand Down Expand Up @@ -262,7 +262,7 @@ describe('ElevenLabs STT', () => {
});

try {
const eleven = new STT({ apiKey: 'test-key', baseURL, modelId: 'scribe_v2_realtime' });
const eleven = new STT({ apiKey: 'test-key', baseURL, model: 'scribe_v2_realtime' });
const stream = eleven.stream();
stream.startTimeOffset = 1;

Expand Down Expand Up @@ -341,7 +341,7 @@ describe('ElevenLabs STT', () => {
const eleven = new STT({
apiKey: 'test-key',
baseURL,
modelId: 'scribe_v2_realtime',
model: 'scribe_v2_realtime',
languageCode: 'en',
includeTimestamps: true,
serverVad: {
Expand Down Expand Up @@ -389,7 +389,7 @@ describe('ElevenLabs STT', () => {
});

try {
const eleven = new STT({ apiKey: 'test-key', baseURL, modelId: 'scribe_v2_realtime' });
const eleven = new STT({ apiKey: 'test-key', baseURL, model: 'scribe_v2_realtime' });
const stream = eleven.stream();

await waitUntil(() => urls.length === 1);
Expand Down
24 changes: 18 additions & 6 deletions plugins/elevenlabs/src/stt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ export interface STTOptions {
serverVad?: VADOptions | null;
includeTimestamps?: boolean;
httpSession?: STTHTTPSession;
model?: ElevenLabsSTTModels | string;
/** @deprecated Use `model` instead. */
modelId?: ElevenLabsSTTModels | string;
keyterms?: string[];
noVerbatim?: boolean;
Expand Down Expand Up @@ -192,20 +194,30 @@ export class STT extends stt.STT {
label = 'elevenlabs.STT';

constructor(opts: STTOptions = {}) {
let modelId = opts.modelId;
let model = opts.model;
if (opts.modelId !== undefined) {
if (model !== undefined) {
log().warn(
'both `model` and `modelId` parameters are provided. `modelId` will be ignored.',
);
} else {
log().warn('`modelId` parameter is deprecated, use `model` instead.');
model = opts.modelId;
}
}
if (opts.useRealtime !== undefined) {
if (modelId !== undefined) {
if (model !== undefined) {
log().warn(
'both `useRealtime` and `modelId` parameters are provided. `useRealtime` will be ignored.',
'both `useRealtime` and `model` parameters are provided. `useRealtime` will be ignored.',
);
} else {
log().warn(
'`useRealtime` parameter is deprecated. Specify a realtime modelId to enable streaming. Defaulting modelId to one based on useRealtime parameter.',
'`useRealtime` parameter is deprecated. Specify a realtime model to enable streaming. Defaulting model to one based on useRealtime parameter.',
);
modelId = opts.useRealtime ? 'scribe_v2_realtime' : 'scribe_v1';
model = opts.useRealtime ? 'scribe_v2_realtime' : 'scribe_v1';
}
}
modelId = modelId ?? 'scribe_v1';
const modelId = model ?? 'scribe_v1';
const useRealtime = modelId === 'scribe_v2_realtime';

if (!useRealtime && opts.serverVad !== undefined) {
Expand Down
Loading