Slot List Rasa

Posted : admin On 3/19/2022
Slot List Rasa Average ratng: 3,9/5 1619 reviews

The conversational skills of artificial intelligence are breaking new grounds with rapid algorithmic advancements and sophisticated frameworks. One such open-source chatbot framework, RASA, is gaining momentum with its contextual and human-like interaction abilities. Development of chatbots with RASA’s natural language understanding (NLU) and dialogue engine, RASA Core, enable businesses to resolve complex user queries. Today, global businesses are exploring chatbot development servicesbacked by RASA’s machine learning algorithms for enhancing user experiences across digital platforms.

Slot List Rasa Example

In this video you will learn what are slots and how they are useful in creating the Rasa chatbot. Also you will learn what are the different types of slots and how to define them in Rasa chatbot. How can I extract the value of a slot/entity during a conversation in FormAction.slotmappings? I have the value set in tracker.slots'templatename', but don't have access to that value from t. You can find all the links here: Ngrok: Imports used: import email import smtplib, ssl from email import encoders from smtplib imp. Rasa has two main components: Rasa NLU (Natural Language Understanding): Rasa NLU is an open-source natural language processing tool for intent classification (decides what the user is asking), extraction of the entity from the bot in the form of structured data and helps the chatbot understand what user is saying.

This blog post guides developers and businesses through RASA events, a functionality that sequences conversation to streamline user conversations.

Understanding RASA events

Every conversation in RASA is represented as a sequence of events. These events cover important user tasks and queries that are categorized as-

1) General Purpose events- It envelopes setting up of slot, restarting, pausing, and resuming a conversation, forcing a follow-up action, and more.

2) Automatically Tracked Events- It entails a user’s conversation with the interface, with the functionality to undo a message and log an executed action.

To create a chatbot with human-like capabilities, it is very important to have the availability of context and flexibility to manage certain events. This functionality is assured while building chatbots with RASA events and hence improves the power of a chatbot.

Also, RASA’s underlying Python language enables real-time modification and bug detection supported by rich libraries of tools. Its pre-defined environments enable developers to analyze data and build natural language processing (NLP) solutions and chatbots with RASA efficiently.

Also Read- Business Benefits of Using Python for AI Projects

General Purpose Events

General-purpose events are related to the context (which can be managed with the help of slots) and the flow of the conversation.

In RASA, the context of a conversation can be handled by using slot values and it helps to decide the flow of chat. Slot values can be used in the user stories to provide context to the conversation and decide the next action.

Events provide flexibility to control the context by manually setting or resetting the slot values from custom actions.

RASA bot assistant built by Oodles AI in action.

For instance, consider a case where a pet shop has a chatbot on its website and it provides the list of cats or the list of dogs on request of the user. If the user writes “Show me dogs’ list,’‘ the bot will run a custom function to fetch a list of dogs. If the user writes “Show me cats’ list,” the bot will run a custom function to fetch the list of cats. The list contains the pet names in both cases. In order to listen to the sound of a pet, the user can write – ‘My hello to “pet_name” ‘. This will, in turn, run a custom action “say_hello_to_pet” which will search the list of dogs or list of cats, match the pet name and play sound corresponding to that animal.

Following is the code.

nlu.md:

## intent:dog_list

– show me list of dogs

– show me dog list

– dog list

– list of dogs

– available dogs

## intent:cat_list

– show me list of cats

– show me cat list

Slot list rasa video

– cat list

– list of cats

– available cats

## intent: hello_to_pet

– hello to [“kitty’] (pet_name)

– hello to [“carry’] (pet_name)

– hello to [“tommy”] (pet_name)

stories.md:

## dog list path

*dog_list

– action_get_dog_list

## cat list path

*cat_list

– action_get_cat_list

## hello to pet

* hello_to_pet

– action_hello_to_pet

actions.py:

class ActionGetDogList(Action):

def name(self) -> Text:

return “action_get_dog_list”

def run(self, dispatcher, tracker, domain):

Rasa

# code to fetch list of dogs and return it to UI

return []

class ActionGetCatList(Action):

def name(self) -> Text:

return “action_get_cat_list”

def run(self, dispatcher, tracker, domain):

# code to fetch list of cats and return it to UI

return []

class HelloToPet(Action):

def name(self) -> Text:

return “action_hello_to_pet”

def run(self, dispatcher, tracker, domain):

pet_name = tracker.getslot(“pet_name”)

# conflict. search dog list or cat list?

return []

In action HelloToPet, it is visible that there is confusion about whether to search the dog list or cat list to match pet_name. Even if both lists are searched for matching, a problem will occur in a scenario like if “carry” is a name available in both cat and dog list. Here we can use the SlotSet event as a part of list search actions to set an entity “animal”. We can use the value of this slot to get a context of which animal the user is interested in. The following is the updated action file.

actions.py:

class ActionGetDogList(Action):

def name(self) -> Text:

return “action_get_dog_list”

def run(self, dispatcher, tracker, domain):

# code to fetch the list of dogs and return it to UI

return [SlotSet(“animal”,”dog”)]

class ActionGetCatList(Action):

def name(self) -> Text:

return “action_get_cat_list”

def run(self, dispatcher, tracker, domain):

# code to fetch the list of cats and return it to UI

return [SlotSet(“animal”,”cat”)]

class HelloToPet(Action):

def name(self) -> Text:

return “action_hello_to_pet”

def run(self, dispatcher, tracker, domain):

pet_name = tracker.getslot(“pet_name”)

animal = tracker.getslot(“animal”)

if animal “dog”:

#match from dog list

if animal “cat”:

#match from cat list

return []

Slot List Rasa Video

To clear a particular slot, use SlotSet(“slot_name”, “None”) in the return statement of the function. To clear all context and reset all slots, use AllSlotsReset() in the return statement of the function. Slot values can also be used in user stories to decide the prediction of the next function based on slot values.

Events also provide the functionality to pause or resume a conversation. Returning ConversationPaused() event from action will pause the conversation and bot will stop taking user input. Similarly, ConversationResumed() event will resume the conversation. ReminderScheduler() event allows the asynchronous execution of a custom function at any specified time.

Also Read- Deploying TensorFlow and Keras for Deep Learning Models

Automatically Tracked Events

Automatically tracked events are related to the actions and utterances. In some situations, the bot needs to assume some default inputs from the user to automatically call an intent to run a function. Consider a case in which there are two custom actions ActionShowList and ActionUpdateList which are called independently when corresponding two different intents are classified.

Slot List Rasa Tv

Following is the stories code:

stories.md:

## show list

*show_list

– action_show_list

## update list

*update_list

– action_update_list

If there is a scenario that you want to change the functionality to automatically call ActionShowList after ActionUpdateList, events can be used. The following code shows the usage of the UserUttered event.

actions.py:

class ActionUpdateList(Action):

def name(self) -> Text:

return “action_update_list”

def run(self, dispatcher, tracker, domain):

# code to update the list.

return [UserUttered(text=”/show_list”, intent = {“name”:”show_list”, “confidence”:1}, entities=[])]

Slot list rasa tv

As soon as the first function completes, the UserUttered event will create an input on behalf of the user which directly classifies the required intent and the corresponding action is called.

Slot List Rasa Youtube

Similarly, BotUttered is an event that represents the utterance of a response from the bot. We can also undo an action or a user message using UserUtteranceReverted and ActionReverted respectively.

Slot List Rasa Movie

Also Read- Automating Business Interactions with Whatsapp Chatbots

Developing Intelligent Chatbots with RASA and Oodles AI

We, at Oodles, have experiential knowledge in using Python for building chatbots with RASA, virtual assistants, and conversation AI models. Our AI development team deploys comprehensive neural networks to build machine learning models for manufacturing, retail, eCommerce, healthcare, and other global businesses. We combine AI’s NLP and computer vision technologies to build intelligent chatbot interfaces that fulfill the customer service requirements of businesses.

Talk to our AI team to know more about our Chatbot and AI app development services.