wooden-beard-26644
08/18/2025, 5:46 PMtall-airline-16756
08/18/2025, 5:46 PMtall-airline-16756
08/18/2025, 5:47 PMChatMessage
with the role "assistant". This message comes through as a ConversationItemAddedEvent
containing the speech content.
• Tool Calls: Tool calls from the LLM show up as FunctionCall
and FunctionCallOutput
events, which are emitted as FunctionToolsExecutedEvent
.
Here’s a simple example to help you capture these events:
conversation_events = []
tool_executed_events = []
session.on("conversation_item_added", lambda ev: conversation_events.append(ev))
session.on("function_tools_executed", lambda ev: tool_executed_events.append(ev))
# After processing...
# Check speech messages
for event in conversation_events:
if event.item.role == "assistant":
print("LLM Speech:", event.item.text_content)
# Check tool calls and outputs
for event in tool_executed_events:
for fnc_call in event.function_calls:
print("Tool Call:", fnc_call.name)
for fnc_output in event.function_call_outputs:
print("Tool Output:", fnc_output)
Hopefully, this makes it easier for you to verify both the speech responses and the tool executions from the LLM. If you have any questions or need a hand, just let me know!