From 55a6e5aa4c70d3889a093b0db0b6e1e1b5a9e3d8 Mon Sep 17 00:00:00 2001 From: Mark Backman Date: Wed, 2 Apr 2025 12:08:18 -0400 Subject: [PATCH] Add new voices to OpenAITTSService --- examples/foundational/07g-interruptible-openai.py | 2 +- src/pipecat/services/openai/tts.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/foundational/07g-interruptible-openai.py b/examples/foundational/07g-interruptible-openai.py index 476dd5cea..e73daa881 100644 --- a/examples/foundational/07g-interruptible-openai.py +++ b/examples/foundational/07g-interruptible-openai.py @@ -59,7 +59,7 @@ async def main(): prompt="Expect words related to dogs, such as breed names.", ) - tts = OpenAITTSService(api_key=os.getenv("OPENAI_API_KEY"), model="gpt-4o-mini-tts-latest") + tts = OpenAITTSService(api_key=os.getenv("OPENAI_API_KEY"), voice="ballad") llm = OpenAILLMService(api_key=os.getenv("OPENAI_API_KEY"), model="gpt-4o") diff --git a/src/pipecat/services/openai/tts.py b/src/pipecat/services/openai/tts.py index 6024310b8..238684504 100644 --- a/src/pipecat/services/openai/tts.py +++ b/src/pipecat/services/openai/tts.py @@ -19,14 +19,20 @@ from pipecat.frames.frames import ( ) from pipecat.services.tts_service import TTSService -ValidVoice = Literal["alloy", "echo", "fable", "onyx", "nova", "shimmer"] +ValidVoice = Literal[ + "alloy", "ash", "ballad", "coral", "echo", "fable", "onyx", "nova", "sage", "shimmer" +] VALID_VOICES: Dict[str, ValidVoice] = { "alloy": "alloy", + "ash": "ash", + "ballad": "ballad", + "coral": "coral", "echo": "echo", "fable": "fable", "onyx": "onyx", "nova": "nova", + "sage": "sage", "shimmer": "shimmer", }