AIServiceExtensions.SelectAIService 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.
Overloads
SelectAIService<T>(IAIServiceSelector, Kernel, KernelFunction, KernelArguments) |
Resolves an IAIService and associated PromptExecutionSettings from the specified Kernel based on a KernelFunction and associated KernelArguments. |
SelectAIService<T>(IAIServiceSelector, Kernel, IReadOnlyDictionary<String,PromptExecutionSettings>, KernelArguments) |
Resolves an IAIService and associated PromptExecutionSettings from the specified Kernel based on a KernelFunction and associated KernelArguments. |
SelectAIService<T>(IAIServiceSelector, Kernel, KernelFunction, KernelArguments)
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
SelectAIService<T>(IAIServiceSelector, Kernel, IReadOnlyDictionary<String,PromptExecutionSettings>, KernelArguments)
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, System.Collections.Generic.IReadOnlyDictionary<string,Microsoft.SemanticKernel.PromptExecutionSettings>? executionSettings, Microsoft.SemanticKernel.KernelArguments arguments) where T : class, Microsoft.SemanticKernel.Services.IAIService;
static member SelectAIService : Microsoft.SemanticKernel.IAIServiceSelector * Microsoft.SemanticKernel.Kernel * System.Collections.Generic.IReadOnlyDictionary<string, Microsoft.SemanticKernel.PromptExecutionSettings> * 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, executionSettings As IReadOnlyDictionary(Of String, PromptExecutionSettings), 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.
- executionSettings
- IReadOnlyDictionary<String,PromptExecutionSettings>
The dictionary of PromptExecutionSettings to use to select a service from the Kernel.
- 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.