hi everyone, i am getting the same error, in rasa x. i have done all the above steps. please help me. my domain.yml %YAML 1.1
actions:
- ActionHelloWorld
- action_check_restaurants
- restaurant_form
- utter_build
- utter_cheer_up
- utter_consultance
- utter_did_that_help
- utter_domain
- utter_goodbye
- utter_greet
- utter_happy
- utter_joke
- utter_name
- utter_thanks
- utter_send
entities:
- name
- project_name
- program_use
- idea
- application
- money
- contact
intents:
- affirm
- deny
- goodbye
- greet
- joke
- mood_great
- mood_unhappy
- name
- restaurant
- requestquote
slots: name: type: text project_name: type: unfeaturized auto_fill: false program_use: type: unfeaturized auto_fill: false idea: type: unfeaturized auto_fill: false application: type: unfeaturized auto_fill: false money: type: unfeaturized auto_fill: false contact: type: unfeaturized auto_fill: false
templates: utter_build:
- text: We can build any sort of IT solutions like Web or Product Development utter_cheer_up:
- image: https://i.imgur.com/nGF1K8f.jpg text: ‘Here is something to cheer you up:’ utter_consultance:
- text: We are experts in consultance. We can get you in touch with our experts to develop your idea. utter_did_that_help:
- text: Did that help you? utter_domain:
- buttons:
- payload: ‘/choose{“service”: “consultance”}’ title: Consultance
- payload: ‘/choose{“service”: “build”}’ title: build text: what service would you like? utter_goodbye:
- text: Bye utter_greet:
- text: Hi {name} ! How are you ? utter_happy:
- text: Great carry on! utter_joke:
- text: why is 9 afraid of 7 cuz 789 utter_name:
- text: Tell me your name? utter_thanks:
- text: Thank you utter_send:
- text: I will send these details and get back to you shortly.
forms:
- quote_form
policies:
- name: “FormPolicy”
actions.py
This files contains your custom actions which can be used to run
custom Python code.
See this guide on how to implement these action:
Actions
This is a simple example for a custom action which utters “Hello World!”
from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcherfrom typing import Any, Text, Dict, List
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]]:
dispatcher.utter_message(“Hello World!”)
return []
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]]:
dispatcher.utter_message(“Hello World!”)
return []
from rasa_core_sdk import Action from rasa_core_sdk.events import SlotSet from typing import Dict, Text, Any, List, Union, Optional
from rasa_core_sdk import ActionExecutionRejection from rasa_core_sdk import Tracker from rasa_core_sdk.executor import CollectingDispatcher from rasa_core_sdk.forms import FormAction, REQUESTED_SLOT
class ActionCheckRestaurants(Action):
def name(self):
# type: () -> Text
return “action_check_restaurants”
def run(self, dispatcher, tracker, domain):
# type: (CollectingDispatcher, Tracker, Dict[Text, Any]) -> List[Dict[Text, Any]]
#cuisine = tracker.get_slot(‘name’)
#q = “select * from restaurants where cuisine=’{0}’ limit 1”.format(cuisine)
#result = db.query(q)
result = “Let me show you some restaurents”
return [SlotSet(“matches”, result)]
class Quoteform(FormAction): def name(self): return “quote_form”
@staticmethod
def required_slot(tracker:Tracker)->List[Text]:
return (["project_name","program_use","idea","application","money","contact"])
def slot_mappings(self):
# type: () -> Dict[Text: Union[Dict, List[Dict]]]
"""A dictionary to map required slots to
- an extracted entity
- intent: value pairs
- a whole message
or a list of them, where a first match will be picked"""
return {"project_name": [self.from_text()],
"program_use": [self.from_text()],
"idea": [self.from_text()],
"application": [self.from_text()],
"money": [self.from_text()],
"contact": [self.from_text()]}
def submit(self,dispatcher : CollectingDispatcher,tracker:Tracker,domain :Dict[Text,Any]) -> List[Dict]:
dispatcher.utter_template('utter_send',tracker)
return []
my story
New Story
- greet
- utter_name
- name{“name”:“harsh”}
- utter_greet
- mood_great
- requestquote
- quote_form
pls help me !!!