OrderedAIServiceSelector Class

public class OrderedAIServiceSelector
extends BaseAIServiceSelector

Implementation of AIServiceSelector that selects the AI service based on the order of the execution settings. Uses the service id or model id to select the preferred service provider and then returns the service and associated execution settings.

Constructor Summary

Constructor Description
OrderedAIServiceSelector()

Initializes a new instance of the OrderedAIServiceSelector class with an empty collection of services.

OrderedAIServiceSelector(AIServiceCollection services)

Initializes a new instance of the OrderedAIServiceSelector class with the specified services.

Method Summary

Modifier and Type Method and Description
T getService(Class<T> clazz)

Gets the service of the specified type.

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.

AIService getService(String serviceId)

Gets the service with the specified service id.

Methods inherited from BaseAIServiceSelector

com.microsoft.semantickernel.services.BaseAIServiceSelector.<T>trySelectAIService(java.lang.Class<T>,com.microsoft.semantickernel.semanticfunctions.KernelFunction< com.microsoft.semantickernel.services.BaseAIServiceSelector.<T>trySelectAIService(java.lang.Class<T>,com.microsoft.semantickernel.semanticfunctions.KernelFunction<

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

Constructor Details

OrderedAIServiceSelector

public OrderedAIServiceSelector()

Initializes a new instance of the OrderedAIServiceSelector class with an empty collection of services.

OrderedAIServiceSelector

public OrderedAIServiceSelector(AIServiceCollection services)

Initializes a new instance of the OrderedAIServiceSelector class with the specified services.

Parameters:

services - The services to select from.

Method Details

getService

public T getService(Class clazz)

Gets the service of the specified type.

Parameters:

clazz - The type of service to get.

Returns:

The service of the specified type, or null if no such service exists.

trySelectAIService

public 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.

Overrides:

OrderedAIServiceSelector.trySelectAIService(Class<T> serviceType, KernelFunction<?> function, KernelFunctionArguments arguments, Map<Class<? extends AIService>,AIService> services)

Parameters:

serviceType
function
arguments
services

getService

public AIService getService(String serviceId)

Gets the service with the specified service id.

Parameters:

serviceId - The service id.

Returns:

The service with the specified service id, or null if no such service exists.

Applies to