Class ToolCallBehavior

    • 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.
      • formFullFunctionName

        public static String formFullFunctionName​(@Nullable
                                                  String pluginName,
                                                  String functionName)
        Form the full function name.
        Parameters:
        pluginName - The name of the plugin that the function is in.
        functionName - The name of the function.
        Returns:
        The key for the function.