Partager via


FunctionChoiceBehavior.Required Method

Definition

Gets an instance of the FunctionChoiceBehavior that provides either all of the Kernel's plugins' functions to the AI model to call or specified ones. This behavior forces the model to call the provided functions. SK connectors will invoke a requested function or multiple requested functions if the model requests multiple ones in one request, while handling the first request, and stop advertising the functions for the following requests to prevent the model from repeatedly calling the same function(s).

public static Microsoft.SemanticKernel.FunctionChoiceBehavior Required (System.Collections.Generic.IEnumerable<Microsoft.SemanticKernel.KernelFunction>? functions = default, bool autoInvoke = true, Microsoft.SemanticKernel.FunctionChoiceBehaviorOptions? options = default);
static member Required : seq<Microsoft.SemanticKernel.KernelFunction> * bool * Microsoft.SemanticKernel.FunctionChoiceBehaviorOptions -> Microsoft.SemanticKernel.FunctionChoiceBehavior
Public Shared Function Required (Optional functions As IEnumerable(Of KernelFunction) = Nothing, Optional autoInvoke As Boolean = true, Optional options As FunctionChoiceBehaviorOptions = Nothing) As FunctionChoiceBehavior

Parameters

functions
IEnumerable<KernelFunction>

Functions to provide to the model. If null, all of the Kernel's plugins' functions are provided to the model. If empty, no functions are provided to the model, which is equivalent to disabling function calling.

autoInvoke
Boolean

Indicates whether the functions should be automatically invoked by AI connectors.

options
FunctionChoiceBehaviorOptions

The behavior options.

Returns

An instance of one of the FunctionChoiceBehavior.

Applies to