processors(realtime-ai): add silero vad to the transport
This commit is contained in:
@@ -13,6 +13,7 @@ from pipecat.pipeline.task import PipelineParams, PipelineTask
|
||||
from pipecat.pipeline.runner import PipelineRunner
|
||||
from pipecat.processors.frameworks.realtimeai import RealtimeAIProcessor
|
||||
from pipecat.transports.services.daily import DailyParams, DailyTransport
|
||||
from pipecat.vad.silero import SileroVADAnalyzer
|
||||
|
||||
from runner import configure
|
||||
|
||||
@@ -31,9 +32,10 @@ async def main(room_url, token):
|
||||
token,
|
||||
"Realtime AI",
|
||||
DailyParams(
|
||||
audio_in_enabled=True,
|
||||
audio_out_enabled=True,
|
||||
transcription_enabled=True,
|
||||
vad_enabled=True,
|
||||
vad_analyzer=SileroVADAnalyzer()
|
||||
))
|
||||
|
||||
rtai = RealtimeAIProcessor(
|
||||
|
||||
@@ -25,7 +25,6 @@ from pipecat.services.ai_services import AIService
|
||||
from pipecat.services.cartesia import CartesiaTTSService
|
||||
from pipecat.services.openai import OpenAILLMService
|
||||
from pipecat.transports.base_transport import BaseTransport
|
||||
from pipecat.vad.silero import SileroVAD
|
||||
|
||||
DEFAULT_MESSAGES = [
|
||||
{
|
||||
@@ -141,8 +140,6 @@ class RealtimeAIProcessor(FrameProcessor):
|
||||
|
||||
async def _handle_setup(self, setup: RealtimeAISetup | None):
|
||||
try:
|
||||
vad = SileroVAD()
|
||||
|
||||
model = DEFAULT_MODEL
|
||||
if setup and setup.config and setup.config.llm and setup.config.llm.model:
|
||||
model = setup.config.llm.model
|
||||
@@ -166,7 +163,6 @@ class RealtimeAIProcessor(FrameProcessor):
|
||||
self._tts = self._tts_cls(api_key=self._tts_api_key, voice_id=voice)
|
||||
|
||||
pipeline = Pipeline([
|
||||
vad,
|
||||
self._tma_in,
|
||||
self._llm,
|
||||
self._tts,
|
||||
@@ -220,8 +216,7 @@ class RealtimeAIProcessor(FrameProcessor):
|
||||
# send any messages. So, we setup a super basic pipeline with just the
|
||||
# output transport so we can send messages.
|
||||
if not self._pipeline:
|
||||
# We add the SilerVAD() so the audio doesn't go through.
|
||||
pipeline = Pipeline([SileroVAD(), self._transport.output()])
|
||||
pipeline = Pipeline([self._transport.output()])
|
||||
self._pipeline = pipeline
|
||||
|
||||
parent = self.get_parent()
|
||||
|
||||
Reference in New Issue
Block a user