When using the voice agent in typed code, it is suboptimal and error
prone to type the TTS voice variables in your code independently.
With this commit we are making the type exportable so that developers
can just use that and be future-proof.
Example of usage in code:
```
DEFAULT_TTS_VOICE: TTSModelSettings.TTSVoice = "alloy"
...
tts_voice: TTSModelSettings.TTSVoice = DEFAULT_TTS_VOICE
...
output = await VoicePipeline(
workflow=workflow,
config=VoicePipelineConfig(
tts_settings=TTSModelSettings(
buffer_size=512,
transform_data=transform_data,
voice=tts_voice,
instructions=tts_instructions,
))
).run(audio_input)
```
---------
Co-authored-by: Rohan Mehta <rm@openai.com>
53 lines
1.5 KiB
Python
53 lines
1.5 KiB
Python
from .events import VoiceStreamEvent, VoiceStreamEventAudio, VoiceStreamEventLifecycle
|
|
from .exceptions import STTWebsocketConnectionError
|
|
from .input import AudioInput, StreamedAudioInput
|
|
from .model import (
|
|
StreamedTranscriptionSession,
|
|
STTModel,
|
|
STTModelSettings,
|
|
TTSModel,
|
|
TTSModelSettings,
|
|
TTSVoice,
|
|
VoiceModelProvider,
|
|
)
|
|
from .models.openai_model_provider import OpenAIVoiceModelProvider
|
|
from .models.openai_stt import OpenAISTTModel, OpenAISTTTranscriptionSession
|
|
from .models.openai_tts import OpenAITTSModel
|
|
from .pipeline import VoicePipeline
|
|
from .pipeline_config import VoicePipelineConfig
|
|
from .result import StreamedAudioResult
|
|
from .utils import get_sentence_based_splitter
|
|
from .workflow import (
|
|
SingleAgentVoiceWorkflow,
|
|
SingleAgentWorkflowCallbacks,
|
|
VoiceWorkflowBase,
|
|
VoiceWorkflowHelper,
|
|
)
|
|
|
|
__all__ = [
|
|
"AudioInput",
|
|
"StreamedAudioInput",
|
|
"STTModel",
|
|
"STTModelSettings",
|
|
"TTSModel",
|
|
"TTSModelSettings",
|
|
"TTSVoice",
|
|
"VoiceModelProvider",
|
|
"StreamedAudioResult",
|
|
"SingleAgentVoiceWorkflow",
|
|
"OpenAIVoiceModelProvider",
|
|
"OpenAISTTModel",
|
|
"OpenAITTSModel",
|
|
"VoiceStreamEventAudio",
|
|
"VoiceStreamEventLifecycle",
|
|
"VoiceStreamEvent",
|
|
"VoicePipeline",
|
|
"VoicePipelineConfig",
|
|
"get_sentence_based_splitter",
|
|
"VoiceWorkflowHelper",
|
|
"VoiceWorkflowBase",
|
|
"SingleAgentWorkflowCallbacks",
|
|
"StreamedTranscriptionSession",
|
|
"OpenAISTTTranscriptionSession",
|
|
"STTWebsocketConnectionError",
|
|
]
|