This question originally came up in our Slack community and the thread has been consolidated here for long-term reference.
When executing a function_tool, I want to access the full chat history. How can I do this?
This question originally came up in our Slack community and the thread has been consolidated here for long-term reference.
When executing a function_tool, I want to access the full chat history. How can I do this?
You can call ctx.session.history to get the conversation history:
@function_tool(description="My tool")
async def my_tool(ctx: RunContext):
history = ctx.session.history
# history contains the conversation messages
return "Done"