by the way the None india
is printed from the action_answer
method not the validation method
I want the same output as the one here: Could any body tell me why the validation form methods don't be called automatically(don't work at all)? - #28 by sun
ok
(rasa-chatbot3.8) D:\master-linux\salama4ai-chatbot>rasa run actions
2022-02-20 13:09:11 INFO rasa_sdk.endpoint - Starting action endpoint server...
2022-02-20 13:09:11 INFO rasa_sdk.executor - Registered function for 'action_answer'.
2022-02-20 13:09:11 INFO rasa_sdk.executor - Registered function for 'validate_country_pop_cap_form'.
2022-02-20 13:09:12 INFO rasa_sdk.endpoint - Action endpoint is up and running on http://0.0.0.0:5055
{'config': {'store_entities_as_slots': True}, 'session_config': {'session_expiration_time': 60, 'carry_over_slots_to_new_session': True}, 'intents': [{'country_pop_cap_query': {'use_entities': True}}, {'greet': {'use_entities': True}}, {'bot_challenge': {'use_entities': True}}, {'goodbye': {'use_entities': True}}, {'thank': {'use_entities': True}}], 'entities': ['country', 'pop_cap'], 'slots': {'pop_cap': {'type': 'rasa.shared.core.slots.CategoricalSlot', 'initial_value': None, 'influence_conversation': False, 'mappings': [{'type': 'from_entity', 'entity': 'pop_cap'}], 'values': ['capital', 'population']}, 'country': {'type': 'rasa.shared.core.slots.TextSlot', 'initial_value': None, 'influence_conversation': False, 'mappings': [{'type': 'from_entity', 'entity': 'country'}]}}, 'responses': {'utter_greet': [{'text': 'Hey! How are you?'}, {'text': 'hey dude, how are you doing'}, {'text': "you, what's up"}, {'text': 'Hi there, How is your day going?'}, {'text': 'how day bro'}, {'text': 'hello buddy, how you doing'}, {'text': 'Welcome. How is your day going?'}], 'utter_thank': [{'text': 'you are welcome bro'}, {'text': 'always happy to help'}, {'text': 'with pleasure dude'}, {'text': "it's my pleasure"}], 'utter_goodbye': [{'text': 'Bye, see you'}, {'text': 'bye bye :)'}, {'text': 'have a nice day'}, {'text': 'see you around'}, {'text': 'have a great day dude'}, {'text': 'have a good day bro'}, {'text': 'all the best buddy'}, {'text': 'see you'}], 'utter_iamabot': [{'text': 'I am a bot, how did you guess that :)'}, {'text': 'I am a bot, powered by Rasa.'}, {'text': 'your guess is correct, I am a bot :)'}, {'text': "you are so clever to guess that, yes i'm a bot :)"}, {'text': "dude i was tring to hide that, ya i'm a bot"}, {'text': "that what i was tring to not let you reveal, ya i'm a bot"}], 'utter_offer': [{'text': 'I can give you information about the capital and population of some countries if you like'}, {'text': 'I have information about the capital and number of population of some countries'}, {'text': 'if you interested to know about the population or the capital of countries, i can help you '}, {'text': 'By the way, i offer information about the capital and the population of countries'}, {'text': 'i will provide you with the capital and population if you ask me'}, {'text': 'please feel free to ask me about the capital and population of countries'}, {'text': 'if you interested in knowing the population or the capital of counties, i will help you'}, {'text': 'the population and the capital of countries is my game'}], 'utter_ask_country': [{'text': 'Which country do you want to know about please?'}, {'text': 'Please determine which country you intent'}, {'text': 'which country do you interested in?'}, {'text': 'which country do you care about?'}, {'text': 'select a country please?'}], 'utter_ask_pop_cap': [{'text': 'Do you want to know about the Population or the Capital of {country}?'}, {'text': 'Are you interested in knowing the Population or the Capital of {country}?'}, {'text': 'do you intented in the Capital or the Population?'}, {'text': 'are you care about the Capital or the Population?'}], 'utter_server_failure': [{'text': "i'm so sorry, but we are facing server problem now, could you try later please?"}, {'text': 'so sorry, could you try later please? there are some issues '}, {'text': "i'm sorry, perhaps a connection problem happened"}, {'text': 'The server encountered an internal error and cannot complete your request.'}], 'utter_not_found': [{'text': "I'm so sorry, but {country} is not included in our database?"}, {'text': "Sorry, i don't know about {country}, select another one please?"}, {'text': 'Unfortunately, i know nothing about {country}, could you determine another country pls?'}, {'text': "hmm, i appologize i don't know much about that country, select another one please"}, {'text': "i don't know about this country dude, sorry!"}], 'utter_answer_cap': [{'text': 'The capital city of {country} is {cap}'}, {'text': '{cap} is the capital city of {country}'}], 'utter_answer_pop': [{'text': '{country} has a population of about {pop} '}, {'text': 'Population of {country} is about {pop}'}], 'utter_typo': [{'text': "Sorry, i didn't get you Please could you spell your input correctly?"}, {'text': "i didn't understand, Please could you spell your message accurately?"}, {'text': 'could you rewrite your choice correctly please'}, {'text': "i'm affraid i didn't understand, Please could you spell your input correctly?"}, {'text': 'it seems that you write some words wrongly'}, {'text': 'Please could you spell it correctly?'}, {'text': 'Sorry, Iām afraid I donāt follow you.'}, {'text': 'Excuse me, could you rewrite your words correctly please?'}, {'text': 'Iām sorry, I donāt understand. Could you write it correctly please?'}]}, 'actions': ['utter_greet', 'utter_offer', 'utter_iamabot', 'utter_thank', 'utter_goodbye', 'utter_ask_country', 'utter_ask_pop_cap', 'utter_not_found', 'utter_server_failure', 'utter_answer_cap', 'utter_answer_pop', 'utter_typo', 'validate_country_pop_cap_form', 'action_answer'], 'forms': {'country_pop_cap_form': {'required_slots': ['country', 'pop_cap']}}, 'e2e_actions': []}
validate_country
{'config': {'store_entities_as_slots': True}, 'session_config': {'session_expiration_time': 60, 'carry_over_slots_to_new_session': True}, 'intents': [{'country_pop_cap_query': {'use_entities': True}}, {'greet': {'use_entities': True}}, {'bot_challenge': {'use_entities': True}}, {'goodbye': {'use_entities': True}}, {'thank': {'use_entities': True}}], 'entities': ['country', 'pop_cap'], 'slots': {'pop_cap': {'type': 'rasa.shared.core.slots.CategoricalSlot', 'initial_value': None, 'influence_conversation': False, 'mappings': [{'type': 'from_entity', 'entity': 'pop_cap'}], 'values': ['capital', 'population']}, 'country': {'type': 'rasa.shared.core.slots.TextSlot', 'initial_value': None, 'influence_conversation': False, 'mappings': [{'type': 'from_entity', 'entity': 'country'}]}}, 'responses': {'utter_greet': [{'text': 'Hey! How are you?'}, {'text': 'hey dude, how are you doing'}, {'text': "you, what's up"}, {'text': 'Hi there, How is your day going?'}, {'text': 'how day bro'}, {'text': 'hello buddy, how you doing'}, {'text': 'Welcome. How is your day going?'}], 'utter_thank': [{'text': 'you are welcome bro'}, {'text': 'always happy to help'}, {'text': 'with pleasure dude'}, {'text': "it's my pleasure"}], 'utter_goodbye': [{'text': 'Bye, see you'}, {'text': 'bye bye :)'}, {'text': 'have a nice day'}, {'text': 'see you around'}, {'text': 'have a great day dude'}, {'text': 'have a good day bro'}, {'text': 'all the best buddy'}, {'text': 'see you'}], 'utter_iamabot': [{'text': 'I am a bot, how did you guess that :)'}, {'text': 'I am a bot, powered by Rasa.'}, {'text': 'your guess is correct, I am a bot :)'}, {'text': "you are so clever to guess that, yes i'm a bot :)"}, {'text': "dude i was tring to hide that, ya i'm a bot"}, {'text': "that what i was tring to not let you reveal, ya i'm a bot"}], 'utter_offer': [{'text': 'I can give you information about the capital and population of some countries if you like'}, {'text': 'I have information about the capital and number of population of some countries'}, {'text': 'if you interested to know about the population or the capital of countries, i can help you '}, {'text': 'By the way, i offer information about the capital and the population of countries'}, {'text': 'i will provide you with the capital and population if you ask me'}, {'text': 'please feel free to ask me about the capital and population of countries'}, {'text': 'if you interested in knowing the population or the capital of counties, i will help you'}, {'text': 'the population and the capital of countries is my game'}], 'utter_ask_country': [{'text': 'Which country do you want to know about please?'}, {'text': 'Please determine which country you intent'}, {'text': 'which country do you interested in?'}, {'text': 'which country do you care about?'}, {'text': 'select a country please?'}], 'utter_ask_pop_cap': [{'text': 'Do you want to know about the Population or the Capital of {country}?'}, {'text': 'Are you interested in knowing the Population or the Capital of {country}?'}, {'text': 'do you intented in the Capital or the Population?'}, {'text': 'are you care about the Capital or the Population?'}], 'utter_server_failure': [{'text': "i'm so sorry, but we are facing server problem now, could you try later please?"}, {'text': 'so sorry, could you try later please? there are some issues '}, {'text': "i'm sorry, perhaps a connection problem happened"}, {'text': 'The server encountered an internal error and cannot complete your request.'}], 'utter_not_found': [{'text': "I'm so sorry, but {country} is not included in our database?"}, {'text': "Sorry, i don't know about {country}, select another one please?"}, {'text': 'Unfortunately, i know nothing about {country}, could you determine another country pls?'}, {'text': "hmm, i appologize i don't know much about that country, select another one please"}, {'text': "i don't know about this country dude, sorry!"}], 'utter_answer_cap': [{'text': 'The capital city of {country} is {cap}'}, {'text': '{cap} is the capital city of {country}'}], 'utter_answer_pop': [{'text': '{country} has a population of about {pop} '}, {'text': 'Population of {country} is about {pop}'}], 'utter_typo': [{'text': "Sorry, i didn't get you Please could you spell your input correctly?"}, {'text': "i didn't understand, Please could you spell your message accurately?"}, {'text': 'could you rewrite your choice correctly please'}, {'text': "i'm affraid i didn't understand, Please could you spell your input correctly?"}, {'text': 'it seems that you write some words wrongly'}, {'text': 'Please could you spell it correctly?'}, {'text': 'Sorry, Iām afraid I donāt follow you.'}, {'text': 'Excuse me, could you rewrite your words correctly please?'}, {'text': 'Iām sorry, I donāt understand. Could you write it correctly please?'}]}, 'actions': ['utter_greet', 'utter_offer', 'utter_iamabot', 'utter_thank', 'utter_goodbye', 'utter_ask_country', 'utter_ask_pop_cap', 'utter_not_found', 'utter_server_failure', 'utter_answer_cap', 'utter_answer_pop', 'utter_typo', 'validate_country_pop_cap_form', 'action_answer'], 'forms': {'country_pop_cap_form': {'required_slots': ['country', 'pop_cap']}}, 'e2e_actions': []}
Exception occurred while handling uri: 'http://localhost:5055/webhook'
Traceback (most recent call last):
File "handle_request", line 83, in handle_request
class Sanic(BaseSanic, metaclass=TouchUpMeta):
File "C:\Users\huzyfa\Anaconda3\envs\rasa-chatbot3.8\lib\site-packages\rasa_sdk\endpoint.py", line 104, in webhook
result = await executor.run(action_call)
File "C:\Users\huzyfa\Anaconda3\envs\rasa-chatbot3.8\lib\site-packages\rasa_sdk\executor.py", line 397, in run
events = await utils.call_potential_coroutine(
File "C:\Users\huzyfa\Anaconda3\envs\rasa-chatbot3.8\lib\site-packages\rasa_sdk\utils.py", line 230, in call_potential_coroutine
return await coroutine_or_return_value
File "C:\Users\huzyfa\Anaconda3\envs\rasa-chatbot3.8\lib\site-packages\rasa_sdk\forms.py", line 46, in run
validation_events = await self._extract_validation_events(
File "C:\Users\huzyfa\Anaconda3\envs\rasa-chatbot3.8\lib\site-packages\rasa_sdk\forms.py", line 265, in _extract_validation_events
validation_events = await self.get_validation_events(
File "C:\Users\huzyfa\Anaconda3\envs\rasa-chatbot3.8\lib\site-packages\rasa_sdk\forms.py", line 167, in get_validation_events
validate_method(slot_value, dispatcher, tracker, domain)
File "D:\master-linux\salama4ai-chatbot\actions\actions.py", line 50, in validate_country
country = slot_value.title()
AttributeError: 'dict' object has no attribute 'title'
This is what is being printed as slot_value
.
And the reason is immediately clear.
This is your domain file.
Here, you didnāt use the correct order in the arguments. Look at the docs.
It should be
def validate_country(self, slot_value, dispatcher, tracker, domain):
With your code, dispatcher
is actually slot_value
, tracker
is actually dispatcher
, domain
is actually tracker
, and slot_value
is actually domain
.
Please use the arguments in the correct order. Itās the order that is important, not the name.
Great, i test that in the past, but let me check it again please
Reminder that your if
condition was wrong then. Hopefully you changed it now.
I am 100% sure the mistake is the order of the variables in the method.
7 posts were split to a new topic: Error: make sure the validation method returns the correct output