An R function the model can ask for while it answers: FunctAI runs it and sends the result back, until the model gives its answer. The tool's inputs are the function's arguments; its name is the function's.
Arguments
- .fn
The function. It is called with its arguments by name.
- .description
What it does, for the model.
- ...
Its arguments' types, as in
ai(): nothing (text), a sentence (text, described) or a type.- .name
The tool's name, as the model sees it. Default: the name
.fnis given by (ai_tool(lookup_order, ...)islookup_order).- .effects
What it does to the world:
"reads"(it only looks: a search, a lookup) or"changes"(it writes, sends or pays). Left out, it is unknown, which every approval rule treats as"changes": forgetting to declare is safe. An AI function given as a tool reads, unless one of its own tools changes things or declares nothing.
Examples
orders <- c("A-1042" = "stuck at the carrier since Monday")
lookup_order <- function(order) if (order %in% names(orders)) orders[[order]] else "unknown order"
ai_tool(lookup_order, "Look up where an order is.", order = "a letter, a dash and four digits")
#> <ai tool> lookup_order(order): Look up where an order is.