llm user and assistant aggregator renames
This commit is contained in:
@@ -3,8 +3,8 @@ import aiohttp
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from dailyai.pipeline.aggregators import (
|
from dailyai.pipeline.aggregators import (
|
||||||
LLMResponseAggregator,
|
LLMAssistantResponseAggregator,
|
||||||
UserResponseAggregator,
|
LLMUserResponseAggregator,
|
||||||
)
|
)
|
||||||
|
|
||||||
from dailyai.pipeline.pipeline import Pipeline
|
from dailyai.pipeline.pipeline import Pipeline
|
||||||
@@ -63,8 +63,8 @@ async def main(room_url: str, token):
|
|||||||
|
|
||||||
await transport.run_interruptible_pipeline(
|
await transport.run_interruptible_pipeline(
|
||||||
pipeline,
|
pipeline,
|
||||||
post_processor=LLMResponseAggregator(messages),
|
post_processor=LLMAssistantResponseAggregator(messages),
|
||||||
pre_processor=UserResponseAggregator(messages),
|
pre_processor=LLMUserResponseAggregator(messages),
|
||||||
)
|
)
|
||||||
|
|
||||||
transport.transcription_settings["extra"]["punctuate"] = False
|
transport.transcription_settings["extra"]["punctuate"] = False
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ from PIL import Image
|
|||||||
from typing import AsyncGenerator
|
from typing import AsyncGenerator
|
||||||
|
|
||||||
from dailyai.pipeline.aggregators import (
|
from dailyai.pipeline.aggregators import (
|
||||||
LLMResponseAggregator,
|
LLMAssistantResponseAggregator,
|
||||||
UserResponseAggregator,
|
LLMUserResponseAggregator,
|
||||||
)
|
)
|
||||||
from dailyai.pipeline.frames import (
|
from dailyai.pipeline.frames import (
|
||||||
ImageFrame,
|
ImageFrame,
|
||||||
@@ -135,8 +135,8 @@ async def main(room_url: str, token):
|
|||||||
|
|
||||||
await transport.run_interruptible_pipeline(
|
await transport.run_interruptible_pipeline(
|
||||||
pipeline,
|
pipeline,
|
||||||
post_processor=LLMResponseAggregator(messages),
|
post_processor=LLMAssistantResponseAggregator(messages),
|
||||||
pre_processor=UserResponseAggregator(messages),
|
pre_processor=LLMUserResponseAggregator(messages),
|
||||||
)
|
)
|
||||||
|
|
||||||
transport.transcription_settings["extra"]["endpointing"] = True
|
transport.transcription_settings["extra"]["endpointing"] = True
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ from dailyai.services.deepgram_ai_services import DeepgramTTSService
|
|||||||
from dailyai.services.elevenlabs_ai_service import ElevenLabsTTSService
|
from dailyai.services.elevenlabs_ai_service import ElevenLabsTTSService
|
||||||
from dailyai.pipeline.aggregators import (
|
from dailyai.pipeline.aggregators import (
|
||||||
LLMAssistantContextAggregator,
|
LLMAssistantContextAggregator,
|
||||||
UserResponseAggregator,
|
LLMAssistantResponseAggregator,
|
||||||
LLMResponseAggregator,
|
LLMUserResponseAggregator,
|
||||||
)
|
)
|
||||||
from dailyai.pipeline.frames import (
|
from dailyai.pipeline.frames import (
|
||||||
EndPipeFrame,
|
EndPipeFrame,
|
||||||
@@ -209,8 +209,8 @@ async def main(room_url: str, token):
|
|||||||
key_id=os.getenv("FAL_KEY_ID"),
|
key_id=os.getenv("FAL_KEY_ID"),
|
||||||
key_secret=os.getenv("FAL_KEY_SECRET"),
|
key_secret=os.getenv("FAL_KEY_SECRET"),
|
||||||
)
|
)
|
||||||
lra = LLMResponseAggregator(messages)
|
lra = LLMAssistantResponseAggregator(messages)
|
||||||
ura = UserResponseAggregator(messages)
|
ura = LLMUserResponseAggregator(messages)
|
||||||
sp = StoryProcessor(messages, story)
|
sp = StoryProcessor(messages, story)
|
||||||
sig = StoryImageGenerator(story, llm, img)
|
sig = StoryImageGenerator(story, llm, img)
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ from dailyai.services.ai_services import AIService
|
|||||||
from typing import AsyncGenerator, Coroutine, List
|
from typing import AsyncGenerator, Coroutine, List
|
||||||
|
|
||||||
|
|
||||||
class BasicResponseAggregator(FrameProcessor):
|
class ResponseAggregator(FrameProcessor):
|
||||||
"""This frame processor aggregates frames between a start and an end frame
|
"""This frame processor aggregates frames between a start and an end frame
|
||||||
into complete text frame sentences.
|
into complete text frame sentences.
|
||||||
|
|
||||||
@@ -37,10 +37,10 @@ class BasicResponseAggregator(FrameProcessor):
|
|||||||
... if isinstance(frame, TextFrame):
|
... if isinstance(frame, TextFrame):
|
||||||
... print(frame.text)
|
... print(frame.text)
|
||||||
|
|
||||||
>>> aggregator = BasicResponseAggregator(start_frame = UserStartedSpeakingFrame,
|
>>> aggregator = ResponseAggregator(start_frame = UserStartedSpeakingFrame,
|
||||||
... end_frame=UserStoppedSpeakingFrame,
|
... end_frame=UserStoppedSpeakingFrame,
|
||||||
... accumulator_frame=TranscriptionFrame,
|
... accumulator_frame=TranscriptionFrame,
|
||||||
... pass_through=False)
|
... pass_through=False)
|
||||||
>>> asyncio.run(print_frames(aggregator, UserStartedSpeakingFrame()))
|
>>> asyncio.run(print_frames(aggregator, UserStartedSpeakingFrame()))
|
||||||
>>> asyncio.run(print_frames(aggregator, TranscriptionFrame("Hello,", 1, 1)))
|
>>> asyncio.run(print_frames(aggregator, TranscriptionFrame("Hello,", 1, 1)))
|
||||||
>>> asyncio.run(print_frames(aggregator, TranscriptionFrame("world.", 1, 2)))
|
>>> asyncio.run(print_frames(aggregator, TranscriptionFrame("world.", 1, 2)))
|
||||||
@@ -84,7 +84,7 @@ class BasicResponseAggregator(FrameProcessor):
|
|||||||
yield frame
|
yield frame
|
||||||
|
|
||||||
|
|
||||||
class UserTranscriptionAggregator(BasicResponseAggregator):
|
class UserResponseAggregator(ResponseAggregator):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
start_frame=UserStartedSpeakingFrame,
|
start_frame=UserStartedSpeakingFrame,
|
||||||
@@ -94,7 +94,7 @@ class UserTranscriptionAggregator(BasicResponseAggregator):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ResponseAggregator(FrameProcessor):
|
class LLMResponseAggregator(FrameProcessor):
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
@@ -139,7 +139,7 @@ class ResponseAggregator(FrameProcessor):
|
|||||||
yield frame
|
yield frame
|
||||||
|
|
||||||
|
|
||||||
class LLMResponseAggregator(ResponseAggregator):
|
class LLMAssistantResponseAggregator(LLMResponseAggregator):
|
||||||
def __init__(self, messages: list[dict]):
|
def __init__(self, messages: list[dict]):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
messages=messages,
|
messages=messages,
|
||||||
@@ -150,7 +150,7 @@ class LLMResponseAggregator(ResponseAggregator):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class UserResponseAggregator(ResponseAggregator):
|
class LLMUserResponseAggregator(LLMResponseAggregator):
|
||||||
def __init__(self, messages: list[dict]):
|
def __init__(self, messages: list[dict]):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
messages=messages,
|
messages=messages,
|
||||||
|
|||||||
Reference in New Issue
Block a user