My bot reads and replies in simple mail conversation. More like in chat manner, one or 2 sentences only done through email. My backend is taking care of reading emails, interpreting api.ai responses, storing locally useful data and sending next questions. Before sending to api.ai, messages are split in sentences.
What I've seen from example conversations already done by humans is that the end users are quite often sending several significant information in one sentence. That means that from e.g. 8 possible peaces of information I totally can have (mostly non required) I can get in one sentence any 2 of them.
How to organize that?
I started with one intent for each field I require. But to solve case with any two intents in one sentence, I am extending user says examples with other field too. At the end I will have 8 intents which are actually filled with similar examples.
Now I am thinking to have just one intent and cover all in it. That might work, but the real question is that really way to do it?
Here are example conversations to describe issue better
v1 - simple way like in api.ai examples
- u: Hi. I need notebook bellow $700.
- b: Great. What size should it be?
- u: 17'
- b: I have gaming one at $590 and one professional for $650.
- u: I more to gaming one.
v2 - what I can expect from real life examples
- u: Hi I would like to buy 15 inch gaming laptop.
- great, what price range?
- ...
Api.ai has a feature called slot filling that allows to collect parameter values within a single intent. It's great for building conversational interfaces. You can see if it's compatible with you use case.
Here's how such intent could look like for the examples you provided:
See the "book_notebook" intent:
and how it would work in conversation:
See a test for the "book_notebook" intent:
Related
I am creating a HR chatbot using Dialogflow. I am unable to figure out the right approach to have the bot handle both direct questions and questions asked in a contextual manner. For example:
Contextual case:
User: I want to know how many leaves i can get in a year
Bot: You get x number of leaves
User: Ok cool how do i apply for one then?
Bot: Follow this process to apply for a leave
Direct case (2 separate conversations with direct questions):
Conversation 1:
User: I want to know how many leaves i can get in a year
Bot: You get x number of leaves
Conversation 2:
User: I want to know how to apply for leave
Bot: Follow this process to apply for a leave
Approaches I have tried:
1) Adding input and output contexts to handle contextual cases and add direct questions to knowledge base.
The issue with this approach is that since we cannot give multiple phrases in knowledge base, most direct questions do not match
2) Have 2 intents, one with input and output contexts and one to handle direct questions. (For example: One intent would be leaves.apply.context which would have both input and output context set and would have training phrases like how do i apply for this and another intent leaves.apply.direct which would have training phrases like how do i apply for a leave and no context). I'm not convinced that this is the right way as I am essentially creating two intents for the same question with the same response.
So is there a recommended approach to solve this problem?
I don't think there is a recommended approach to this, it is a matter of taste. Your solutions are a nice way of approaching this, but I don't think you will get around the fact that you will have to make an extra intent with the same response if you want to allow a follow-up question to also be approachable directly due to the context.
If you really don't like to create two intents for the same response, I think you would be able to workout this scenario by creating two intents and dropping the contextual flow. Just create a HowManyLeavesAvailableIntent and a HowToApplyForLeaveIntent without any context and train the HowToApplyForLeaveIntent to trigger on phrases that would follow-up HowManyLeavesAvailableIntent and direct questions for HowToApplyForLeaveIntent. Due to the missing context, this might not be ideal because it can create weird mappings to intents, but it would allow you to have just one intent for how to apply for leave.
I'm trying to create a bot that should allow this kind of interaction:
(U = user, B = bot)
Case A:
U: Create a new XXX analysis
B: Got it! Let's create a new XXX analysis
B: What's your first name?
U: Joe Doe
B: etc, etc...
Case B:
U: Create a new YYY analysis
B: Got it! Let's create a new YYY analysis
B: What's your favourite color?
U: Red
B: etc, etc...
So, I need to trigger a different question depending by what the user told me in the first interaction.
Right now I properly get the type of analysis (XXX or YYY), but I can't figure out how to trigger a different follow-up intent depending by the type value.
What's the proper way to do it?
I was counting to write the bot using Node.js so if the answer requires to write a backend please I'd like to get referenced to the Node.js docs and resources.
First of all, remember that intents are triggered based on what the user does. You don't "trigger" an intent, your users do. How you process that intent is based on the intent triggered as well as other state you may have about the conversation - in this case, the analysis type. See this StackOverflow answer and the related medium article (and followup articles) that discuss how to handle this.
If you want to ask something different based on how the user replied - use your webhook fulfillment to ask something different. Responses aren't based on Intents. You don't need to "trigger" anything.
Sometimes you want only certain intents to be triggered based on state. In these cases, you can set a Context and limit Intents to be fired only when the Input Contexts are all present.
I want to make a simple Q&A Alexa app similar to Alexa's custom Q&A blueprint app. I don't want to use blueprints because I need additional functionality. What is the best practice for creating the Alexa app? Should I create a separate intent for each question or should I somehow use utterances?
The best way depends upon what the questions are and how it will be asked.
1. If the questions has a simple structure
Consider these examples:
what is a black hole
define supernova
tell me about milkyway
what is a dwarf star
then it can be configured like this in an intent:
what is a {space}
define {space}
tell me about {space}
and the slot {space} -> black hole, supernova, milkyway, dwarf star.
From the slot value, you can understand what the question is and respond. Since Alexa will also fill slots with values other than those configured, you will be able to accommodate more questions which follows this sentence structure.
2. If the question structure is little complex
what is the temperature of sun
temperature to boil water
number of eyes of a spider
what is the weight of an elephant
then it can be configured like this in an intent:
what is the {unit} of {item}
{unit} to boil {item}
{unit} of eyes of a {item}
what is the {unit} of an {item}
Here,
{unit} -> temperature, number, weight, height etc.
{item} -> sun, moon, water, spider etc
With proper validation of slots you will be able to provide the right answer to the user.
Also, you will be able to provide suggestions if the user asks a question partially.
Ex:
user: what is the temperature
[slots filled: "unit"="temperature","item":""]
Now, you know that the user asked about temperature but the item is missing, so you respond back with a suggestion like this
"Sorry I didn't understand. Do you want to know the temperature of the sun?"
3. If the questions has totally different structure
How to deal with an annoying neighbor
What are the types of man made debris in space
Recommend few good Nickelback songs
Can I jump out of a running train
If your questions are like this, with total random structure, you can focus on certain keywords or crust of the question and group them. Even if you can't group them, find out the required fields or mandatory words.
IntentA: How to deal with an annoying {person}
IntentB: What are the types of man made {item} in {place}
IntentC: Recommend few good {person} songs
IntentD: Can I {action} out of a running {vehicle}
The advantage of using slots here is that even if the user asks a partial question and an associated intent is triggered, you will be able to identify it and respond back with an answer/suggestion or error message.
Ex:
user: what are the types of man made mangoes in space
[IntentB will be triggered]
If you have configured this without a mandatory slot, your backend will be focusing on the intent triggered and will respond with the right answer (man made debris in space), which in this case won't make any sense to the user.
Now, with proper usage of slots and validation you can find that instead of debris your backend received "mangoes" which is not valid. And therefore you can respond back with a suggestion or error message like
"Sorry, I don't know that. Do you want to know about the man made debris found in space"
Grouping questions will help you to add other similar questions later with ease. You can use one intent per question if it is too difficult to group. But remember to validate it with a slot if you want to avoid the situation mentioned right above.
While naming question-intents use a prefix. This might help you to group handlers in your backend code depending on your backend design. This is not mandatory, just a suggestion.
Summary:
Group questions with similar structure.
Use slots appropriately and validate them.
Use predefined slots wherever possible.
Don't just depend on intents alone, because intents can be mapped if its the closest match. But the question might be entirely different or might not make any sense. So use slots appropriately and validate them.
If possible provide suggestion for partial questions.
Test thoroughly and make sure it wont break your interaction model.
You should check Alexa Dialog Interface that allow you to make Q/A or QUIZZ.
https://developer.amazon.com/fr/docs/custom-skills/dialog-interface-reference.html
I am making a chat bot to answer questions on a particular subject(example, physics). How would you structure all the possible questions as intent in dialogflow?
I am considering the following 2 methods,
Methods:
make each question as an unique intent.
group all the questions into one "asking questions" intent and use entity to identify the specific question being asked.
Pros:
Dialogflow can easily match users input to the specific questions using low confidence score threshold, and can give multiple training phrases per question.
Only need one "asking questions" intent, neater and maintaining it is easier.
Cons:
There will be tons of intents, and maintaining it might be a nightmare. Might also reach the max number of intents.
Detecting entity might be more strict and less robust.
I would suggest you to try Knowledge Base feature of DialogFlow.
You can give multiple web-page links from where it can gather all the questions, or you can manually prepare a list and upload it to DialogFlow.
That way you don't need to make it in separate intents, it will try to match it automatically.
Let me know if you have any confusion.
This looks like an FAQ type chatbot. You can develop the chatbot in 2 ways:
Use Prebuilt Agents - Go to prebuilt agent and select and import FAQ and add your intents.
Use Knowledge Base approach - This is in Beta mode right now, but super easy to build.
a. You need to enable Beta Features from the agent settings
b. Go to Knowledge Base on the left menu, create a new document and upload CSV file (Q and A). You can also provide a link for Q/A if you have.
Check out the documentation for more details.
Knowledge Base seems to be the best way, but it only supports English content
I'm using wit to recognize different intents in a retail context. Some of them trigger (successfully) FAQ answers, other initiate a business logic.
Surprisingly, I'm having a lot of trouble with the most basics conversational intents, like answering a hi or hello. Specially if they come as a single word (it doesn't get hi or hello but it successfully returns the correct intent for hi buddy or hey dude). Obviously there's a high chance that the first thing an user would say is just a simple hello, any of you found the same issue? Any guidance on that?
It is actually the first time I experience this issue, and I haven't heard about it. Could it be related to the increasing number of intents created (now 15+)? I'm using trait as a search strategy.
Greetings intent
Click on image for a larger version of the image.
Thank you very much for your help,