From 17162258a29addf4f2f0cebcd0ee8697055b9f2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Tue, 17 Dec 2024 11:28:58 -0800 Subject: [PATCH 1/3] fix ruff linter import organization --- examples/chatbot-audio-recording/bot.py | 6 +-- examples/deployment/flyio-example/bot.py | 13 +++--- .../deployment/flyio-example/bot_runner.py | 12 ++--- examples/deployment/modal-example/app.py | 3 +- examples/dialin-chatbot/bot_daily.py | 13 +++--- examples/dialin-chatbot/bot_runner.py | 12 ++--- examples/dialin-chatbot/bot_twilio.py | 14 +++--- examples/foundational/01-say-one-thing.py | 14 +++--- examples/foundational/01a-local-audio.py | 9 ++-- examples/foundational/01b-livekit-audio.py | 9 ++-- examples/foundational/01c-fastpitch.py | 14 +++--- examples/foundational/02-llm-say-one-thing.py | 12 ++--- examples/foundational/03-still-frame.py | 12 ++--- .../foundational/03a-local-still-frame.py | 10 ++-- .../foundational/04-utterance-and-speech.py | 15 +++--- .../foundational/05-sync-speech-and-image.py | 17 +++---- .../05a-local-sync-speech-and-image.py | 16 +++---- examples/foundational/06a-image-sync.py | 14 ++---- examples/foundational/07-interruptible-vad.py | 14 +++--- examples/foundational/07-interruptible.py | 12 ++--- .../07b-interruptible-langchain.py | 20 ++++---- .../07d-interruptible-elevenlabs.py | 2 +- .../foundational/07f-interruptible-azure.py | 13 ++---- .../07g-interruptible-openai-tts.py | 2 +- .../07h-interruptible-openpipe.py | 14 +++--- .../foundational/07i-interruptible-xtts.py | 12 ++--- .../foundational/07k-interruptible-lmnt.py | 12 ++--- .../foundational/07p-interruptible-krisp.py | 2 +- .../07s-interruptible-google-audio-in.py | 27 ++++++----- examples/foundational/08-bots-arguing.py | 19 ++++---- examples/foundational/09-mirror.py | 14 +++--- examples/foundational/09a-local-mirror.py | 13 ++---- examples/foundational/10-wake-phrase.py | 12 ++--- examples/foundational/11-sound-effects.py | 12 ++--- examples/foundational/12-describe-video.py | 12 ++--- .../12a-describe-video-gemini-flash.py | 12 ++--- .../foundational/12b-describe-video-gpt-4o.py | 12 ++--- .../12c-describe-video-anthropic.py | 14 +++--- .../foundational/13-whisper-transcription.py | 12 ++--- examples/foundational/13a-whisper-local.py | 7 ++- .../13b-deepgram-transcription.py | 14 +++--- examples/foundational/14-function-calling.py | 15 +++--- .../14a-function-calling-anthropic.py | 14 +++--- .../14b-function-calling-anthropic-video.py | 14 +++--- .../14d-function-calling-video.py | 15 +++--- .../14e-function-calling-gemini.py | 12 ++--- examples/foundational/15-switch-voices.py | 17 +++---- examples/foundational/15a-switch-languages.py | 16 +++---- examples/foundational/17-detect-user-idle.py | 12 ++--- examples/foundational/18-gstreamer-filesrc.py | 14 +++--- .../18a-gstreamer-videotestsrc.py | 12 ++--- .../20a-persistent-context-openai.py | 3 +- .../20c-persistent-context-anthropic.py | 3 +- .../20d-persistent-context-gemini.py | 1 - examples/foundational/21-tavus-layer.py | 14 +++--- .../foundational/22-natural-conversation.py | 14 +++--- .../22b-natural-conversation-proposal.py | 46 +++++++++---------- .../22d-natural-conversation-gemini-audio.py | 46 +++++++++---------- .../foundational/23-bot-background-sound.py | 14 +++--- examples/foundational/25-google-audio-in.py | 29 ++++++------ .../foundational/26-gemini-multimodal-live.py | 6 +-- examples/foundational/27-simli-layer.py | 18 ++++---- examples/foundational/runner.py | 3 +- examples/moondream-chatbot/bot.py | 15 +++--- examples/moondream-chatbot/runner.py | 3 +- examples/moondream-chatbot/server.py | 7 ++- examples/patient-intake/bot.py | 14 +++--- examples/patient-intake/runner.py | 3 +- examples/patient-intake/server.py | 7 ++- .../storytelling-chatbot/src/bot_runner.py | 18 +++----- .../storytelling-chatbot/src/processors.py | 5 +- .../storytelling-chatbot/src/utils/helpers.py | 1 + examples/studypal/runner.py | 3 +- examples/studypal/studypal.py | 15 +++--- examples/translation-chatbot/bot.py | 12 ++--- examples/translation-chatbot/server.py | 7 ++- examples/twilio-chatbot/bot.py | 13 +++--- examples/twilio-chatbot/server.py | 4 +- examples/websocket-server/bot.py | 7 ++- src/pipecat/audio/filters/krisp_filter.py | 5 +- .../audio/filters/noisereduce_filter.py | 4 +- src/pipecat/audio/utils.py | 1 + src/pipecat/audio/vad/silero.py | 3 +- src/pipecat/metrics/metrics.py | 1 + src/pipecat/pipeline/base_pipeline.py | 1 - src/pipecat/pipeline/parallel_pipeline.py | 7 ++- src/pipecat/pipeline/runner.py | 4 +- .../pipeline/sync_parallel_pipeline.py | 5 +- src/pipecat/pipeline/task.py | 6 +-- .../pipeline/to_be_updated/merge_pipeline.py | 1 + src/pipecat/processors/aggregators/gated.py | 4 +- .../processors/aggregators/user_response.py | 2 +- src/pipecat/processors/async_generator.py | 3 +- src/pipecat/processors/audio/vad/silero.py | 4 +- .../processors/filters/wake_check_filter.py | 5 +- .../processors/frameworks/langchain.py | 4 +- .../processors/gstreamer/pipeline_source.py | 3 +- .../processors/idle_frame_processor.py | 1 - src/pipecat/processors/logger.py | 8 ++-- .../metrics/frame_processor_metrics.py | 4 +- src/pipecat/processors/metrics/sentry.py | 1 + src/pipecat/serializers/livekit.py | 4 +- src/pipecat/serializers/protobuf.py | 5 +- src/pipecat/serializers/twilio.py | 2 +- src/pipecat/services/canonical.py | 7 ++- src/pipecat/services/cartesia.py | 1 - src/pipecat/services/fal.py | 10 ++-- .../services/gemini_multimodal_live/events.py | 5 +- src/pipecat/services/moondream.py | 7 +-- .../services/openai_realtime_beta/context.py | 2 +- .../services/openai_realtime_beta/openai.py | 8 ++-- src/pipecat/services/openpipe.py | 9 ++-- src/pipecat/services/simli.py | 14 +++--- src/pipecat/services/tavus.py | 16 +++---- .../to_be_updated/cloudflare_ai_service.py | 3 +- .../to_be_updated/google_ai_service.py | 5 +- .../services/to_be_updated/mock_ai_service.py | 3 +- src/pipecat/services/whisper.py | 4 +- src/pipecat/transports/base_output.py | 2 +- src/pipecat/transports/base_transport.py | 7 +-- src/pipecat/transports/local/audio.py | 5 +- src/pipecat/transports/local/tk.py | 6 +-- .../transports/network/fastapi_websocket.py | 5 +- .../transports/network/websocket_server.py | 5 +- src/pipecat/transports/services/livekit.py | 3 +- src/pipecat/utils/test_frame_processor.py | 1 + tests/integration/integration_azure_llm.py | 12 ++--- tests/integration/integration_ollama_llm.py | 10 ++-- tests/integration/integration_openai_llm.py | 9 ++-- tests/test_aggregators.py | 13 ++---- tests/test_ai_services.py | 3 +- tests/test_langchain.py | 6 +-- tests/test_pipeline.py | 7 ++- 133 files changed, 540 insertions(+), 706 deletions(-) diff --git a/examples/chatbot-audio-recording/bot.py b/examples/chatbot-audio-recording/bot.py index f020a9626..ee679ffcf 100644 --- a/examples/chatbot-audio-recording/bot.py +++ b/examples/chatbot-audio-recording/bot.py @@ -4,15 +4,15 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiofiles import asyncio +import datetime import io import os import sys +import wave +import aiofiles import aiohttp -import datetime -import wave from dotenv import load_dotenv from loguru import logger from runner import configure diff --git a/examples/deployment/flyio-example/bot.py b/examples/deployment/flyio-example/bot.py index 7c69f62bd..05e55016f 100644 --- a/examples/deployment/flyio-example/bot.py +++ b/examples/deployment/flyio-example/bot.py @@ -1,22 +1,21 @@ +import argparse import asyncio import os import sys -import argparse + +from dotenv import load_dotenv +from loguru import logger from pipecat.audio.vad.silero import SileroVADAnalyzer +from pipecat.frames.frames import EndFrame, LLMMessagesFrame from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.task import PipelineParams, PipelineTask -from pipecat.frames.frames import LLMMessagesFrame, EndFrame from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext -from pipecat.services.openai import OpenAILLMService from pipecat.services.elevenlabs import ElevenLabsTTSService +from pipecat.services.openai import OpenAILLMService from pipecat.transports.services.daily import DailyParams, DailyTransport -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/deployment/flyio-example/bot_runner.py b/examples/deployment/flyio-example/bot_runner.py index 3795847e4..fcdfa65ab 100644 --- a/examples/deployment/flyio-example/bot_runner.py +++ b/examples/deployment/flyio-example/bot_runner.py @@ -4,26 +4,24 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiohttp import argparse -import subprocess import os - +import subprocess from contextlib import asynccontextmanager -from fastapi import FastAPI, Request, HTTPException +import aiohttp +from dotenv import load_dotenv +from fastapi import FastAPI, HTTPException, Request from fastapi.middleware.cors import CORSMiddleware from fastapi.responses import JSONResponse from pipecat.transports.services.helpers.daily_rest import ( DailyRESTHelper, DailyRoomObject, - DailyRoomProperties, DailyRoomParams, + DailyRoomProperties, ) -from dotenv import load_dotenv - load_dotenv(override=True) diff --git a/examples/deployment/modal-example/app.py b/examples/deployment/modal-example/app.py index 97a9f32ab..21d85f79f 100644 --- a/examples/deployment/modal-example/app.py +++ b/examples/deployment/modal-example/app.py @@ -2,12 +2,11 @@ import aiohttp import modal +from bot import _voice_bot_process from fastapi import HTTPException from fastapi.responses import JSONResponse from loguru import logger -from bot import _voice_bot_process - MAX_SESSION_TIME = 15 * 60 # 15 minutes app = modal.App("pipecat-modal") diff --git a/examples/dialin-chatbot/bot_daily.py b/examples/dialin-chatbot/bot_daily.py index 79e8665b3..d277011ab 100644 --- a/examples/dialin-chatbot/bot_daily.py +++ b/examples/dialin-chatbot/bot_daily.py @@ -1,21 +1,20 @@ +import argparse import asyncio import os import sys -import argparse + +from dotenv import load_dotenv +from loguru import logger from pipecat.audio.vad.silero import SileroVADAnalyzer +from pipecat.frames.frames import EndFrame, LLMMessagesFrame from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.task import PipelineParams, PipelineTask -from pipecat.frames.frames import LLMMessagesFrame, EndFrame from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext from pipecat.services.elevenlabs import ElevenLabsTTSService from pipecat.services.openai import OpenAILLMService -from pipecat.transports.services.daily import DailyParams, DailyTransport, DailyDialinSettings - -from loguru import logger - -from dotenv import load_dotenv +from pipecat.transports.services.daily import DailyDialinSettings, DailyParams, DailyTransport load_dotenv(override=True) diff --git a/examples/dialin-chatbot/bot_runner.py b/examples/dialin-chatbot/bot_runner.py index ac2ce79bf..050ad62b9 100644 --- a/examples/dialin-chatbot/bot_runner.py +++ b/examples/dialin-chatbot/bot_runner.py @@ -7,14 +7,14 @@ Refer to README for more information. """ -import aiohttp -import os import argparse +import os import subprocess - from contextlib import asynccontextmanager -from fastapi import FastAPI, Request, HTTPException +import aiohttp +from dotenv import load_dotenv +from fastapi import FastAPI, HTTPException, Request from fastapi.middleware.cors import CORSMiddleware from fastapi.responses import JSONResponse, PlainTextResponse from twilio.twiml.voice_response import VoiceResponse @@ -22,13 +22,11 @@ from pipecat.transports.services.helpers.daily_rest import ( DailyRESTHelper, DailyRoomObject, + DailyRoomParams, DailyRoomProperties, DailyRoomSipParams, - DailyRoomParams, ) -from dotenv import load_dotenv - load_dotenv(override=True) diff --git a/examples/dialin-chatbot/bot_twilio.py b/examples/dialin-chatbot/bot_twilio.py index 135fcf4ea..86b37381a 100644 --- a/examples/dialin-chatbot/bot_twilio.py +++ b/examples/dialin-chatbot/bot_twilio.py @@ -1,24 +1,22 @@ +import argparse import asyncio import os import sys -import argparse + +from dotenv import load_dotenv +from loguru import logger +from twilio.rest import Client from pipecat.audio.vad.silero import SileroVADAnalyzer +from pipecat.frames.frames import EndFrame, LLMMessagesFrame from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.task import PipelineParams, PipelineTask -from pipecat.frames.frames import LLMMessagesFrame, EndFrame from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext from pipecat.services.elevenlabs import ElevenLabsTTSService from pipecat.services.openai import OpenAILLMService from pipecat.transports.services.daily import DailyParams, DailyTransport -from twilio.rest import Client - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/01-say-one-thing.py b/examples/foundational/01-say-one-thing.py index f0fec28d8..290a0b80c 100644 --- a/examples/foundational/01-say-one-thing.py +++ b/examples/foundational/01-say-one-thing.py @@ -5,23 +5,21 @@ # import asyncio -import aiohttp import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.frames.frames import EndFrame, TTSSpeakFrame from pipecat.pipeline.pipeline import Pipeline -from pipecat.pipeline.task import PipelineTask from pipecat.pipeline.runner import PipelineRunner +from pipecat.pipeline.task import PipelineTask from pipecat.services.cartesia import CartesiaTTSService from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/01a-local-audio.py b/examples/foundational/01a-local-audio.py index e62ab1020..ca7802b1a 100644 --- a/examples/foundational/01a-local-audio.py +++ b/examples/foundational/01a-local-audio.py @@ -5,10 +5,13 @@ # import asyncio -import aiohttp import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger + from pipecat.frames.frames import EndFrame, TTSSpeakFrame from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner @@ -17,10 +20,6 @@ from pipecat.transports.base_transport import TransportParams from pipecat.transports.local.audio import LocalAudioTransport -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/01b-livekit-audio.py b/examples/foundational/01b-livekit-audio.py index 9b3efc603..ed610e027 100644 --- a/examples/foundational/01b-livekit-audio.py +++ b/examples/foundational/01b-livekit-audio.py @@ -4,6 +4,9 @@ import sys import aiohttp +from dotenv import load_dotenv +from livekit import api +from loguru import logger from pipecat.frames.frames import TextFrame from pipecat.pipeline.pipeline import Pipeline @@ -12,12 +15,6 @@ from pipecat.services.cartesia import CartesiaTTSService from pipecat.transports.services.livekit import LiveKitParams, LiveKitTransport -from livekit import api - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/01c-fastpitch.py b/examples/foundational/01c-fastpitch.py index b041e6c7b..01a68abd9 100644 --- a/examples/foundational/01c-fastpitch.py +++ b/examples/foundational/01c-fastpitch.py @@ -5,23 +5,21 @@ # import asyncio -import aiohttp import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.frames.frames import EndFrame, TTSSpeakFrame from pipecat.pipeline.pipeline import Pipeline -from pipecat.pipeline.task import PipelineTask from pipecat.pipeline.runner import PipelineRunner +from pipecat.pipeline.task import PipelineTask from pipecat.services.riva import FastPitchTTSService from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/02-llm-say-one-thing.py b/examples/foundational/02-llm-say-one-thing.py index ba2be607c..1e1ad2827 100644 --- a/examples/foundational/02-llm-say-one-thing.py +++ b/examples/foundational/02-llm-say-one-thing.py @@ -5,10 +5,14 @@ # import asyncio -import aiohttp import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.frames.frames import EndFrame, LLMMessagesFrame from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner @@ -17,12 +21,6 @@ from pipecat.services.openai import OpenAILLMService from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/03-still-frame.py b/examples/foundational/03-still-frame.py index 688146cb1..e532a4b37 100644 --- a/examples/foundational/03-still-frame.py +++ b/examples/foundational/03-still-frame.py @@ -5,10 +5,14 @@ # import asyncio -import aiohttp import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.frames.frames import EndFrame, TextFrame from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner @@ -16,12 +20,6 @@ from pipecat.services.fal import FalImageGenService from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/03a-local-still-frame.py b/examples/foundational/03a-local-still-frame.py index c06834d90..821c9979c 100644 --- a/examples/foundational/03a-local-still-frame.py +++ b/examples/foundational/03a-local-still-frame.py @@ -5,12 +5,14 @@ # import asyncio -import aiohttp import os import sys - import tkinter as tk +import aiohttp +from dotenv import load_dotenv +from loguru import logger + from pipecat.frames.frames import TextFrame from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner @@ -19,10 +21,6 @@ from pipecat.transports.base_transport import TransportParams from pipecat.transports.local.tk import TkLocalTransport -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/04-utterance-and-speech.py b/examples/foundational/04-utterance-and-speech.py index 7f63757d6..02f035485 100644 --- a/examples/foundational/04-utterance-and-speech.py +++ b/examples/foundational/04-utterance-and-speech.py @@ -8,27 +8,24 @@ # This example broken on latest pipecat and needs updating. # -import aiohttp import asyncio import os import sys -from pipecat.pipeline.merge_pipeline import SequentialMergePipeline -from pipecat.pipeline.pipeline import Pipeline +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure from pipecat.frames.frames import EndPipeFrame, LLMMessagesFrame, TextFrame +from pipecat.pipeline.merge_pipeline import SequentialMergePipeline +from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.task import PipelineTask from pipecat.services.azure import AzureLLMService, AzureTTSService from pipecat.services.elevenlabs import ElevenLabsTTSService from pipecat.services.transport_services import TransportServiceOutput from pipecat.services.transports.daily_transport import DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/05-sync-speech-and-image.py b/examples/foundational/05-sync-speech-and-image.py index 64f85930b..1648b11a7 100644 --- a/examples/foundational/05-sync-speech-and-image.py +++ b/examples/foundational/05-sync-speech-and-image.py @@ -5,12 +5,15 @@ # import asyncio -import aiohttp import os import sys - from dataclasses import dataclass +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.frames.frames import ( DataFrame, Frame, @@ -22,19 +25,13 @@ from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.sync_parallel_pipeline import SyncParallelPipeline from pipecat.pipeline.task import PipelineTask -from pipecat.processors.frame_processor import FrameDirection, FrameProcessor from pipecat.processors.aggregators.sentence import SentenceAggregator +from pipecat.processors.frame_processor import FrameDirection, FrameProcessor from pipecat.services.cartesia import CartesiaHttpTTSService -from pipecat.services.openai import OpenAILLMService from pipecat.services.fal import FalImageGenService +from pipecat.services.openai import OpenAILLMService from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/05a-local-sync-speech-and-image.py b/examples/foundational/05a-local-sync-speech-and-image.py index 4a561c073..d62d853cf 100644 --- a/examples/foundational/05a-local-sync-speech-and-image.py +++ b/examples/foundational/05a-local-sync-speech-and-image.py @@ -4,20 +4,22 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiohttp import asyncio import os import sys - import tkinter as tk +import aiohttp +from dotenv import load_dotenv +from loguru import logger + from pipecat.frames.frames import ( Frame, + LLMMessagesFrame, OutputAudioRawFrame, + TextFrame, TTSAudioRawFrame, URLImageRawFrame, - LLMMessagesFrame, - TextFrame, ) from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner @@ -26,15 +28,11 @@ from pipecat.processors.aggregators.sentence import SentenceAggregator from pipecat.processors.frame_processor import FrameDirection, FrameProcessor from pipecat.services.cartesia import CartesiaHttpTTSService -from pipecat.services.openai import OpenAILLMService from pipecat.services.fal import FalImageGenService +from pipecat.services.openai import OpenAILLMService from pipecat.transports.base_transport import TransportParams from pipecat.transports.local.tk import TkLocalTransport, TkOutputTransport -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/06a-image-sync.py b/examples/foundational/06a-image-sync.py index eda3c61df..1406e93a2 100644 --- a/examples/foundational/06a-image-sync.py +++ b/examples/foundational/06a-image-sync.py @@ -5,11 +5,14 @@ # import asyncio -import aiohttp import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger from PIL import Image +from runner import configure from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import Frame, OutputImageRawFrame, SystemFrame, TextFrame @@ -20,14 +23,7 @@ from pipecat.processors.frame_processor import FrameDirection, FrameProcessor from pipecat.services.cartesia import CartesiaHttpTTSService from pipecat.services.openai import OpenAILLMService -from pipecat.transports.services.daily import DailyTransport - -from pipecat.transports.services.daily import DailyParams -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv +from pipecat.transports.services.daily import DailyParams, DailyTransport load_dotenv(override=True) diff --git a/examples/foundational/07-interruptible-vad.py b/examples/foundational/07-interruptible-vad.py index 59013bd3a..53adf84f5 100644 --- a/examples/foundational/07-interruptible-vad.py +++ b/examples/foundational/07-interruptible-vad.py @@ -5,26 +5,24 @@ # import asyncio -import aiohttp import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.frames.frames import LLMMessagesFrame from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.task import PipelineParams, PipelineTask -from pipecat.processors.audio.vad.silero import SileroVAD from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext +from pipecat.processors.audio.vad.silero import SileroVAD from pipecat.services.cartesia import CartesiaTTSService from pipecat.services.openai import OpenAILLMService from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/07-interruptible.py b/examples/foundational/07-interruptible.py index 3148986a8..c68d4aa40 100644 --- a/examples/foundational/07-interruptible.py +++ b/examples/foundational/07-interruptible.py @@ -5,10 +5,14 @@ # import asyncio -import aiohttp import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import LLMMessagesFrame from pipecat.pipeline.pipeline import Pipeline @@ -19,12 +23,6 @@ from pipecat.services.openai import OpenAILLMService from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/07b-interruptible-langchain.py b/examples/foundational/07b-interruptible-langchain.py index e86c4a8e9..8bf4ceea2 100644 --- a/examples/foundational/07b-interruptible-langchain.py +++ b/examples/foundational/07b-interruptible-langchain.py @@ -9,6 +9,14 @@ import sys import aiohttp +from dotenv import load_dotenv +from langchain.prompts import ChatPromptTemplate, MessagesPlaceholder +from langchain_community.chat_message_histories import ChatMessageHistory +from langchain_core.chat_history import BaseChatMessageHistory +from langchain_core.runnables.history import RunnableWithMessageHistory +from langchain_openai import ChatOpenAI +from loguru import logger +from runner import configure from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import LLMMessagesFrame @@ -23,18 +31,6 @@ from pipecat.services.cartesia import CartesiaTTSService from pipecat.transports.services.daily import DailyParams, DailyTransport -from langchain.prompts import ChatPromptTemplate, MessagesPlaceholder -from langchain_community.chat_message_histories import ChatMessageHistory -from langchain_core.chat_history import BaseChatMessageHistory -from langchain_core.runnables.history import RunnableWithMessageHistory -from langchain_openai import ChatOpenAI - -from loguru import logger - -from runner import configure - -from dotenv import load_dotenv - load_dotenv(override=True) diff --git a/examples/foundational/07d-interruptible-elevenlabs.py b/examples/foundational/07d-interruptible-elevenlabs.py index 24ccf6a24..8f3895d00 100644 --- a/examples/foundational/07d-interruptible-elevenlabs.py +++ b/examples/foundational/07d-interruptible-elevenlabs.py @@ -11,7 +11,6 @@ import aiohttp from dotenv import load_dotenv from loguru import logger -from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext from runner import configure from pipecat.audio.vad.silero import SileroVADAnalyzer @@ -19,6 +18,7 @@ from pipecat.pipeline.pipeline import Pipeline 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.elevenlabs import ElevenLabsTTSService from pipecat.services.openai import OpenAILLMService from pipecat.transports.services.daily import DailyParams, DailyTransport diff --git a/examples/foundational/07f-interruptible-azure.py b/examples/foundational/07f-interruptible-azure.py index fb3e8ea0c..b08deb1b3 100644 --- a/examples/foundational/07f-interruptible-azure.py +++ b/examples/foundational/07f-interruptible-azure.py @@ -4,11 +4,15 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiohttp import asyncio import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import LLMMessagesFrame from pipecat.pipeline.pipeline import Pipeline @@ -18,13 +22,6 @@ from pipecat.services.azure import AzureLLMService, AzureSTTService, AzureTTSService from pipecat.transports.services.daily import DailyParams, DailyTransport - -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/07g-interruptible-openai-tts.py b/examples/foundational/07g-interruptible-openai-tts.py index af414e3e3..17dbb2b30 100644 --- a/examples/foundational/07g-interruptible-openai-tts.py +++ b/examples/foundational/07g-interruptible-openai-tts.py @@ -11,7 +11,6 @@ import aiohttp from dotenv import load_dotenv from loguru import logger -from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext from runner import configure from pipecat.audio.vad.silero import SileroVADAnalyzer @@ -19,6 +18,7 @@ from pipecat.pipeline.pipeline import Pipeline 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.openai import OpenAILLMService, OpenAITTSService from pipecat.transports.services.daily import DailyParams, DailyTransport diff --git a/examples/foundational/07h-interruptible-openpipe.py b/examples/foundational/07h-interruptible-openpipe.py index f01d535df..aa4373d4b 100644 --- a/examples/foundational/07h-interruptible-openpipe.py +++ b/examples/foundational/07h-interruptible-openpipe.py @@ -5,9 +5,14 @@ # import asyncio -import aiohttp import os import sys +import time + +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import LLMMessagesFrame @@ -19,13 +24,6 @@ from pipecat.services.openpipe import OpenPipeLLMService from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger -import time - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/07i-interruptible-xtts.py b/examples/foundational/07i-interruptible-xtts.py index 5bfe13b5c..ea20b0238 100644 --- a/examples/foundational/07i-interruptible-xtts.py +++ b/examples/foundational/07i-interruptible-xtts.py @@ -5,10 +5,14 @@ # import asyncio -import aiohttp import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import LLMMessagesFrame from pipecat.pipeline.pipeline import Pipeline @@ -19,12 +23,6 @@ from pipecat.services.xtts import XTTSService from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/07k-interruptible-lmnt.py b/examples/foundational/07k-interruptible-lmnt.py index 49179e747..31b65d6a5 100644 --- a/examples/foundational/07k-interruptible-lmnt.py +++ b/examples/foundational/07k-interruptible-lmnt.py @@ -4,11 +4,15 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiohttp import asyncio import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import LLMMessagesFrame from pipecat.pipeline.pipeline import Pipeline @@ -19,12 +23,6 @@ from pipecat.services.openai import OpenAILLMService from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/07p-interruptible-krisp.py b/examples/foundational/07p-interruptible-krisp.py index 834e59037..27070df0b 100644 --- a/examples/foundational/07p-interruptible-krisp.py +++ b/examples/foundational/07p-interruptible-krisp.py @@ -13,6 +13,7 @@ from loguru import logger from runner import configure +from pipecat.audio.filters.krisp_filter import KrispFilter from pipecat.frames.frames import LLMMessagesFrame from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner @@ -25,7 +26,6 @@ from pipecat.services.openai import OpenAILLMService from pipecat.transports.services.daily import DailyParams, DailyTransport from pipecat.vad.silero import SileroVADAnalyzer -from pipecat.audio.filters.krisp_filter import KrispFilter load_dotenv(override=True) diff --git a/examples/foundational/07s-interruptible-google-audio-in.py b/examples/foundational/07s-interruptible-google-audio-in.py index 1778e0c62..854cf1954 100644 --- a/examples/foundational/07s-interruptible-google-audio-in.py +++ b/examples/foundational/07s-interruptible-google-audio-in.py @@ -4,38 +4,37 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiohttp import asyncio import os import sys +from dataclasses import dataclass +import aiohttp import google.ai.generativelanguage as glm - -from dataclasses import dataclass from dotenv import load_dotenv from loguru import logger from runner import configure from pipecat.audio.vad.silero import SileroVADAnalyzer -from pipecat.pipeline.pipeline import Pipeline -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.cartesia import CartesiaTTSService -from pipecat.services.google import GoogleLLMService -from pipecat.processors.frame_processor import FrameProcessor -from pipecat.transports.services.daily import DailyParams, DailyTransport from pipecat.frames.frames import ( - LLMFullResponseStartFrame, - LLMFullResponseEndFrame, - InputAudioRawFrame, Frame, + InputAudioRawFrame, + LLMFullResponseEndFrame, + LLMFullResponseStartFrame, StartInterruptionFrame, TextFrame, TranscriptionFrame, UserStartedSpeakingFrame, UserStoppedSpeakingFrame, ) +from pipecat.pipeline.pipeline import Pipeline +from pipecat.pipeline.runner import PipelineRunner +from pipecat.pipeline.task import PipelineParams, PipelineTask +from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext +from pipecat.processors.frame_processor import FrameProcessor +from pipecat.services.cartesia import CartesiaTTSService +from pipecat.services.google import GoogleLLMService +from pipecat.transports.services.daily import DailyParams, DailyTransport load_dotenv(override=True) diff --git a/examples/foundational/08-bots-arguing.py b/examples/foundational/08-bots-arguing.py index 150fbfc0a..e455b321b 100644 --- a/examples/foundational/08-bots-arguing.py +++ b/examples/foundational/08-bots-arguing.py @@ -1,20 +1,19 @@ -from typing import Tuple -import aiohttp import asyncio import logging import os -from pipecat.processors.aggregators import SentenceAggregator -from pipecat.pipeline.pipeline import Pipeline +from typing import Tuple -from pipecat.transports.services.daily import DailyTransport +import aiohttp +from dotenv import load_dotenv +from runner import configure + +from pipecat.frames.frames import AudioFrame, EndFrame, ImageFrame, LLMMessagesFrame, TextFrame +from pipecat.pipeline.pipeline import Pipeline +from pipecat.processors.aggregators import SentenceAggregator from pipecat.services.azure import AzureLLMService, AzureTTSService from pipecat.services.elevenlabs import ElevenLabsTTSService from pipecat.services.fal import FalImageGenService -from pipecat.frames.frames import AudioFrame, EndFrame, ImageFrame, LLMMessagesFrame, TextFrame - -from runner import configure - -from dotenv import load_dotenv +from pipecat.transports.services.daily import DailyTransport load_dotenv(override=True) diff --git a/examples/foundational/09-mirror.py b/examples/foundational/09-mirror.py index a719d54f6..676935da6 100644 --- a/examples/foundational/09-mirror.py +++ b/examples/foundational/09-mirror.py @@ -4,10 +4,14 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiohttp import asyncio import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.frames.frames import ( Frame, InputAudioRawFrame, @@ -19,13 +23,7 @@ from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.task import PipelineTask from pipecat.processors.frame_processor import FrameDirection, FrameProcessor -from pipecat.transports.services.daily import DailyTransport, DailyParams - -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv +from pipecat.transports.services.daily import DailyParams, DailyTransport load_dotenv(override=True) diff --git a/examples/foundational/09a-local-mirror.py b/examples/foundational/09a-local-mirror.py index 539cca600..50b729883 100644 --- a/examples/foundational/09a-local-mirror.py +++ b/examples/foundational/09a-local-mirror.py @@ -4,12 +4,15 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiohttp import asyncio import sys - import tkinter as tk +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.frames.frames import ( Frame, InputAudioRawFrame, @@ -25,12 +28,6 @@ from pipecat.transports.local.tk import TkLocalTransport from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/10-wake-phrase.py b/examples/foundational/10-wake-phrase.py index 982303aee..b69ef683b 100644 --- a/examples/foundational/10-wake-phrase.py +++ b/examples/foundational/10-wake-phrase.py @@ -5,10 +5,14 @@ # import asyncio -import aiohttp import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner @@ -19,12 +23,6 @@ from pipecat.services.openai import OpenAILLMService from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/11-sound-effects.py b/examples/foundational/11-sound-effects.py index d8692a7f1..a52b214e7 100644 --- a/examples/foundational/11-sound-effects.py +++ b/examples/foundational/11-sound-effects.py @@ -4,12 +4,16 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiohttp import asyncio import os import sys import wave +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import ( Frame, @@ -29,12 +33,6 @@ from pipecat.services.openai import OpenAILLMService from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/12-describe-video.py b/examples/foundational/12-describe-video.py index b5bb577aa..9003ca6f0 100644 --- a/examples/foundational/12-describe-video.py +++ b/examples/foundational/12-describe-video.py @@ -5,10 +5,14 @@ # import asyncio -import aiohttp import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import Frame, TextFrame, UserImageRequestFrame from pipecat.pipeline.pipeline import Pipeline @@ -21,12 +25,6 @@ from pipecat.services.moondream import MoondreamService from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/12a-describe-video-gemini-flash.py b/examples/foundational/12a-describe-video-gemini-flash.py index bc76afc73..df37c24a9 100644 --- a/examples/foundational/12a-describe-video-gemini-flash.py +++ b/examples/foundational/12a-describe-video-gemini-flash.py @@ -5,10 +5,14 @@ # import asyncio -import aiohttp import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import Frame, TextFrame, UserImageRequestFrame from pipecat.pipeline.pipeline import Pipeline @@ -21,12 +25,6 @@ from pipecat.services.google import GoogleLLMService from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/12b-describe-video-gpt-4o.py b/examples/foundational/12b-describe-video-gpt-4o.py index d8474b568..4e96f7264 100644 --- a/examples/foundational/12b-describe-video-gpt-4o.py +++ b/examples/foundational/12b-describe-video-gpt-4o.py @@ -5,10 +5,14 @@ # import asyncio -import aiohttp import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import Frame, TextFrame, UserImageRequestFrame from pipecat.pipeline.pipeline import Pipeline @@ -21,12 +25,6 @@ from pipecat.services.openai import OpenAILLMService from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/12c-describe-video-anthropic.py b/examples/foundational/12c-describe-video-anthropic.py index bc6f5a4ea..1c88b5dd4 100644 --- a/examples/foundational/12c-describe-video-anthropic.py +++ b/examples/foundational/12c-describe-video-anthropic.py @@ -5,10 +5,14 @@ # import asyncio -import aiohttp import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import Frame, TextFrame, UserImageRequestFrame from pipecat.pipeline.pipeline import Pipeline @@ -17,16 +21,10 @@ from pipecat.processors.aggregators.user_response import UserResponseAggregator from pipecat.processors.aggregators.vision_image_frame import VisionImageFrameAggregator from pipecat.processors.frame_processor import FrameDirection, FrameProcessor -from pipecat.services.cartesia import CartesiaTTSService from pipecat.services.anthropic import AnthropicLLMService +from pipecat.services.cartesia import CartesiaTTSService from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/13-whisper-transcription.py b/examples/foundational/13-whisper-transcription.py index c895cb944..72fee4bb0 100644 --- a/examples/foundational/13-whisper-transcription.py +++ b/examples/foundational/13-whisper-transcription.py @@ -4,10 +4,14 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiohttp import asyncio import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.frames.frames import Frame, TranscriptionFrame from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner @@ -16,12 +20,6 @@ from pipecat.services.whisper import WhisperSTTService from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/13a-whisper-local.py b/examples/foundational/13a-whisper-local.py index c1ba37ca9..dcb5fd51a 100644 --- a/examples/foundational/13a-whisper-local.py +++ b/examples/foundational/13a-whisper-local.py @@ -7,6 +7,9 @@ import asyncio import sys +from dotenv import load_dotenv +from loguru import logger + from pipecat.frames.frames import Frame, TranscriptionFrame from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner @@ -16,10 +19,6 @@ from pipecat.transports.base_transport import TransportParams from pipecat.transports.local.audio import LocalAudioTransport -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/13b-deepgram-transcription.py b/examples/foundational/13b-deepgram-transcription.py index 7b3a25316..ad464e87a 100644 --- a/examples/foundational/13b-deepgram-transcription.py +++ b/examples/foundational/13b-deepgram-transcription.py @@ -4,25 +4,23 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiohttp import asyncio import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.frames.frames import Frame, TranscriptionFrame from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.task import PipelineTask from pipecat.processors.frame_processor import FrameDirection, FrameProcessor -from pipecat.services.deepgram import DeepgramSTTService, LiveOptions, Language +from pipecat.services.deepgram import DeepgramSTTService, Language, LiveOptions from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/14-function-calling.py b/examples/foundational/14-function-calling.py index 2479e3f3e..0aebc915a 100644 --- a/examples/foundational/14-function-calling.py +++ b/examples/foundational/14-function-calling.py @@ -5,10 +5,15 @@ # import asyncio -import aiohttp import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from openai.types.chat import ChatCompletionToolParam +from runner import configure + from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner @@ -17,14 +22,6 @@ from pipecat.services.openai import OpenAILLMContext, OpenAILLMService from pipecat.transports.services.daily import DailyParams, DailyTransport -from openai.types.chat import ChatCompletionToolParam - -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/14a-function-calling-anthropic.py b/examples/foundational/14a-function-calling-anthropic.py index 9d3335809..24587c935 100644 --- a/examples/foundational/14a-function-calling-anthropic.py +++ b/examples/foundational/14a-function-calling-anthropic.py @@ -5,25 +5,23 @@ # import asyncio -import aiohttp import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.pipeline.pipeline import Pipeline 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.cartesia import CartesiaTTSService from pipecat.services.anthropic import AnthropicLLMService +from pipecat.services.cartesia import CartesiaTTSService from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/14b-function-calling-anthropic-video.py b/examples/foundational/14b-function-calling-anthropic-video.py index cdc69556d..7473af10d 100644 --- a/examples/foundational/14b-function-calling-anthropic-video.py +++ b/examples/foundational/14b-function-calling-anthropic-video.py @@ -5,25 +5,23 @@ # import asyncio -import aiohttp import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.pipeline.pipeline import Pipeline 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.cartesia import CartesiaTTSService from pipecat.services.anthropic import AnthropicLLMService +from pipecat.services.cartesia import CartesiaTTSService from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/14d-function-calling-video.py b/examples/foundational/14d-function-calling-video.py index e238d91eb..93a87f420 100644 --- a/examples/foundational/14d-function-calling-video.py +++ b/examples/foundational/14d-function-calling-video.py @@ -5,10 +5,15 @@ # import asyncio -import aiohttp import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from openai.types.chat import ChatCompletionToolParam +from runner import configure + from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner @@ -17,14 +22,6 @@ from pipecat.services.openai import OpenAILLMContext, OpenAILLMService from pipecat.transports.services.daily import DailyParams, DailyTransport -from openai.types.chat import ChatCompletionToolParam - -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/14e-function-calling-gemini.py b/examples/foundational/14e-function-calling-gemini.py index ede7222bb..35b3fa264 100644 --- a/examples/foundational/14e-function-calling-gemini.py +++ b/examples/foundational/14e-function-calling-gemini.py @@ -5,10 +5,14 @@ # import asyncio -import aiohttp import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner @@ -18,12 +22,6 @@ from pipecat.services.openai import OpenAILLMContext from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/15-switch-voices.py b/examples/foundational/15-switch-voices.py index 5c61dd25f..aa516fdb2 100644 --- a/examples/foundational/15-switch-voices.py +++ b/examples/foundational/15-switch-voices.py @@ -4,15 +4,20 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiohttp import asyncio import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from openai.types.chat import ChatCompletionToolParam +from runner import configure + from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import LLMMessagesFrame -from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.parallel_pipeline import ParallelPipeline +from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.task import PipelineParams, PipelineTask from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext @@ -21,14 +26,6 @@ from pipecat.services.openai import OpenAILLMService from pipecat.transports.services.daily import DailyParams, DailyTransport -from openai.types.chat import ChatCompletionToolParam - -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/15a-switch-languages.py b/examples/foundational/15a-switch-languages.py index 4b8794ab8..86798ba50 100644 --- a/examples/foundational/15a-switch-languages.py +++ b/examples/foundational/15a-switch-languages.py @@ -5,16 +5,20 @@ # import asyncio -import aiohttp import os import sys +import aiohttp from deepgram import LiveOptions +from dotenv import load_dotenv +from loguru import logger +from openai.types.chat import ChatCompletionToolParam +from runner import configure from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import LLMMessagesFrame -from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.parallel_pipeline import ParallelPipeline +from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.task import PipelineParams, PipelineTask from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext @@ -24,14 +28,6 @@ from pipecat.services.openai import OpenAILLMService from pipecat.transports.services.daily import DailyParams, DailyTransport -from openai.types.chat import ChatCompletionToolParam - -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/17-detect-user-idle.py b/examples/foundational/17-detect-user-idle.py index 7268e2305..a3e11fb0f 100644 --- a/examples/foundational/17-detect-user-idle.py +++ b/examples/foundational/17-detect-user-idle.py @@ -5,10 +5,14 @@ # import asyncio -import aiohttp import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import LLMMessagesFrame from pipecat.pipeline.pipeline import Pipeline @@ -20,12 +24,6 @@ from pipecat.services.openai import OpenAILLMService from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/18-gstreamer-filesrc.py b/examples/foundational/18-gstreamer-filesrc.py index 8ebcaa1b9..169e46bc4 100644 --- a/examples/foundational/18-gstreamer-filesrc.py +++ b/examples/foundational/18-gstreamer-filesrc.py @@ -4,23 +4,21 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import asyncio -import aiohttp import argparse +import asyncio import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure_with_args + from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.task import PipelineTask from pipecat.processors.gstreamer.pipeline_source import GStreamerPipelineSource from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure_with_args - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/18a-gstreamer-videotestsrc.py b/examples/foundational/18a-gstreamer-videotestsrc.py index 9e5977348..778fea06d 100644 --- a/examples/foundational/18a-gstreamer-videotestsrc.py +++ b/examples/foundational/18a-gstreamer-videotestsrc.py @@ -5,21 +5,19 @@ # import asyncio -import aiohttp import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.task import PipelineTask from pipecat.processors.gstreamer.pipeline_source import GStreamerPipelineSource from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/20a-persistent-context-openai.py b/examples/foundational/20a-persistent-context-openai.py index d4d418e91..bf8af53ea 100644 --- a/examples/foundational/20a-persistent-context-openai.py +++ b/examples/foundational/20a-persistent-context-openai.py @@ -24,9 +24,8 @@ from pipecat.processors.aggregators.openai_llm_context import ( OpenAILLMContext, ) -from pipecat.services.openai import OpenAILLMService from pipecat.services.cartesia import CartesiaTTSService - +from pipecat.services.openai import OpenAILLMService from pipecat.transports.services.daily import DailyParams, DailyTransport load_dotenv(override=True) diff --git a/examples/foundational/20c-persistent-context-anthropic.py b/examples/foundational/20c-persistent-context-anthropic.py index 421b00603..f8a42fda3 100644 --- a/examples/foundational/20c-persistent-context-anthropic.py +++ b/examples/foundational/20c-persistent-context-anthropic.py @@ -24,9 +24,8 @@ from pipecat.processors.aggregators.openai_llm_context import ( OpenAILLMContext, ) -from pipecat.services.cartesia import CartesiaTTSService from pipecat.services.anthropic import AnthropicLLMService - +from pipecat.services.cartesia import CartesiaTTSService from pipecat.transports.services.daily import DailyParams, DailyTransport load_dotenv(override=True) diff --git a/examples/foundational/20d-persistent-context-gemini.py b/examples/foundational/20d-persistent-context-gemini.py index 25d809021..52736606f 100644 --- a/examples/foundational/20d-persistent-context-gemini.py +++ b/examples/foundational/20d-persistent-context-gemini.py @@ -26,7 +26,6 @@ ) from pipecat.services.cartesia import CartesiaTTSService from pipecat.services.google import GoogleLLMService - from pipecat.transports.services.daily import DailyParams, DailyTransport load_dotenv(override=True) diff --git a/examples/foundational/21-tavus-layer.py b/examples/foundational/21-tavus-layer.py index 61705b28a..abb2f202d 100644 --- a/examples/foundational/21-tavus-layer.py +++ b/examples/foundational/21-tavus-layer.py @@ -5,12 +5,15 @@ # import asyncio -import aiohttp import os import sys - from typing import Any, Mapping +import aiohttp +from dotenv import load_dotenv +from loguru import logger + +from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import LLMMessagesFrame from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner @@ -20,15 +23,10 @@ LLMUserResponseAggregator, ) from pipecat.services.cartesia import CartesiaTTSService -from pipecat.services.openai import OpenAILLMService from pipecat.services.deepgram import DeepgramSTTService +from pipecat.services.openai import OpenAILLMService from pipecat.services.tavus import TavusVideoService from pipecat.transports.services.daily import DailyParams, DailyTransport -from pipecat.audio.vad.silero import SileroVADAnalyzer - -from loguru import logger - -from dotenv import load_dotenv load_dotenv(override=True) diff --git a/examples/foundational/22-natural-conversation.py b/examples/foundational/22-natural-conversation.py index 73dfb003d..6f9dbbb5b 100644 --- a/examples/foundational/22-natural-conversation.py +++ b/examples/foundational/22-natural-conversation.py @@ -5,14 +5,18 @@ # import asyncio -import aiohttp import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import LLMMessagesFrame, TextFrame -from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.parallel_pipeline import ParallelPipeline +from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.task import PipelineParams, PipelineTask from pipecat.processors.aggregators.gated_openai_llm_context import GatedOpenAILLMContextAggregator @@ -26,12 +30,6 @@ from pipecat.sync.event_notifier import EventNotifier from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/22b-natural-conversation-proposal.py b/examples/foundational/22b-natural-conversation-proposal.py index 2deeb3da4..1ed4360e3 100644 --- a/examples/foundational/22b-natural-conversation-proposal.py +++ b/examples/foundational/22b-natural-conversation-proposal.py @@ -4,50 +4,48 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiohttp import asyncio import os import sys import time +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.audio.vad.silero import SileroVADAnalyzer -from pipecat.frames.frames import LLMMessagesFrame, TextFrame -from pipecat.pipeline.pipeline import Pipeline -from pipecat.pipeline.parallel_pipeline import ParallelPipeline -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.cartesia import CartesiaTTSService -from pipecat.services.deepgram import DeepgramSTTService -from pipecat.services.openai import OpenAILLMService -from pipecat.sync.event_notifier import EventNotifier -from pipecat.transports.services.daily import DailyParams, DailyTransport -from pipecat.processors.frame_processor import FrameProcessor, FrameDirection from pipecat.frames.frames import ( CancelFrame, EndFrame, Frame, + LLMMessagesFrame, StartFrame, StartInterruptionFrame, StopInterruptionFrame, SystemFrame, + TextFrame, TranscriptionFrame, UserStartedSpeakingFrame, UserStoppedSpeakingFrame, ) -from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContextFrame -from pipecat.sync.base_notifier import BaseNotifier +from pipecat.pipeline.parallel_pipeline import ParallelPipeline +from pipecat.pipeline.pipeline import Pipeline +from pipecat.pipeline.runner import PipelineRunner +from pipecat.pipeline.task import PipelineParams, PipelineTask +from pipecat.processors.aggregators.openai_llm_context import ( + OpenAILLMContext, + OpenAILLMContextFrame, +) from pipecat.processors.filters.function_filter import FunctionFilter +from pipecat.processors.frame_processor import FrameDirection, FrameProcessor from pipecat.processors.user_idle_processor import UserIdleProcessor - - -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv +from pipecat.services.cartesia import CartesiaTTSService +from pipecat.services.deepgram import DeepgramSTTService +from pipecat.services.openai import OpenAILLMService +from pipecat.sync.base_notifier import BaseNotifier +from pipecat.sync.event_notifier import EventNotifier +from pipecat.transports.services.daily import DailyParams, DailyTransport load_dotenv(override=True) diff --git a/examples/foundational/22d-natural-conversation-gemini-audio.py b/examples/foundational/22d-natural-conversation-gemini-audio.py index 1ff8aa23e..96e9e12c5 100644 --- a/examples/foundational/22d-natural-conversation-gemini-audio.py +++ b/examples/foundational/22d-natural-conversation-gemini-audio.py @@ -4,51 +4,49 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiohttp import asyncio import os import sys import time +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.audio.vad.silero import SileroVADAnalyzer -from pipecat.frames.frames import LLMMessagesFrame, TextFrame -from pipecat.pipeline.pipeline import Pipeline -from pipecat.pipeline.parallel_pipeline import ParallelPipeline -from pipecat.pipeline.runner import PipelineRunner -from pipecat.services.deepgram import DeepgramSTTService -from pipecat.pipeline.task import PipelineParams, PipelineTask -from pipecat.processors.aggregators.openai_llm_context import ( - OpenAILLMContext, -) -from pipecat.services.cartesia import CartesiaTTSService -from pipecat.services.google import GoogleLLMService, GoogleLLMContext -from pipecat.sync.event_notifier import EventNotifier -from pipecat.transports.services.daily import DailyParams, DailyTransport -from pipecat.processors.frame_processor import FrameProcessor, FrameDirection from pipecat.frames.frames import ( CancelFrame, EndFrame, Frame, InputAudioRawFrame, + LLMMessagesFrame, StartFrame, StartInterruptionFrame, StopInterruptionFrame, SystemFrame, + TextFrame, TranscriptionFrame, UserStartedSpeakingFrame, UserStoppedSpeakingFrame, ) -from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContextFrame -from pipecat.sync.base_notifier import BaseNotifier +from pipecat.pipeline.parallel_pipeline import ParallelPipeline +from pipecat.pipeline.pipeline import Pipeline +from pipecat.pipeline.runner import PipelineRunner +from pipecat.pipeline.task import PipelineParams, PipelineTask +from pipecat.processors.aggregators.openai_llm_context import ( + OpenAILLMContext, + OpenAILLMContextFrame, +) from pipecat.processors.filters.function_filter import FunctionFilter +from pipecat.processors.frame_processor import FrameDirection, FrameProcessor from pipecat.processors.user_idle_processor import UserIdleProcessor - - -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv +from pipecat.services.cartesia import CartesiaTTSService +from pipecat.services.deepgram import DeepgramSTTService +from pipecat.services.google import GoogleLLMContext, GoogleLLMService +from pipecat.sync.base_notifier import BaseNotifier +from pipecat.sync.event_notifier import EventNotifier +from pipecat.transports.services.daily import DailyParams, DailyTransport load_dotenv(override=True) diff --git a/examples/foundational/23-bot-background-sound.py b/examples/foundational/23-bot-background-sound.py index 68dd700d5..cde90f933 100644 --- a/examples/foundational/23-bot-background-sound.py +++ b/examples/foundational/23-bot-background-sound.py @@ -6,13 +6,17 @@ import argparse import asyncio -import aiohttp import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure_with_args + from pipecat.audio.mixers.soundfile_mixer import SoundfileMixer from pipecat.audio.vad.silero import SileroVADAnalyzer -from pipecat.frames.frames import LLMMessagesFrame, MixerUpdateSettingsFrame, MixerEnableFrame +from pipecat.frames.frames import LLMMessagesFrame, MixerEnableFrame, MixerUpdateSettingsFrame from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.task import PipelineParams, PipelineTask @@ -21,12 +25,6 @@ from pipecat.services.openai import OpenAILLMService from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure_with_args - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/foundational/25-google-audio-in.py b/examples/foundational/25-google-audio-in.py index 843d24e1f..477b72ddc 100644 --- a/examples/foundational/25-google-audio-in.py +++ b/examples/foundational/25-google-audio-in.py @@ -4,31 +4,18 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiohttp import asyncio import os import sys +from dataclasses import dataclass +import aiohttp import google.ai.generativelanguage as glm - -from dataclasses import dataclass from dotenv import load_dotenv from loguru import logger from runner import configure from pipecat.audio.vad.silero import SileroVADAnalyzer -from pipecat.pipeline.pipeline import Pipeline -from pipecat.pipeline.parallel_pipeline import ParallelPipeline -from pipecat.pipeline.runner import PipelineRunner -from pipecat.pipeline.task import PipelineParams, PipelineTask -from pipecat.processors.aggregators.openai_llm_context import ( - OpenAILLMContext, - OpenAILLMContextFrame, -) -from pipecat.services.cartesia import CartesiaTTSService -from pipecat.services.google import GoogleLLMService, GoogleLLMContext -from pipecat.processors.frame_processor import FrameProcessor -from pipecat.transports.services.daily import DailyParams, DailyTransport from pipecat.frames.frames import ( Frame, InputAudioRawFrame, @@ -40,6 +27,18 @@ UserStartedSpeakingFrame, UserStoppedSpeakingFrame, ) +from pipecat.pipeline.parallel_pipeline import ParallelPipeline +from pipecat.pipeline.pipeline import Pipeline +from pipecat.pipeline.runner import PipelineRunner +from pipecat.pipeline.task import PipelineParams, PipelineTask +from pipecat.processors.aggregators.openai_llm_context import ( + OpenAILLMContext, + OpenAILLMContextFrame, +) +from pipecat.processors.frame_processor import FrameProcessor +from pipecat.services.cartesia import CartesiaTTSService +from pipecat.services.google import GoogleLLMContext, GoogleLLMService +from pipecat.transports.services.daily import DailyParams, DailyTransport load_dotenv(override=True) diff --git a/examples/foundational/26-gemini-multimodal-live.py b/examples/foundational/26-gemini-multimodal-live.py index 3a73c648a..3b528ec26 100644 --- a/examples/foundational/26-gemini-multimodal-live.py +++ b/examples/foundational/26-gemini-multimodal-live.py @@ -4,23 +4,21 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiohttp import asyncio import os import sys - +import aiohttp from dotenv import load_dotenv from loguru import logger from runner import configure -from pipecat.services.gemini_multimodal_live.gemini import GeminiMultimodalLiveLLMService - from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.audio.vad.vad_analyzer import VADParams from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.task import PipelineParams, PipelineTask +from pipecat.services.gemini_multimodal_live.gemini import GeminiMultimodalLiveLLMService from pipecat.transports.services.daily import DailyParams, DailyTransport load_dotenv(override=True) diff --git a/examples/foundational/27-simli-layer.py b/examples/foundational/27-simli-layer.py index 55e6de2b7..415384380 100644 --- a/examples/foundational/27-simli-layer.py +++ b/examples/foundational/27-simli-layer.py @@ -5,27 +5,25 @@ # import asyncio -import aiohttp import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure +from simli import SimliConfig + from pipecat.audio.vad.silero import SileroVADAnalyzer +from pipecat.frames.frames import LLMMessagesFrame from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.task import PipelineParams, PipelineTask -from pipecat.frames.frames import LLMMessagesFrame - from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext from pipecat.services.cartesia import CartesiaTTSService from pipecat.services.openai import OpenAILLMService -from pipecat.transports.services.daily import DailyParams, DailyTransport - -from runner import configure -from loguru import logger -from dotenv import load_dotenv - -from simli import SimliConfig from pipecat.services.simli import SimliVideoService +from pipecat.transports.services.daily import DailyParams, DailyTransport load_dotenv(override=True) diff --git a/examples/foundational/runner.py b/examples/foundational/runner.py index 13c4ff076..f4c774757 100644 --- a/examples/foundational/runner.py +++ b/examples/foundational/runner.py @@ -4,10 +4,11 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiohttp import argparse import os +import aiohttp + from pipecat.transports.services.helpers.daily_rest import DailyRESTHelper diff --git a/examples/moondream-chatbot/bot.py b/examples/moondream-chatbot/bot.py index 54c2013b4..a815148b1 100644 --- a/examples/moondream-chatbot/bot.py +++ b/examples/moondream-chatbot/bot.py @@ -5,21 +5,24 @@ # import asyncio -import aiohttp import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger from PIL import Image +from runner import configure from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import ( BotStartedSpeakingFrame, BotStoppedSpeakingFrame, + Frame, ImageRawFrame, + LLMMessagesFrame, OutputImageRawFrame, SpriteFrame, - Frame, - LLMMessagesFrame, TextFrame, UserImageRawFrame, UserImageRequestFrame, @@ -37,12 +40,6 @@ from pipecat.services.openai import OpenAILLMService from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/moondream-chatbot/runner.py b/examples/moondream-chatbot/runner.py index 3df3ee81f..f19fcf211 100644 --- a/examples/moondream-chatbot/runner.py +++ b/examples/moondream-chatbot/runner.py @@ -4,10 +4,11 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiohttp import argparse import os +import aiohttp + from pipecat.transports.services.helpers.daily_rest import DailyRESTHelper diff --git a/examples/moondream-chatbot/server.py b/examples/moondream-chatbot/server.py index aa4e82c90..4caa47f5b 100644 --- a/examples/moondream-chatbot/server.py +++ b/examples/moondream-chatbot/server.py @@ -4,14 +4,13 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiohttp -import os import argparse +import os import subprocess - from contextlib import asynccontextmanager -from fastapi import FastAPI, Request, HTTPException +import aiohttp +from fastapi import FastAPI, HTTPException, Request from fastapi.middleware.cors import CORSMiddleware from fastapi.responses import JSONResponse, RedirectResponse diff --git a/examples/patient-intake/bot.py b/examples/patient-intake/bot.py index c33a2495d..7c65393c7 100644 --- a/examples/patient-intake/bot.py +++ b/examples/patient-intake/bot.py @@ -5,28 +5,26 @@ # import asyncio -import aiohttp import os import sys import wave +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import OutputAudioRawFrame from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.task import PipelineParams, PipelineTask -from pipecat.processors.logger import FrameLogger from pipecat.processors.frame_processor import FrameDirection +from pipecat.processors.logger import FrameLogger from pipecat.services.cartesia import CartesiaTTSService from pipecat.services.openai import OpenAILLMContext, OpenAILLMContextFrame, OpenAILLMService from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/patient-intake/runner.py b/examples/patient-intake/runner.py index 3df3ee81f..f19fcf211 100644 --- a/examples/patient-intake/runner.py +++ b/examples/patient-intake/runner.py @@ -4,10 +4,11 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiohttp import argparse import os +import aiohttp + from pipecat.transports.services.helpers.daily_rest import DailyRESTHelper diff --git a/examples/patient-intake/server.py b/examples/patient-intake/server.py index 20894b019..2d2fee0ed 100644 --- a/examples/patient-intake/server.py +++ b/examples/patient-intake/server.py @@ -4,14 +4,13 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiohttp -import os import argparse +import os import subprocess - from contextlib import asynccontextmanager -from fastapi import FastAPI, Request, HTTPException +import aiohttp +from fastapi import FastAPI, HTTPException, Request from fastapi.middleware.cors import CORSMiddleware from fastapi.responses import JSONResponse, RedirectResponse diff --git a/examples/storytelling-chatbot/src/bot_runner.py b/examples/storytelling-chatbot/src/bot_runner.py index 25a1bca37..79de6c3e3 100644 --- a/examples/storytelling-chatbot/src/bot_runner.py +++ b/examples/storytelling-chatbot/src/bot_runner.py @@ -4,31 +4,27 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiohttp import argparse -import subprocess import os - +import subprocess +from contextlib import asynccontextmanager from pathlib import Path from typing import Optional -from contextlib import asynccontextmanager - -from fastapi import FastAPI, Request, HTTPException +import aiohttp +from dotenv import load_dotenv +from fastapi import FastAPI, HTTPException, Request from fastapi.middleware.cors import CORSMiddleware -from fastapi.staticfiles import StaticFiles from fastapi.responses import FileResponse, JSONResponse +from fastapi.staticfiles import StaticFiles from pipecat.transports.services.helpers.daily_rest import ( DailyRESTHelper, DailyRoomObject, - DailyRoomProperties, DailyRoomParams, + DailyRoomProperties, ) - -from dotenv import load_dotenv - load_dotenv(override=True) # ------------ Fast API Config ------------ # diff --git a/examples/storytelling-chatbot/src/processors.py b/examples/storytelling-chatbot/src/processors.py index 6aa9ad7ab..096efd577 100644 --- a/examples/storytelling-chatbot/src/processors.py +++ b/examples/storytelling-chatbot/src/processors.py @@ -1,6 +1,8 @@ import re from async_timeout import timeout +from prompts import CUE_ASSISTANT_TURN, CUE_USER_TURN, IMAGE_GEN_PROMPT +from utils.helpers import load_sounds from pipecat.frames.frames import ( Frame, @@ -11,9 +13,6 @@ from pipecat.processors.frame_processor import FrameDirection, FrameProcessor from pipecat.transports.services.daily import DailyTransportMessageFrame -from utils.helpers import load_sounds -from prompts import IMAGE_GEN_PROMPT, CUE_USER_TURN, CUE_ASSISTANT_TURN - sounds = load_sounds(["talking.wav", "listening.wav", "ding.wav"]) # -------------- Frame Types ------------- # diff --git a/examples/storytelling-chatbot/src/utils/helpers.py b/examples/storytelling-chatbot/src/utils/helpers.py index 36ba3e609..ac3a38ede 100644 --- a/examples/storytelling-chatbot/src/utils/helpers.py +++ b/examples/storytelling-chatbot/src/utils/helpers.py @@ -1,5 +1,6 @@ import os import wave + from PIL import Image from pipecat.frames.frames import OutputAudioRawFrame, OutputImageRawFrame diff --git a/examples/studypal/runner.py b/examples/studypal/runner.py index 13c4ff076..f4c774757 100644 --- a/examples/studypal/runner.py +++ b/examples/studypal/runner.py @@ -4,10 +4,11 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiohttp import argparse import os +import aiohttp + from pipecat.transports.services.helpers.daily_rest import DailyRESTHelper diff --git a/examples/studypal/studypal.py b/examples/studypal/studypal.py index bccd7ad27..0bed8dedb 100644 --- a/examples/studypal/studypal.py +++ b/examples/studypal/studypal.py @@ -1,12 +1,15 @@ -import aiohttp import asyncio +import io import os import sys -import io +import aiohttp +import tiktoken from bs4 import BeautifulSoup +from dotenv import load_dotenv +from loguru import logger from pypdf import PdfReader -import tiktoken +from runner import configure from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import LLMMessagesFrame @@ -18,12 +21,6 @@ from pipecat.services.openai import OpenAILLMService from pipecat.transports.services.daily import DailyParams, DailyTransport -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) # Run this script directly from your command line. diff --git a/examples/translation-chatbot/bot.py b/examples/translation-chatbot/bot.py index e654c0159..946864426 100644 --- a/examples/translation-chatbot/bot.py +++ b/examples/translation-chatbot/bot.py @@ -4,11 +4,15 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiohttp import asyncio import os import sys +import aiohttp +from dotenv import load_dotenv +from loguru import logger +from runner import configure + from pipecat.frames.frames import Frame, LLMMessagesFrame, TextFrame from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner @@ -25,12 +29,6 @@ DailyTransportMessageFrame, ) -from runner import configure - -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/examples/translation-chatbot/server.py b/examples/translation-chatbot/server.py index 9063e28b1..ffd8fc5d6 100644 --- a/examples/translation-chatbot/server.py +++ b/examples/translation-chatbot/server.py @@ -4,14 +4,13 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiohttp -import os import argparse +import os import subprocess - from contextlib import asynccontextmanager -from fastapi import FastAPI, Request, HTTPException +import aiohttp +from fastapi import FastAPI, HTTPException, Request from fastapi.middleware.cors import CORSMiddleware from fastapi.responses import JSONResponse, RedirectResponse diff --git a/examples/twilio-chatbot/bot.py b/examples/twilio-chatbot/bot.py index 5e6d91910..57d542e24 100644 --- a/examples/twilio-chatbot/bot.py +++ b/examples/twilio-chatbot/bot.py @@ -1,24 +1,23 @@ import os import sys +from dotenv import load_dotenv +from loguru import logger + from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import EndFrame, LLMMessagesFrame from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.task import PipelineParams, PipelineTask from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext +from pipecat.serializers.twilio import TwilioFrameSerializer from pipecat.services.cartesia import CartesiaTTSService -from pipecat.services.openai import OpenAILLMService from pipecat.services.deepgram import DeepgramSTTService +from pipecat.services.openai import OpenAILLMService from pipecat.transports.network.fastapi_websocket import ( - FastAPIWebsocketTransport, FastAPIWebsocketParams, + FastAPIWebsocketTransport, ) -from pipecat.serializers.twilio import TwilioFrameSerializer - -from loguru import logger - -from dotenv import load_dotenv load_dotenv(override=True) diff --git a/examples/twilio-chatbot/server.py b/examples/twilio-chatbot/server.py index 31e98e25f..c59b6e2ee 100644 --- a/examples/twilio-chatbot/server.py +++ b/examples/twilio-chatbot/server.py @@ -1,13 +1,11 @@ import json import uvicorn - +from bot import run_bot from fastapi import FastAPI, WebSocket from fastapi.middleware.cors import CORSMiddleware from starlette.responses import HTMLResponse -from bot import run_bot - app = FastAPI() app.add_middleware( diff --git a/examples/websocket-server/bot.py b/examples/websocket-server/bot.py index 3f961de8d..80633ac74 100644 --- a/examples/websocket-server/bot.py +++ b/examples/websocket-server/bot.py @@ -8,6 +8,9 @@ import os import sys +from dotenv import load_dotenv +from loguru import logger + from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import LLMMessagesFrame from pipecat.pipeline.pipeline import Pipeline @@ -22,10 +25,6 @@ WebsocketServerTransport, ) -from loguru import logger - -from dotenv import load_dotenv - load_dotenv(override=True) logger.remove(0) diff --git a/src/pipecat/audio/filters/krisp_filter.py b/src/pipecat/audio/filters/krisp_filter.py index 0055c672b..7a54c5bd5 100644 --- a/src/pipecat/audio/filters/krisp_filter.py +++ b/src/pipecat/audio/filters/krisp_filter.py @@ -4,11 +4,12 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import numpy as np import os -from pipecat.audio.filters.base_audio_filter import BaseAudioFilter +import numpy as np from loguru import logger + +from pipecat.audio.filters.base_audio_filter import BaseAudioFilter from pipecat.frames.frames import FilterControlFrame, FilterEnableFrame try: diff --git a/src/pipecat/audio/filters/noisereduce_filter.py b/src/pipecat/audio/filters/noisereduce_filter.py index 4f0449452..ed68bb27a 100644 --- a/src/pipecat/audio/filters/noisereduce_filter.py +++ b/src/pipecat/audio/filters/noisereduce_filter.py @@ -5,11 +5,9 @@ # import numpy as np - -from pipecat.audio.filters.base_audio_filter import BaseAudioFilter - from loguru import logger +from pipecat.audio.filters.base_audio_filter import BaseAudioFilter from pipecat.frames.frames import FilterControlFrame, FilterEnableFrame try: diff --git a/src/pipecat/audio/utils.py b/src/pipecat/audio/utils.py index 057942e04..5ef48dd1e 100644 --- a/src/pipecat/audio/utils.py +++ b/src/pipecat/audio/utils.py @@ -5,6 +5,7 @@ # import audioop + import numpy as np import pyloudnorm as pyln import resampy diff --git a/src/pipecat/audio/vad/silero.py b/src/pipecat/audio/vad/silero.py index 1da0fb12d..28e0de716 100644 --- a/src/pipecat/audio/vad/silero.py +++ b/src/pipecat/audio/vad/silero.py @@ -7,11 +7,10 @@ import time import numpy as np +from loguru import logger from pipecat.audio.vad.vad_analyzer import VADAnalyzer, VADParams -from loguru import logger - # How often should we reset internal model state _MODEL_RESET_STATES_TIME = 5.0 diff --git a/src/pipecat/metrics/metrics.py b/src/pipecat/metrics/metrics.py index 053708998..c40f68590 100644 --- a/src/pipecat/metrics/metrics.py +++ b/src/pipecat/metrics/metrics.py @@ -1,4 +1,5 @@ from typing import Optional + from pydantic import BaseModel diff --git a/src/pipecat/pipeline/base_pipeline.py b/src/pipecat/pipeline/base_pipeline.py index 393914684..a5ad68aa4 100644 --- a/src/pipecat/pipeline/base_pipeline.py +++ b/src/pipecat/pipeline/base_pipeline.py @@ -5,7 +5,6 @@ # from abc import abstractmethod - from typing import List from pipecat.processors.frame_processor import FrameProcessor diff --git a/src/pipecat/pipeline/parallel_pipeline.py b/src/pipecat/pipeline/parallel_pipeline.py index 40bfea90d..323f7ed24 100644 --- a/src/pipecat/pipeline/parallel_pipeline.py +++ b/src/pipecat/pipeline/parallel_pipeline.py @@ -5,16 +5,15 @@ # import asyncio - from itertools import chain from typing import Awaitable, Callable, List +from loguru import logger + +from pipecat.frames.frames import CancelFrame, EndFrame, Frame, StartFrame, SystemFrame from pipecat.pipeline.base_pipeline import BasePipeline from pipecat.pipeline.pipeline import Pipeline from pipecat.processors.frame_processor import FrameDirection, FrameProcessor -from pipecat.frames.frames import CancelFrame, EndFrame, Frame, StartFrame, SystemFrame - -from loguru import logger class Source(FrameProcessor): diff --git a/src/pipecat/pipeline/runner.py b/src/pipecat/pipeline/runner.py index 57b818487..e83eab0f7 100644 --- a/src/pipecat/pipeline/runner.py +++ b/src/pipecat/pipeline/runner.py @@ -7,11 +7,11 @@ import asyncio import signal +from loguru import logger + from pipecat.pipeline.task import PipelineTask from pipecat.utils.utils import obj_count, obj_id -from loguru import logger - class PipelineRunner: def __init__(self, *, name: str | None = None, handle_sigint: bool = True): diff --git a/src/pipecat/pipeline/sync_parallel_pipeline.py b/src/pipecat/pipeline/sync_parallel_pipeline.py index 20f4275e4..5f9ff9ce7 100644 --- a/src/pipecat/pipeline/sync_parallel_pipeline.py +++ b/src/pipecat/pipeline/sync_parallel_pipeline.py @@ -5,18 +5,17 @@ # import asyncio - from dataclasses import dataclass from itertools import chain from typing import List +from loguru import logger + from pipecat.frames.frames import ControlFrame, EndFrame, Frame, SystemFrame from pipecat.pipeline.base_pipeline import BasePipeline from pipecat.pipeline.pipeline import Pipeline from pipecat.processors.frame_processor import FrameDirection, FrameProcessor -from loguru import logger - @dataclass class SyncFrame(ControlFrame): diff --git a/src/pipecat/pipeline/task.py b/src/pipecat/pipeline/task.py index f09013a58..2ed5afcee 100644 --- a/src/pipecat/pipeline/task.py +++ b/src/pipecat/pipeline/task.py @@ -5,9 +5,9 @@ # import asyncio - from typing import AsyncIterable, Iterable +from loguru import logger from pydantic import BaseModel from pipecat.clocks.base_clock import BaseClock @@ -23,13 +23,11 @@ StartFrame, StopTaskFrame, ) -from pipecat.metrics.metrics import TTFBMetricsData, ProcessingMetricsData +from pipecat.metrics.metrics import ProcessingMetricsData, TTFBMetricsData from pipecat.pipeline.base_pipeline import BasePipeline from pipecat.processors.frame_processor import FrameDirection, FrameProcessor from pipecat.utils.utils import obj_count, obj_id -from loguru import logger - class PipelineParams(BaseModel): allow_interruptions: bool = False diff --git a/src/pipecat/pipeline/to_be_updated/merge_pipeline.py b/src/pipecat/pipeline/to_be_updated/merge_pipeline.py index 6142a55ea..27a52894b 100644 --- a/src/pipecat/pipeline/to_be_updated/merge_pipeline.py +++ b/src/pipecat/pipeline/to_be_updated/merge_pipeline.py @@ -1,4 +1,5 @@ from typing import List + from pipecat.frames.frames import EndFrame, EndPipeFrame from pipecat.pipeline.pipeline import Pipeline diff --git a/src/pipecat/processors/aggregators/gated.py b/src/pipecat/processors/aggregators/gated.py index c39a35c82..6976c9f10 100644 --- a/src/pipecat/processors/aggregators/gated.py +++ b/src/pipecat/processors/aggregators/gated.py @@ -6,11 +6,11 @@ from typing import List, Tuple +from loguru import logger + from pipecat.frames.frames import Frame, SystemFrame from pipecat.processors.frame_processor import FrameDirection, FrameProcessor -from loguru import logger - class GatedAggregator(FrameProcessor): """Accumulate frames, with custom functions to start and stop accumulation. diff --git a/src/pipecat/processors/aggregators/user_response.py b/src/pipecat/processors/aggregators/user_response.py index 903019059..fd6b607a5 100644 --- a/src/pipecat/processors/aggregators/user_response.py +++ b/src/pipecat/processors/aggregators/user_response.py @@ -4,7 +4,6 @@ # SPDX-License-Identifier: BSD 2-Clause License # -from pipecat.processors.frame_processor import FrameDirection, FrameProcessor from pipecat.frames.frames import ( Frame, InterimTranscriptionFrame, @@ -14,6 +13,7 @@ UserStartedSpeakingFrame, UserStoppedSpeakingFrame, ) +from pipecat.processors.frame_processor import FrameDirection, FrameProcessor class ResponseAggregator(FrameProcessor): diff --git a/src/pipecat/processors/async_generator.py b/src/pipecat/processors/async_generator.py index 4f9bc85d0..892f9d8b8 100644 --- a/src/pipecat/processors/async_generator.py +++ b/src/pipecat/processors/async_generator.py @@ -5,7 +5,6 @@ # import asyncio - from typing import Any, AsyncGenerator from pipecat.frames.frames import ( @@ -13,7 +12,7 @@ EndFrame, Frame, ) -from pipecat.processors.frame_processor import FrameProcessor, FrameDirection +from pipecat.processors.frame_processor import FrameDirection, FrameProcessor from pipecat.serializers.base_serializer import FrameSerializer diff --git a/src/pipecat/processors/audio/vad/silero.py b/src/pipecat/processors/audio/vad/silero.py index 4aa32a163..2b115a8bb 100644 --- a/src/pipecat/processors/audio/vad/silero.py +++ b/src/pipecat/processors/audio/vad/silero.py @@ -4,6 +4,8 @@ # SPDX-License-Identifier: BSD 2-Clause License # +from loguru import logger + from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.audio.vad.vad_analyzer import VADParams, VADState from pipecat.frames.frames import ( @@ -16,8 +18,6 @@ ) from pipecat.processors.frame_processor import FrameDirection, FrameProcessor -from loguru import logger - class SileroVAD(FrameProcessor): def __init__( diff --git a/src/pipecat/processors/filters/wake_check_filter.py b/src/pipecat/processors/filters/wake_check_filter.py index f1a7afbef..860e45fa3 100644 --- a/src/pipecat/processors/filters/wake_check_filter.py +++ b/src/pipecat/processors/filters/wake_check_filter.py @@ -6,14 +6,13 @@ import re import time - from enum import Enum +from loguru import logger + from pipecat.frames.frames import ErrorFrame, Frame, TranscriptionFrame from pipecat.processors.frame_processor import FrameDirection, FrameProcessor -from loguru import logger - class WakeCheckFilter(FrameProcessor): """ diff --git a/src/pipecat/processors/frameworks/langchain.py b/src/pipecat/processors/frameworks/langchain.py index c0b657244..47789cec9 100644 --- a/src/pipecat/processors/frameworks/langchain.py +++ b/src/pipecat/processors/frameworks/langchain.py @@ -6,6 +6,8 @@ from typing import Union +from loguru import logger + from pipecat.frames.frames import ( Frame, LLMFullResponseEndFrame, @@ -15,8 +17,6 @@ ) from pipecat.processors.frame_processor import FrameDirection, FrameProcessor -from loguru import logger - try: from langchain_core.messages import AIMessageChunk from langchain_core.runnables import Runnable diff --git a/src/pipecat/processors/gstreamer/pipeline_source.py b/src/pipecat/processors/gstreamer/pipeline_source.py index 649a2c529..7d2c23c69 100644 --- a/src/pipecat/processors/gstreamer/pipeline_source.py +++ b/src/pipecat/processors/gstreamer/pipeline_source.py @@ -6,6 +6,7 @@ import asyncio +from loguru import logger from pydantic import BaseModel from pipecat.frames.frames import ( @@ -19,8 +20,6 @@ ) from pipecat.processors.frame_processor import FrameDirection, FrameProcessor -from loguru import logger - try: import gi diff --git a/src/pipecat/processors/idle_frame_processor.py b/src/pipecat/processors/idle_frame_processor.py index e674b6b84..d1c86e3ab 100644 --- a/src/pipecat/processors/idle_frame_processor.py +++ b/src/pipecat/processors/idle_frame_processor.py @@ -5,7 +5,6 @@ # import asyncio - from typing import Awaitable, Callable, List from pipecat.frames.frames import Frame diff --git a/src/pipecat/processors/logger.py b/src/pipecat/processors/logger.py index a26c67014..8c925af2a 100644 --- a/src/pipecat/processors/logger.py +++ b/src/pipecat/processors/logger.py @@ -4,11 +4,13 @@ # SPDX-License-Identifier: BSD 2-Clause License # -from pipecat.frames.frames import BotSpeakingFrame, Frame, AudioRawFrame, TransportMessageFrame -from pipecat.processors.frame_processor import FrameDirection, FrameProcessor -from loguru import logger from typing import Optional +from loguru import logger + +from pipecat.frames.frames import AudioRawFrame, BotSpeakingFrame, Frame, TransportMessageFrame +from pipecat.processors.frame_processor import FrameDirection, FrameProcessor + logger = logger.opt(ansi=True) diff --git a/src/pipecat/processors/metrics/frame_processor_metrics.py b/src/pipecat/processors/metrics/frame_processor_metrics.py index 2c0099989..9cacb9a7f 100644 --- a/src/pipecat/processors/metrics/frame_processor_metrics.py +++ b/src/pipecat/processors/metrics/frame_processor_metrics.py @@ -6,6 +6,8 @@ import time +from loguru import logger + from pipecat.frames.frames import MetricsFrame from pipecat.metrics.metrics import ( LLMTokenUsage, @@ -16,8 +18,6 @@ TTSUsageMetricsData, ) -from loguru import logger - class FrameProcessorMetrics: def __init__(self): diff --git a/src/pipecat/processors/metrics/sentry.py b/src/pipecat/processors/metrics/sentry.py index 6cc6d1103..bc93170ff 100644 --- a/src/pipecat/processors/metrics/sentry.py +++ b/src/pipecat/processors/metrics/sentry.py @@ -5,6 +5,7 @@ # import time + from loguru import logger try: diff --git a/src/pipecat/serializers/livekit.py b/src/pipecat/serializers/livekit.py index a14483b15..aafc00b23 100644 --- a/src/pipecat/serializers/livekit.py +++ b/src/pipecat/serializers/livekit.py @@ -7,11 +7,11 @@ import ctypes import pickle +from loguru import logger + from pipecat.frames.frames import Frame, InputAudioRawFrame, OutputAudioRawFrame from pipecat.serializers.base_serializer import FrameSerializer, FrameSerializerType -from loguru import logger - try: from livekit.rtc import AudioFrame except ModuleNotFoundError as e: diff --git a/src/pipecat/serializers/protobuf.py b/src/pipecat/serializers/protobuf.py index 1d2e6c3f2..4e6ade772 100644 --- a/src/pipecat/serializers/protobuf.py +++ b/src/pipecat/serializers/protobuf.py @@ -6,8 +6,9 @@ import dataclasses -import pipecat.frames.protobufs.frames_pb2 as frame_protos +from loguru import logger +import pipecat.frames.protobufs.frames_pb2 as frame_protos from pipecat.frames.frames import ( Frame, InputAudioRawFrame, @@ -17,8 +18,6 @@ ) from pipecat.serializers.base_serializer import FrameSerializer, FrameSerializerType -from loguru import logger - class ProtobufFrameSerializer(FrameSerializer): SERIALIZABLE_TYPES = { diff --git a/src/pipecat/serializers/twilio.py b/src/pipecat/serializers/twilio.py index a0d02fa2f..3c3648365 100644 --- a/src/pipecat/serializers/twilio.py +++ b/src/pipecat/serializers/twilio.py @@ -9,7 +9,7 @@ from pydantic import BaseModel -from pipecat.audio.utils import ulaw_to_pcm, pcm_to_ulaw +from pipecat.audio.utils import pcm_to_ulaw, ulaw_to_pcm from pipecat.frames.frames import AudioRawFrame, Frame, InputAudioRawFrame, StartInterruptionFrame from pipecat.serializers.base_serializer import FrameSerializer, FrameSerializerType diff --git a/src/pipecat/services/canonical.py b/src/pipecat/services/canonical.py index 265cc1b1b..376168c3f 100644 --- a/src/pipecat/services/canonical.py +++ b/src/pipecat/services/canonical.py @@ -4,23 +4,22 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiohttp import io import os import uuid import wave - from datetime import datetime from typing import Dict, List, Tuple +import aiohttp +from loguru import logger + from pipecat.frames.frames import CancelFrame, EndFrame, Frame from pipecat.processors.audio import audio_buffer_processor from pipecat.processors.audio.audio_buffer_processor import AudioBufferProcessor from pipecat.processors.frame_processor import FrameDirection from pipecat.services.ai_services import AIService -from loguru import logger - try: import aiofiles import aiofiles.os diff --git a/src/pipecat/services/cartesia.py b/src/pipecat/services/cartesia.py index 88fbf29d4..f4d5935a8 100644 --- a/src/pipecat/services/cartesia.py +++ b/src/pipecat/services/cartesia.py @@ -14,7 +14,6 @@ from pydantic import BaseModel from tenacity import AsyncRetrying, RetryCallState, stop_after_attempt, wait_exponential - from pipecat.frames.frames import ( BotStoppedSpeakingFrame, CancelFrame, diff --git a/src/pipecat/services/fal.py b/src/pipecat/services/fal.py index aecdeb709..a7b2b7e30 100644 --- a/src/pipecat/services/fal.py +++ b/src/pipecat/services/fal.py @@ -4,20 +4,18 @@ # SPDX-License-Identifier: BSD 2-Clause License # -import aiohttp import io import os +from typing import AsyncGenerator, Dict, Optional, Union +import aiohttp +from loguru import logger +from PIL import Image from pydantic import BaseModel -from typing import AsyncGenerator, Optional, Union, Dict from pipecat.frames.frames import ErrorFrame, Frame, URLImageRawFrame from pipecat.services.ai_services import ImageGenService -from PIL import Image - -from loguru import logger - try: import fal_client except ModuleNotFoundError as e: diff --git a/src/pipecat/services/gemini_multimodal_live/events.py b/src/pipecat/services/gemini_multimodal_live/events.py index 24e2b015e..edb2867f9 100644 --- a/src/pipecat/services/gemini_multimodal_live/events.py +++ b/src/pipecat/services/gemini_multimodal_live/events.py @@ -6,13 +6,12 @@ # import base64 -import json import io - -from pydantic import BaseModel, Field +import json from typing import List, Literal, Optional from PIL import Image +from pydantic import BaseModel, Field from pipecat.frames.frames import ImageRawFrame diff --git a/src/pipecat/services/moondream.py b/src/pipecat/services/moondream.py index 74442dfee..400028700 100644 --- a/src/pipecat/services/moondream.py +++ b/src/pipecat/services/moondream.py @@ -5,19 +5,16 @@ # import asyncio +from typing import AsyncGenerator +from loguru import logger from PIL import Image -from typing import AsyncGenerator - from pipecat.frames.frames import ErrorFrame, Frame, TextFrame, VisionImageRawFrame from pipecat.services.ai_services import VisionService -from loguru import logger - try: import torch - from transformers import AutoModelForCausalLM, AutoTokenizer except ModuleNotFoundError as e: logger.error(f"Exception: {e}") diff --git a/src/pipecat/services/openai_realtime_beta/context.py b/src/pipecat/services/openai_realtime_beta/context.py index 2b6ff968f..9ea8dd691 100644 --- a/src/pipecat/services/openai_realtime_beta/context.py +++ b/src/pipecat/services/openai_realtime_beta/context.py @@ -21,7 +21,7 @@ ) from . import events -from .frames import RealtimeMessagesUpdateFrame, RealtimeFunctionCallResultFrame +from .frames import RealtimeFunctionCallResultFrame, RealtimeMessagesUpdateFrame class OpenAIRealtimeLLMContext(OpenAILLMContext): diff --git a/src/pipecat/services/openai_realtime_beta/openai.py b/src/pipecat/services/openai_realtime_beta/openai.py index ac492a205..c0240676e 100644 --- a/src/pipecat/services/openai_realtime_beta/openai.py +++ b/src/pipecat/services/openai_realtime_beta/openai.py @@ -8,10 +8,10 @@ import base64 import json import time - from dataclasses import dataclass import websockets +from loguru import logger from pipecat.frames.frames import ( BotStoppedSpeakingFrame, @@ -48,13 +48,11 @@ from . import events from .context import ( + OpenAIRealtimeAssistantContextAggregator, OpenAIRealtimeLLMContext, OpenAIRealtimeUserContextAggregator, - OpenAIRealtimeAssistantContextAggregator, ) -from .frames import RealtimeMessagesUpdateFrame, RealtimeFunctionCallResultFrame - -from loguru import logger +from .frames import RealtimeFunctionCallResultFrame, RealtimeMessagesUpdateFrame @dataclass diff --git a/src/pipecat/services/openpipe.py b/src/pipecat/services/openpipe.py index 827ffcb85..fb6362b15 100644 --- a/src/pipecat/services/openpipe.py +++ b/src/pipecat/services/openpipe.py @@ -6,14 +6,15 @@ from typing import Dict, List +from loguru import logger + from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext from pipecat.services.openai import OpenAILLMService -from loguru import logger - try: - from openpipe import AsyncOpenAI as OpenPipeAI, AsyncStream - from openai.types.chat import ChatCompletionMessageParam, ChatCompletionChunk + from openai.types.chat import ChatCompletionChunk, ChatCompletionMessageParam + from openpipe import AsyncOpenAI as OpenPipeAI + from openpipe import AsyncStream except ModuleNotFoundError as e: logger.error(f"Exception: {e}") logger.error( diff --git a/src/pipecat/services/simli.py b/src/pipecat/services/simli.py index bfae861dc..1f88838be 100644 --- a/src/pipecat/services/simli.py +++ b/src/pipecat/services/simli.py @@ -6,24 +6,22 @@ import asyncio +import numpy as np +from loguru import logger + from pipecat.frames.frames import ( + CancelFrame, + EndFrame, Frame, OutputImageRawFrame, - TTSAudioRawFrame, StartInterruptionFrame, - EndFrame, - CancelFrame, + TTSAudioRawFrame, ) from pipecat.processors.frame_processor import FrameDirection, FrameProcessor, StartFrame -import numpy as np - -from loguru import logger - try: from av.audio.frame import AudioFrame from av.audio.resampler import AudioResampler - from simli import SimliClient, SimliConfig except ModuleNotFoundError as e: logger.error(f"Exception: {e}") diff --git a/src/pipecat/services/tavus.py b/src/pipecat/services/tavus.py index ff2b7fb87..b701af00d 100644 --- a/src/pipecat/services/tavus.py +++ b/src/pipecat/services/tavus.py @@ -7,24 +7,24 @@ """This module implements Tavus as a sink transport layer""" -import aiohttp import base64 +import aiohttp +from loguru import logger + +from pipecat.audio.utils import resample_audio from pipecat.frames.frames import ( + CancelFrame, + EndFrame, Frame, - TTSAudioRawFrame, + StartInterruptionFrame, TransportMessageUrgentFrame, + TTSAudioRawFrame, TTSStartedFrame, TTSStoppedFrame, - StartInterruptionFrame, - EndFrame, - CancelFrame, ) from pipecat.processors.frame_processor import FrameDirection from pipecat.services.ai_services import AIService -from pipecat.audio.utils import resample_audio - -from loguru import logger class TavusVideoService(AIService): diff --git a/src/pipecat/services/to_be_updated/cloudflare_ai_service.py b/src/pipecat/services/to_be_updated/cloudflare_ai_service.py index 1329f9c79..ff637ff1a 100644 --- a/src/pipecat/services/to_be_updated/cloudflare_ai_service.py +++ b/src/pipecat/services/to_be_updated/cloudflare_ai_service.py @@ -1,5 +1,6 @@ -import requests import os + +import requests from services.ai_service import AIService # Note that Cloudflare's AI workers are still in beta. diff --git a/src/pipecat/services/to_be_updated/google_ai_service.py b/src/pipecat/services/to_be_updated/google_ai_service.py index 25668ca0a..3ca688750 100644 --- a/src/pipecat/services/to_be_updated/google_ai_service.py +++ b/src/pipecat/services/to_be_updated/google_ai_service.py @@ -1,11 +1,12 @@ -from services.ai_service import AIService -import openai import os +import openai + # To use Google Cloud's AI products, you'll need to install Google Cloud # CLI and enable the TTS and in your project: # https://cloud.google.com/sdk/docs/install from google.cloud import texttospeech +from services.ai_service import AIService class GoogleAIService(AIService): diff --git a/src/pipecat/services/to_be_updated/mock_ai_service.py b/src/pipecat/services/to_be_updated/mock_ai_service.py index dc200f622..0825cde33 100644 --- a/src/pipecat/services/to_be_updated/mock_ai_service.py +++ b/src/pipecat/services/to_be_updated/mock_ai_service.py @@ -1,6 +1,7 @@ import io -import requests import time + +import requests from PIL import Image from services.ai_service import AIService diff --git a/src/pipecat/services/whisper.py b/src/pipecat/services/whisper.py index a4635c6cb..266ff2b84 100644 --- a/src/pipecat/services/whisper.py +++ b/src/pipecat/services/whisper.py @@ -7,18 +7,16 @@ """This module implements Whisper transcription with a locally-downloaded model.""" import asyncio - from enum import Enum from typing import AsyncGenerator import numpy as np +from loguru import logger from pipecat.frames.frames import ErrorFrame, Frame, TranscriptionFrame from pipecat.services.ai_services import SegmentedSTTService from pipecat.utils.time import time_now_iso8601 -from loguru import logger - try: from faster_whisper import WhisperModel except ModuleNotFoundError as e: diff --git a/src/pipecat/transports/base_output.py b/src/pipecat/transports/base_output.py index 573b67717..fbe337d6d 100644 --- a/src/pipecat/transports/base_output.py +++ b/src/pipecat/transports/base_output.py @@ -29,9 +29,9 @@ StartInterruptionFrame, StopInterruptionFrame, SystemFrame, - TTSAudioRawFrame, TransportMessageFrame, TransportMessageUrgentFrame, + TTSAudioRawFrame, ) from pipecat.processors.frame_processor import FrameDirection, FrameProcessor from pipecat.transports.base_transport import TransportParams diff --git a/src/pipecat/transports/base_transport.py b/src/pipecat/transports/base_transport.py index 91f95fbbc..27f6cab75 100644 --- a/src/pipecat/transports/base_transport.py +++ b/src/pipecat/transports/base_transport.py @@ -6,20 +6,17 @@ import asyncio import inspect - from abc import ABC, abstractmethod from typing import Optional -from pydantic import ConfigDict -from pydantic import BaseModel +from loguru import logger +from pydantic import BaseModel, ConfigDict from pipecat.audio.filters.base_audio_filter import BaseAudioFilter from pipecat.audio.mixers.base_audio_mixer import BaseAudioMixer from pipecat.audio.vad.vad_analyzer import VADAnalyzer from pipecat.processors.frame_processor import FrameProcessor -from loguru import logger - class TransportParams(BaseModel): model_config = ConfigDict(arbitrary_types_allowed=True) diff --git a/src/pipecat/transports/local/audio.py b/src/pipecat/transports/local/audio.py index e1ccefec2..d62c6bd48 100644 --- a/src/pipecat/transports/local/audio.py +++ b/src/pipecat/transports/local/audio.py @@ -5,17 +5,16 @@ # import asyncio - from concurrent.futures import ThreadPoolExecutor +from loguru import logger + from pipecat.frames.frames import InputAudioRawFrame, StartFrame from pipecat.processors.frame_processor import FrameProcessor from pipecat.transports.base_input import BaseInputTransport from pipecat.transports.base_output import BaseOutputTransport from pipecat.transports.base_transport import BaseTransport, TransportParams -from loguru import logger - try: import pyaudio except ModuleNotFoundError as e: diff --git a/src/pipecat/transports/local/tk.py b/src/pipecat/transports/local/tk.py index ed7cdbea6..e720f3907 100644 --- a/src/pipecat/transports/local/tk.py +++ b/src/pipecat/transports/local/tk.py @@ -5,19 +5,17 @@ # import asyncio - +import tkinter as tk from concurrent.futures import ThreadPoolExecutor import numpy as np -import tkinter as tk +from loguru import logger from pipecat.frames.frames import InputAudioRawFrame, OutputImageRawFrame, StartFrame from pipecat.transports.base_input import BaseInputTransport from pipecat.transports.base_output import BaseOutputTransport from pipecat.transports.base_transport import BaseTransport, TransportParams -from loguru import logger - try: import pyaudio except ModuleNotFoundError as e: diff --git a/src/pipecat/transports/network/fastapi_websocket.py b/src/pipecat/transports/network/fastapi_websocket.py index cd21fbe0d..e7ac8b5a5 100644 --- a/src/pipecat/transports/network/fastapi_websocket.py +++ b/src/pipecat/transports/network/fastapi_websocket.py @@ -10,8 +10,9 @@ import time import typing import wave - from typing import Awaitable, Callable + +from loguru import logger from pydantic import BaseModel from pipecat.frames.frames import ( @@ -27,8 +28,6 @@ from pipecat.transports.base_output import BaseOutputTransport from pipecat.transports.base_transport import BaseTransport, TransportParams -from loguru import logger - try: from fastapi import WebSocket from starlette.websockets import WebSocketState diff --git a/src/pipecat/transports/network/websocket_server.py b/src/pipecat/transports/network/websocket_server.py index ce9b9614d..beac5a3ee 100644 --- a/src/pipecat/transports/network/websocket_server.py +++ b/src/pipecat/transports/network/websocket_server.py @@ -8,8 +8,9 @@ import io import time import wave - from typing import Awaitable, Callable + +from loguru import logger from pydantic import BaseModel from pipecat.frames.frames import ( @@ -28,8 +29,6 @@ from pipecat.transports.base_output import BaseOutputTransport from pipecat.transports.base_transport import BaseTransport, TransportParams -from loguru import logger - try: import websockets except ModuleNotFoundError as e: diff --git a/src/pipecat/transports/services/livekit.py b/src/pipecat/transports/services/livekit.py index ded16182f..21a91f664 100644 --- a/src/pipecat/transports/services/livekit.py +++ b/src/pipecat/transports/services/livekit.py @@ -8,6 +8,7 @@ from dataclasses import dataclass from typing import Any, Awaitable, Callable, List +from loguru import logger from pydantic import BaseModel from pipecat.audio.utils import resample_audio @@ -28,8 +29,6 @@ from pipecat.transports.base_output import BaseOutputTransport from pipecat.transports.base_transport import BaseTransport, TransportParams -from loguru import logger - try: from livekit import rtc from tenacity import retry, stop_after_attempt, wait_exponential diff --git a/src/pipecat/utils/test_frame_processor.py b/src/pipecat/utils/test_frame_processor.py index e46bae7ad..fde476007 100644 --- a/src/pipecat/utils/test_frame_processor.py +++ b/src/pipecat/utils/test_frame_processor.py @@ -1,4 +1,5 @@ from typing import List + from pipecat.processors.frame_processor import FrameProcessor diff --git a/tests/integration/integration_azure_llm.py b/tests/integration/integration_azure_llm.py index 5a2b68c37..8e49e9d04 100644 --- a/tests/integration/integration_azure_llm.py +++ b/tests/integration/integration_azure_llm.py @@ -1,17 +1,17 @@ -import unittest - import asyncio import os +import unittest + +from openai.types.chat import ( + ChatCompletionSystemMessageParam, +) + from pipecat.processors.aggregators.openai_llm_context import ( OpenAILLMContext, OpenAILLMContextFrame, ) from pipecat.services.azure import AzureLLMService -from openai.types.chat import ( - ChatCompletionSystemMessageParam, -) - if __name__ == "__main__": @unittest.skip("Skip azure integration test") diff --git a/tests/integration/integration_ollama_llm.py b/tests/integration/integration_ollama_llm.py index ced24ed68..085500cb8 100644 --- a/tests/integration/integration_ollama_llm.py +++ b/tests/integration/integration_ollama_llm.py @@ -1,14 +1,14 @@ +import asyncio import unittest -import asyncio +from openai.types.chat import ( + ChatCompletionSystemMessageParam, +) + from pipecat.processors.aggregators.openai_llm_context import ( OpenAILLMContext, OpenAILLMContextFrame, ) - -from openai.types.chat import ( - ChatCompletionSystemMessageParam, -) from pipecat.services.ollama import OLLamaLLMService if __name__ == "__main__": diff --git a/tests/integration/integration_openai_llm.py b/tests/integration/integration_openai_llm.py index 164dcba8d..c788936a1 100644 --- a/tests/integration/integration_openai_llm.py +++ b/tests/integration/integration_openai_llm.py @@ -3,17 +3,16 @@ import os from typing import List -from pipecat.services.openai import OpenAILLMContextFrame, OpenAILLMContext -from pipecat.processors.frame_processor import FrameDirection, FrameProcessor -from pipecat.frames.frames import LLMFullResponseStartFrame, LLMFullResponseEndFrame, TextFrame -from pipecat.utils.test_frame_processor import TestFrameProcessor from openai.types.chat import ( ChatCompletionSystemMessageParam, ChatCompletionToolParam, ChatCompletionUserMessageParam, ) -from pipecat.services.openai import OpenAILLMService +from pipecat.frames.frames import LLMFullResponseEndFrame, LLMFullResponseStartFrame, TextFrame +from pipecat.processors.frame_processor import FrameDirection, FrameProcessor +from pipecat.services.openai import OpenAILLMContext, OpenAILLMContextFrame, OpenAILLMService +from pipecat.utils.test_frame_processor import TestFrameProcessor tools = [ ChatCompletionToolParam( diff --git a/tests/test_aggregators.py b/tests/test_aggregators.py index 76834183c..dcf27ad6e 100644 --- a/tests/test_aggregators.py +++ b/tests/test_aggregators.py @@ -3,23 +3,20 @@ import functools import unittest -from pipecat.processors.aggregators.gated import GatedAggregator -from pipecat.processors.aggregators.sentence import SentenceAggregator -from pipecat.processors.text_transformer import StatelessTextTransformer - -from pipecat.pipeline.parallel_pipeline import ParallelPipeline - from pipecat.frames.frames import ( AudioRawFrame, EndFrame, + Frame, ImageRawFrame, LLMFullResponseEndFrame, LLMFullResponseStartFrame, - Frame, TextFrame, ) - +from pipecat.pipeline.parallel_pipeline import ParallelPipeline from pipecat.pipeline.pipeline import Pipeline +from pipecat.processors.aggregators.gated import GatedAggregator +from pipecat.processors.aggregators.sentence import SentenceAggregator +from pipecat.processors.text_transformer import StatelessTextTransformer class TestDailyFrameAggregators(unittest.IsolatedAsyncioTestCase): diff --git a/tests/test_ai_services.py b/tests/test_ai_services.py index 975f7e20c..13aa20467 100644 --- a/tests/test_ai_services.py +++ b/tests/test_ai_services.py @@ -1,9 +1,8 @@ import unittest - from typing import AsyncGenerator -from pipecat.services.ai_services import AIService, match_endofsentence from pipecat.frames.frames import EndFrame, Frame, TextFrame +from pipecat.services.ai_services import AIService, match_endofsentence class SimpleAIService(AIService): diff --git a/tests/test_langchain.py b/tests/test_langchain.py index d30d213bd..bed3f907a 100644 --- a/tests/test_langchain.py +++ b/tests/test_langchain.py @@ -6,6 +6,9 @@ import unittest +from langchain.prompts import ChatPromptTemplate +from langchain_core.language_models import FakeStreamingListLLM + from pipecat.frames.frames import ( EndFrame, LLMFullResponseEndFrame, @@ -25,9 +28,6 @@ from pipecat.processors.frame_processor import FrameProcessor from pipecat.processors.frameworks.langchain import LangchainProcessor -from langchain.prompts import ChatPromptTemplate -from langchain_core.language_models import FakeStreamingListLLM - class TestLangchain(unittest.IsolatedAsyncioTestCase): class MockProcessor(FrameProcessor): diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py index ba82974bc..7d703d5ed 100644 --- a/tests/test_pipeline.py +++ b/tests/test_pipeline.py @@ -2,12 +2,11 @@ import unittest from unittest.mock import Mock -from pipecat.processors.aggregators.sentence import SentenceAggregator -from pipecat.processors.text_transformer import StatelessTextTransformer -from pipecat.processors.frame_processor import FrameProcessor from pipecat.frames.frames import EndFrame, TextFrame - from pipecat.pipeline.pipeline import Pipeline +from pipecat.processors.aggregators.sentence import SentenceAggregator +from pipecat.processors.frame_processor import FrameProcessor +from pipecat.processors.text_transformer import StatelessTextTransformer class TestDailyPipeline(unittest.IsolatedAsyncioTestCase): From 5c57cccea3006f03866f56399350009aed9e2d4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Tue, 17 Dec 2024 11:29:28 -0800 Subject: [PATCH 2/3] github: run ruff check import linter --- .github/workflows/format.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/format.yaml b/.github/workflows/format.yaml index 5866f881b..444e24338 100644 --- a/.github/workflows/format.yaml +++ b/.github/workflows/format.yaml @@ -35,7 +35,12 @@ jobs: python -m pip install --upgrade pip pip install -r dev-requirements.txt - name: Ruff formatter - id: ruff + id: ruff-format run: | source .venv/bin/activate ruff format --diff + - name: Ruff import linter + id: ruff-check + run: | + source .venv/bin/activate + ruff check --select I From b9ca667d3104f1517f3a03b69c12e7bbd5fc2974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Tue, 17 Dec 2024 11:40:43 -0800 Subject: [PATCH 3/3] pyproject: use tool.ruff.lint sections --- pyproject.toml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1a43b1b89..8b8026a8e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -89,9 +89,11 @@ fallback_version = "0.0.0-dev" exclude = ["*_pb2.py"] line-length = 100 +[tool.ruff.lint] select = [ "D", # Docstring rules + "I", # Import rules ] -[tool.ruff.pydocstyle] -convention = "google" \ No newline at end of file +[tool.ruff.lint.pydocstyle] +convention = "google"