Class ToolCallBehavior
- java.lang.Object
-
- com.microsoft.semantickernel.orchestration.ToolCallBehavior
-
- Direct Known Subclasses:
ToolCallBehavior.AllowedKernelFunctions,ToolCallBehavior.RequiredKernelFunction
public class ToolCallBehavior extends Object
Defines the behavior of a tool call. Currently, the only tool available is function calling.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classToolCallBehavior.AllowedKernelFunctionsA set of allowed kernel functions.static classToolCallBehavior.RequiredKernelFunctionA required kernel function.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ToolCallBehaviorallowAllKernelFunctions(boolean autoInvoke)Allow all kernel functions.static ToolCallBehaviorallowOnlyKernelFunctions(boolean autoInvoke, KernelFunction<?>... functions)Allow a set of kernel functions.static ToolCallBehaviorallowOnlyKernelFunctions(boolean autoInvoke, List<KernelFunction<?>> functions)Allow a set of kernel functions.static StringformFullFunctionName(String pluginName, String functionName)Form the full function name.intgetMaximumAutoInvokeAttempts()Get the maximum number of times that auto-invocation will be attempted.booleanisAutoInvokeAllowed()Check whether auto-invocation is enabled.static ToolCallBehaviorrequireKernelFunction(KernelFunction<?> function)Require a function.
-
-
-
Method Detail
-
allowAllKernelFunctions
public static ToolCallBehavior allowAllKernelFunctions(boolean autoInvoke)
Allow all kernel functions. All Kernel functions will be passed to the model.- Parameters:
autoInvoke- Enable or disable auto-invocation. If auto-invocation is enabled, the model may request that the Semantic Kernel invoke the kernel functions and return the value to the model.- Returns:
- A new ToolCallBehavior instance with all kernel functions allowed.
-
requireKernelFunction
public static ToolCallBehavior requireKernelFunction(KernelFunction<?> function)
Require a function. The required function will be the only function passed to the model and forces the model to call the function. Only one function can be required.- Parameters:
function- The function to require.- Returns:
- A new ToolCallBehavior instance with the required function.
-
allowOnlyKernelFunctions
public static ToolCallBehavior allowOnlyKernelFunctions(boolean autoInvoke, List<KernelFunction<?>> functions)
Allow a set of kernel functions. If a function is allowed, it may be called. If it is not allowed, it will not be called. By default, all functions are not allowed.- Parameters:
autoInvoke- Enable or disable auto-invocation. If auto-invocation is enabled, the model may request that the Semantic Kernel invoke the kernel functions and return the value to the model.functions- The functions to allow.- Returns:
- A new ToolCallBehavior instance with the allowed functions.
-
allowOnlyKernelFunctions
public static ToolCallBehavior allowOnlyKernelFunctions(boolean autoInvoke, KernelFunction<?>... functions)
Allow a set of kernel functions. If a function is allowed, it may be called. If it is not allowed, it will not be called. By default, all functions are not allowed.- Parameters:
autoInvoke- Enable or disable auto-invocation. If auto-invocation is enabled, the model may request that the Semantic Kernel invoke the kernel functions and return the value to the model.functions- The functions to allow.- Returns:
- A new ToolCallBehavior instance with the allowed functions.
-
isAutoInvokeAllowed
public boolean isAutoInvokeAllowed()
Check whether auto-invocation is enabled.- Returns:
- Whether auto-invocation is enabled.
-
getMaximumAutoInvokeAttempts
public int getMaximumAutoInvokeAttempts()
Get the maximum number of times that auto-invocation will be attempted.- Returns:
- The maximum number of attempts.
-
-