| HookHandler | R Documentation |
R6 class to manage and execute hooks.
hooksList of hook functions.
new()Initialize HookHandler
HookHandler$new(hooks_list = list())
hooks_listA list of hook functions. Supported hooks:
on_generation_start(model, prompt, tools)
on_generation_end(result)
on_tool_start(tool, args)
on_tool_end(tool, result)
on_tool_approval(tool, args) - Return TRUE to approve, FALSE to deny.
trigger_generation_start()Trigger on_generation_start
HookHandler$trigger_generation_start(model, prompt, tools)
modelThe language model object.
promptThe prompt being sent.
toolsThe list of tools provided.
trigger_generation_end()Trigger on_generation_end
HookHandler$trigger_generation_end(result)
resultThe generation result object.
trigger_tool_start()Trigger on_tool_start
HookHandler$trigger_tool_start(tool, args)
toolThe tool object.
argsThe arguments for the tool.
trigger_tool_end()Trigger on_tool_end
HookHandler$trigger_tool_end( tool, result, success = TRUE, error = NULL, args = NULL )
toolThe tool object.
resultThe result from the tool execution.
successLogical indicating whether execution succeeded.
errorOptional error message when execution failed.
argsOptional tool arguments for downstream telemetry.
clone()The objects of this class are cloneable with this method.
HookHandler$clone(deep = FALSE)
deepWhether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.