BaseAIServiceSelector Class

  • java.lang.Object
    • com.microsoft.semantickernel.services.BaseAIServiceSelector

Implements

public abstract class BaseAIServiceSelector
implements AIServiceSelector

Base class for AIServiceSelector implementations which provides a Map based collection from which an AIService can be selected. The trySelectAIService(Class<T> serviceType, KernelFunction<?> function, KernelFunctionArguments arguments) method has been implemented. Child classes must implement the method #trySelectAIService(Class, KernelFunction, KernelFunctionArguments, Map).

Field Summary

Modifier and Type Field and Description
protected final AIServiceCollection services

Constructor Summary

Modifier Constructor Description
protected BaseAIServiceSelector(AIServiceCollection services)

Initializes a new instance of the BaseAIServiceSelector class.

Method Summary

Modifier and Type Method and Description
AIServiceSelection<T> trySelectAIService(Class<T> serviceType, KernelFunction<?> function, KernelFunctionArguments arguments)

Resolves an AIService and associated and PromptExecutionSettings based on the associated KernelFunction<T> and KernelFunctionArguments.

protected abstract AIServiceSelection<T> trySelectAIService(Class<T> serviceType, KernelFunction<?> function, KernelFunctionArguments arguments, Map<Class<? extends AIService>,AIService> services)

Resolves an AIService from the services argument using the specified function and arguments for selection.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Field Details

services

protected final AIServiceCollection services

Constructor Details

BaseAIServiceSelector

protected BaseAIServiceSelector(AIServiceCollection services)

Initializes a new instance of the BaseAIServiceSelector class.

Parameters:

services - The services to select from.

Method Details

trySelectAIService

public AIServiceSelection trySelectAIService(Class serviceType, KernelFunction function, KernelFunctionArguments arguments)

Resolves an AIService and associated and PromptExecutionSettings based on the associated KernelFunction<T> and KernelFunctionArguments.

Parameters:

serviceType
function
arguments

trySelectAIService

protected abstract AIServiceSelection trySelectAIService(Class serviceType, KernelFunction function, KernelFunctionArguments arguments, Map,AIService> services)

Resolves an AIService from the services argument using the specified function and arguments for selection.

Parameters:

serviceType - The type of service to select. This must be the same type with which the service was registered in the AIServiceSelection<T>
function - The KernelFunction to use to select the service, or null.
arguments - The KernelFunctionArguments to use to select the service, or null.
services - The services to select from.

Returns:

The selected service, or null if no service could be selected.

Applies to