Tool
A function a model may call. The usual way to create one is from a @Serializable class that holds the input, which also gives the model the input's schema:
@Serializable
data class Forecast(
@Description("The city, for example \"Madrid\"") val city: String,
val days: Int = 1,
)
val forecast = Tool<Forecast>("forecast", "Returns the weather forecast of a city.") { input ->
weatherService.forecast(input.city, input.days)
}Content copied to clipboard
Use this constructor when you write the schema by hand.
Constructors
Properties
Link copied to clipboard
runs the tool with the input the model sent and returns the text the model gets back. An exception it throws reaches the model as an error result; see List.execute.