From 01cdb6eb3a1679c365c7f1fdcc1fe755af7507b1 Mon Sep 17 00:00:00 2001 From: mattie ruth backman Date: Thu, 19 Sep 2024 11:32:14 -0400 Subject: [PATCH] linting --- src/pipecat/frames/frames.py | 26 ++++------------------- src/pipecat/processors/frame_processor.py | 4 ++-- src/pipecat/services/deepgram.py | 5 +---- src/pipecat/services/elevenlabs.py | 3 +-- 4 files changed, 8 insertions(+), 30 deletions(-) diff --git a/src/pipecat/frames/frames.py b/src/pipecat/frames/frames.py index 1ec369980..d3068bda9 100644 --- a/src/pipecat/frames/frames.py +++ b/src/pipecat/frames/frames.py @@ -98,11 +98,7 @@ class VisionImageRawFrame(ImageRawFrame): def __str__(self): pts = format_pts(self.pts) - return f"{ - self.name}(pts: {pts}, text: { - self.text}, size: { - self.size}, format: { - self.format})" + return f"{self.name}(pts: {pts}, text: {self.text}, size: {self.size}, format: {self.format})" @dataclass @@ -115,11 +111,7 @@ class UserImageRawFrame(ImageRawFrame): def __str__(self): pts = format_pts(self.pts) - return f"{ - self.name}(pts: {pts}, user: { - self.user_id}, size: { - self.size}, format: { - self.format})" + return f"{self.name}(pts: {pts}, user: {self.user_id}, size: {self.size}, format: {self.format})" @dataclass @@ -160,12 +152,7 @@ class TranscriptionFrame(TextFrame): language: Language | None = None def __str__(self): - return f"{ - self.name}(user: { - self.user_id}, text: { - self.text}, language: { - self.language}, timestamp: { - self.timestamp})" + return f"{self.name}(user: {self.user_id}, text: {self.text}, language: {self.language}, timestamp: {self.timestamp})" @dataclass @@ -177,12 +164,7 @@ class InterimTranscriptionFrame(TextFrame): language: Language | None = None def __str__(self): - return f"{ - self.name}(user: { - self.user_id}, text: { - self.text}, language: { - self.language}, timestamp: { - self.timestamp})" + return f"{self.name}(user: {self.user_id}, text: {self.text}, language: {self.language}, timestamp: {self.timestamp})" @dataclass diff --git a/src/pipecat/processors/frame_processor.py b/src/pipecat/processors/frame_processor.py index b97129e96..e44b8b0ff 100644 --- a/src/pipecat/processors/frame_processor.py +++ b/src/pipecat/processors/frame_processor.py @@ -85,8 +85,8 @@ async def stop_processing_metrics(self): return MetricsFrame(data=[processing]) async def start_llm_usage_metrics(self, tokens: LLMTokenUsage): - logger.debug(f"{self._processor_name()} prompt tokens: { - tokens.prompt_tokens}, completion tokens: {tokens.completion_tokens}") + logger.debug( + f"{self._processor_name()} prompt tokens: {tokens.prompt_tokens}, completion tokens: {tokens.completion_tokens}") value = LLMUsageMetricsData( processor=self._processor_name(), model=self._model_name(), diff --git a/src/pipecat/services/deepgram.py b/src/pipecat/services/deepgram.py index 7e5e16d3e..5aebdfbb3 100644 --- a/src/pipecat/services/deepgram.py +++ b/src/pipecat/services/deepgram.py @@ -75,10 +75,7 @@ async def run_tts(self, text: str) -> AsyncGenerator[Frame, None]: logger.debug(f"Generating TTS: [{text}]") base_url = self._base_url - request_url = f"{base_url}?model={ - self._voice}&encoding={ - self._encoding}&container=none&sample_rate={ - self._sample_rate}" + request_url = f"{base_url}?model={self._voice}&encoding={self._encoding}&container=none&sample_rate={self._sample_rate}" headers = {"authorization": f"token {self._api_key}"} body = {"text": text} diff --git a/src/pipecat/services/elevenlabs.py b/src/pipecat/services/elevenlabs.py index 10015e791..40aa25865 100644 --- a/src/pipecat/services/elevenlabs.py +++ b/src/pipecat/services/elevenlabs.py @@ -162,8 +162,7 @@ async def _connect(self): voice_id = self._voice_id model = self.model_name output_format = self._params.output_format - url = f"{ - self._url}/v1/text-to-speech/{voice_id}/stream-input?model_id={model}&output_format={output_format}" + url = f"{self._url}/v1/text-to-speech/{voice_id}/stream-input?model_id={model}&output_format={output_format}" self._websocket = await websockets.connect(url) self._receive_task = self.get_event_loop().create_task(self._receive_task_handler()) self._keepalive_task = self.get_event_loop().create_task(self._keepalive_task_handler())