Tool call fix for Spring AI - Let ADK call tools#733
Tool call fix for Spring AI - Let ADK call tools#733alexcheng1982 wants to merge 1 commit intogoogle:mainfrom
Conversation
Let ADK call tools
|
cc @ddobrin for your info |
|
Hi @alexcheng1982 It might be better that there is a (flexible) config which should allow for the selection of who should do function calling |
|
A couple of notes here:
The old code added both [link ](https://github.com/google/adk-java/blob/fba5f4fe41ac12f30ff68f9992051abbee17c2eb/contrib/spring-ai/src/main/java/com/google/adk/models/springai/MessageC
[link]( https://github.com/google/adk-java/blob/fba5f4fe41ac12f30ff68f9992051abbee17c2eb/contrib/spring-ai/src/main/java/com/google/adk/models/springai/MessageC |
|
hi the issue has been closed, but the PR remains open was this fixed? |
|
Could you please validate that the issue has been addressed at this time with the existing codebase? |
|
hi again the issue has not yet been resolved i manually added the fixes from this PR and everything was normal, but when I removed them, the error persists Caused by: java.lang.NullPointerException: Cannot invoke "com.google.adk.tools.ToolContext.eventActions()" because "toolContext" is null dependencies: |
|
@ddobrin Looking at the PR and the current source code, @arthuursantos is right and the changes in this PR don't seem to have been applied to the codebase right now. |
In the current implementation of Spring AI integration, tool calls are handled by Spring AI, this means the code needs to handle the conversion between Spring AI tools and ADK tools. This is unnecessary and introduces serval issues, like
ToolContextisnull(see #699 ), before and after tool callbacks are not invoked.In this PR, tool calls are handled by ADK, just like other
BaseLlmimplementations.internalToolExecutionEnabledtofalseinToolCallingChatOptions.FunctionToolCallbackin Spring AI simply returns empty strings.FunctionToolCallbackis only used to pass tool definitions. The actual tool calls are handled by ADK.ToolResponseMessageinMessageConverter.