From f7d9f32b0fcd560fc3819d9c04650e18c14ae0cd Mon Sep 17 00:00:00 2001 From: Mark Backman Date: Wed, 27 Aug 2025 13:34:28 -0400 Subject: [PATCH] Cartesia: update speed InputParam --- CHANGELOG.md | 4 ++++ src/pipecat/services/cartesia/tts.py | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7aade22d1..9cbc09712 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -87,6 +87,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Updated `CartesiaTTSService` and `CartesiaHttpTTSService` to align with + Cartesia's changes for the `speed` parameter. It now takes only an enum of + `slow`, `normal`, or `fast`. + - Added support to `AWSBedrockLLMService` for setting authentication credentials through environment variables. diff --git a/src/pipecat/services/cartesia/tts.py b/src/pipecat/services/cartesia/tts.py index 53208b53f..f8f148a38 100644 --- a/src/pipecat/services/cartesia/tts.py +++ b/src/pipecat/services/cartesia/tts.py @@ -10,7 +10,7 @@ import base64 import json import uuid import warnings -from typing import AsyncGenerator, List, Optional, Union +from typing import AsyncGenerator, List, Literal, Optional, Union from loguru import logger from pydantic import BaseModel, Field @@ -101,7 +101,7 @@ class CartesiaTTSService(AudioContextWordTTSService): Parameters: language: Language to use for synthesis. - speed: Voice speed control (string or float). + speed: Voice speed control. emotion: List of emotion controls. .. deprecated:: 0.0.68 @@ -109,7 +109,7 @@ class CartesiaTTSService(AudioContextWordTTSService): """ language: Optional[Language] = Language.EN - speed: Optional[Union[str, float]] = "" + speed: Optional[Literal["slow", "normal", "fast"]] = None emotion: Optional[List[str]] = [] def __init__( @@ -478,7 +478,7 @@ class CartesiaHttpTTSService(TTSService): Parameters: language: Language to use for synthesis. - speed: Voice speed control (string or float). + speed: Voice speed control. emotion: List of emotion controls. .. deprecated:: 0.0.68 @@ -486,7 +486,7 @@ class CartesiaHttpTTSService(TTSService): """ language: Optional[Language] = Language.EN - speed: Optional[Union[str, float]] = "" + speed: Optional[Literal["slow", "normal", "fast"]] = None emotion: Optional[List[str]] = Field(default_factory=list) def __init__(