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
- https://docs.elevenlabs.io/api-reference/text-to-speech
- https://docs.elevenlabs.io/api-reference/text-to-speech-websockets
Hierarchy
-
AbstractModel
<ElevenLabsSpeechModelSettings
>↳
ElevenLabsSpeechModel
Implements
Accessors
modelInformation
• get
modelInformation(): ModelInformation
Returns
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
Name | Type |
---|---|
settings | ElevenLabsSpeechModelSettings |
Returns
Overrides
AbstractModel<ElevenLabsSpeechModelSettings>.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
Name | Type |
---|---|
text | string |
options | FunctionCallOptions |
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
Name | Type |
---|---|
textStream | AsyncIterable <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
Name | Type |
---|---|
additionalSettings | Partial <ElevenLabsSpeechModelSettings > |
Returns
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