This lets your AI respond with special commands that your game can then understand and execute.
Actions
are defined with:
local Actions = {
-- Name of the action
Test = {
-- Detailed description of the action (So the AI can know what function it has access to)
Description = 'This is a test function. Usage [Test {number}]',
-- Actual function that fires
Action = function(params, Context)
print(Context.Name)
print(params)
end,
},
}
FunctionCaller.GetDescription(Actions: Actions): string
Returns a JSON string describing all available functions (those with a .Description field).
Parameters:
FunctionCalling.Parse(RawResponse: string): (string, { [number]: { FunctionName: string, Params: string } })
Parses a raw AI or user-generated response string into:
[FunctionName {params}]
.Parameters:
Play sound [PlaySound {Explosion}]
"Returns:
FunctionCalling.Execute(extractedActions, availableActions: Actions, context: { [any]: any })
Executes a list of parsed actions by looking them up in the provided Actions
table.
Parameters
Parse
, each with:
Returns:
FunctionCalling.FunctionCallingInstructions
: string