Class KernelFunction<T>

    • Method Detail

      • createFromMethod

        public static <T> KernelFunctionFromMethod.Builder<T> createFromMethod​(Method method,
                                                                               Object target)
        Creates a KernelFunction instance for a method, specified via a Method instance
        Type Parameters:
        T - The return type of the method.
        Parameters:
        method - The method to be represented via the created KernelFunction.
        target - The target object for the method if it represents an instance method. This should be null if and only if method is a static method.
        Returns:
        The created KernelFunction wrapper for method.
      • getPluginName

        @Nullable
        public String getPluginName()
        Returns:
        The name of the plugin that this function is within
      • getName

        public String getName()
        Returns:
        The name of this function
      • getDescription

        @Nullable
        public String getDescription()
        Returns:
        A description of the function
      • toEmbeddingString

        public String toEmbeddingString()
        Create a string for generating an embedding for a function.
        Returns:
        A string for generating an embedding for a function.
      • toManualString

        public String toManualString​(boolean includeOutputs)
        Create a manual-friendly string for a function.
        Parameters:
        includeOutputs - Whether to include function outputs in the string.
        Returns:
        A manual-friendly string for a function.
      • getExecutionSettings

        public Map<String,​PromptExecutionSettings> getExecutionSettings()
        Get an unmodifiable map of the execution settings for the function.
        Returns:
        An unmodifiable map of the execution settings for the function
      • getMetadata

        public KernelFunctionMetadata<?> getMetadata()
        Get the metadata for the function.
        Returns:
        The metadata for the function
      • invokeAsync

        public FunctionInvocation<T> invokeAsync​(Kernel kernel)
        Invokes this KernelFunction.
        Parameters:
        kernel - The Kernel containing services, plugins, and other state for use throughout the operation.
        Returns:
        The result of the function's execution.
      • invoke

        public FunctionResult<T> invoke​(Kernel kernel)
        Invokes this KernelFunction.
        Parameters:
        kernel - The Kernel containing services, plugins, and other state for use throughout the operation.
        Returns:
        The result of the function's execution.