Function Tool
@Serializable
A function the model may call, described by its JSON Schema.
The model answers with a FunctionCallItem; run the function and feed the result back as a FunctionCallOutputItem carrying the same call_id.
Example:
val weather = FunctionTool(
name = "get_weather",
description = "Get the current weather for a city",
parameters = buildJsonObject {
put("type", "object")
putJsonObject("properties") { putJsonObject("city") { put("type", "string") } }
putJsonArray("required") { add("city") }
},
)Content copied to clipboard