Bug description The class DefaultFunctionCallbackBuilder has a field private String inputTypeSchema, but there is no .build() method to costruct an instance of a FunctionCallback defined at runtime. The class FunctionInvokingFunctionCallback has not public constructor.

Environment Spring AI version: 1.0.0-SNAPSHOT Java version: 17

Expected behavior I need a public usable Builder where I can set the name, the description and the JSON schema in string format (and not necessarily a Class) and returning an instance of FunctionCallback.

    DefaultFunctionCallbackBuilder defaultFunctionCallbackBuilder = new DefaultFunctionCallbackBuilder();
    FunctionCallback.Builder builder = defaultFunctionCallbackBuilder
            .description(description).inputTypeSchema(parameters)
            .schemaType(FunctionCallbackContext.SchemaType.JSON_SCHEMA);
    FunctionCallback functionCallback = builder.build();    // MISSING !
    ChatOptions promptOptions = AzureOpenAiChatOptions.builder()
            .withResponseFormat(AzureOpenAiResponseFormat.JSON)
            .withFunctionCallbacks(List.of(functionCallback)).build();

Comment From: markpollack

Some changes were made to the builder since we got to triage this issue.

You can use this style of the builder to achieve what you want now.

    FunctionCallback.builder().function("functionName", input -> "output").inputTypeSchema("my custom schema").description("my description").schemaType(FunctionCallback.SchemaType.JSON_SCHEMA);

Let us know if this solves your issue.

Thanks

Comment From: ilayaperumalg

Closing this as the support around FunctionCallback and the generic Tool support is being addressed here

Comment From: fedecompa

@ilayaperumalg how can I adapt the same working code by @markpollack with the new FunctionToolCallback since FunctionCallback is deprecated?

I need to set dynamically the Strings name, description and inputSchema

Comment From: ilayaperumalg

@fedecompa Please refer to this documentation for using FunctionToolCallback. This documentation will soon be merged into reference document once all the changes related to the FunctionToolCallback is completed.

Comment From: fedecompa

@ilayaperumalg I can't find in the documentation an option to set name, description and inputSchema as STRINGS

Comment From: ilayaperumalg

Does this help?

Comment From: fedecompa

@ilayaperumalg yes, thanks. Is there also the support for Structured Outputs?

https://medium.com/@ingridwickstevens/transform-unstructured-legal-text-into-organized-data-with-openais-structured-outputs-0a6a6aaf553b