Add an RTVIProcessor to the simple-chatbot pipeline
This commit is contained in:
@@ -42,6 +42,8 @@ from pipecat.pipeline.task import PipelineParams, PipelineTask
|
||||
from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext
|
||||
from pipecat.processors.frame_processor import FrameDirection, FrameProcessor
|
||||
from pipecat.processors.frameworks.rtvi import (
|
||||
RTVIProcessor,
|
||||
RTVIConfig,
|
||||
RTVIBotTranscriptionProcessor,
|
||||
RTVIMetricsProcessor,
|
||||
RTVISpeakingProcessor,
|
||||
@@ -179,9 +181,13 @@ async def main():
|
||||
# This will send `metrics` messages.
|
||||
rtvi_metrics = RTVIMetricsProcessor()
|
||||
|
||||
# Handles RTVI messages from the client
|
||||
rtvi = RTVIProcessor(config=RTVIConfig(config=[]))
|
||||
|
||||
pipeline = Pipeline(
|
||||
[
|
||||
transport.input(),
|
||||
rtvi,
|
||||
context_aggregator.user(),
|
||||
llm,
|
||||
rtvi_speaking,
|
||||
@@ -204,6 +210,10 @@ async def main():
|
||||
)
|
||||
await task.queue_frame(quiet_frame)
|
||||
|
||||
@rtvi.event_handler("on_client_ready")
|
||||
async def on_client_ready(rtvi):
|
||||
await rtvi.set_bot_ready()
|
||||
|
||||
@transport.event_handler("on_first_participant_joined")
|
||||
async def on_first_participant_joined(transport, participant):
|
||||
await transport.capture_participant_transcription(participant["id"])
|
||||
|
||||
@@ -43,10 +43,12 @@ from pipecat.pipeline.task import PipelineParams, PipelineTask
|
||||
from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext
|
||||
from pipecat.processors.frame_processor import FrameDirection, FrameProcessor
|
||||
from pipecat.processors.frameworks.rtvi import (
|
||||
RTVIProcessor,
|
||||
RTVIBotTranscriptionProcessor,
|
||||
RTVIMetricsProcessor,
|
||||
RTVISpeakingProcessor,
|
||||
RTVIUserTranscriptionProcessor,
|
||||
RTVIConfig,
|
||||
)
|
||||
from pipecat.services.elevenlabs import ElevenLabsTTSService
|
||||
from pipecat.services.openai import OpenAILLMService
|
||||
@@ -201,9 +203,13 @@ async def main():
|
||||
# This will send `metrics` messages.
|
||||
rtvi_metrics = RTVIMetricsProcessor()
|
||||
|
||||
# Handles RTVI messages from the client
|
||||
rtvi = RTVIProcessor(config=RTVIConfig(config=[]))
|
||||
|
||||
pipeline = Pipeline(
|
||||
[
|
||||
transport.input(),
|
||||
rtvi,
|
||||
rtvi_speaking,
|
||||
rtvi_user_transcription,
|
||||
context_aggregator.user(),
|
||||
@@ -227,6 +233,10 @@ async def main():
|
||||
)
|
||||
await task.queue_frame(quiet_frame)
|
||||
|
||||
@rtvi.event_handler("on_client_ready")
|
||||
async def on_client_ready(rtvi):
|
||||
await rtvi.set_bot_ready()
|
||||
|
||||
@transport.event_handler("on_first_participant_joined")
|
||||
async def on_first_participant_joined(transport, participant):
|
||||
await transport.capture_participant_transcription(participant["id"])
|
||||
|
||||
Reference in New Issue
Block a user