I think this works
This commit is contained in:
@@ -49,15 +49,11 @@ class ContextSwitcher:
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Update context with new messages
|
# Update context with new messages
|
||||||
# await self._llm.push_frame(LLMMessagesUpdateFrame(messages))
|
|
||||||
self._context_aggregator.set_messages(messages)
|
self._context_aggregator.set_messages(messages)
|
||||||
context_frame = self._context_aggregator.get_context_frame()
|
context_frame = self._context_aggregator.get_context_frame()
|
||||||
# Trigger LLM response by pushing a context frame
|
# Trigger LLM response by pushing a context frame
|
||||||
pprint(vars(context_frame.context))
|
pprint(vars(context_frame.context))
|
||||||
await self._llm.queue_frame(context_frame)
|
await self._llm.push_frame(context_frame)
|
||||||
|
|
||||||
|
|
||||||
## Call result callback
|
|
||||||
|
|
||||||
|
|
||||||
class FunctionHandlers:
|
class FunctionHandlers:
|
||||||
@@ -68,19 +64,19 @@ class FunctionHandlers:
|
|||||||
self, function_name, tool_call_id, args, llm, context, result_callback
|
self, function_name, tool_call_id, args, llm, context, result_callback
|
||||||
):
|
):
|
||||||
await self.context_switcher.switch_context(system_instruction="Always respond with Apple")
|
await self.context_switcher.switch_context(system_instruction="Always respond with Apple")
|
||||||
# await result_callback("")
|
await result_callback("Always respond with Apple")
|
||||||
|
|
||||||
async def respond_with_banana(
|
async def respond_with_banana(
|
||||||
self, function_name, tool_call_id, args, llm, context, result_callback
|
self, function_name, tool_call_id, args, llm, context, result_callback
|
||||||
):
|
):
|
||||||
await self.context_switcher.switch_context(system_instruction="Always respond with Banana")
|
await self.context_switcher.switch_context(system_instruction="Always respond with Banana")
|
||||||
# await result_callback("")
|
await result_callback("Always respond with banana")
|
||||||
|
|
||||||
async def respond_with_oranges(
|
async def respond_with_oranges(
|
||||||
self, function_name, tool_call_id, args, llm, context, result_callback
|
self, function_name, tool_call_id, args, llm, context, result_callback
|
||||||
):
|
):
|
||||||
await self.context_switcher.switch_context(system_instruction="Always respond with Oranges")
|
await self.context_switcher.switch_context(system_instruction="Always respond with Oranges")
|
||||||
# await result_callback("")
|
await result_callback("Always respond with oranges")
|
||||||
|
|
||||||
|
|
||||||
async def terminate_call(
|
async def terminate_call(
|
||||||
|
|||||||
Reference in New Issue
Block a user