Agents 0.0.2
Edge AI Agents SDK
|
Interface for tools that an agent can use. More...
#include <tool.h>
Public Member Functions | |
Tool (const String &name, const String &description) | |
Constructor. | |
virtual | ~Tool ()=default |
Destructor. | |
const String & | getName () const |
Get the name of the tool. | |
const String & | getDescription () const |
Get the description of the tool. | |
const ParameterMap & | getParameters () const |
Get the parameters of the tool. | |
const JsonObject & | getSchema () const |
Get the schema of the tool. | |
void | addParameter (const Parameter ¶m) |
Add a parameter to the tool. | |
void | setCallback (ToolCallback callback) |
Set the execution callback. | |
virtual ToolResult | execute (const JsonObject ¶ms) const |
Execute the tool with the given parameters. | |
bool | validateParameters (const JsonObject ¶ms) const |
Validate parameters against schema. | |
Interface for tools that an agent can use.
Tools are capabilities that the LLM can use to interact with the outside world. Each tool has a name, description, set of parameters, and execution logic.
Constructor.
name | The name of the tool |
description | The description of the tool |
void agents::Tool::addParameter | ( | const Parameter & | param | ) |
Add a parameter to the tool.
param | The parameter to add |
|
virtual |
Execute the tool with the given parameters.
params | The parameters to execute the tool with |
const String & agents::Tool::getDescription | ( | ) | const |
Get the description of the tool.
const String & agents::Tool::getName | ( | ) | const |
Get the name of the tool.
const ParameterMap & agents::Tool::getParameters | ( | ) | const |
Get the parameters of the tool.
const JsonObject & agents::Tool::getSchema | ( | ) | const |
Get the schema of the tool.
void agents::Tool::setCallback | ( | ToolCallback | callback | ) |
Set the execution callback.
callback | The callback to set |
bool agents::Tool::validateParameters | ( | const JsonObject & | params | ) | const |
Validate parameters against schema.
params | The parameters to validate |