| tool_annotations | R Documentation |
Tool annotations are additional properties that, when passed to the
.annotations argument of tool(), provide additional information about the
tool and its behavior. This information can be used for display to users, for
example in a Shiny app or another user interface.
The annotations in tool_annotations() are drawn from the Model Context Protocol and are considered
hints. Tool authors should use these annotations to communicate tool
properties, but users should note that these annotations are not guaranteed.
tool_annotations(
title = NULL,
read_only_hint = NULL,
open_world_hint = NULL,
idempotent_hint = NULL,
destructive_hint = NULL,
...
)
title |
A human-readable title for the tool. |
read_only_hint |
If |
open_world_hint |
If |
idempotent_hint |
If |
destructive_hint |
If |
... |
Additional named parameters to include in the tool annotations. |
A list of tool annotations.
Other tool calling helpers:
tool(),
tool_reject()
# See ?tool() for a full example using this function.
# We're creating a tool around R's `rnorm()` function to allow the chatbot to
# generate random numbers from a normal distribution.
tool_rnorm <- tool(
rnorm,
# Describe the tool function to the LLM
.description = "Drawn numbers from a random normal distribution",
# Describe the parameters used by the tool function
n = type_integer("The number of observations. Must be a positive integer."),
mean = type_number("The mean value of the distribution."),
sd = type_number("The standard deviation of the distribution. Must be a non-negative number."),
# Tool annotations optionally provide additional context to the LLM
.annotations = tool_annotations(
title = "Draw Random Normal Numbers",
read_only_hint = TRUE, # the tool does not modify any state
open_world_hint = FALSE # the tool does not interact with the outside world
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.