Class Kernel.Builder

  • Enclosing interface:
    Kernel

    public static class Kernel.Builder
    extends Object
    • Constructor Detail

      • Builder

        public Builder()
    • 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 AIServiceKernel.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 AIServiceKernel.Builder withAIService​(@Nullable
                                                                  String serviceId,
                                                                  T instance,
                                                                  boolean setAsDefault,
                                                                  Class<T> clazz)
        Adds an instance to the services collection
        Parameters:
        serviceId - The service ID
        instance - The instance.
        setAsDefault - Optional: set as the default AI service for type T
        clazz - The class of the instance.
      • withDefaultAIService

        public <T extends AIServiceKernel.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 AIServiceKernel.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 ID
        factory - The factory method that creates the AI service instances of type T.
        setAsDefault - Optional: set as the default AI service for type T
        clazz - The class of the instance.
      • build

        public Kernel build()
        Build the kernel
        Returns:
        Kernel