From 0e83d4f7280196fb959f00bbb8e3322b6a0bbb4d Mon Sep 17 00:00:00 2001
From: Dominic Kraemer
 <Dominic_Daniel.Kraemer@Student.Reutlingen-University.de>
Date: Thu, 20 Jun 2024 17:17:31 +0200
Subject: [PATCH] add fallback feature

---
 rasa/config.yml                  | 2 +-
 rasa/data/rules/rules_basics.yml | 5 +++++
 rasa/domain.yml                  | 7 +++++++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/rasa/config.yml b/rasa/config.yml
index 107a70d..8e67e49 100644
--- a/rasa/config.yml
+++ b/rasa/config.yml
@@ -36,7 +36,7 @@ pipeline:
     epochs: 100
     constrain_similarities: true
   - name: FallbackClassifier
-    threshold: 0.3
+    threshold: 0.7
     ambiguity_threshold: 0.1
 
 # Configuration for Rasa Core.
diff --git a/rasa/data/rules/rules_basics.yml b/rasa/data/rules/rules_basics.yml
index 58143fd..db03ca7 100644
--- a/rasa/data/rules/rules_basics.yml
+++ b/rasa/data/rules/rules_basics.yml
@@ -1,6 +1,11 @@
 version: "3.1"
 
 rules:
+- rule: ask the user to rephrase whenever they send a message with low NLU confidence
+  steps:
+  - intent: nlu_fallback
+  - action: utter_could_not_understand
+
 - rule: respond to a thankful user
   steps:
   - intent: thank_you
diff --git a/rasa/domain.yml b/rasa/domain.yml
index 9d03497..9233a15 100644
--- a/rasa/domain.yml
+++ b/rasa/domain.yml
@@ -65,6 +65,13 @@ actions:
   - action_future_iss_location
 
 responses:
+  utter_could_not_understand:
+  - text: "I'm sorry, I didn't quite understand that. Could you rephrase?"
+
+  #######################################################
+  #######################################################
+  #######################################################
+
   utter_your_welcome:
   - text: "You're welcome! I am always happy to assist you."
   - text: "Of course! If you have any other question or request feel free to ask them!"
-- 
GitLab