Proper ordering of conditions

Conditions should be always ordered in most restrictive to least restrictive:
  • ELSE conditions should always come at the end
  • e.g if the user agrees to send the message, then say: “Thank you for agreeing to send the message”. if the user disagrees to send the message, then say: “I understand, but I strongly recommend to send the message”
  • 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 {% endif %}. e.g {%if variable == “False”%} say: “variable is set as false” {%elif variable == “True”%} say: “variable is set as True” {%else%} say: “variable value is neither True nor False” {%endif%}

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.