Hi, I want the bot to utter a value that is float type. I have set the slot as type float. But it’s always showing the value is none.
The complete is given here: nlu.yml:
-
intent: mood_great
examples: |
- perfect
- great
- amazing
- feeling like a king
- wonderful
- I am feeling very good
- I am great
- I am amazing
- I am going to save the world
- super stoked
- extremely good
- so so perfect
- so good
- so perfect
-
intent: parameter_tuning_mu
examples: |
- Change the mutation rate parameter
- Set the mutation rate parameter
- I want to change the mutation rate parameter
- Tune parameter by changing the mutation rate parameter
- Run the algorithm with new mutation rate parameter
- Take new value of mu rate parameter
- change the value of mu rate parameter
- I want to change the murate parameter
-
intent: new_parameter
examples: |
- 0.01
- 0.05
- 0.03
- 0.02
- parameter is 0.01
- parameter is 0.05
- It is 0.05
domain.yml: version: “3.1”
intents:
- greet
- goodbye
- affirm
- deny
- mood_great
- mood_unhappy
- bot_challenge
- parameter_tuning_mu
- new_parameter
- crossover_value_tuning
slots:
parameter:
type: float
min_value: 0.00
max_value: 1.00
mappings:
- type: custom
value:
type: float
min_value: 0.00
max_value: 1.00
mappings:
- type: custom
actions:
- action_hello_world
responses:
utter_greet:
- text: “Hey! How are you?”
utter_cheer_up:
-
text: “Here is something to cheer you up:”
image: “https://i.imgur.com/nGF1K8f.jpg”
utter_did_that_help:
- text: “Did that help you?”
utter_happy:
- text: “Great, carry on!”
utter_goodbye:
- text: “Bye”
utter_ask_mutation_rate:
- text: “What will be the next parameter?”
utter_ask_crossover_rate:
- text: “What will be the next value?”
utter_next:
- text: “ok, what is next?”
utter_iamabot:
- text: “I am a bot, powered by Rasa.”
config: store_entities_as_slots: true
session_config: session_expiration_time: 60 carry_over_slots_to_new_session: true
stories.yml:
-
story: parameter tuning path
steps:
- intent: greet
- action: utter_greet
- intent: mood_great
- action: utter_happy
- intent: parameter_tuning_mu
- action: utter_ask_mutation_rate
- intent: new_parameter
- action: action_hello_world
- action: utter_next
from typing import Any, Text, Dict, List
from rasa_sdk.events import SlotSet
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
class ActionHelloWorld(Action):
def name(self) -> Text:
return "action_hello_world"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
parameter = tracker.get_slot("parameter")
if not parameter:
dispatcher.utter_message(text="No mutation rate" )
else:
dispatcher.utter_message(text="The mutation rate is {.2f% parameter}")
return [SlotSet("parameter", parameter)]
Any help is highly appreciated.