Parameter Attribute

The Parameter attribute is to be used alongside the Tool attribute and is used to define a function's parameters, including the parameter's name, description, and optional list of enums.

When implementing a tool with parameters, import the Indie.Attributes and use the Tool Attribute.

using Indie.Attributes;

A tool with a single parameter.

public class MyClass
{
    [Tool("MyMethod", "Description of the tool.")]
    [Parameter("parameter", "Description of the parameter.")]
    public void MyMethod(int parameter)
    {
        // Method implementation
    }
}

Or with a tool with multiple parameters.

public class MyClass
{
    [Tool("MyMethod", "Description of the tool.")]
    [Parameter("param1", "Description of the parameter.")]
    [Parameter("param2", "Description of the parameter.", "option1", "option2", "option3")]
    public void MyMethod(int param1, string param2)
    {
        // Method implementation
    }
}

The Parameter attribute adds extra context to tools with parameters, so the model can be informed of what arguments to use when deciding to call on one of these functions.

Last updated