1. Action Meta
  2. AI Function Calling

Action Meta

AI Function Calling

Enabling AI to Use Actions as Functions

Once this feature is enabled, the AI can leverage this specific action as part of its decision-making process. This means that when the AI is working to fulfill a user's request, it will actively consider whether this action aligns with the user's needs.

In essence, the AI uses the name and description of the action as a guide to understand when and why the action should be executed. Throughout the conversation or process, the AI continuously evaluates the context, assessing if and when the action is appropriate to use. If it determines the action is relevant, the AI will automatically trigger and execute it.

Basic usage

To make an action available to an AI, navigate to the AI Tab on the action, and simply toggle AI Enabled on.

How to enable AI for an action

The action will now be available for the AI to use.

Advanced

Using the json editor on the AI tab or the advanced view of the action, you can specify what data or context you would like to give to the assistant. You can also specify additional properties that can change the behaviour of the AI assistant. It could do things like:

  • Clear previous function call results to reduce tokens.
  • Disable dynamic tasks. This prevents the assistant from responding when it decides to call an action.
  • Clear intermediary system messages to make the assistant's instructions more concise.

This information can also be found on the GPT Chat Task page.

loading...

Parameters

ai_function_calling
optional
boolean

Whether or not an action is callable by an AI assistant.

Default: false


ai_details
required if ai_function_calling is true
object

The object that contains the additional parameters relevant to AI action calling. It is only relevant if ai_function_calling is set to true.

Default: null

Show child attributes
ai_details.action_result_inject_data
required if ai_function_calling is true
object

The data that will be passed back the AI assistant after a successful AI action call. The aim for good inject data is to have it be as concise as possible. You don't want to return the full stubpost, as this will use a lot of tokens and be quite expensive. You want to return only the data that the model will need from the result of the action it chose to run.

Example:

loading...

Default:

loading...

ai_details.clear_function_call_results
optional
boolean

With this parameter set to true, all previous function call results will be cleared. This can be used to reduce the token count in long chats where function results account for a lot of unnecessary tokens.

Default: false


ai_details.clear_intermediate_system_messages
optional
boolean

With this parameter set to true, all system messages except for the first (the one in the 0th message position) and the most recent will be cleared. This can help reduce token count and also helps with keeping the instructions to the model as concise as possible.

Default: false


ai_details.disable_dynamic_tasks
optional
boolean

Whenever an AI assistant runs an action, a dynamic task that returns the result of the action to the chat is added to that action automatically. This can be disabled for all actions in the gpt_chat_task params by setting action_call_result_method to custom. However, sometimes we want to do that only when a specific action is run.

This parameter disables the addition of the default dynamic task when the specific action is run.

Default: false


ai_details.allowed_chat_names
optional
array

It is possible to restrict which chats can call an action. This can be useful in cases where you want to have multiple chats operating in the same state with different purposes and sets of actions each. If this parameter is not defined, all chats are allowed to call the action.

Example:

loading...

ai_details.availability_conditions
optional
array

This can be used to restrict the availability of an action to the AI assistant based on the conditions defined in the array. Only if all conditions evaluate to true, the action is available to the AI assistant.

Example:

loading...
NOTE

Top level Action Conditions can also be used to control the availability of an action to the AI assistant.


Full Example of AI Details on Action Meta

This example shows an action that is available for ai function calling. It will clear the function call results, clear the intermediate system messages, disable dynamic tasks, and only allow the action to be called by the supervisor and contractor chats. It will also only be available if the apicall task was successful and the channel is webchat.

loading...