AIHelper

Helper class for constructing AI tools

Functions

6

Convenience function to easily create a specific add records tool for the agent.

ParameterTypeDescription
optionsObject
options.modelNameString

The model name to create the tool for, as configured in models

Returns: AIToolConfig

Convenience function to easier create tools without repeating redundant code blocks. Assumes that the parameters are of type object.

ParameterTypeDescription
optionsObject
options.descriptionString

A quite short description of the tool's purpose for the AI agent

options.availableBoolean | function

Whether or not the tool is available at the time of the request. If a function is provided, it must return a Boolean.

options.fnfunction

The function to call when the tool is invoked

options.fn.argumentsObject
options.fn.arguments.argsObject

The arguments provided to the tool invocation

options.propertiesObject<String, AIToolProperty>

The parameters schema of the tool. The keys are the parameter names and the values are objects describing that parameter

options.requiredString[]
statusDescriptionString

A short text message to display in the ChatPanel when this tool is being used

Returns: AIToolConfig

Convenience function to easier create tools with support for conditions which in short is a way for the agent and the AI feature to communicate about datasets without actually reading the datasets. In essence, they are filters which is used when reading or modifying data to target the correct records.

ParameterTypeDescription
optionsObject
options.descriptionString

A quite short description of the tool's purpose for the AI agent

options.availableBoolean | function

Whether or not the tool is available at the time of the request. If a function is provided, it must return a Boolean.

options.fnfunction

The function to call when the tool is invoked

options.fn.argumentsObject
options.fn.arguments.argsObject

The arguments provided to the tool invocation

options.fn.arguments.recordsObject<String, Model[]> | Model[]

If a single condition is configured, this will contain the records matching that condition. If multiple conditions are configured, this will be an object with the condition name as property and an array containing the matching records as value.

options.propertiesObject<String, AIToolProperty>

The parameters schema of the tool. The keys are the parameter names and the values are objects describing that parameter. These will be merged with the conditions properties.

options.requiredString[]
statusDescriptionString

A short text message to display in the ChatPanel when this tool is being used

options.conditionsAIToolCondition[]

Array of conditions configuration objects

Returns: AIToolConfig

Convenience function to easily create a specific delete records tool for the agent.

ParameterTypeDescription
optionsObject
options.modelNameString

The model name to create the tool for, as configured in models

Returns: AIToolConfig

Convenience function to easily create a specific read data tool for the agent.

ParameterTypeDescription
optionsObject
options.modelNameString

The model name to create the tool for, as configured in models

Returns: AIToolConfig

Convenience function to easily create a specific update data tool for the agent.

ParameterTypeDescription
optionsObject
options.modelNameString

The model name to create the tool for, as configured in models

Returns: AIToolConfig

Typedefs

1

An AI tool condition object

ParameterTypeDescription
nameString

The property name of the condition used in the call to the tool fn. If not provided, the uncapitalized modelName will be used appended with Conditions.

modelNameString

The model name to use with conditions, as configured in models

requiredBoolean

If the agent must provide these conditions, set this to true