Skip to contents

Define a tool for an agent

Usage

create_tool(name, function_name, description, parameters = list())

Arguments

name

Character: The name of the tool, e.g. "Wikipedia Search".

function_name

Character: The name of the function to call, e.g. "query_wikipedia".

description

Character: The description of the tool.

parameters

List of ToolParameter: The parameters of the tool, each defined using tool_param.

Value

Tool object

Author

EDG

Examples

tool_addition <- create_tool(
  name = "Addition",
  function_name = "add_numbers",
  description = "Performs arithmetic addition of two numbers.",
  parameters = list(
    tool_param(
      name = "x",
      type = "number",
      description = "The first number to add",
      required = TRUE
    ),
    tool_param(
      name = "y",
      type = "number",
      description = "The second number to add",
      required = TRUE
    )
  )
)