Action execution¶
The execution
parameter in the act()
function allows you to adjust and fine-tune the AI agent behavior. You can use this parameter to define:
Tasks the AI agent must perform based on user queries
How the AI agent must query data corpuses to retrieve information
How the AI agent must formulate its responses
To modify the AI agent’s behavior, add the act()
function to the dialog script. In the execution
parameter, specify the transform that provides instructions on how the AI agent must act in specific situations.
act({
execution: transforms.act_execute
});
Example of use¶
Assume you are building an AI agent that provides information on medications. When a user asks about medication usage, the AI agent should recommend consulting a healthcare professional. To achieve this:
To the dialog script, add data corpuses that provide information about medications:
corpus({ title: `Cleveland Clinic`, urls: [`https://my.clevelandclinic.org/health/treatments/penicillin`], depth: 1, maxPages: 1 }); corpus({ title: `Health Direct`, urls: [`https://www.healthdirect.gov.au/penicillin`], depth: 1, maxPages: 1 });
In the Debugging Chat, ask a question about medication usage and check the response.
Under Transforms, create the
act_execute
transform with the following instructions:If a user asks about medications, give a general response and advise them to consult a healthcare professional for accurate and safe medical advice.
To the dialog script, add the
act()
function with theexecution
parameter:act({ execution: transforms.act_execute });
In the Debugging Chat, ask a question about medication usage once again and check the response.