IAIServiceSelector.TrySelectAIService<T> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Resolves an IAIService and associated PromptExecutionSettings from the specified Kernel based on a KernelFunction and associated KernelArguments.
public bool TrySelectAIService<T> (Microsoft.SemanticKernel.Kernel kernel, Microsoft.SemanticKernel.KernelFunction function, Microsoft.SemanticKernel.KernelArguments arguments, out T? service, out Microsoft.SemanticKernel.PromptExecutionSettings? serviceSettings) where T : class, Microsoft.SemanticKernel.Services.IAIService;
abstract member TrySelectAIService : Microsoft.SemanticKernel.Kernel * Microsoft.SemanticKernel.KernelFunction * Microsoft.SemanticKernel.KernelArguments * 'T * PromptExecutionSettings -> bool (requires 'T : null and 'T :> Microsoft.SemanticKernel.Services.IAIService)
Public Function TrySelectAIService(Of T As {Class, IAIService}) (kernel As Kernel, function As KernelFunction, arguments As KernelArguments, ByRef service As T, ByRef serviceSettings As PromptExecutionSettings) As Boolean
Type Parameters
- T
Specifies the type of the IAIService required. This must be the same type with which the service was registered in the IServiceCollection orvia the IKernelBuilder.
Parameters
- kernel
- Kernel
The Kernel containing services, plugins, and other state for use throughout the operation.
- function
- KernelFunction
The function.
- arguments
- KernelArguments
The function arguments.
- service
- T
The selected service, or null if none was selected.
- serviceSettings
- PromptExecutionSettings
The settings associated with the selected service. This may be null even if a service is selected.
Returns
true if a matching service was selected; otherwise, false.