From c0ac5c6ae84139fb441a6737d4e7d80b261c9dc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Thu, 29 Aug 2024 11:11:24 -0700 Subject: [PATCH] services(lmnt): fix example and update README and CHANGELOG --- CHANGELOG.md | 3 +++ README.md | 2 +- examples/foundational/07k-interruptible-lmnt.py | 2 +- src/pipecat/services/ai_services.py | 2 +- src/pipecat/services/lmnt.py | 11 ++++------- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7acae5c82..7bf00326d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Added new `LmntTTSService` text-to-speech service. + (see https://www.lmnt.com/) + - Added `TTSModelUpdateFrame`, `TTSLanguageUpdateFrame`, `STTModelUpdateFrame`, and `STTLanguageUpdateFrame` frames to allow you to switch models, language and voices in TTS and STT services. diff --git a/README.md b/README.md index 40f96636c..681fd3b91 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ pip install "pipecat-ai[option,...]" Your project may or may not need these, so they're made available as optional requirements. Here is a list: -- **AI services**: `anthropic`, `azure`, `deepgram`, `gladia`, `google`, `fal`, `moondream`, `openai`, `openpipe`, `playht`, `silero`, `whisper`, `xtts` +- **AI services**: `anthropic`, `azure`, `deepgram`, `gladia`, `google`, `fal`, `lmnt`, `moondream`, `openai`, `openpipe`, `playht`, `silero`, `whisper`, `xtts` - **Transports**: `local`, `websocket`, `daily` ## Code examples diff --git a/examples/foundational/07k-interruptible-lmnt.py b/examples/foundational/07k-interruptible-lmnt.py index 790c4794e..6e68564ea 100644 --- a/examples/foundational/07k-interruptible-lmnt.py +++ b/examples/foundational/07k-interruptible-lmnt.py @@ -50,7 +50,7 @@ async def main(): tts = LmntTTSService( api_key=os.getenv("LMNT_API_KEY"), - voice="morgan" + voice_id="morgan" ) llm = OpenAILLMService( diff --git a/src/pipecat/services/ai_services.py b/src/pipecat/services/ai_services.py index c10f3e46e..c5cb7cc0d 100644 --- a/src/pipecat/services/ai_services.py +++ b/src/pipecat/services/ai_services.py @@ -9,7 +9,7 @@ import io import wave from abc import abstractmethod -from typing import AsyncGenerator, Mapping, Optional +from typing import AsyncGenerator, Optional from pipecat.frames.frames import ( AudioRawFrame, diff --git a/src/pipecat/services/lmnt.py b/src/pipecat/services/lmnt.py index e6688dc78..f7afd6a41 100644 --- a/src/pipecat/services/lmnt.py +++ b/src/pipecat/services/lmnt.py @@ -4,23 +4,19 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import json -import uuid -import base64 import asyncio -import time from typing import AsyncGenerator from pipecat.processors.frame_processor import FrameDirection from pipecat.frames.frames import ( + AudioRawFrame, CancelFrame, + EndFrame, ErrorFrame, Frame, - AudioRawFrame, StartFrame, StartInterruptionFrame, - EndFrame, TTSStartedFrame, TTSStoppedFrame, ) @@ -95,7 +91,8 @@ class LmntTTSService(TTSService): async def _connect(self): try: self._speech = Speech() - self._connection = await self._speech.synthesize_streaming(self._voice_id, format="raw", sample_rate=self._output_format["sample_rate"]) + self._connection = await self._speech.synthesize_streaming( + self._voice_id, format="raw", sample_rate=self._output_format["sample_rate"]) self._receive_task = self.get_event_loop().create_task(self._receive_task_handler()) except Exception as e: logger.exception(f"{self} initialization error: {e}")