OpenAIVoiceModelProvider
OpenAIVoiceModelProvider
Bases:VoiceModelProvider
A voice model provider that uses OpenAI models.
Source code insrc/agents/voice/models/openai_model_provider.py
__init__
__init__(*,api_key:str|None=None,base_url:str|None=None,openai_client:AsyncOpenAI|None=None,organization:str|None=None,project:str|None=None,)->NoneCreate a new OpenAI voice model provider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_key | str | None | The API key to use for the OpenAI client. If not provided, we will use thedefault API key. | None |
base_url | str | None | The base URL to use for the OpenAI client. If not provided, we will use thedefault base URL. | None |
openai_client | AsyncOpenAI | None | An optional OpenAI client to use. If not provided, we will create a newOpenAI client using the api_key and base_url. | None |
organization | str | None | The organization to use for the OpenAI client. | None |
project | str | None | The project to use for the OpenAI client. | None |
Source code insrc/agents/voice/models/openai_model_provider.py
get_stt_model
get_stt_model(model_name:str|None)->STTModelGet a speech-to-text model by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_name | str | None | The name of the model to get. | required |
Returns:
| Type | Description |
|---|---|
STTModel | The speech-to-text model. |
Source code insrc/agents/voice/models/openai_model_provider.py
get_tts_model
get_tts_model(model_name:str|None)->TTSModelGet a text-to-speech model by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_name | str | None | The name of the model to get. | required |
Returns:
| Type | Description |
|---|---|
TTSModel | The text-to-speech model. |