-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Update tools.adoc About toolDefinition parameter transfer error #3468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There shouldn't be a method here. This is obviously wrong. Signed-off-by: qwp_p <70431503+RobinElysia@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please refer to the following source code. I don't think there is any error in the document itself. Could you please double-check it?
spring-ai/spring-ai-model/src/main/java/org/springframework/ai/tool/support/ToolDefinitions.java
Line 47 in 694bb50
public static DefaultToolDefinition.Builder builder(Method method) { |
Ok, maybe it's my version problem.😂 |
No, no, no, that's not right. The version is fine. Sorry, it seems to be the fault of the document sample.😦 |
This should be the interface: |
I'm a bit confused about what you mean, the sample code in the current sample documentation is as follows: spring-ai/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/tools.adoc Lines 318 to 324 in 694bb50
According to the interface definition, the spring-ai/spring-ai-model/src/main/java/org/springframework/ai/tool/method/MethodToolCallback.java Lines 210 to 213 in 694bb50
and Line 67 in 694bb50
which I don't seem to see a problem with. |
Method method = ReflectionUtils.findMethod(DateTimeTools.class, "getCurrentDateTime");
ToolCallback toolCallback = MethodToolCallback.builder()
.toolDefinition(ToolDefinition.builder() // Shouldn't method be passed here?
.description("Get the current date and time in the user's timezone")
.build())
.toolMethod(method)
.toolObject(new DateTimeTools())
.build();