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.

Dialog script
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:

  1. To the dialog script, add data corpuses that provide information about medications:

    Dialog script
    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
    });
    
  2. In the Debugging Chat, ask a question about medication usage and check the response.

    ../../../_images/act-execution.png
  3. Under Transforms, create the act_execute transform with the following instructions:

    Dialog script
    If a user asks about medications, give a general response and advise them to consult a healthcare professional for accurate and safe medical advice.
    
    ../../../_images/act-execution-instructions.png
  4. To the dialog script, add the act() function with the execution parameter:

    Dialog script
    act({
        execution: transforms.act_execute
    });
    

In the Debugging Chat, ask a question about medication usage once again and check the response.

../../../_images/act-execution-result.png

See also

Transforms