AppFunctionSchemaDefinition


@Retention(value = AnnotationRetention.BINARY)
@Target(allowedTargets = [AnnotationTarget.CLASS])
public annotation AppFunctionSchemaDefinition


Marks an interface as a pre-defined schema for an App Function.

The provided metadata will be stored in AppSearch when indexing App Functions. Agents can then retrieve this metadata as an AppFunctionSchemaMetadata object by calling AppFunctionManagerCompat.observeAppFunctions. Agent developers can define and share these annotated App Function schemas as an SDK with app developers.

A pre-defined schema outlines an App Function's capabilities, including its parameters and return type. Knowing the schema in advance allows agents to perform tasks like model fine-tuning for more accurate function calling.

For example, here's how you might define a findNotes function schema:

@AppFunctionSchemaDefinition(name = "findNotes", version = 1, category = "Notes")
interface FindNotesSchema {
suspend fun findNotes(
appFunctionContext: AppFunctionContext,
params: FindNotesParams,
)
: List<Note>
}

Summary

Public constructors

AppFunctionSchemaDefinition(
    @NonNull String name,
    int version,
    @NonNull String category
)

Public methods

final @NonNull String

The category of the schema.

final @NonNull String

The name of the schema.

final int

The version of the schema.

Public constructors

AppFunctionSchemaDefinition

public AppFunctionSchemaDefinition(
    @NonNull String name,
    int version,
    @NonNull String category
)

Public methods

getCategory

public final @NonNull String getCategory()

The category of the schema.

getName

public final @NonNull String getName()

The name of the schema.

getVersion

public final int getVersion()

The version of the schema.