rasa-pro 3.13.1a6__py3-none-any.whl → 3.13.1a8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rasa-pro might be problematic. Click here for more details.
- rasa/builder/project_generator.py +20 -8
- rasa/builder/service.py +32 -19
- rasa/cli/project_templates/finance/actions/database.py +108 -65
- rasa/cli/project_templates/finance/tests/conversation_repair/cancellations.yml +12 -0
- rasa/cli/project_templates/finance/tests/conversation_repair/cannot_handle.yml +7 -0
- rasa/cli/project_templates/finance/tests/conversation_repair/chitchat.yml +7 -0
- rasa/cli/project_templates/finance/tests/conversation_repair/clarification.yml +9 -0
- rasa/cli/project_templates/finance/tests/conversation_repair/completion.yml +18 -0
- rasa/cli/project_templates/finance/tests/conversation_repair/corrections.yml +17 -0
- rasa/cli/project_templates/finance/tests/conversation_repair/digressions.yml +32 -0
- rasa/cli/project_templates/finance/tests/conversation_repair/human_handoff.yml +21 -0
- rasa/cli/project_templates/finance/tests/conversation_repair/skipping_collect_steps.yml +16 -0
- rasa/cli/project_templates/finance/tests/demo_scripts/main.yml +16 -0
- rasa/cli/project_templates/finance/tests/happy_paths/balance_verification.yml +15 -0
- rasa/cli/project_templates/finance/tests/happy_paths/banking_questions.yml +12 -0
- rasa/cli/project_templates/finance/tests/happy_paths/card_blocking.yml +52 -0
- rasa/cli/project_templates/finance/tests/happy_paths/money_transfer.yml +136 -0
- rasa/cli/project_templates/finance/tests/happy_paths/payee_management.yml +27 -0
- rasa/cli/project_templates/finance/tests/happy_paths/user_greeted.yml +5 -0
- rasa/cli/project_templates/plain/domain.yml +1 -1
- rasa/cli/project_templates/telco/actions/actions_billing.py +115 -70
- rasa/cli/project_templates/telco/actions/actions_get_data_from_db.py +26 -11
- rasa/core/channels/studio_chat.py +4 -2
- rasa/core/policies/enterprise_search_policy.py +1 -1
- rasa/dialogue_understanding/generator/flow_retrieval.py +10 -9
- rasa/version.py +1 -1
- {rasa_pro-3.13.1a6.dist-info → rasa_pro-3.13.1a8.dist-info}/METADATA +1 -1
- {rasa_pro-3.13.1a6.dist-info → rasa_pro-3.13.1a8.dist-info}/RECORD +31 -16
- rasa/cli/project_templates/finance/requirements.txt +0 -1
- {rasa_pro-3.13.1a6.dist-info → rasa_pro-3.13.1a8.dist-info}/NOTICE +0 -0
- {rasa_pro-3.13.1a6.dist-info → rasa_pro-3.13.1a8.dist-info}/WHEEL +0 -0
- {rasa_pro-3.13.1a6.dist-info → rasa_pro-3.13.1a8.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
test_cases:
|
|
2
|
+
- test_case: conversation_repair_skipping_collect_step
|
|
3
|
+
steps:
|
|
4
|
+
- user: "I want to transfer 55 to Amy from savings right now"
|
|
5
|
+
- utter: utter_transfer_money_understand
|
|
6
|
+
- utter: utter_ask_confirm_immediate_payment
|
|
7
|
+
- user: "sorry, I meant 65"
|
|
8
|
+
- utter: utter_corrected_previous_input
|
|
9
|
+
- utter: utter_ask_confirm_immediate_payment
|
|
10
|
+
- user: "sorry, I meant in the future"
|
|
11
|
+
- utter: utter_corrected_previous_input
|
|
12
|
+
- utter: utter_ask_payment_date
|
|
13
|
+
- user: "12/12/2025"
|
|
14
|
+
- utter: utter_ask_confirm_future_payment
|
|
15
|
+
- user: "yes"
|
|
16
|
+
- utter: utter_payment_scheduled
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
test_cases:
|
|
2
|
+
- test_case: A simple test scripts used in standard demos for Starterpack - Financial Services (en)
|
|
3
|
+
steps:
|
|
4
|
+
- user: "I want to transfer money"
|
|
5
|
+
- utter: utter_transfer_money_understand
|
|
6
|
+
- bot: "Which account would you like to transfer money from?"
|
|
7
|
+
- user: "56789012"
|
|
8
|
+
- utter: utter_ask_payee_name
|
|
9
|
+
- user: "Susan"
|
|
10
|
+
- utter: utter_ask_amount
|
|
11
|
+
- user: "55.10"
|
|
12
|
+
- utter: utter_ask_timing
|
|
13
|
+
- user: "/SetSlots(timing=now)"
|
|
14
|
+
- utter: utter_ask_confirm_immediate_payment
|
|
15
|
+
- user: "Yes"
|
|
16
|
+
- utter: utter_transfer_successful
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
test_cases:
|
|
2
|
+
- test_case: various_tests_for_account_balance
|
|
3
|
+
steps:
|
|
4
|
+
- user: "I want to view my account balance"
|
|
5
|
+
- bot: "Which account would you like the balance for?"
|
|
6
|
+
- user: "12345678"
|
|
7
|
+
- bot: "The balance is: $10123.45"
|
|
8
|
+
- user: "I want to query the balance of my acccounts"
|
|
9
|
+
- bot: "Which account would you like the balance for?"
|
|
10
|
+
- user: "12345678"
|
|
11
|
+
- bot: "The balance is: $10123.45"
|
|
12
|
+
- user: "I want to know the balance of one of my accounts"
|
|
13
|
+
- bot: "Which account would you like the balance for?"
|
|
14
|
+
- user: "23456789"
|
|
15
|
+
- bot: "The balance is: $4923.67"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
test_cases:
|
|
2
|
+
- test_case: banking_questions - Happy paths no 1
|
|
3
|
+
steps:
|
|
4
|
+
- user: "Are there any fees to transfer money to my friends?"
|
|
5
|
+
- bot: "Yes, there may be fees associated with transferring money, especially for international transfers. To avoid fees, consider using bank-to-bank transfers within the UK whenever possible. You will be notified of any applicable fees before confirming the transfer."
|
|
6
|
+
|
|
7
|
+
- test_case: banking_questions - Happy paths no 2
|
|
8
|
+
steps:
|
|
9
|
+
- user: "I have a question on prepaid card"
|
|
10
|
+
- utter: utter_help
|
|
11
|
+
- user: "are there fees to transfer from or to prepaid cards"
|
|
12
|
+
- bot: "Yes, there may be fees associated with transferring funds to or from prepaid cards. It is advisable to check your account details for specific charges related to these transactions."
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
test_cases:
|
|
2
|
+
- test_case: card_blocking - Happy paths no1
|
|
3
|
+
steps:
|
|
4
|
+
- user: "I want to block my card"
|
|
5
|
+
- utter: utter_block_card_understand
|
|
6
|
+
- bot: "Select the card you require assistance with:"
|
|
7
|
+
- user: "Wait, Wait, what will happen to my pre-authorized payments"
|
|
8
|
+
- bot: "When you block your card, any recurring payments linked to it will be interrupted until you update them with a new card number. You can request the merchants to cancel the hold on your pre-authorized payments if it is no longer necessary."
|
|
9
|
+
- bot: "Select the card you require assistance with:"
|
|
10
|
+
- user: "SetSlots(card_selection=3456789034567890)"
|
|
11
|
+
- utter: utter_ask_reason_for_blocking
|
|
12
|
+
- user: "/SetSlots(reason_for_blocking=lost)"
|
|
13
|
+
- utter: utter_acknowledge_reason_fraud_stolen_lost
|
|
14
|
+
- utter: utter_card_blocked
|
|
15
|
+
- utter: utter_ask_confirm_issue_new_card
|
|
16
|
+
- user: "/SetSlots(confirm_issue_new_card=true)"
|
|
17
|
+
- utter: utter_ask_address_confirmed
|
|
18
|
+
- user: "/SetSlots(address_confirmed=True)"
|
|
19
|
+
- utter: utter_confirm_physical_address
|
|
20
|
+
|
|
21
|
+
- test_case: card_blocking - Happy paths no2
|
|
22
|
+
steps:
|
|
23
|
+
- user: "I think I that I have lost my card"
|
|
24
|
+
- utter: utter_block_card_understand
|
|
25
|
+
- bot: "Select the card you require assistance with:"
|
|
26
|
+
- user: "SetSlots(card_selection=5555666677778888)"
|
|
27
|
+
- utter: utter_acknowledge_reason_fraud_stolen_lost
|
|
28
|
+
- utter: utter_card_blocked
|
|
29
|
+
- utter: utter_ask_confirm_issue_new_card
|
|
30
|
+
- user: "/SetSlots(confirm_issue_new_card=false)"
|
|
31
|
+
|
|
32
|
+
- test_case: card_blocking - Happy paths no3
|
|
33
|
+
steps:
|
|
34
|
+
- user: "I think I have lost my card"
|
|
35
|
+
- utter: utter_block_card_understand
|
|
36
|
+
- bot: "Select the card you require assistance with:"
|
|
37
|
+
- user: "SetSlots(card_selection=1111222233334444)"
|
|
38
|
+
- utter: utter_acknowledge_reason_fraud_stolen_lost
|
|
39
|
+
- utter: utter_card_blocked
|
|
40
|
+
- utter: utter_ask_confirm_issue_new_card
|
|
41
|
+
- user: "sorry, i selected the wrong card"
|
|
42
|
+
- utter: utter_corrected_previous_input
|
|
43
|
+
- bot: "Select the card you require assistance with:"
|
|
44
|
+
- user: "the second debit card"
|
|
45
|
+
- utter: utter_corrected_previous_input
|
|
46
|
+
- utter: utter_acknowledge_reason_fraud_stolen_lost
|
|
47
|
+
- utter: utter_card_blocked
|
|
48
|
+
- utter: utter_ask_confirm_issue_new_card
|
|
49
|
+
- user: "/SetSlots(confirm_issue_new_card=true)"
|
|
50
|
+
- utter: utter_ask_address_confirmed
|
|
51
|
+
- user: "yes"
|
|
52
|
+
- utter: utter_confirm_physical_address
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
test_cases:
|
|
2
|
+
- test_case: Money Transfer - Happy paths no1
|
|
3
|
+
steps:
|
|
4
|
+
- user: "I want to transfer money"
|
|
5
|
+
- utter: utter_transfer_money_understand
|
|
6
|
+
- bot: "Which account would you like to transfer money from?"
|
|
7
|
+
- user: "12345678"
|
|
8
|
+
- utter: utter_ask_payee_name
|
|
9
|
+
- user: "Robert"
|
|
10
|
+
- utter: utter_ask_amount
|
|
11
|
+
- user: "55"
|
|
12
|
+
- utter: utter_ask_timing
|
|
13
|
+
- user: "immediate"
|
|
14
|
+
- utter: utter_ask_confirm_immediate_payment
|
|
15
|
+
- user: "Yes"
|
|
16
|
+
- utter: utter_transfer_successful
|
|
17
|
+
|
|
18
|
+
- test_case: Money Transfer - Happy paths no2
|
|
19
|
+
steps:
|
|
20
|
+
- user: "I want to transfer $55.55 to Amy from checking"
|
|
21
|
+
- utter: utter_transfer_money_understand
|
|
22
|
+
- utter: utter_ask_timing
|
|
23
|
+
- user: "/SetSlots(timing=now)"
|
|
24
|
+
- utter: utter_ask_confirm_immediate_payment
|
|
25
|
+
- user: "yes"
|
|
26
|
+
- utter: utter_transfer_successful
|
|
27
|
+
|
|
28
|
+
- test_case: Money Transfer - Happy paths no3
|
|
29
|
+
steps:
|
|
30
|
+
- user: "I want to transfer $55.55 to Amy"
|
|
31
|
+
- utter: utter_transfer_money_understand
|
|
32
|
+
- bot: "Which account would you like to transfer money from?"
|
|
33
|
+
- user: "78901234"
|
|
34
|
+
- utter: utter_ask_timing
|
|
35
|
+
- user: "/SetSlots(timing=now)"
|
|
36
|
+
- utter: utter_ask_confirm_immediate_payment
|
|
37
|
+
- user: "yes"
|
|
38
|
+
- utter: utter_transfer_successful
|
|
39
|
+
|
|
40
|
+
- test_case: Money Transfer - Happy paths no4
|
|
41
|
+
steps:
|
|
42
|
+
- user: "I would like to transfer $55.55 to Amy"
|
|
43
|
+
- utter: utter_transfer_money_understand
|
|
44
|
+
- bot: "Which account would you like to transfer money from?"
|
|
45
|
+
- user: "78901234"
|
|
46
|
+
- utter: utter_ask_timing
|
|
47
|
+
- user: "/SetSlots(timing=future)"
|
|
48
|
+
- utter: utter_ask_payment_date
|
|
49
|
+
- user: "12-12-2025"
|
|
50
|
+
- utter: utter_ask_confirm_future_payment
|
|
51
|
+
- user: "yes"
|
|
52
|
+
- utter: utter_payment_scheduled
|
|
53
|
+
|
|
54
|
+
- test_case: Money Transfer - Happy paths no5
|
|
55
|
+
steps:
|
|
56
|
+
- user: "I want to transfer $55.55 to Amy from checking"
|
|
57
|
+
- utter: utter_transfer_money_understand
|
|
58
|
+
- utter: utter_ask_timing
|
|
59
|
+
- user: "/SetSlots(timing=now)"
|
|
60
|
+
- utter: utter_ask_confirm_immediate_payment
|
|
61
|
+
- user: "yes"
|
|
62
|
+
- utter: utter_transfer_successful
|
|
63
|
+
|
|
64
|
+
- test_case: Money Transfer - Happy paths no6
|
|
65
|
+
steps:
|
|
66
|
+
- user: "I want to transfer 55.55$ to Amy"
|
|
67
|
+
- utter: utter_transfer_money_understand
|
|
68
|
+
- bot: "Which account would you like to transfer money from?"
|
|
69
|
+
- user: "67890123"
|
|
70
|
+
- utter: utter_ask_timing
|
|
71
|
+
- user: "immediate"
|
|
72
|
+
- utter: utter_ask_confirm_immediate_payment
|
|
73
|
+
- user: "yes"
|
|
74
|
+
- utter: utter_transfer_successful
|
|
75
|
+
|
|
76
|
+
- test_case: Money Transfer - Happy paths no7
|
|
77
|
+
steps:
|
|
78
|
+
- user: "I want to transfer $55.55 to Amy from checking right now"
|
|
79
|
+
- utter: utter_transfer_money_understand
|
|
80
|
+
- utter: utter_ask_confirm_immediate_payment
|
|
81
|
+
- user: "yes"
|
|
82
|
+
- utter: utter_transfer_successful
|
|
83
|
+
|
|
84
|
+
- test_case: Money Transfer - Happy paths no8
|
|
85
|
+
steps:
|
|
86
|
+
- user: "I want to transfer 100.24$ from my savings to Amy right now"
|
|
87
|
+
- utter: utter_transfer_money_understand
|
|
88
|
+
- utter: utter_ask_confirm_immediate_payment
|
|
89
|
+
- user: "yes"
|
|
90
|
+
- utter: utter_transfer_successful
|
|
91
|
+
|
|
92
|
+
- test_case: Money Transfer - Happy paths no9
|
|
93
|
+
steps:
|
|
94
|
+
- user: "I want to transfer money"
|
|
95
|
+
- utter: utter_transfer_money_understand
|
|
96
|
+
- bot: "Which account would you like to transfer money from?"
|
|
97
|
+
- user: "who are my payees"
|
|
98
|
+
- bot: "You are authorised to transfer money to: Robert, James and Food Market"
|
|
99
|
+
- utter: utter_flow_continue_interrupted
|
|
100
|
+
- bot: "Which account would you like to transfer money from?"
|
|
101
|
+
- user: "I would like to add Timmy as a payee"
|
|
102
|
+
- utter: utter_ask_account_number
|
|
103
|
+
- user: "56567"
|
|
104
|
+
- utter: utter_ask_payee_type
|
|
105
|
+
- user: "/SetSlots(payee_type=person)"
|
|
106
|
+
- utter: utter_ask_reference
|
|
107
|
+
- user: "Facebook Marketplace"
|
|
108
|
+
- utter: utter_ask_confirm_payee_details
|
|
109
|
+
- user: "/SetSlots(confirm_payee_details=True)"
|
|
110
|
+
- utter: utter_payee_added_success
|
|
111
|
+
- utter: utter_flow_continue_interrupted
|
|
112
|
+
- bot: "Which account would you like to transfer money from?"
|
|
113
|
+
- user: "12345678"
|
|
114
|
+
- utter: utter_ask_amount
|
|
115
|
+
- user: "$40.67"
|
|
116
|
+
- utter: utter_ask_timing
|
|
117
|
+
- user: "/SetSlots(timing=now)"
|
|
118
|
+
- utter: utter_ask_confirm_immediate_payment
|
|
119
|
+
- user: "yup"
|
|
120
|
+
- utter: utter_transfer_successful
|
|
121
|
+
|
|
122
|
+
- test_case: Money Transfer - Happy paths no10
|
|
123
|
+
steps:
|
|
124
|
+
- user: "I want to transfer 55 to Amy from savings right now"
|
|
125
|
+
- utter: utter_transfer_money_understand
|
|
126
|
+
- utter: utter_ask_confirm_immediate_payment
|
|
127
|
+
- user: "sorry I meant 65"
|
|
128
|
+
- utter: utter_corrected_previous_input
|
|
129
|
+
- utter: utter_ask_confirm_immediate_payment
|
|
130
|
+
- user: "sorry I meant in the future"
|
|
131
|
+
- utter: utter_corrected_previous_input
|
|
132
|
+
- utter: utter_ask_payment_date
|
|
133
|
+
- user: "12/12/2025"
|
|
134
|
+
- utter: utter_ask_confirm_future_payment
|
|
135
|
+
- user: "Yes"
|
|
136
|
+
- utter: utter_payment_scheduled
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
test_cases:
|
|
2
|
+
- test_case: payee_management - Happy paths no1
|
|
3
|
+
steps:
|
|
4
|
+
- user: "who are my payees"
|
|
5
|
+
- bot: "You are authorised to transfer money to: Robert, James and Food Market"
|
|
6
|
+
|
|
7
|
+
- test_case: payee_management - Happy paths no2
|
|
8
|
+
steps:
|
|
9
|
+
- user: "I want to add a payee"
|
|
10
|
+
- utter: utter_ask_payee_name
|
|
11
|
+
- user: "Sonia Smith"
|
|
12
|
+
- utter: utter_ask_account_number
|
|
13
|
+
- user: "123456"
|
|
14
|
+
- utter: utter_ask_payee_type
|
|
15
|
+
- user: "person"
|
|
16
|
+
- utter: utter_ask_reference
|
|
17
|
+
- user: "Facebook Marketplace"
|
|
18
|
+
- utter: utter_ask_confirm_payee_details
|
|
19
|
+
- user: "/SetSlots(confirm_payee_details=True)"
|
|
20
|
+
- utter: utter_payee_added_success
|
|
21
|
+
|
|
22
|
+
- test_case: payee_management - Happy paths no3
|
|
23
|
+
steps:
|
|
24
|
+
- user: "who are my payees"
|
|
25
|
+
- bot: "You are authorised to transfer money to: Robert, James and Food Market"
|
|
26
|
+
- user: "I want to remove a payee"
|
|
27
|
+
- utter: utter_ask_rephrase
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import csv
|
|
1
2
|
import logging
|
|
2
3
|
from datetime import datetime
|
|
3
4
|
|
|
4
|
-
import pandas as pd
|
|
5
5
|
from rasa_sdk import Action
|
|
6
6
|
from rasa_sdk.events import SlotSet
|
|
7
7
|
|
|
@@ -29,17 +29,11 @@ class ActionVerifyBillByDate(Action):
|
|
|
29
29
|
return "Invalid format. Please use a full month name (e.g., 'March')."
|
|
30
30
|
|
|
31
31
|
def run(self, dispatcher, tracker, domain):
|
|
32
|
-
# Load CSV file with billing data
|
|
33
|
-
df = pd.read_csv("csvs/billing.csv")
|
|
34
|
-
|
|
35
32
|
# Get customer ID and date from slots
|
|
36
33
|
customer_id = tracker.get_slot("customer_id")
|
|
37
34
|
bill_month = tracker.get_slot("bill_month")
|
|
38
|
-
# logging.info(f"This is an info message: bill_month : {bill_month}")
|
|
39
35
|
|
|
40
36
|
bill_date = ActionVerifyBillByDate.text_to_date(bill_month)
|
|
41
|
-
# logging.info(f"This is an info message: bill_month after
|
|
42
|
-
# transformation: {bill_date}")
|
|
43
37
|
|
|
44
38
|
if not customer_id:
|
|
45
39
|
dispatcher.utter_message(
|
|
@@ -53,37 +47,69 @@ class ActionVerifyBillByDate(Action):
|
|
|
53
47
|
)
|
|
54
48
|
return []
|
|
55
49
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
50
|
+
try:
|
|
51
|
+
# Load CSV file with billing data
|
|
52
|
+
with open("csvs/billing.csv", "r", newline="") as csvfile:
|
|
53
|
+
reader = csv.DictReader(csvfile)
|
|
54
|
+
|
|
55
|
+
# Convert bill_date to datetime for comparison
|
|
56
|
+
bill_date_obj = datetime.strptime(bill_date, "%d/%m/%Y")
|
|
57
|
+
|
|
58
|
+
# Filter data for the given customer and date
|
|
59
|
+
customer_bills = []
|
|
60
|
+
specific_bill = None
|
|
61
|
+
|
|
62
|
+
for row in reader:
|
|
63
|
+
if row["customer_id"] == str(customer_id):
|
|
64
|
+
# Parse the date from CSV
|
|
65
|
+
row_date = datetime.strptime(row["date"], "%Y-%m-%d")
|
|
66
|
+
row["amount"] = float(row["amount"])
|
|
67
|
+
customer_bills.append(row)
|
|
68
|
+
|
|
69
|
+
# Check if this is the specific bill we're looking for
|
|
70
|
+
if row_date.date() == bill_date_obj.date():
|
|
71
|
+
specific_bill = row
|
|
72
|
+
|
|
73
|
+
if specific_bill is None:
|
|
74
|
+
dispatcher.utter_message(
|
|
75
|
+
f"No bill found for {bill_date_obj.date()}."
|
|
76
|
+
)
|
|
77
|
+
return []
|
|
78
|
+
|
|
79
|
+
bill_amount = specific_bill["amount"]
|
|
80
|
+
|
|
81
|
+
# Calculate average
|
|
82
|
+
if customer_bills:
|
|
83
|
+
average_bill = sum(bill["amount"] for bill in customer_bills) / len(
|
|
84
|
+
customer_bills
|
|
85
|
+
)
|
|
86
|
+
else:
|
|
87
|
+
average_bill = 0
|
|
88
|
+
|
|
89
|
+
difference = bill_amount - average_bill
|
|
90
|
+
|
|
91
|
+
# Generate response
|
|
92
|
+
response = (
|
|
93
|
+
f"Your bill for {bill_month} {bill_date_obj.date().year} is "
|
|
94
|
+
f"${bill_amount:.2f}. \n"
|
|
95
|
+
f"The average of your past bills is ${average_bill:.2f}. \n"
|
|
96
|
+
f"This bill is {'higher' if difference > 0 else 'lower'} than "
|
|
97
|
+
f"your average by ${abs(difference):.2f}."
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
dispatcher.utter_message(response)
|
|
101
|
+
return [
|
|
102
|
+
SlotSet("bill_amount", int(bill_amount)),
|
|
103
|
+
SlotSet("average_bill", int(average_bill)),
|
|
104
|
+
SlotSet("difference", int(difference)),
|
|
105
|
+
]
|
|
106
|
+
|
|
107
|
+
except FileNotFoundError:
|
|
108
|
+
dispatcher.utter_message("Billing data file not found.")
|
|
109
|
+
return []
|
|
110
|
+
except Exception:
|
|
111
|
+
dispatcher.utter_message("Error retrieving billing information.")
|
|
66
112
|
return []
|
|
67
|
-
|
|
68
|
-
bill_amount = specific_bill.iloc[0]["amount"]
|
|
69
|
-
average_bill = customer_bills["amount"].mean()
|
|
70
|
-
difference = bill_amount - average_bill
|
|
71
|
-
|
|
72
|
-
# Generate response
|
|
73
|
-
response = (
|
|
74
|
-
f"Your bill for {bill_month} {bill_date.date().year} is "
|
|
75
|
-
f"${bill_amount:.2f}. \n"
|
|
76
|
-
f"The average of your past bills is ${average_bill:.2f}. \n"
|
|
77
|
-
f"This bill is {'higher' if difference > 0 else 'lower'} than "
|
|
78
|
-
f"your average by ${abs(difference):.2f}."
|
|
79
|
-
)
|
|
80
|
-
|
|
81
|
-
dispatcher.utter_message(response)
|
|
82
|
-
return [
|
|
83
|
-
SlotSet("bill_amount", int(bill_amount)),
|
|
84
|
-
SlotSet("average_bill", int(average_bill)),
|
|
85
|
-
SlotSet("difference", int(difference)),
|
|
86
|
-
]
|
|
87
113
|
|
|
88
114
|
|
|
89
115
|
class ActionRecapBill(Action):
|
|
@@ -91,21 +117,11 @@ class ActionRecapBill(Action):
|
|
|
91
117
|
return "action_recap_bill"
|
|
92
118
|
|
|
93
119
|
def run(self, dispatcher, tracker, domain):
|
|
94
|
-
# Path to the CSV file (Update path if necessary)
|
|
95
|
-
csv_path = "csvs/billing.csv"
|
|
96
|
-
|
|
97
|
-
# Read the CSV
|
|
98
|
-
df = pd.read_csv(csv_path)
|
|
99
|
-
# this can be shown in the logs of your custom action, if you want
|
|
100
|
-
# the message to be displayed to the user use 'dispatcher.utter_message'
|
|
101
|
-
print(df)
|
|
102
120
|
# Get customer_id and bill_date from slots
|
|
103
121
|
customer_id = tracker.get_slot("customer_id")
|
|
104
122
|
bill_month = tracker.get_slot("bill_month")
|
|
105
|
-
|
|
106
|
-
df["date"] = pd.to_datetime(df["date"])
|
|
123
|
+
|
|
107
124
|
bill_date = ActionVerifyBillByDate.text_to_date(bill_month)
|
|
108
|
-
bill_date = pd.to_datetime(bill_date)
|
|
109
125
|
|
|
110
126
|
if not customer_id:
|
|
111
127
|
dispatcher.utter_message(
|
|
@@ -126,26 +142,55 @@ class ActionRecapBill(Action):
|
|
|
126
142
|
dispatcher.utter_message("Invalid customer ID format.")
|
|
127
143
|
return []
|
|
128
144
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
145
|
+
try:
|
|
146
|
+
# Load CSV file
|
|
147
|
+
with open("csvs/billing.csv", "r", newline="") as csvfile:
|
|
148
|
+
reader = csv.DictReader(csvfile)
|
|
149
|
+
|
|
150
|
+
bill_date_obj = datetime.strptime(bill_date, "%d/%m/%Y")
|
|
151
|
+
|
|
152
|
+
# Filter records for the given customer_id
|
|
153
|
+
filtered_records = []
|
|
154
|
+
for row in reader:
|
|
155
|
+
if row["customer_id"] == str(customer_id):
|
|
156
|
+
# Parse date and add to filtered records
|
|
157
|
+
row_date = datetime.strptime(row["date"], "%Y-%m-%d")
|
|
158
|
+
filtered_records.append(
|
|
159
|
+
{
|
|
160
|
+
"date": row_date,
|
|
161
|
+
"amount": float(row["amount"]),
|
|
162
|
+
"source": row["source"],
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
if not filtered_records:
|
|
167
|
+
dispatcher.utter_message(
|
|
168
|
+
f"No transactions found for customer {customer_id} on "
|
|
169
|
+
f"{bill_date_obj.date().strftime('%B %Y')}."
|
|
170
|
+
)
|
|
171
|
+
return []
|
|
172
|
+
|
|
173
|
+
# Format the output
|
|
174
|
+
response1 = "Here is a summary of your costs :"
|
|
175
|
+
dispatcher.utter_message(response1)
|
|
176
|
+
response = "\n".join(
|
|
177
|
+
[
|
|
178
|
+
(
|
|
179
|
+
f"{record['date'].date()} | {record['amount']} $ "
|
|
180
|
+
f"| {record['source']}"
|
|
181
|
+
)
|
|
182
|
+
for record in filtered_records
|
|
183
|
+
]
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
# Send response to user
|
|
187
|
+
dispatcher.utter_message(response)
|
|
188
|
+
print("response heeere", response)
|
|
189
|
+
return []
|
|
190
|
+
|
|
191
|
+
except FileNotFoundError:
|
|
192
|
+
dispatcher.utter_message("Billing data file not found.")
|
|
193
|
+
return []
|
|
194
|
+
except Exception:
|
|
195
|
+
dispatcher.utter_message("Error retrieving billing information.")
|
|
137
196
|
return []
|
|
138
|
-
|
|
139
|
-
# Format the output
|
|
140
|
-
response1 = "Here is a summary of your costs :"
|
|
141
|
-
dispatcher.utter_message(response1)
|
|
142
|
-
response = "\n".join(
|
|
143
|
-
[
|
|
144
|
-
f"{row['date'].date()} | {row['amount']} $ | {row['source']}"
|
|
145
|
-
for _, row in filtered_df.iterrows()
|
|
146
|
-
]
|
|
147
|
-
)
|
|
148
|
-
# Send response to user
|
|
149
|
-
dispatcher.utter_message(response)
|
|
150
|
-
print("response heeere", response)
|
|
151
|
-
return []
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import csv
|
|
2
|
+
|
|
2
3
|
from rasa_sdk import Action
|
|
3
4
|
from rasa_sdk.events import SlotSet
|
|
4
5
|
|
|
@@ -10,18 +11,32 @@ class ActionGetCustomerInfo(Action):
|
|
|
10
11
|
def run(self, dispatcher, tracker, domain):
|
|
11
12
|
# Load CSV file
|
|
12
13
|
file_path = "csvs/customers.csv" # get information from your DBs
|
|
13
|
-
df = pd.read_csv(file_path)
|
|
14
14
|
customer_id = tracker.get_slot("customer_id")
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
try:
|
|
17
|
+
with open(file_path, "r", newline="") as csvfile:
|
|
18
|
+
reader = csv.DictReader(csvfile)
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
# Filter data for the given customer ID
|
|
21
|
+
customer_info = None
|
|
22
|
+
for row in reader:
|
|
23
|
+
if row["customer_id"] == str(customer_id):
|
|
24
|
+
customer_info = row
|
|
25
|
+
break
|
|
26
|
+
|
|
27
|
+
if customer_info is None:
|
|
28
|
+
dispatcher.utter_message("No customer found with this ID.")
|
|
29
|
+
return []
|
|
22
30
|
|
|
23
|
-
|
|
24
|
-
|
|
31
|
+
# Extract customer details
|
|
32
|
+
first_name = customer_info["first_name"]
|
|
25
33
|
|
|
26
|
-
|
|
27
|
-
|
|
34
|
+
# Set the retrieved name in a slot
|
|
35
|
+
return [SlotSet("customer_first_name", first_name)]
|
|
36
|
+
|
|
37
|
+
except FileNotFoundError:
|
|
38
|
+
dispatcher.utter_message("Customer database file not found.")
|
|
39
|
+
return []
|
|
40
|
+
except Exception:
|
|
41
|
+
dispatcher.utter_message("Error retrieving customer information.")
|
|
42
|
+
return []
|
|
@@ -42,7 +42,7 @@ if TYPE_CHECKING:
|
|
|
42
42
|
from sanic import Sanic, Websocket # type: ignore[attr-defined]
|
|
43
43
|
from socketio import AsyncServer
|
|
44
44
|
|
|
45
|
-
from rasa.core.channels.channel import
|
|
45
|
+
from rasa.core.channels.channel import UserMessage
|
|
46
46
|
from rasa.shared.core.trackers import DialogueStateTracker
|
|
47
47
|
|
|
48
48
|
|
|
@@ -181,7 +181,9 @@ class StudioChatInput(SocketIOInput, VoiceInputChannel):
|
|
|
181
181
|
self._register_tracker_update_hook()
|
|
182
182
|
|
|
183
183
|
@classmethod
|
|
184
|
-
def from_credentials(
|
|
184
|
+
def from_credentials(
|
|
185
|
+
cls, credentials: Optional[Dict[Text, Any]]
|
|
186
|
+
) -> "StudioChatInput":
|
|
185
187
|
"""Creates a StudioChatInput channel from credentials."""
|
|
186
188
|
credentials = credentials or {}
|
|
187
189
|
|
|
@@ -794,7 +794,7 @@ class EnterpriseSearchPolicy(LLMHealthCheckMixin, EmbeddingsHealthCheckMixin, Po
|
|
|
794
794
|
)
|
|
795
795
|
print_error_and_exit(error_message)
|
|
796
796
|
|
|
797
|
-
docs = glob.glob(os.path.join(docs_folder, "
|
|
797
|
+
docs = glob.glob(os.path.join(docs_folder, "**/*.txt"), recursive=True)
|
|
798
798
|
if not docs or len(docs) < 1:
|
|
799
799
|
error_message = (
|
|
800
800
|
f"Document source directory is empty: '{docs_folder}'. "
|
|
@@ -219,11 +219,6 @@ class FlowRetrieval(EmbeddingsHealthCheckMixin):
|
|
|
219
219
|
if self.vector_store is not None:
|
|
220
220
|
with self._model_storage.write_to(self._resource) as model_path:
|
|
221
221
|
self.vector_store.save_local(model_path)
|
|
222
|
-
else:
|
|
223
|
-
structlogger.warning(
|
|
224
|
-
"flow_retrieval.persist_vector_store.not_initialized",
|
|
225
|
-
event_info="Vector store is None, not persisted.",
|
|
226
|
-
)
|
|
227
222
|
|
|
228
223
|
def _persist_config(self) -> None:
|
|
229
224
|
with self._model_storage.write_to(self._resource) as path:
|
|
@@ -249,6 +244,16 @@ class FlowRetrieval(EmbeddingsHealthCheckMixin):
|
|
|
249
244
|
)
|
|
250
245
|
|
|
251
246
|
flows_to_embedd = flows.exclude_link_only_flows()
|
|
247
|
+
|
|
248
|
+
if not flows_to_embedd:
|
|
249
|
+
structlogger.debug(
|
|
250
|
+
"flow_retrieval.populate_vector_store.no_flows_to_embed",
|
|
251
|
+
event_info=(
|
|
252
|
+
"No flows to embed in the vector store, skipping population."
|
|
253
|
+
),
|
|
254
|
+
)
|
|
255
|
+
return
|
|
256
|
+
|
|
252
257
|
embeddings = self._create_embedder(self.config)
|
|
253
258
|
documents = self._generate_flow_documents(flows_to_embedd, domain)
|
|
254
259
|
try:
|
|
@@ -420,10 +425,6 @@ class FlowRetrieval(EmbeddingsHealthCheckMixin):
|
|
|
420
425
|
The top k documents with similarity scores.
|
|
421
426
|
"""
|
|
422
427
|
if self.vector_store is None:
|
|
423
|
-
structlogger.error(
|
|
424
|
-
"flow_retrieval.query_vector_store.vector_store_not_configured",
|
|
425
|
-
event_info="Vector store is not configured",
|
|
426
|
-
)
|
|
427
428
|
return []
|
|
428
429
|
try:
|
|
429
430
|
documents_with_scores = (
|
rasa/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: rasa-pro
|
|
3
|
-
Version: 3.13.
|
|
3
|
+
Version: 3.13.1a8
|
|
4
4
|
Summary: State-of-the-art open-core Conversational AI framework for Enterprises that natively leverages generative AI for effortless assistant development.
|
|
5
5
|
Keywords: nlp,machine-learning,machine-learning-library,bot,bots,botkit,rasa conversational-agents,conversational-ai,chatbot,chatbot-framework,bot-framework
|
|
6
6
|
Author: Rasa Technologies GmbH
|