AutoFunctionDeclaration

Defines a function that the model can use as a tool. Including a function references to enable automatic function calling.

When generating responses, the model might need external information or require the application to perform an action. AutoFunctionDeclaration provides the necessary information for the model to create a FunctionCallPart, which instructs the client to execute the corresponding function. The client then sends the result back to the model as a FunctionResponsePart.

For example

val getExchangeRate = AutoFunctionDeclaration.create(
name = "getExchangeRate",
description = "Get the exchange rate for currencies between countries.",
inputSchema = CurrencyRequest.schema,
outputSchema = CurrencyResponse.schema,
) {
// make an api request to convert currencies and return the result
}

See also

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
val functionReference: suspend (I) -> O?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard