Skip to contents

Returns an ellmer::tool() definition that prompts a human for approval via readline(). If approved, returns "approved". If rejected, calls ellmer::tool_reject() to signal rejection to the LLM.

Usage

approval_tool(prompt_fn = NULL)

Arguments

prompt_fn

Optional function that receives the tool arguments and returns a character string to display as the approval prompt. Defaults to "Approve this action? (yes/no): ".

Value

An ellmer tool definition for human-in-the-loop approval.

See also

Other interrupts: new_interrupt()

Examples

if (FALSE) { # \dontrun{
tool <- approval_tool()
chat <- ellmer::chat_openai(model = "gpt-4o")
chat$register_tool(tool)
} # }