diff --git a/examples/foundational/22-natural-conversation.py b/examples/foundational/22-natural-conversation.py index 9b6471f7c..5e6b0e501 100644 --- a/examples/foundational/22-natural-conversation.py +++ b/examples/foundational/22-natural-conversation.py @@ -104,8 +104,11 @@ async def main(): ) # This processor keeps the last context and will let it through once the - # notifier is woken up. - gated_context_aggregator = GatedOpenAILLMContextAggregator(notifier) + # notifier is woken up. We start with the gate open because we send an + # initial context frame to start the conversation. + gated_context_aggregator = GatedOpenAILLMContextAggregator( + notifier=notifier, start_open=True + ) # Notify if the user hasn't said anything. async def user_idle_notifier(frame): diff --git a/examples/foundational/22b-natural-conversation-proposal.py b/examples/foundational/22b-natural-conversation-proposal.py index 8f19618a8..57639fe20 100644 --- a/examples/foundational/22b-natural-conversation-proposal.py +++ b/examples/foundational/22b-natural-conversation-proposal.py @@ -129,9 +129,9 @@ class CompletenessCheck(FrameProcessor): class OutputGate(FrameProcessor): - def __init__(self, notifier: BaseNotifier, **kwargs): + def __init__(self, *, notifier: BaseNotifier, start_open: bool = False, **kwargs): super().__init__(**kwargs) - self._gate_open = False + self._gate_open = start_open self._frames_buffer = [] self._notifier = notifier @@ -252,7 +252,9 @@ async def main(): # sentence, this will wake up the notifier if that happens. user_idle = UserIdleProcessor(callback=user_idle_notifier, timeout=5.0) - bot_output_gate = OutputGate(notifier=notifier) + # We start with the gate open because we send an initial context frame + # to start the conversation. + bot_output_gate = OutputGate(notifier=notifier, start_open=True) async def block_user_stopped_speaking(frame): return not isinstance(frame, UserStoppedSpeakingFrame) diff --git a/examples/foundational/22c-natural-conversation-mixed-llms.py b/examples/foundational/22c-natural-conversation-mixed-llms.py index e4509da9c..1a24af21c 100644 --- a/examples/foundational/22c-natural-conversation-mixed-llms.py +++ b/examples/foundational/22c-natural-conversation-mixed-llms.py @@ -333,9 +333,9 @@ class CompletenessCheck(FrameProcessor): class OutputGate(FrameProcessor): - def __init__(self, notifier: BaseNotifier, **kwargs): + def __init__(self, *, notifier: BaseNotifier, start_open: bool = False, **kwargs): super().__init__(**kwargs) - self._gate_open = False + self._gate_open = start_open self._frames_buffer = [] self._notifier = notifier @@ -461,7 +461,9 @@ async def main(): # sentence, this will wake up the notifier if that happens. user_idle = UserIdleProcessor(callback=user_idle_notifier, timeout=5.0) - bot_output_gate = OutputGate(notifier=notifier) + # We start with the gate open because we send an initial context frame + # to start the conversation. + bot_output_gate = OutputGate(notifier=notifier, start_open=True) async def block_user_stopped_speaking(frame): return not isinstance(frame, UserStoppedSpeakingFrame)