Skip to content

Commit

Permalink
Merge pull request pipecat-ai#841 from pipecat-ai/aleix/aws-to-polly
Browse files Browse the repository at this point in the history
polly: renamed AWSTTSService to PollyTTSService
  • Loading branch information
aconchillo authored Dec 12, 2024
2 parents def415f + 133e1af commit af821d8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Tamil) and PlayHT (Afrikans, Albanian, Amharic, Arabic, Bengali, Croatian,
Galician, Hebrew, Mandarin, Serbian, Tagalog, Urdu, Xhosa).

### Deprecated

- `AWSTTSService` is now deprecated, use `PollyTTSService` instead.

## [0.0.50] - 2024-12-11

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from pipecat.pipeline.runner import PipelineRunner
from pipecat.pipeline.task import PipelineParams, PipelineTask
from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext
from pipecat.services.aws import AWSTTSService
from pipecat.services.aws import PollyTTSService
from pipecat.services.deepgram import DeepgramSTTService
from pipecat.services.openai import OpenAILLMService
from pipecat.transports.services.daily import DailyParams, DailyTransport
Expand Down Expand Up @@ -48,12 +48,12 @@ async def main():

stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY"))

tts = AWSTTSService(
tts = PollyTTSService(
api_key=os.getenv("AWS_SECRET_ACCESS_KEY"),
aws_access_key_id=os.getenv("AWS_ACCESS_KEY_ID"),
region=os.getenv("AWS_REGION"),
voice_id="Amy",
params=AWSTTSService.InputParams(engine="neural", language="en-GB", rate="1.05"),
params=PollyTTSService.InputParams(engine="neural", language="en-GB", rate="1.05"),
)

llm = OpenAILLMService(api_key=os.getenv("OPENAI_API_KEY"), model="gpt-4o")
Expand Down
15 changes: 14 additions & 1 deletion src/pipecat/services/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def language_to_aws_language(language: Language) -> str | None:
return language_map.get(language)


class AWSTTSService(TTSService):
class PollyTTSService(TTSService):
class InputParams(BaseModel):
engine: Optional[str] = None
language: Optional[Language] = Language.EN
Expand Down Expand Up @@ -244,3 +244,16 @@ def read_audio_data(**args):

finally:
yield TTSStoppedFrame()


class AWSTTSService(PollyTTSService):
def __init__(self, **kwargs):
super().__init__(**kwargs)

import warnings

with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn(
"'AWSTTSService' is deprecated, use 'PollyTTSService' instead.", DeprecationWarning
)

0 comments on commit af821d8

Please sign in to comment.