Rasa-core, Slots not getting Populated - rasa-nlu

I am trying to create simple printer support chat bot using rasa-core via nlu interpreter, bot should get the printer model, and printer type and post a issue.
I have used the printermodel and printertype variable in slot and entity, but the slots are not getting populated from the chat string.
Please help me on this.

Not very much information to go off of, but here are several things I would check if my slots weren't being filled correctly:
Is NLU parsing the entities correctly? Slots are usually filled from NLU entities. Send your text direct to the NLU and see if the entities are found.
Entity and Slot names are not consistent? The default method of filling slots without custom programming expects the slot name to match the entity name.
Are the slots defined correctly in the domain information?
If you're still having trouble I encourage you to create an issue or join us on gitter.

For example, we have to design simple conversation
User: I am Shivam
Bot: Hello Shivam
Here, we have to extract name and respond using it.
Step 1: In nlu.md file
## intent:told_name
- i am [shivam](name)
- my name is [shivam](name)
- hi, i am [shivam](name)
Step 2 In domain.yml file
intents:
- told_name
actions:
- utter_greet
entities:
- name
slots:
name:
type: text
templates:
utter_greet:
- text: "Hello {name}"
- text: "Hello {name}, happy to meet you."
Step 3 In stories.md file
# story_01
* told_name{"name": "Mayank"}
- utter_greet
I think, you are missing someting in step 3

Related

Dialogflow CX $param not showing in agent text

I am getting into CX and have a simple agent going but I cannot get the agent to respond with my filled parameter.
I have a page that asks for #DrinkFrequency and #DrinkChoice, I see both get filled correctly when I test the agent and $page.params.status = FINAL takes me to my next page that says
So you drink $session.params.DrinkFrequency and prefer to drink $session.params.DrinkChoice
But the agent says exactly that, it does not replace $session.params.DrinkFrequency or $session.params.DrinkChoice with the values the user gave. I know it must be a simple issue but I have tried to write $session.params.DrinkFrequency in a few different ways and I looked at the existing tutorial bots and they also have it with just the $ sign. Am I not saving the user given value?
The page that gets the values has the two parameters and they ask for the value in their "Initial prompt fulfillment" field.
You're referring to the entity type, while the display name is the name of your parameter.
If you replace $session.params.DrinkFrequency with $session.params.frequency and $session.params.DrinkChoice with $session.params.preference it should work.

The model is unable to predict the proper action

I added the story,
story: interactive_story_1
steps:
intent: call
entities:
person: son
slot_was_set:
person: son
action: action_call
and when i am running this on rasa interactive, it identifies the intent correctly, sets the slot properly but it predicts action_default_fallback with 0.3 probability and asks to run that instead of action_call which is clearly mentioned in the story!
Ok, I solved it, there was a problem with my rasa core configuration, it was not trained properly so all the action predictions by the dialogue management model was faulty.

How to use IBM Watson Context variables without entities?

Hi all Watson Developers!
I have a question, exposing that I need to know a bit more about context variables!
A user enters "Who owns the boat DUO ?" and my Dialog then uses the Intent "#owner_of_boatname" That works!
I then want to store the boatname in a variable $boatname, to pass it on to my webhook, as the value "$boatname".
If I create an entity with a list containing all possible boatnames, then it works, but what if I do not have all boatnames, and just want to pick up the $boatname from the user, and pass in on to the weebhook ? How do I fill out the handler then ?
I've tried to just put in "DUO" as value to my webhook, and that works fine, so the webhook itself works - I just need to be able to transfer variables to it!
How ?
Thanks a lot
Lars ;-) enter image description here
The ideal solution for this question should use A.I model created in Watson Knowledge Studio to identify names in user's text and deploy it to Natural Language Understanding instance which you would use the extract the name.
However, we can make a simpler solution, we must assume that the name of the boat will always be at the end of user's input and we can use a regular expression on Watson Assistant to extrat the name. You have to create a node before you pass to the webhook just to identify that user will pass the name of the boat, for example:
Assistant: What is the name of your boat?
User: The name of my boat is boatname
The node that return "What is the name of your boat?" should jump to a node and wait to user request and the condition of this node should always be true. When the user says "The name of my boat is boatname" the node with the condition always true should have context variable with the following regex expression in value context area:
"<? input.text.extract('\s\"?(\w+)\"?$',0) ?>"
This regex rule identify the last word of a phrase with double quotes or not.
Once you have extracted the boat's name you can make the node request you webhook.
Here we are using the SpeL language to access the assistant payload to extrat the last word of a phrase. You can find more information about functions on context variables here here.

How do I use capture groups in Regular Expressions in Bot Composer

I am attempting to build a Microsoft Teams bot using the Bot Framework Composer. What I would like to do is create an integration with ServiceNow. The goal would be that if anyone posts a record number (ex. REQ0123456, INC0123456, KB0123456) into the group or direct chat (with the bot), the bot would look up that record and provide a card or a short summary of the record to the chat.
To avoid creating a completely separate intent for each record type, I was hoping to use RegEx to gather the match into 2 capture groups; one for the tbl_code and one for the number.
Here is the entry for the user input:
> add some example phrases to trigger this intent:
- look up {conversation.sn_record.tbl_code=REQ}{conversation.sn_record.number=0123456}
- lookup {conversation.sn_record.tbl_code=REQ}{conversation.sn_record.number=0123456}
- {conversation.sn_record.tbl_code=REQ}{conversation.sn_record.number=0123456}
- lu {conversation.sn_record.tbl_code=REQ}{conversation.sn_record.number=0123456}
> entity definitions:
# regex sn_record tbl_code, number = /([a-z]{2,4})([0-9]{7})/mi
The Issue I'm Having
I don't know how to get the values back from the individual capture groups. I would like to have them separate so that I can determine which table needs to be queried. I could probably just use the entire match and the search API in ServiceNow for the whole record string, but I would still like to know how to use capture group values.
I'm currently using turn.recognized.text, but I don't think this is the best method for what I'm looking to do. This returns the entire regex match.
I'm very new to this framework, so please be gentle. :) Let me know if there is more information I can provide.
Thanks all.
Best Regards,
Josh
I was able to figure this one out using the examples in the ToDosSample bot.
The answer was to use named capture groups and then add them to a dialog property to use in the corresponding dialog.
For reference here are the changes I had to make:
New Regex
(?<sn_record>(?<tbl_code>[a-z]{2,4})(?<numbers>[0-9]{7}))
New Dialog Properties
dialog.sn_record = #sn_record
dialog.sn_tbl_code = #tbl_code
dialog.sn_numbers = #numbers
New response
- Okay, looking up ${dialog.sn_tbl_code}${dialog.sn_numbers}

Rasa. Wrong confidence score for non-related messages

I’m building bot using rasa to response for user’s questions and I have an issue.
Rasa gives me high level of confidence for messages that are completely not related to intent’s examples.
I have medical-related intents but message like “I like coffee” gives me even more confidence than messages related. Also, random chars messages like “laj jfias jjlas fe” also give me high confidence.
Could anyone give me a hint how to fix this? Where can I look for a bug?
This is my config:
language: "en"
pipeline:
- name: "nlp_spacy"
- name: "tokenizer_spacy"
- name: "intent_entity_featurizer_regex"
- name: "intent_featurizer_spacy"
- name: "ner_crf"
- name: "ner_synonyms"
- name: "intent_classifier_sklearn"
Forced classification into one of your intents, seems to be the issue.
One way to solve it can be like this:
Add some examples that are unrelated to your domain & add them under some intent e.g. your_fallback_intent
Define a story for your_fallback_intent
this will make nlu to classify unrelated messages under your_fallback_intent
pls add details in comment if you still face the issue.

Resources