FunctionCall

@Serializable
data class FunctionCall(val nameOrNull: String? = null, val argumentsOrNull: String? = null)

Represents a function invocation with its name and serialized arguments as generated by the model.

In scenarios such as a streaming variant of the chat API, both nameOrNull and argumentsOrNull can be null.

Constructors

Link copied to clipboard
constructor(nameOrNull: String? = null, argumentsOrNull: String? = null)

Properties

Link copied to clipboard

The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.

Link copied to clipboard
@SerialName(value = "arguments")
val argumentsOrNull: String? = null

The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.

Link copied to clipboard

The name of the function to call.

Link copied to clipboard
@SerialName(value = "name")
val nameOrNull: String? = null

The name of the function to call.

Functions

Link copied to clipboard
fun argumentsAsJson(json: Json = Json): JsonObject

Decodes the arguments JSON string into a JsonObject. If arguments is null, the function will return null.

Link copied to clipboard
fun argumentsAsJsonOrNull(json: Json = Json): JsonObject?

Decodes the arguments JSON string into a JsonObject. If arguments is null, the function will return null.