Compare commits
1 Commits
hush/rtviS
...
mb/fully-d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d5f640bab |
@@ -458,7 +458,7 @@ async def on_audio_data(processor, audio, sample_rate, num_channels):
|
|||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
||||||
- `LLMUserResponseAggregator` and `LLMAssistantResponseAggregator` are
|
- `LLMUserResponseAggregator` and `LLMAssistantResponseAggregator` are
|
||||||
mostly deprecated, use `OpenAILLMContext` instead.
|
deprecated. Use `OpenAILLMContext` instead.
|
||||||
|
|
||||||
- The `vad` package is now deprecated and `audio.vad` should be used
|
- The `vad` package is now deprecated and `audio.vad` should be used
|
||||||
instead. The `avd` package will get removed in a future release.
|
instead. The `avd` package will get removed in a future release.
|
||||||
|
|||||||
@@ -14,14 +14,10 @@ from loguru import logger
|
|||||||
from runner import configure
|
from runner import configure
|
||||||
|
|
||||||
from pipecat.audio.filters.krisp_filter import KrispFilter
|
from pipecat.audio.filters.krisp_filter import KrispFilter
|
||||||
from pipecat.frames.frames import LLMMessagesFrame
|
|
||||||
from pipecat.pipeline.pipeline import Pipeline
|
from pipecat.pipeline.pipeline import Pipeline
|
||||||
from pipecat.pipeline.runner import PipelineRunner
|
from pipecat.pipeline.runner import PipelineRunner
|
||||||
from pipecat.pipeline.task import PipelineParams, PipelineTask
|
from pipecat.pipeline.task import PipelineParams, PipelineTask
|
||||||
from pipecat.processors.aggregators.llm_response import (
|
from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext
|
||||||
LLMAssistantResponseAggregator,
|
|
||||||
LLMUserResponseAggregator,
|
|
||||||
)
|
|
||||||
from pipecat.services.deepgram import DeepgramSTTService, DeepgramTTSService
|
from pipecat.services.deepgram import DeepgramSTTService, DeepgramTTSService
|
||||||
from pipecat.services.openai import OpenAILLMService
|
from pipecat.services.openai import OpenAILLMService
|
||||||
from pipecat.transports.services.daily import DailyParams, DailyTransport
|
from pipecat.transports.services.daily import DailyParams, DailyTransport
|
||||||
@@ -63,18 +59,18 @@ async def main():
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
tma_in = LLMUserResponseAggregator(messages)
|
context = OpenAILLMContext(messages)
|
||||||
tma_out = LLMAssistantResponseAggregator(messages)
|
context_aggregator = llm.create_context_aggregator(context)
|
||||||
|
|
||||||
pipeline = Pipeline(
|
pipeline = Pipeline(
|
||||||
[
|
[
|
||||||
transport.input(), # Transport user input
|
transport.input(), # Transport user input
|
||||||
stt, # STT
|
stt, # STT
|
||||||
tma_in, # User responses
|
context_aggregator.user(), # User responses
|
||||||
llm, # LLM
|
llm, # LLM
|
||||||
tts, # TTS
|
tts, # TTS
|
||||||
transport.output(), # Transport bot output
|
transport.output(), # Transport bot output
|
||||||
tma_out, # Assistant spoken responses
|
context_aggregator.assistant(), # Assistant spoken responses
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -84,7 +80,7 @@ async def main():
|
|||||||
async def on_first_participant_joined(transport, participant):
|
async def on_first_participant_joined(transport, participant):
|
||||||
# Kick off the conversation.
|
# Kick off the conversation.
|
||||||
messages.append({"role": "system", "content": "Please introduce yourself to the user."})
|
messages.append({"role": "system", "content": "Please introduce yourself to the user."})
|
||||||
await task.queue_frames([LLMMessagesFrame(messages)])
|
await task.queue_frames([context_aggregator.user().get_context_frame()])
|
||||||
|
|
||||||
runner = PipelineRunner()
|
runner = PipelineRunner()
|
||||||
|
|
||||||
|
|||||||
@@ -14,14 +14,10 @@ from dotenv import load_dotenv
|
|||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
from pipecat.audio.vad.silero import SileroVADAnalyzer
|
from pipecat.audio.vad.silero import SileroVADAnalyzer
|
||||||
from pipecat.frames.frames import LLMMessagesFrame
|
|
||||||
from pipecat.pipeline.pipeline import Pipeline
|
from pipecat.pipeline.pipeline import Pipeline
|
||||||
from pipecat.pipeline.runner import PipelineRunner
|
from pipecat.pipeline.runner import PipelineRunner
|
||||||
from pipecat.pipeline.task import PipelineParams, PipelineTask
|
from pipecat.pipeline.task import PipelineParams, PipelineTask
|
||||||
from pipecat.processors.aggregators.llm_response import (
|
from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext
|
||||||
LLMAssistantResponseAggregator,
|
|
||||||
LLMUserResponseAggregator,
|
|
||||||
)
|
|
||||||
from pipecat.services.cartesia import CartesiaTTSService
|
from pipecat.services.cartesia import CartesiaTTSService
|
||||||
from pipecat.services.deepgram import DeepgramSTTService
|
from pipecat.services.deepgram import DeepgramSTTService
|
||||||
from pipecat.services.openai import OpenAILLMService
|
from pipecat.services.openai import OpenAILLMService
|
||||||
@@ -74,19 +70,19 @@ async def main():
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
tma_in = LLMUserResponseAggregator(messages)
|
context = OpenAILLMContext(messages)
|
||||||
tma_out = LLMAssistantResponseAggregator(messages)
|
context_aggregator = llm.create_context_aggregator(context)
|
||||||
|
|
||||||
pipeline = Pipeline(
|
pipeline = Pipeline(
|
||||||
[
|
[
|
||||||
transport.input(), # Transport user input
|
transport.input(), # Transport user input
|
||||||
stt, # STT
|
stt, # STT
|
||||||
tma_in, # User responses
|
context_aggregator.user(), # User responses
|
||||||
llm, # LLM
|
llm, # LLM
|
||||||
tts, # TTS
|
tts, # TTS
|
||||||
tavus, # Tavus output layer
|
tavus, # Tavus output layer
|
||||||
transport.output(), # Transport bot output
|
transport.output(), # Transport bot output
|
||||||
tma_out, # Assistant spoken responses
|
context_aggregator.assistant(), # Assistant spoken responses
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -120,7 +116,7 @@ async def main():
|
|||||||
messages.append(
|
messages.append(
|
||||||
{"role": "system", "content": "Please introduce yourself to the user."}
|
{"role": "system", "content": "Please introduce yourself to the user."}
|
||||||
)
|
)
|
||||||
await task.queue_frames([LLMMessagesFrame(messages)])
|
await task.queue_frames([context_aggregator.user().get_context_frame()])
|
||||||
|
|
||||||
runner = PipelineRunner()
|
runner = PipelineRunner()
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
# SPDX-License-Identifier: BSD 2-Clause License
|
# SPDX-License-Identifier: BSD 2-Clause License
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import warnings
|
||||||
from typing import List, Type
|
from typing import List, Type
|
||||||
|
|
||||||
from pipecat.frames.frames import (
|
from pipecat.frames.frames import (
|
||||||
@@ -28,6 +29,16 @@ from pipecat.processors.aggregators.openai_llm_context import (
|
|||||||
from pipecat.processors.frame_processor import FrameDirection, FrameProcessor
|
from pipecat.processors.frame_processor import FrameDirection, FrameProcessor
|
||||||
|
|
||||||
|
|
||||||
|
def _deprecation_warning(old_class: str):
|
||||||
|
warnings.warn(
|
||||||
|
f"{old_class} is deprecated and will be removed in a future version. "
|
||||||
|
f"Instead, create an OpenAILLMContext and use llm.create_context_aggregator(context) "
|
||||||
|
f"to get context-aware aggregators via .user() and .assistant() methods.",
|
||||||
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class LLMResponseAggregator(FrameProcessor):
|
class LLMResponseAggregator(FrameProcessor):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
@@ -175,7 +186,10 @@ class LLMResponseAggregator(FrameProcessor):
|
|||||||
|
|
||||||
|
|
||||||
class LLMAssistantResponseAggregator(LLMResponseAggregator):
|
class LLMAssistantResponseAggregator(LLMResponseAggregator):
|
||||||
|
"""DEPRECATED: Create an OpenAILLMContext and use llm.create_context_aggregator(context).assistant() instead."""
|
||||||
|
|
||||||
def __init__(self, messages: List[dict] = []):
|
def __init__(self, messages: List[dict] = []):
|
||||||
|
_deprecation_warning("LLMAssistantResponseAggregator")
|
||||||
super().__init__(
|
super().__init__(
|
||||||
messages=messages,
|
messages=messages,
|
||||||
role="assistant",
|
role="assistant",
|
||||||
@@ -187,7 +201,10 @@ class LLMAssistantResponseAggregator(LLMResponseAggregator):
|
|||||||
|
|
||||||
|
|
||||||
class LLMUserResponseAggregator(LLMResponseAggregator):
|
class LLMUserResponseAggregator(LLMResponseAggregator):
|
||||||
|
"""DEPRECATED: Create an OpenAILLMContext and use llm.create_context_aggregator(context).user() instead."""
|
||||||
|
|
||||||
def __init__(self, messages: List[dict] = []):
|
def __init__(self, messages: List[dict] = []):
|
||||||
|
_deprecation_warning("LLMUserResponseAggregator")
|
||||||
super().__init__(
|
super().__init__(
|
||||||
messages=messages,
|
messages=messages,
|
||||||
role="user",
|
role="user",
|
||||||
|
|||||||
Reference in New Issue
Block a user