Tool
org.llm4s.schema.Tool
@Experimental
object Tool
Tools defined from a function over a case class: the parameter schema is derived from the argument type (SchemaOf), the arguments are decoded into it, and the result is written with its uPickle writer, so the schema the model sees, the argument parsing and the function cannot drift apart.
@description("Where to look up the weather")
case class WeatherArgs(@description("City name") city: String, @description("Days ahead") days: Int)
derives SchemaOf, ReadWriter
val weather: Result[ToolFunction[WeatherArgs, Forecast]] =
Tool.of[WeatherArgs, Forecast]("get_weather", "Gets a forecast")(args => forecast(args.city, args.days))
The result is the ToolFunction that ToolBuilder builds, registered in a ToolRegistry like any other.
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Tool.type
Members list
In this article