Freigeben über


AIServiceExtensions.SelectAIService<T> Method

Definition

Resolves an IAIService and associated PromptExecutionSettings from the specified Kernel based on a KernelFunction and associated KernelArguments.

public static (T, Microsoft.SemanticKernel.PromptExecutionSettings?) SelectAIService<T> (this Microsoft.SemanticKernel.IAIServiceSelector selector, Microsoft.SemanticKernel.Kernel kernel, Microsoft.SemanticKernel.KernelFunction function, Microsoft.SemanticKernel.KernelArguments arguments) where T : class, Microsoft.SemanticKernel.Services.IAIService;
static member SelectAIService : Microsoft.SemanticKernel.IAIServiceSelector * Microsoft.SemanticKernel.Kernel * Microsoft.SemanticKernel.KernelFunction * Microsoft.SemanticKernel.KernelArguments -> ValueTuple<'T, Microsoft.SemanticKernel.PromptExecutionSettings (requires 'T : null and 'T :> Microsoft.SemanticKernel.Services.IAIService)> (requires 'T : null and 'T :> Microsoft.SemanticKernel.Services.IAIService)
<Extension()>
Public Function SelectAIService(Of T As {Class, IAIService}) (selector As IAIServiceSelector, kernel As Kernel, function As KernelFunction, arguments As KernelArguments) As ValueTuple(Of T, PromptExecutionSettings)

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

selector
IAIServiceSelector

The IAIServiceSelector to use to select a service from the Kernel.

kernel
Kernel

The Kernel containing services, plugins, and other state for use throughout the operation.

function
KernelFunction

The function.

arguments
KernelArguments

The function arguments.

Returns

A tuple of the selected service and the settings associated with the service (the settings may be null).

Exceptions

An appropriate service could not be found.

Applies to