Share via


Kernel.Builder Class

  • java.lang.Object
    • com.microsoft.semantickernel.Kernel.Builder

Implements

public static class Kernel.Builder
implements SemanticKernelBuilder<Kernel>

A fluent builder for creating a new instance of Kernel.

Constructor Summary

Constructor Description
Builder()

Construct a Builder for creating a new instance of Kernel.

Method Summary

Modifier and Type Method and Description
Builder withAIService(Class<T> clazz, T aiService)

Adds a service to the kernel.

Kernel build()

Builds a new instance of Kernel with the services and plugins provided.

Builder withPlugin(KernelPlugin plugin)

Adds a plugin to the kernel.

Builder withServiceSelector(Function<AIServiceCollection,AIServiceSelector> serviceSelector)

Sets the service selector provider for the kernel.

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

Builder

public Builder()

Construct a Builder for creating a new instance of Kernel.

Method Details

withAIService

public Kernel.Builder withAIService(Class clazz, T aiService)

Adds a service to the kernel.

Parameters:

clazz - The class of the service to add.
aiService - The service to add.

Returns:

this builder with the service added.

build

public Kernel build()

Builds a new instance of Kernel with the services and plugins provided.

Returns:

A new instance of Kernel.

withPlugin

public Kernel.Builder withPlugin(KernelPlugin plugin)

Adds a plugin to the kernel.

Parameters:

plugin - The plugin to add.

Returns:

this builder with the plugin added.

withServiceSelector

public Kernel.Builder withServiceSelector(Function serviceSelector)

Sets the service selector provider for the kernel.

Parameters:

serviceSelector - The service selector provider for the kernel.

Returns:

this builder with the service selector provider set.

Applies to