Guideline Relationships
Guideline Relationships
Defining how guidelines relate to each other is a powerful (and advanced) part of Conversation Modeling. While these relationships might sound complex at first, they give you a ton of power as a modeler, making you much more capable of generating precise outcomes.
At the very least, we recommend reviewing these relationships briefly to understand their purpose.
Relationship Types
At a glance, these are the supported relationships. Each relationship is between a source (notated S) and a target (notated T). Click on a relationship type to learn more about it.
- Entailment: When S is activated, T should always be activated
- Priority: When both S and T are activated, only S should be activated
- Dependency: When S is activated, deactivate it unless T is also activated
- Implication*: When S is activated and T hasn't applied yet, T should be activated
- Requirement*: When T is activated, S should be activated and completed before T is activated
- Persistence*: When S is activated, T should never activate in the same session from that point on
* Marked relationships are scheduled to be added in Parlant 2.3.
Entailment
When S is activated, T should always be activated
parlant relationship create --kind entailment --source SOURCE --target TARGET
To understand the need for entailment, we first need to understand how Parlant chooses which guidelines activate for an agent when it's about to say something to the customer.
Basically, Parlant examines the session at its current state, and asks questions about it: "Is this guideline relevant now?", "Is that guideline relevant now?".
To do this, it primarily tests the guidelines' conditions.
This would seemingly work well by itself, until you consider two guidelines of the following form:
- Guideline A: When X, Then Y
- Guideline B: When Y, Then Z
Now imagine a situation where, looking at a session, we determine that X does in fact apply, but Y doesn't. With the naive logic above, we would have only fed the agent with the guideline to do Y.
But when we step back and analyze this case, we know that the agent is just about to do Y, which means that, according to the guidelines we have installed, Z should also apply.
That is what entailment accomplishes: requiring that whenever A is activated, B is also activated.
Priority
When both S and T are activated, only S should be activated
parlant relationship create --kind priority --source SOURCE --target TARGET
Priority can be used for multiple use cases. The two most common ones are:
- Controlling the flow and precedence of actions within the conversation
- Disambiguating user input
Controlling Precedence
You may have two guidelines that happen to be activated at the same time, such as:
- When the customer wants to make a transaction, Then help them complete the transaction
- When the customer has less than $1,000 in their account, Then offer savings plans
You may find that the guidelines above activate simultaneously when, for example, account balance details are introduced into the session while the user is in the process of submitting a transaction.
To ensure that savings plans are offered—but with good timing, only once the transaction is completed—you can prioritize completing the transaction over offering savings plans. Once the transaction is completed, the savings-related guideline may be activated.
Disambiguating User Input
You may have a situation where between two (or more) competing guidelines where some or all of which are activated at the same time due to ambiguity, leading to instruction following confusions.
For example, if a customer sent the message "What are my limits?" to a banking agent, and you had the following guidelines, each of which was optimistically activated according to the engine's interpretation:
- When the customer is inquiring about their ATM limits, Then fetch the data from their account profile
- When the customer is inquiring about their credit card's limits, Then fetch them from the card provider
To clarify the customer's intent, you could add an additional guideline, prioritized over all of the above:
When the customer is inquiring about limits but it isn't clear if they're talking about ATM limits, credit card limits, or some other types of limits, Then ask them to clarify what kind they mean
Dependency
When S is activated, deactivate it unless T is also activated
parlant relationship create --kind dependency --source SOURCE --target TARGET
A dependency helps you ensure that a guideline is only activated if other baseline conditions also hold.
The most common use cases is to ensure that more specific conditions are activated only in the proper baseline contexts.
Contextualizing Specific Conditions
When you're building flows, you can address specialized or edge-case scenarios by making them dependent on the flow baseline guideline. For example:
Baseline Guideline
When the customer wants to return an order, Then help them complete the return process
Dependent Guidelines
- When the customer isn't able to provide the order number, Then load up their last order's items and ask them to confirm if that is their order
- When the customer specified the exact order number, Then load up that order's items and ask them to confirm if that is their order
By making these guidelines dependent on the baseline guideline, you can ensure that their evaluation is always performed in the right context.
Implication
When S is activated and T hasn't applied yet, T should be activated
parlant relationship create --kind implication --source SOURCE --target TARGET
This feature is scheduled to be added for Parlant 2.3. Check back soon!
Whereas Entailment always activates B when A is activated, Implication is a slightly weaker bond that gets B to activate only if its action is not deemed to have already been accomplished in the session.
Requirement
When T is activated, S should be activated and completed before T is activated
This feature is scheduled to be added for Parlant 2.3. Check back soon!
Persistence
When S is activated, T should never activate in the same session from that point on
This feature is scheduled to be added for Parlant 2.3. Check back soon!