Skip to main content

Class: ElevenLabsSpeechModel

Synthesize speech using the ElevenLabs Text to Speech API.

Both regular text-to-speech and full duplex text-to-speech streaming are supported.

See

Hierarchy

Implements

Accessors

modelInformation

get modelInformation(): ModelInformation

Returns

ModelInformation

Implementation of

StreamingSpeechGenerationModel.modelInformation

Inherited from

AbstractModel.modelInformation

Defined in

packages/modelfusion/src/model-function/AbstractModel.ts:17


modelName

get modelName(): string

Returns

string

Overrides

AbstractModel.modelName

Defined in

packages/modelfusion/src/model-provider/elevenlabs/ElevenLabsSpeechModel.ts:85


settingsForEvent

get settingsForEvent(): Partial<ElevenLabsSpeechModelSettings>

Returns settings that should be recorded in observability events. Security-related settings (e.g. API keys) should not be included here.

Returns

Partial<ElevenLabsSpeechModelSettings>

Implementation of

StreamingSpeechGenerationModel.settingsForEvent

Overrides

AbstractModel.settingsForEvent

Defined in

packages/modelfusion/src/model-provider/elevenlabs/ElevenLabsSpeechModel.ts:126

Constructors

constructor

new ElevenLabsSpeechModel(settings): ElevenLabsSpeechModel

Parameters

NameType
settingsElevenLabsSpeechModelSettings

Returns

ElevenLabsSpeechModel

Overrides

AbstractModel&lt;ElevenLabsSpeechModelSettings&gt;.constructor

Defined in

packages/modelfusion/src/model-provider/elevenlabs/ElevenLabsSpeechModel.ts:79

Methods

doGenerateSpeechStandard

doGenerateSpeechStandard(text, options): Promise<Uint8Array>

Generates an mp3 audio Uint8Array that contains the speech for the given text.

Parameters

NameType
textstring
optionsFunctionCallOptions

Returns

Promise<Uint8Array>

Implementation of

StreamingSpeechGenerationModel.doGenerateSpeechStandard

Defined in

packages/modelfusion/src/model-provider/elevenlabs/ElevenLabsSpeechModel.ts:134


doGenerateSpeechStreamDuplex

doGenerateSpeechStreamDuplex(textStream): Promise<AsyncIterable<Delta<Uint8Array>>>

Parameters

NameType
textStreamAsyncIterable<string>

Returns

Promise<AsyncIterable<Delta<Uint8Array>>>

Implementation of

StreamingSpeechGenerationModel.doGenerateSpeechStreamDuplex

Defined in

packages/modelfusion/src/model-provider/elevenlabs/ElevenLabsSpeechModel.ts:138


withSettings

withSettings(additionalSettings): ElevenLabsSpeechModel

The withSettings method creates a new model with the same configuration as the original model, but with the specified settings changed.

Parameters

NameType
additionalSettingsPartial<ElevenLabsSpeechModelSettings>

Returns

ElevenLabsSpeechModel

Example

const model = new OpenAICompletionModel({
model: "gpt-3.5-turbo-instruct",
maxGenerationTokens: 500,
});

const modelWithMoreTokens = model.withSettings({
maxGenerationTokens: 1000,
});

Implementation of

StreamingSpeechGenerationModel.withSettings

Overrides

AbstractModel.withSettings

Defined in

packages/modelfusion/src/model-provider/elevenlabs/ElevenLabsSpeechModel.ts:245

Properties

provider

Readonly provider: "elevenlabs"

Overrides

AbstractModel.provider

Defined in

packages/modelfusion/src/model-provider/elevenlabs/ElevenLabsSpeechModel.ts:83


settings

Readonly settings: ElevenLabsSpeechModelSettings

Implementation of

StreamingSpeechGenerationModel.settings

Inherited from

AbstractModel.settings

Defined in

packages/modelfusion/src/model-function/AbstractModel.ts:7