Data merging¶
By default, the Action Transformer automatically merges information from available data sources, evaluating and prioritizing which information to use to deliver a response. You can control this process more precisely using the merge
parameter in the act()
function.
You can use the merge
parameter to:
Specify the priority for information from various sources
Instruct the AI agent on how to resolve conflicts between data from different corpuses
To modify how the AI agent merges information, add the act()
function to the dialog script. In the merge
parameter, define the transform that outlines the merging rules and prioritization of sources.
act({
merge: transforms.act_merge
});
Example of use¶
Assume you are building an AI agent that provides information on medications from various sources. When a user asks about medication usage, the AI agent must combine information from multiple corpuses and prioritize a trusted medical source. 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 side effects and check the response.
Under Transforms, create the
act_merge
transform with the following instructions:Prioritize results from Health Direct
To the dialog script, add the
act()
function with themerge
parameter:act({ merge: transforms.act_merge });
In the Debugging Chat, ask a question about medication side effects once again and check the response.
Under Transforms, select the
act_merge
transform. In the top right corner, click History and check the Query and Result fields to see the initial merge instructions and adjusted merge instructions applied to the user query.