Class FunctionCall
Represents a function call to be used with the AI chat.
Namespace: Glitch9.AIDevKit
Assembly: .dll
Syntax
public class FunctionCall : ToolCall
Constructors
FunctionCall()
Declaration
public FunctionCall()
FunctionCall(FunctionDeclaration, IFunctionDelegate)
Initializes a new instance of the FunctionCall class with the specified function and delegate. Sets the type to Function.
Declaration
public FunctionCall(FunctionDeclaration function, IFunctionDelegate functionDelegate = null)
Parameters
Type | Name | Description |
---|---|---|
FunctionDeclaration | function | The function to be used. |
IFunctionDelegate | functionDelegate | The delegate that will execute the function. |
FunctionCall(string, string, string)
Declaration
public FunctionCall(string id, string name, string args)
Parameters
Type | Name | Description |
---|---|---|
string | id | |
string | name | |
string | args |
Properties
Args
Declaration
public string Args { get; }
Property Value
Type | Description |
---|---|
string |
Delegate
Gets or sets the delegate that will execute the function. This property is ignored during JSON serialization.
Declaration
public IFunctionDelegate Delegate { get; set; }
Property Value
Type | Description |
---|---|
IFunctionDelegate |
Function
Gets or sets the function to be used. This property is required.
Declaration
public FunctionDeclaration Function { get; set; }
Property Value
Type | Description |
---|---|
FunctionDeclaration |
Name
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
string |
Methods
Create(string, string, IFunctionDelegate)
Creates a new FunctionCall instance with the specified name, description, and delegate. Using this method won't generate Parameters based on your return type class. Instead, the return type will be string.
Declaration
public static FunctionCall Create(string name, string description, IFunctionDelegate functionDelegate = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the function. |
string | description | The description of the function. |
IFunctionDelegate | functionDelegate | The delegate that will execute the function. |
Returns
Type | Description |
---|---|
FunctionCall | A new instance of the FunctionCall class. |
Create<T>(string, string, IFunctionDelegate)
Creates a new FunctionCall instance with the specified name, description, and delegate.
The parameters for the function are generated based on the specified type T
.
T
is the return type of the function.
Declaration
public static FunctionCall Create<T>(string name, string description, IFunctionDelegate functionDelegate = null) where T : class
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the function. |
string | description | The description of the function. |
IFunctionDelegate | functionDelegate | The delegate that will execute the function. |
Returns
Type | Description |
---|---|
FunctionCall | A new instance of the FunctionCall class. |
Type Parameters
Name | Description |
---|---|
T | The type used to generate the function's parameters schema. |