OpenAI
OpenAISpeechSynthesizer
Bases: BaseModel
Speech synthesizer using OpenAI's API.
model
class-attribute
instance-attribute
model: Literal['tts-1', 'tts-1-hd'] = 'tts-1'
Model to use for speech synthesis.
voice
class-attribute
instance-attribute
voice: Literal[
"alloy", "echo", "fable", "onyx", "nova", "shimmer"
] = "alloy"
Voice to use for speech synthesis.
speed
class-attribute
instance-attribute
Speed of speech synthesis.
timeout
class-attribute
instance-attribute
timeout: PositiveInt = 120
Timeout for speech synthesis in seconds.
synthesize
synthesize(
texts: Sequence[str],
*,
audio_params: AudioAssetParams | None = None,
**kwargs: Any
) -> list[AudioAsset]
Synthesize speech from texts using OpenAI's API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
texts |
Sequence[str]
|
Texts to synthesize. |
required |
audio_params |
AudioAssetParams | None
|
Parameters for the audio asset. |
None
|
kwargs |
Any
|
Additional parameters for the OpenAI API. |
{}
|
Returns:
Type | Description |
---|---|
list[AudioAsset]
|
List of audio assets. |