Skip to content

Commit

Permalink
Ato 2960 update bot with persist slot config (#64)
Browse files Browse the repository at this point in the history
* update rasa-pro

* swap property `reset_after_flow_ends` for `persist_slots`

* update e2e test cases

* update verify account flow to persist a slot filled in a set_slots step
  • Loading branch information
Tawakalt authored Nov 29, 2024
1 parent 2eb722d commit ba57f87
Show file tree
Hide file tree
Showing 7 changed files with 801 additions and 568 deletions.
6 changes: 5 additions & 1 deletion data/flows/verify_account.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@ flows:
- intent:
name: verify_account
confidence_threshold: 0.9
persisted_slots:
- based_in_california
- based_in_the_us
steps:
- collect: verify_account_email
ask_before_filling: true
- collect: based_in_california
ask_before_filling: false
reset_after_flow_ends: false
next:
- if: slots.based_in_california
then:
- set_slots:
- based_in_the_us: true
- collect: verify_account_sufficient_california_income
ask_before_filling: true
next:
Expand Down
5 changes: 5 additions & 0 deletions domain/flows/verify_account.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ slots:
shared_for_coexistence: True
mappings:
- type: from_llm
based_in_the_us:
type: bool
shared_for_coexistence: True
mappings:
- type: from_llm
verify_account_sufficient_california_income:
type: bool
mappings:
Expand Down
29 changes: 28 additions & 1 deletion e2e_tests/passing/happy_path/user_verifies_account.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ test_cases:
- slot_was_set:
- verify_account_confirmation: true
- utter: utter_verify_account_success
# verify slot reset
- slot_was_set:
- verify_account_email: null
- verify_account_confirmation: null
- verify_account_sufficient_california_income: null
# verify slot persistence
- slot_was_not_set:
- based_in_california
- based_in_the_us

- test_case: Verify account for California resident with insufficient income
steps:
Expand All @@ -36,6 +45,15 @@ test_cases:
- slot_was_set:
- verify_account_sufficient_california_income: false
- utter: utter_ca_income_insufficient
# verify slot reset
- slot_was_set:
- verify_account_email: null
- verify_account_confirmation: null
- verify_account_sufficient_california_income: null
# verify slot persistence
- slot_was_not_set:
- based_in_california
- based_in_the_us
- utter: utter_can_do_something_else

- test_case: Verify account for California resident with sufficient income
Expand All @@ -60,4 +78,13 @@ test_cases:
- slot_was_set:
- verify_account_confirmation: true
- utter: utter_verify_account_success
- utter: utter_can_do_something_else
# verify slot reset
- slot_was_set:
- verify_account_email: null
- verify_account_confirmation: null
- verify_account_sufficient_california_income: null
# verify slot persistence
- slot_was_not_set:
- based_in_california
- based_in_the_us
- utter: utter_can_do_something_else
36 changes: 36 additions & 0 deletions e2e_tests_with_assertions/passing/happy_path/user_orders_pizza.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,23 @@ test_cases:
value: 1234 5678 9012 3456
- bot_uttered:
utter_name: utter_execute_payment
- flow_completed:
flow_id: order_pizza
# verify slot reset
- slot_was_set:
- name: pizza
value: null
- name: num_pizza
value: null
- name: address
value: null
- name: card_details
value: null
- name: payment_option
value: null
# verify slot persistence
- slot_was_not_set:
- name: confirmation_order

- test_case: user_orders_pizza_stating_which_type_and_pays_with_points
steps:
Expand Down Expand Up @@ -117,4 +134,23 @@ test_cases:
utter_name: utter_execute_payment
- flow_completed:
flow_id: order_pizza
# verify slot reset
- slot_was_set:
- name: pizza
value: null
- name: num_pizza
value: null
- name: address
value: null
- name: card_details
value: null
- name: payment_option
value: null
- name: user_name
value: null
- name: user_password
value: null
# verify slot persistence
- slot_was_not_set:
- name: confirmation_order

Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ test_cases:
value: true
- bot_uttered:
utter_name: utter_verify_account_success
# verify slot reset
- slot_was_set:
- name: verify_account_email
value: null
- name: verify_account_confirmation
value: null
- name: verify_account_sufficient_california_income
value: null
# verify slot persistence
- slot_was_not_set:
- name: based_in_california
- name: based_in_the_us

- test_case: Verify account for California resident with insufficient income
steps:
Expand All @@ -57,6 +69,8 @@ test_cases:
- slot_was_set:
- name: based_in_california
value: true
- name: based_in_the_us
value: true
- bot_uttered:
utter_name: utter_ask_verify_account_sufficient_california_income
- user: "no"
Expand All @@ -66,6 +80,18 @@ test_cases:
value: false
- bot_uttered:
utter_name: utter_ca_income_insufficient
# verify slot reset
- slot_was_set:
- name: verify_account_email
value: null
- name: verify_account_confirmation
value: null
- name: verify_account_sufficient_california_income
value: null
# verify slot persistence
- slot_was_not_set:
- name: based_in_california
- name: based_in_the_us
- bot_uttered:
utter_name: utter_can_do_something_else

Expand All @@ -90,6 +116,8 @@ test_cases:
- slot_was_set:
- name: based_in_california
value: true
- name: based_in_the_us
value: true
- bot_uttered:
utter_name: utter_ask_verify_account_sufficient_california_income
- user: "yes"
Expand All @@ -108,5 +136,17 @@ test_cases:
value: true
- bot_uttered:
utter_name: utter_verify_account_success
# verify slot reset
- slot_was_set:
- name: verify_account_email
value: null
- name: verify_account_confirmation
value: null
- name: verify_account_sufficient_california_income
value: null
# verify slot persistence
- slot_was_not_set:
- name: based_in_california
- name: based_in_the_us
- bot_uttered:
utter_name: utter_can_do_something_else
Loading

0 comments on commit ba57f87

Please sign in to comment.