Skip to content

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

@ThomasVitale

Description

@ThomasVitale

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions