I am following rasa weatherbot tutorial. I am able to get the results properly and everything works fine but since i have implemented fallback policy my custom action is not working when i set core_threshold & nlu_threshold >0.3. when both are set in 0.3 everything works fine but as soon as they are increases even when my confidence score is >.9 i am only getting fallback messages. Please help me.
Domain.yml
%YAML 1.1
---
actions:
- utter_greet
- utter_goodbye
- utter_ask_location
- action_weather
- utter_default
entities:
- purchase
- booking
- location
- goodbye
intents:
- inform
- greet
- goodbye
slots:
location:
type: text
templates:
utter_ask_location:
- text: In what location ?
utter_default:
- text: Sorry i cant understand
utter_goodbye:
- text: Talk to you later.
- text: Bye Bye :(
utter_greet:
- text: Hello ! How can i help you
Stories.md
story 01
- greet
- utter_greet
story 02
- goodbye
- utter_goodbye
story 03
- inform
- utter_ask_location
story 04
- inform
- action_weather
- greet
- utter_greet
- inform
- utter_ask_location
- inform
- utter_ask_location
- inform
- utter_ask_location
- inform
- action_restart
Generated Story 8218453580895522855
- greet
- utter_greet
- goodbye{âbookingâ: âbookâ}
- action_default_fallback
- rewind
- goodbye{âpurchaseâ: âbuyâ}
- action_default_fallback
- rewind
- goodbye{âbookingâ: âtrainâ}
- action_default_fallback
- rewind
- inform
- utter_ask_location
- inform{âlocationâ: ânewyorkâ}
- slot{âlocationâ: ânewyorkâ}
- action_weather
- inform{âlocationâ: âlondonâ}
- slot{âlocationâ: âlondonâ}
- action_weather
- slot{âlocationâ: âlondonâ}
- goodbye{âgoodbyeâ: âcyaâ}
- utter_goodbye
dialogue_management.py
from future import absolute_import from future import division from future import print_function from future import unicode_literals
import logging
import rasa_core
from rasa_core.agent import Agent
from rasa_core.policies.keras_policy import KerasPolicy
from rasa_core.policies.memoization import MemoizationPolicy
from rasa_core.interpreter import RasaNLUInterpreter
from rasa_core.utils import EndpointConfig
from rasa_core.run import serve_application
from rasa_core import config
from rasa_core.policies.fallback import FallbackPolicy
from rasa_core.policies.keras_policy import KerasPolicy
logger = logging.getLogger(name)
def train_dialogue(domain_file=âC:\RASA_nlu\domain.ymlâ, model_path=âC:\RASA_nlu\models\dialogueâ, training_data_file=âC:\RASA_nlu\data\stories.mdâ):
fallback = FallbackPolicy(fallback_action_name="action_default_fallback",core_threshold=0.4,nlu_threshold=0.5) agent = Agent(domain_file, policies=[MemoizationPolicy(), KerasPolicy(max_history=3, epochs=200, batch_size=50),fallback]) data = agent.load_data(training_data_file) agent.train(data) agent.persist(model_path) return agentdef run_weather_bot(serve_forever=True):
interpreter = RasaNLUInterpreter('C:\\RASA_nlu\\models\\nlu\\default\\weathernlu') action_endpoint = EndpointConfig(url="http://localhost:5055/webhook") agent = Agent.load('C:\\RASA_nlu\\models\\dialogue', interpreter=interpreter, action_endpoint=action_endpoint) rasa_core.run.serve_application(agent, channel='cmdline') return agentif name == âmainâ:
train_dialogue() run_weather_bot()