Skip to content
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

[Core] Implementations of FunctionCallback.Builder cannot instantiate FunctionInvokingFunctionCallback and MethodInvokingFunctionCallback #2032

Open
ThomasVitale opened this issue Jan 3, 2025 · 0 comments · May be fixed by #2033

Comments

@ThomasVitale
Copy link
Contributor

ThomasVitale commented Jan 3, 2025

Bug description
The FunctionInvokingFunctionCallback and MethodInvokingFunctionCallback classes have package-scoped constructors, meaning that it's not possible to instantiate them outside their package. As a consequence, the only way to get instances is via Reflection or via the DefaultFunctionCallbackBuilder. Among the other things, this issue impacts custom implementations of FunctionCallback.Builder.

Environment
Spring AI: 1.0.0-SNAPSHOT
Java: 23

Expected behavior
The FunctionInvokingFunctionCallback and MethodInvokingFunctionCallback classes can be instantiated outside their package.

Minimal Complete Reproducible example
See the consequence of this issue here, where Reflection had to be used to instantiate FunctionInvokingFunctionCallback (example) and MethodInvokingFunctionCallback (example).

ThomasVitale added a commit to ThomasVitale/spring-ai that referenced this issue Jan 3, 2025
* Make constructor in MethodInvokingFunctionCallback public.
* Make constructor in FunctionInvokingFunctionCallback public.
* Make JSON Schema Generation strategy in MethodInvokingFunctionCallback more customizable.

Fixes spring-projectsgh-2032

Signed-off-by: Thomas Vitale <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant