Share via


DefineKernelFunction Interface

Implements

java.lang.annotation.Annotation

public interface DefineKernelFunction
implements java.lang.annotation.Annotation

Annotation that defines a method that can be invoked as a native function

Method Summary

Modifier and Type Method and Description
abstract java.lang.String description()

The description of what the function does.

abstract java.lang.String name()

The name of the function.

abstract java.lang.String returnDescription()

The description of the return value of the function.

abstract java.lang.String returnType()

The fully qualified class name of the return value of the function, for example, "java.lang.String".

abstract SKSample[] samples()

Examples of how to use the function.

Method Details

description

public abstract 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.

name

public abstract String name()

The name of the function.

Returns:

the name of the function, or an empty string if no name is provided.

returnDescription

public abstract 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.

returnType

public abstract 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

samples

public abstract 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.

Applies to