ChatResponse chatResponse = chatClient.prompt() .user(prompt) .tools(new OpenIaFunctions()) .advisors( a -> a .param(AbstractChatMemoryAdvisor.CHAT_MEMORY_CONVERSATION_ID_KEY, finalClientId) .param(AbstractChatMemoryAdvisor.CHAT_MEMORY_RETRIEVE_SIZE_KEY, 100) ) .call() .chatResponse();
List
but in my tool
@Tool(description = "Return a hello.")
public String saudacao(@ToolParam(description = "name to say hello") String name) {
**log.info("acess function");**
return "Hello, " + name+ "!";
}
the log.info("acess function"); is show.
So my log shows that the tool was activated but the chatresponse list is empty, why?
I'm using the M8 version.
Comment From: markpollack
We internally intercept the tool call messages sent by the model by default. If you want to have more finer grained control over getting access the the back and forth of messages sent for tool calling, you can follow this approach
https://docs.spring.io/spring-ai/reference/api/tools.html#_user_controlled_tool_execution
Comment From: markpollack
Closing the issue, please reopen if necessary.
Comment From: hopperd
I'm not sure using the User Controlled Tool Execution
is what was originally being requested here. I know for our use case we want Spring AI to handle all the tool calling we just want to be able to introspect once the entire response is done to get a list of all the tools that were called. It feels like the call to chatResponse.getResult().getOutput().getToolCalls();
should return all the tools that were actually executed as part of the exchange with AI.
I'd like to reopen this issue b/c it seems like this is missing in terms of getting all the tools that were called for audit and tracking purposes which we use in our app.