Package com.microsoft.semantickernel
Class Kernel.Builder
- java.lang.Object
-
- com.microsoft.semantickernel.Kernel.Builder
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Kernelbuild()Build the kernel<T extends AIService>
Kernel.BuilderwithAIService(String serviceId, Function<KernelConfig,T> factory, boolean setAsDefault, Class<T> clazz)Adds a factory method to the services collection<T extends AIService>
Kernel.BuilderwithAIService(String serviceId, T instance, boolean setAsDefault, Class<T> clazz)Adds an instance to the services collection<T extends AIService>
Kernel.BuilderwithDefaultAIService(Supplier<T> factory, Class<T> clazz)Adds a factory method to the services collection<T extends AIService>
Kernel.BuilderwithDefaultAIService(T instance, Class<T> clazz)Adds an instance to the services collectionKernel.BuilderwithKernelConfig(KernelConfig kernelConfig)Set the kernel configurationKernel.BuilderwithMemory(SemanticTextMemory memory)Kernel.BuilderwithMemoryStore(MemoryStore memoryStore)Set the memory storeKernel.BuilderwithPromptTemplateEngine(PromptTemplateEngine promptTemplateEngine)Set the prompt template engine
-
-
-
Method Detail
-
withKernelConfig
public Kernel.Builder withKernelConfig(KernelConfig kernelConfig)
Set the kernel configuration- Parameters:
kernelConfig- Kernel configuration- Returns:
- Builder
-
withPromptTemplateEngine
public Kernel.Builder withPromptTemplateEngine(PromptTemplateEngine promptTemplateEngine)
Set the prompt template engine- Parameters:
promptTemplateEngine- Prompt template engine- Returns:
- Builder
-
withMemoryStore
public Kernel.Builder withMemoryStore(MemoryStore memoryStore)
Set the memory store- Parameters:
memoryStore- Memory store- Returns:
- Builder
-
withDefaultAIService
public <T extends AIService> Kernel.Builder withDefaultAIService(T instance, Class<T> clazz)
Adds an instance to the services collection- Parameters:
instance- The instance.clazz- The class of the instance.- Returns:
- The builder.
-
withAIService
public <T extends AIService> Kernel.Builder withAIService(@Nullable String serviceId, T instance, boolean setAsDefault, Class<T> clazz)
Adds an instance to the services collection- Parameters:
serviceId- The service IDinstance- The instance.setAsDefault- Optional: set as the default AI service for type Tclazz- The class of the instance.
-
withDefaultAIService
public <T extends AIService> Kernel.Builder withDefaultAIService(Supplier<T> factory, Class<T> clazz)
Adds a factory method to the services collection- Parameters:
factory- The factory method that creates the AI service instances of type T.clazz- The class of the instance.
-
withAIService
public <T extends AIService> Kernel.Builder withAIService(@Nullable String serviceId, Function<KernelConfig,T> factory, boolean setAsDefault, Class<T> clazz)
Adds a factory method to the services collection- Parameters:
serviceId- The service IDfactory- The factory method that creates the AI service instances of type T.setAsDefault- Optional: set as the default AI service for type Tclazz- The class of the instance.
-
withMemory
public Kernel.Builder withMemory(SemanticTextMemory memory)
-
build
public Kernel build()
Build the kernel- Returns:
- Kernel
-
-