Condition in a flow using slots - Detecting Invalid Condition - Rasa Pro CALM

Slots in the domain.yml:

  annual_income:
    type: float
    mappings:
      - type: from_llm
  cibil_score:
    type: float
    mappings:
      - type: from_llm

Flow having the condition in the flow.yml file:

  loan_eligibility:
    description: checking the eligibility of suer for loan
    steps:
      - collect: annual_income
        next:
          - if: ((slots.annual_income > 30,000) and (slots.cibil_score > 650))
            then: eligible
          - else: ineligible
      - action: utter_eligible
        id: eligible
      - action: utter_ineligible
        id: ineligible

Flow after splitting the condition in the flow.yml file:

  loan_eligibility:
    description: checking the eligibility of user for loan
    steps:
      - collect: annual_income
        next:
          - if: slots.annual_income < 30,000
            then:
              - action: utter_ineligible
                next: END
          - else: check_cibil_score
      - collect: cibil_score
        id: check_cibil_score
        next:
          - if: slots.cibil_score < 650
            then:
              - action: utter_ineligible
                next: END
          - else:
              - action: utter_eligible
                next: END

Responses for utterances in the domain.yml:

  utter_eligible:
    - text: "Great news! 🥳 You are eligible to get bike loan. 😃"

  utter_ineligible:
    - text: "we are deeply sorry! 😞 We can't give you a bike loan. Better luck next time. 👍"

Error facing while training rasa before splitting if condition:

2024-07-09 19:17:08 ERROR    rasa.validator  - [error    ] Detected invalid condition '((slots.annual_income > 30,000) and (slots.cibil_score > 650))' at step '0_collect_annual_income' for flow id 'loan_eligibility'. 
Please make sure that all conditions are valid. event_key=validator.verify_predicates.link.invalid_condition flow=loan_eligibility link=((slots.annual_income > 30,000) and (slots.cibil_score > 650)) step=0_collect_annual_income

Error facing while training rasa after splitting if condition:

2024-07-09 19:46:46 ERROR    rasa.validator  - [error    ] Detected invalid condition 'slots.annual_income < 30,000' at step '0_collect_annual_income' for flow id 'loan_eligibility'. 
Please make sure that all conditions are valid. event_key=validator.verify_predicates.link.invalid_condition flow=loan_eligibility link=slots.annual_income < 30,000 step=0_collect_annual_income

I have:

  • tried every possible way to use parenthesis in the “if” condition within the loan_eligibility flow
  • tried to have utterances outside the loan_eligibility flow by using call
  • tried giving action to utter the corresponding under both if and else conditions

Yet i am facing the same error as mentioned above. I am searching for any other way to work it out.

Any updating or correcting replies would be appreciated.

The comma in 30,000 is breaking the if statement. Try (slots.annual_income > 30000) instead.

1 Like

Thank you so much for the correction. Yeah, the model got trained.

1 Like