Class AutomaticFunctionCallingResponder (1.9.0)

public final class AutomaticFunctionCallingResponder

A responder that automatically calls functions when requested by the GenAI model.

Inheritance

java.lang.Object > AutomaticFunctionCallingResponder

Constructors

AutomaticFunctionCallingResponder()

public AutomaticFunctionCallingResponder()

Constructs an AutomaticFunctionCallingResponder instance.

AutomaticFunctionCallingResponder(int maxFunctionCalls)

public AutomaticFunctionCallingResponder(int maxFunctionCalls)

Constructs an AutomaticFunctionCallingResponder instance.

Parameter
Name Description
maxFunctionCalls int

the maximum number of function calls to make in a row

Methods

addCallableFunction(String functionName, Method callableFunction, String[] orderedParameterNames)

public void addCallableFunction(String functionName, Method callableFunction, String[] orderedParameterNames)

Adds a callable function to the AutomaticFunctionCallingResponder.

Note:: If you don't want to manually provide parameter names, you can ignore orderedParameterNames and compile your code with the "-parameters" flag. In this case, the parameter names can be auto retrieved from reflection.

Parameters
Name Description
functionName String

the name of the function

callableFunction Method

the method to call when the functionName is requested

orderedParameterNames String[]

the names of the parameters in the order they are passed to the function

getMaxFunctionCalls()

public int getMaxFunctionCalls()

Gets the maximum number of function calls to make in a row.

Returns
Type Description
int

setMaxFunctionCalls(int maxFunctionCalls)

public void setMaxFunctionCalls(int maxFunctionCalls)

Sets the maximum number of function calls to make in a row.

Parameter
Name Description
maxFunctionCalls int