-
Notifications
You must be signed in to change notification settings - Fork 945
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
Advancing Tool Support - Part 2 #2085
base: main
Are you sure you want to change the base?
Conversation
* Enhanced support for functions as tools via FunctionToolCallback (deprecating the existing FunctionInvokingFunctionCallback). * Aligned JSON Schema generation and parsing logic between function-based and method-based tools. * Deprecated previous client-side function calling APIs. * Included AOT configuration for Tool-annotated methods in Spring beans. Relates to spring-projectsgh-2049 Signed-off-by: Thomas Vitale <[email protected]>
30165fe
to
29b9b1b
Compare
* @author Thomas Vitale | ||
* @since 1.0.0 | ||
*/ | ||
class ToolBeanRegistrationAotProcessor implements BeanRegistrationAotProcessor { |
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.
@sdeleuze I followed your tips and implemented this BeanRegistrationAotProcessor
to process Spring beans which contain @Tool
-annotated methods. I included unit tests and also tested it in a GraalVM-based app here: https://github.com/ThomasVitale/llm-apps-java-spring-ai/tree/main/patterns/tool-calling/tool-calling-openai
return builder(name, function); | ||
} | ||
|
||
public static class Builder<I, O> { |
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.
I kept a similar API to the one in FunctionCallback.Builder so to make it straightforward to migrate to this new Builder.
@NonNullFields | ||
package org.springframework.ai.aot; | ||
|
||
import org.springframework.lang.NonNullApi; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
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.
Spring Framework is migrating to JSpecify in the new generation (version 7). When that happens, I imagine the other Spring projects (including Spring AI) will follow. The current generation is still Spring Framework 6, where JSpecify is not adopted.
Relates to gh-2049