AutoFunctionDeclaration.Companion

public static class AutoFunctionDeclaration.Companion


Summary

Public methods

static final @NonNull AutoFunctionDeclaration<@NonNull I, @NonNull FunctionResponsePart>
<I extends Object> create(
    @NonNull String functionName,
    @NonNull String description,
    @NonNull JsonSchema<@NonNull I> inputSchema,
    SuspendFunction1<@NonNull I, @NonNull FunctionResponsePart> functionReference
)

Creates a strongly typed function declaration with an associated function reference.

static final @NonNull AutoFunctionDeclaration<@NonNull I, @NonNull O>
<I extends Object, O extends Object> create(
    @NonNull String functionName,
    @NonNull String description,
    @NonNull JsonSchema<@NonNull I> inputSchema,
    @NonNull JsonSchema<@NonNull O> outputSchema,
    SuspendFunction1<@NonNull I, @NonNull O> functionReference
)

Creates a strongly typed function declaration with an associated function reference.

Public methods

create

public static final @NonNull AutoFunctionDeclaration<@NonNull I, @NonNull FunctionResponsePart> <I extends Object> create(
    @NonNull String functionName,
    @NonNull String description,
    @NonNull JsonSchema<@NonNull I> inputSchema,
    SuspendFunction1<@NonNull I, @NonNull FunctionResponsePart> functionReference
)

Creates a strongly typed function declaration with an associated function reference. This version allows an arbitrary JsonObject as output rather than a strict schema.

Parameters
@NonNull String functionName

the name of the function (to the model)

@NonNull String description

the description of the function

@NonNull JsonSchema<@NonNull I> inputSchema

the object the model must provide to you as input

SuspendFunction1<@NonNull I, @NonNull FunctionResponsePart> functionReference

the function that will be executed when requested by the model

create

public static final @NonNull AutoFunctionDeclaration<@NonNull I, @NonNull O> <I extends Object, O extends Object> create(
    @NonNull String functionName,
    @NonNull String description,
    @NonNull JsonSchema<@NonNull I> inputSchema,
    @NonNull JsonSchema<@NonNull O> outputSchema,
    SuspendFunction1<@NonNull I, @NonNull O> functionReference
)

Creates a strongly typed function declaration with an associated function reference.

Parameters
@NonNull String functionName

the name of the function (to the model)

@NonNull String description

the description of the function

@NonNull JsonSchema<@NonNull I> inputSchema

the object the model must provide to you as input

@NonNull JsonSchema<@NonNull O> outputSchema

the type that will be return to the model when the function is executed

SuspendFunction1<@NonNull I, @NonNull O> functionReference

the function that will be executed when requested by the model.