Class KernelFunctionYaml


  • public class KernelFunctionYaml
    extends Object
    A class for creating a KernelFunction instance from a YAML representation of a prompt function.
    • Constructor Detail

      • KernelFunctionYaml

        public KernelFunctionYaml()
    • Method Detail

      • fromPromptYaml

        public static <T> KernelFunction<T> fromPromptYaml​(String yaml,
                                                           @Nullable
                                                           PromptTemplateFactory promptTemplateFactory)
                                                    throws IOException
        Create a KernelFunction instance for a prompt function using the specified markdown text.
        Type Parameters:
        T - The return type of the function.
        Parameters:
        yaml - YAML representation of the PromptTemplateConfig to use to create the prompt function
        promptTemplateFactory - Prompt template factory.
        Returns:
        The created KernelFunction.
        Throws:
        IOException - If an error occurs while reading the YAML.
      • fromPromptYaml

        public static <T> KernelFunction<T> fromPromptYaml​(String yaml)
                                                    throws IOException
        Create a KernelFunction instance for a prompt function using the specified markdown text.
        Type Parameters:
        T - The return type of the function.
        Parameters:
        yaml - YAML representation of the PromptTemplateConfig to use to create the prompt function
        Returns:
        The created KernelFunction.
        Throws:
        IOException - If an error occurs while reading the YAML.
      • fromYaml

        public static <T> KernelFunction<T> fromYaml​(Path filePath)
                                              throws IOException
        Create a KernelFunction instance for a prompt function using the specified markdown text.
        Type Parameters:
        T - The return type of the function.
        Parameters:
        filePath - Path to the YAML representation of the PromptTemplateConfig to use to create the prompt function
        Returns:
        The created KernelFunction.
        Throws:
        IOException - If an error occurs while reading the YAML.