Annotation Type DefineKernelFunction


  • @Retention(RUNTIME)
    @Target(METHOD)
    public @interface DefineKernelFunction
    Annotation that defines a method that can be invoked as a native function
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      String description
      The description of what the function does.
      String name
      The name of the function.
      String returnDescription
      The description of the return value of the function.
      String returnType
      The fully qualified class name of the return value of the function, for example, "java.lang.String".
      SKSample[] samples
      Examples of how to use the function.
    • Element Detail

      • description

        String description
        The description of what the function does. The description should be short and concise. The model uses the description to determine whether the function is a good match for use to complete a prompt. If the model is not selecting a function when it should be, consider adding more detail to the description.
        Returns:
        the description of the function, or an empty string if no description is provided.
        Default:
        ""
      • name

        String name
        The name of the function.
        Returns:
        the name of the function, or an empty string if no name is provided.
        Default:
        ""
      • returnType

        String returnType
        The fully qualified class name of the return value of the function, for example, "java.lang.String". If this parameter is not provided, the model will attempt to infer the return type from the method signature. For async methods provide the return from the async method, i.e. if the method returns a Mono<String> then the returnType should be "java.lang.String".
        Returns:
        the fully qualified class name of the return value of the function
        Default:
        ""
      • returnDescription

        String returnDescription
        The description of the return value of the function. The description should be short and concise.
        Returns:
        the description of the return value of the function, or an empty string if no description is provided.
        Default:
        ""
      • samples

        SKSample[] samples
        Examples of how to use the function. The examples should be short and concise. The Semantic Kernel can use the examples to help the model understand how the function is used.
        Returns:
        Examples of how to use the function, or an empty array if no examples are provided.
        Default:
        {}