examples: pipelines readability and add LLM assistants after transport
This commit is contained in:
@@ -98,9 +98,13 @@ async def main():
|
|||||||
|
|
||||||
image_grabber = ImageGrabber()
|
image_grabber = ImageGrabber()
|
||||||
|
|
||||||
pipeline = Pipeline([llm, aggregator, description,
|
pipeline = Pipeline([
|
||||||
ParallelPipeline([tts, audio_grabber],
|
llm,
|
||||||
[imagegen, image_grabber])])
|
aggregator,
|
||||||
|
description,
|
||||||
|
ParallelPipeline([tts, audio_grabber],
|
||||||
|
[imagegen, image_grabber])
|
||||||
|
])
|
||||||
|
|
||||||
task = PipelineTask(pipeline)
|
task = PipelineTask(pipeline)
|
||||||
await task.queue_frame(LLMMessagesFrame(messages))
|
await task.queue_frame(LLMMessagesFrame(messages))
|
||||||
|
|||||||
@@ -70,8 +70,16 @@ async def main(room_url: str, token):
|
|||||||
tma_in = LLMUserResponseAggregator(messages)
|
tma_in = LLMUserResponseAggregator(messages)
|
||||||
tma_out = LLMAssistantResponseAggregator(messages)
|
tma_out = LLMAssistantResponseAggregator(messages)
|
||||||
|
|
||||||
pipeline = Pipeline([fl_in, transport.input(), tma_in, llm,
|
pipeline = Pipeline([
|
||||||
fl_out, tts, tma_out, transport.output()])
|
fl_in,
|
||||||
|
transport.input(),
|
||||||
|
tma_in,
|
||||||
|
llm,
|
||||||
|
fl_out,
|
||||||
|
tts,
|
||||||
|
transport.output(),
|
||||||
|
tma_out
|
||||||
|
])
|
||||||
|
|
||||||
task = PipelineTask(pipeline)
|
task = PipelineTask(pipeline)
|
||||||
|
|
||||||
|
|||||||
@@ -95,8 +95,15 @@ async def main(room_url: str, token):
|
|||||||
os.path.join(os.path.dirname(__file__), "assets", "waiting.png"),
|
os.path.join(os.path.dirname(__file__), "assets", "waiting.png"),
|
||||||
)
|
)
|
||||||
|
|
||||||
pipeline = Pipeline([transport.input(), image_sync_aggregator,
|
pipeline = Pipeline([
|
||||||
tma_in, llm, tma_out, tts, transport.output()])
|
transport.input(),
|
||||||
|
image_sync_aggregator,
|
||||||
|
tma_in,
|
||||||
|
llm,
|
||||||
|
tts,
|
||||||
|
transport.output(),
|
||||||
|
tma_out
|
||||||
|
])
|
||||||
|
|
||||||
task = PipelineTask(pipeline)
|
task = PipelineTask(pipeline)
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,13 @@ async def main(room_url: str, token):
|
|||||||
tma_in = LLMUserResponseAggregator(messages)
|
tma_in = LLMUserResponseAggregator(messages)
|
||||||
tma_out = LLMAssistantResponseAggregator(messages)
|
tma_out = LLMAssistantResponseAggregator(messages)
|
||||||
|
|
||||||
pipeline = Pipeline([transport.input(), tma_in, llm, tts, tma_out, transport.output()])
|
pipeline = Pipeline([
|
||||||
|
transport.input(),
|
||||||
|
tma_in,
|
||||||
|
llm,
|
||||||
|
tts,
|
||||||
|
transport.output(),
|
||||||
|
tma_out])
|
||||||
|
|
||||||
task = PipelineTask(pipeline, allow_interruptions=True)
|
task = PipelineTask(pipeline, allow_interruptions=True)
|
||||||
|
|
||||||
|
|||||||
@@ -157,8 +157,16 @@ async def main(room_url: str, token):
|
|||||||
tma_out = LLMAssistantContextAggregator(messages)
|
tma_out = LLMAssistantContextAggregator(messages)
|
||||||
ncf = NameCheckFilter(["Santa Cat", "Santa"])
|
ncf = NameCheckFilter(["Santa Cat", "Santa"])
|
||||||
|
|
||||||
pipeline = Pipeline([transport.input(), isa, ncf, tma_in,
|
pipeline = Pipeline([
|
||||||
llm, tma_out, tts, transport.output()])
|
transport.input(),
|
||||||
|
isa,
|
||||||
|
ncf,
|
||||||
|
tma_in,
|
||||||
|
llm,
|
||||||
|
tts,
|
||||||
|
transport.output(),
|
||||||
|
tma_out
|
||||||
|
])
|
||||||
|
|
||||||
@transport.event_handler("on_first_participant_joined")
|
@transport.event_handler("on_first_participant_joined")
|
||||||
async def on_first_participant_joined(transport, participant):
|
async def on_first_participant_joined(transport, participant):
|
||||||
|
|||||||
@@ -111,8 +111,18 @@ async def main(room_url: str, token):
|
|||||||
fl = FrameLogger("LLM Out")
|
fl = FrameLogger("LLM Out")
|
||||||
fl2 = FrameLogger("Transcription In")
|
fl2 = FrameLogger("Transcription In")
|
||||||
|
|
||||||
pipeline = Pipeline([transport.input(), tma_in, in_sound, fl2, llm,
|
pipeline = Pipeline([
|
||||||
tma_out, fl, tts, out_sound, transport.output()])
|
transport.input(),
|
||||||
|
tma_in,
|
||||||
|
in_sound,
|
||||||
|
fl2,
|
||||||
|
llm,
|
||||||
|
fl,
|
||||||
|
tts,
|
||||||
|
out_sound,
|
||||||
|
transport.output(),
|
||||||
|
tma_out
|
||||||
|
])
|
||||||
|
|
||||||
@transport.event_handler("on_first_participant_joined")
|
@transport.event_handler("on_first_participant_joined")
|
||||||
async def on_first_participant_joined(transport, participant):
|
async def on_first_participant_joined(transport, participant):
|
||||||
|
|||||||
@@ -89,8 +89,15 @@ async def main(room_url: str, token):
|
|||||||
transport.capture_participant_transcription(participant["id"])
|
transport.capture_participant_transcription(participant["id"])
|
||||||
image_requester.set_participant_id(participant["id"])
|
image_requester.set_participant_id(participant["id"])
|
||||||
|
|
||||||
pipeline = Pipeline([transport.input(), user_response, image_requester,
|
pipeline = Pipeline([
|
||||||
vision_aggregator, moondream, tts, transport.output()])
|
transport.input(),
|
||||||
|
user_response,
|
||||||
|
image_requester,
|
||||||
|
vision_aggregator,
|
||||||
|
moondream,
|
||||||
|
tts,
|
||||||
|
transport.output()
|
||||||
|
])
|
||||||
|
|
||||||
task = PipelineTask(pipeline)
|
task = PipelineTask(pipeline)
|
||||||
|
|
||||||
|
|||||||
@@ -168,11 +168,17 @@ async def main(room_url: str, token):
|
|||||||
|
|
||||||
ura = LLMUserResponseAggregator(messages)
|
ura = LLMUserResponseAggregator(messages)
|
||||||
|
|
||||||
pipeline = Pipeline([transport.input(), ura, llm,
|
pipeline = Pipeline([
|
||||||
ParallelPipeline(
|
transport.input(),
|
||||||
[sa, ir, va, moondream],
|
ura,
|
||||||
[tf, imgf]),
|
llm,
|
||||||
tts, ta, transport.output()])
|
ParallelPipeline(
|
||||||
|
[sa, ir, va, moondream],
|
||||||
|
[tf, imgf]),
|
||||||
|
tts,
|
||||||
|
ta,
|
||||||
|
transport.output()
|
||||||
|
])
|
||||||
|
|
||||||
task = PipelineTask(pipeline)
|
task = PipelineTask(pipeline)
|
||||||
await task.queue_frame(quiet_frame)
|
await task.queue_frame(quiet_frame)
|
||||||
|
|||||||
@@ -138,8 +138,14 @@ async def main(room_url: str, token):
|
|||||||
|
|
||||||
ta = TalkingAnimation()
|
ta = TalkingAnimation()
|
||||||
|
|
||||||
pipeline = Pipeline([transport.input(), user_response,
|
pipeline = Pipeline([
|
||||||
llm, tts, ta, transport.output()])
|
transport.input(),
|
||||||
|
user_response,
|
||||||
|
llm,
|
||||||
|
tts,
|
||||||
|
ta,
|
||||||
|
transport.output()
|
||||||
|
])
|
||||||
|
|
||||||
task = PipelineTask(pipeline, allow_interruptions=True)
|
task = PipelineTask(pipeline, allow_interruptions=True)
|
||||||
await task.queue_frame(quiet_frame)
|
await task.queue_frame(quiet_frame)
|
||||||
|
|||||||
@@ -133,8 +133,8 @@ async def main(room_url, token=None):
|
|||||||
story_processor,
|
story_processor,
|
||||||
image_processor,
|
image_processor,
|
||||||
tts_service,
|
tts_service,
|
||||||
llm_responses,
|
transport.output(),
|
||||||
transport.output()
|
llm_responses
|
||||||
])
|
])
|
||||||
|
|
||||||
main_task = PipelineTask(main_pipeline)
|
main_task = PipelineTask(main_pipeline)
|
||||||
|
|||||||
@@ -103,7 +103,16 @@ async def main(room_url: str, token):
|
|||||||
lfra = LLMFullResponseAggregator()
|
lfra = LLMFullResponseAggregator()
|
||||||
ts = TranslationSubtitles("spanish")
|
ts = TranslationSubtitles("spanish")
|
||||||
|
|
||||||
pipeline = Pipeline([transport.input(), sa, tp, llm, lfra, ts, tts, transport.output()])
|
pipeline = Pipeline([
|
||||||
|
transport.input(),
|
||||||
|
sa,
|
||||||
|
tp,
|
||||||
|
llm,
|
||||||
|
lfra,
|
||||||
|
ts,
|
||||||
|
tts,
|
||||||
|
transport.output()
|
||||||
|
])
|
||||||
|
|
||||||
task = PipelineTask(pipeline)
|
task = PipelineTask(pipeline)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user