Tips for IF-ELSE conditionals
Proper ordering of conditions
Conditions should be always ordered in most restrictive to least restrictive:
- ELSE conditions should always come at the end
- if you have 2 cases (X & Y, X & ~Y), put the X & Y condition first.
Using Jinja for static conditions
Whenever we have a variable which is not going to change during a conversation (or during a state) it is recommended to use Jinja for IF-ELSE conditions rather than relying on the LLM: {% if loan_type == "TypeA" %} Say A {% else %} Say B {% end_if %}
.
Jinja formatting best practices
If a jinja condition is covering a complete bullet point, shift it to the leftmost so that empty bullets are not created, which can reduce reliability.
Handling yes/no questions
If a question has a yes/no answer, ensure that you also case of user not replying in a yes/no fashion. e.g. : If they do not provide a clear answer, emphasise that their feedback is very important, and ask again for them to share their feedback.