OpenAI TTS
OpenAITTSModel
Bases:TTSModel
A text-to-speech model for OpenAI.
Source code insrc/agents/voice/models/openai_tts.py
__init__
Create a new OpenAI text-to-speech model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model | str | The name of the model to use. | required |
openai_client | AsyncOpenAI | The OpenAI client to use. | required |
Source code insrc/agents/voice/models/openai_tts.py
runasync
run(text:str,settings:TTSModelSettings)->AsyncIterator[bytes]Run the text-to-speech model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text | str | The text to convert to speech. | required |
settings | TTSModelSettings | The settings to use for the text-to-speech model. | required |
Returns:
| Type | Description |
|---|---|
AsyncIterator[bytes] | An iterator of audio chunks. |