Package com.microsoft.semantickernel
Class Kernel.Builder
- java.lang.Object
-
- com.microsoft.semantickernel.Kernel.Builder
-
- All Implemented Interfaces:
SemanticKernelBuilder<Kernel>
- Enclosing class:
- Kernel
public static class Kernel.Builder extends Object implements SemanticKernelBuilder<Kernel>
A fluent builder for creating a new instance ofKernel.
-
-
Constructor Summary
Constructors Constructor Description Builder()Construct a Builder for creating a new instance ofKernel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Kernelbuild()Builds a new instance ofKernelwith the services and plugins provided.<T extends AIService>
Kernel.BuilderwithAIService(Class<T> clazz, T aiService)Adds a service to the kernel.Kernel.BuilderwithPlugin(KernelPlugin plugin)Adds a plugin to the kernel.Kernel.BuilderwithServiceSelector(Function<AIServiceCollection,AIServiceSelector> serviceSelector)Sets the service selector provider for the kernel.
-
-
-
Method Detail
-
withAIService
public <T extends AIService> Kernel.Builder withAIService(Class<T> clazz, T aiService)
Adds a service to the kernel.- Type Parameters:
T- The type of the service to add.- Parameters:
clazz- The class of the service to add.aiService- The service to add.- Returns:
thisbuilder with the service added.
-
withPlugin
public Kernel.Builder withPlugin(KernelPlugin plugin)
Adds a plugin to the kernel.- Parameters:
plugin- The plugin to add.- Returns:
thisbuilder with the plugin added.
-
withServiceSelector
public Kernel.Builder withServiceSelector(Function<AIServiceCollection,AIServiceSelector> serviceSelector)
Sets the service selector provider for the kernel.- Parameters:
serviceSelector- The service selector provider for the kernel.- Returns:
thisbuilder with the service selector provider set.
-
build
public Kernel build()
Builds a new instance ofKernelwith the services and plugins provided.- Specified by:
buildin interfaceSemanticKernelBuilder<Kernel>- Returns:
- A new instance of
Kernel.
-
-