I am trying to build a Dialogflow agent for something like StackOverflow, where it takes care of the user asking a complete question. I want to store the answer (and feed it back to the user). For example:
User: "I get an error."
CX: "Which error?"
"Java.lang.NullPointerException"
"Okay, what have you tried so far to solve this problem?"
"I googled it but found no results..."
"On what line of code do you get the error?"
"if (running) {counter ++}"
"Okay, so to summarize:
- You got the error Java.lang.NullPointerException
- You tried: I googled it but found no results...
- You got the problem on the line of code: what line of code do you get the error?
Is that correct?"
With no 'Fallback Intent'-hack available in CX; how would I go about building a bot with open ended questions?
Here is the following response to your comment How to build a Dialogflow CX agent with open questions?
To work with open ended (meaning: open answers that cannot be categorized into intents / parameters) questions, and store answers, you can use the same approach provided in my previous response, and utilize the “sys.any” entity and parameters.
To do this:
When you create an intent for the utterances, annotate the
utterances to the “sys.any” entity. Here is a sample for your
reference:
You can change the name of your parameter-id to distinguish the parameters that you will use in each page.
Add those parameters on each page. Here is the sample for your
reference:
Continue applying Step 1 & 2 to your other intents and pages for the
collection and storage of answers to your open-ended questions.
When you have reached your final page, you can reference your
parameters in the responses through this format:
$session.params.parameter-name. Here is the sample for your
reference:
You can check out reference session parameters for more information.
When this is completed, this is how your use case similarly looks like:
To build a bot with open ended questions in Dialogflow CX, you can utilize the Flows and Pages features.
As an overview, Flows are used to define your topics and its associated conversational paths. For each flow, you can define many pages, where your combined pages can handle a complete conversation on the topics the flow is designed for.
You configure each page to collect information from the end-user that is relevant for the conversational state represented by the page.
Once a page becomes active, the agent follows several steps which may involve entry fulfillment, pre-filling forms, state handler evaluation, form parameter prompting, sending response messages to the end-user, and either a page change or a repeat loop.
For your use case, you can create a flow for the user getting an error and pages for the error details.
To do this:
Create an intent for the utterance “I get an error”.
Add this intent as an intent route in your flow.
In the same intent route, create a new page for the error.
Under the Page’s Fulfillment, you can add your response as shown
below:
This approach will leave an open ended question. See the test result below:
Continue the flow by creating another intent for the utterance
“Java.lang.NullPointerException”.
Add the intent as an intent route in your page for the error(As an
example: The page for the error is named “Error Types” and the
intent name in Step#5 is “Java Error” as shown below):
In the same intent route, create a new page for the
“Java.lang.NullPointerException” (As an example, the page named is
“Java Error Type” as shown below):
Under the Page’s Fulfillment, you can add “Okay, what have you tried
so far to solve this problem?” as the response.
Continue the flow by applying the same approach to your other open
ended questions.
When this is completed, this is how your use case similarly looks like in the visual builder:
See the test result below:
Related
I have a question about the update of the status of an order.
I create the basket using OCAPI and then I can successfully create an order with
https://mydomain/dw/shop/v21_10/orders (POST)
Order is fine. All data are there.
Now the order has status CREATED and I want to change it to OPEN using the Shop API again.
https://mydomain/dw/shop/v21_10/orders/MyOrderNumber (PATCH)
This is the message I receive
{"_v":"21.10","fault":{"arguments":{"statusFrom":"CREATED","statusTo":"OPEN"},"type":"StatusTransitionNotPossibleException","message":"The status transition from 'CREATED' to 'OPEN' isn't possible."}}
While if I try to make the same transition in Business Manager it works perfectly.
Anyone knows why?
The reason you can't transition the order from CREATED to OPEN is because there is a step in between.
Unfortunately, this is poorly documented in OCAPI docs, but we can see a clearer picture if we look at the DW API docs which explain in more detail.
A bit of background
First, notice the description of the PATCH /orders/{order_no} endpoint:
same status transitions are possible as for dw.order.Order.setStatus(int status) plus CREATED to FAILED)
Okay, so it follows the DW API rules. Let's take a look at the Order.setStatus() method (emphasis mine):
This method does not support order statuses ORDER_STATUS_CREATED or ORDER_STATUS_FAILED. Please use OrderMgr.placeOrder(Order) or OrderMgr.failOrder(Order).
So this is telling us that we can't move an order out of CREATED status except by either placing it or failing it. If we take a look at the documentation for OrderMgr.placeOrder(order), it corroborates this:
This method places an order and is usually called after payment has been authorized. The specified order must be in status CREATED, and will be set to status NEW.
Now back to OCAPI
Now we know that OCAPI generally follows the same rules as the DW API when it comes to transitioning order statuses. (with the exception of CREATED -> FAILED)
So how do we go about placing an order with OCAPI?
With OCAPI, you can place an order by calling POST orders/{order_no}/payment_instruments which will trigger the following hooks:
Authorize the payment with either dw.order.hooks.PaymentHooks.authorizeCreditCard or dw.order.hooks.PaymentHooks.authorize, depending on the payment type
Place the order with dw.ocapi.shop.order.afterPostPaymentInstrument
On success of both those hooks, your order will now be in NEW status, and ready to be transitioned into OPEN.
This discussion is on the same topic, although talking about the controller context, not OCAPI.
So, even though business manager lets you get away with stuff (I assume so that admins can override things where necessary), in the context of OCAPI or a controller, the order has to follow the regular placement steps.
I am currently exploring Dialogflow CX and struggling to create a simple entry message to greet the user.
I googled and found this, conceptually i can understand it, but i am having difficulty to implement the concept.
Hoping that anyone here can help with this. Thanks
I opened the link you posted and understand your doubt. I'm guessing what you're referring to is this sentence: "Propagating intents is useful to create an entry message for a flow's start page (transition target flow's route has a fulfillment)."
I have two considerations:
If your goal is simply to create an entry dialogue for a page, or flow, ignore this passage in the documentation and just use the entry dialog option on a page as shown below. Note that only pages which are not Start can have an entry dialog: if you'd like to add an entry dialog to a flow just create a new page in that flow, add routing from the Start page to your new page with the custom expression "true" as shown here and then add the dialog:
On the other hand if you're interested in intent propagation it simply states that whenever you match an intent, that is forgotten at the next step in the conversation, because another intent or condition will be matched. The only exception is if you mean to route the conversation to other flows or pages: until you reach the final "destination", the intent just matched will be remembered in the intermediate jumps and can be used in conditions for example. So say that if intent I_Want_Chocolate is matched in page Book_table of flow Restaurant_Reservation, you want the conversation to move to another flow, Vending_Machine: if the start page of flow Vending_Machine has a condition based on intents, your I_Want_Chocolate will be remembered even if the user started in another flow/another page: in this way you can for example create multiple pages and have Vending_Machine route to pages ChocolateOrder, CandyOrder, WaterOrder without asking the user again what it is they want.
Hope this cleared it up!
Using the awesome resources provided by Microsoft.
Following the documentation at https://learn.microsoft.com/en-us/composer/
Create Folder somewhere
Perform https://learn.microsoft.com/en-us/composer/setup-yarn in that folder
Perform https://learn.microsoft.com/en-us/composer/tutorial/tutorial-create-bot
Test in Emulator: Pressed Restart Conversation - New User ID: Works fine, responds with: Hi! I’m a friendly bot that can help with the weather. Try saying WEATHER or FORECAST.
Perform https://learn.microsoft.com/en-us/composer/tutorial/tutorial-add-dialog
Test in Emulator: Presents ”Let’s check the weather” som response på user input “weather”. Works fine.
Then create new Trigger with Dialog event and Dialog started and continue with: https://learn.microsoft.com/en-us/composer/how-to-add-qna-to-bot, enter the following in the settings
Please note that in order to use the Settings values, an extra “=”
has to proceed the id, e.g. “=settings.qna.knowledgebaseid”.
Please also not that in order to make this work in Europe, with our
“,” instead of “.” as decimal marker, the Threshold has to be set to
“float(‘0.3’)” in order to be evaluated as a float.
Make sure that the settings are accurate according to your QnA Base.
Please note that at this point the LUIS fiels are left mostly empty,
except for the values prefilled as described in
https://learn.microsoft.com/en-us/composer/how-to-add-qna-to-bot
No LUIS added at this point.
Restart bot
Click Test in Emulator
Press Restart Conversation - New User ID
Now there are three problems:
A. There is no longer any greeting phrase.
B. The first response from QnA maker results in a “The given key ‘stepIndex’ was not present in the dictionary.”. Then after this the QnA maker part works, but issue A and C are still present.
C. The weather regex does only trigger once if it is the first entry only, then at the second attempt or after entering something else, it fails to trigger.
Expected behavior:
When Press Restart Conversation - New User ID, the bot should greet
the user.
When the weather regex is the best choice it should trigger
The text “The given key ‘stepIndex’ was not present in the dictionary” should not be presented as the first response, instead the right reply should be presented based on the intent provided.
I`m a bit late to the game on this but I hit the exact same issue in composer and found the same problem. The suggested approach to use unknown intent in MS Docs does not work well. its really just a tutorial to get you up and running as quickly as possible, with no real thought beyond that - and as you point out, it easily gets stuck in an internal loop that prevents other intents from firing.
Assuming you are using Luis.ai, a "QnA intent recognised" should be added & a "duplicate intent recognised". this will make sure that automatic cross-training is implemented such that QNAmaker will know about Luis Questions and vice versa and they will not only understand their own questions but know to exclude the questions in the other approach. This will make for better training. However, depending on how similar questions are in both, they may both return matches of varying confidence anyway - this is what the "duplicate intent recognised" is for. It catches both before they execute their intents and implements checks for confidence against each and re-raises the event that wins out. Thus ensuring only one of the two is recognised and executed.
I'm trying out Powerapps and would like to try out this low code approach.
The idea is as follows:
Display an Adaptive Card (going to use the sample one) to the user using Microsoft Flow/Power Automate application within Teams.
The user would then input some information on the card and submit it
Use that input that was submitted to populate another Adaptive Card.
To illustrate the above, in Power Automate:
Here is how the output is displayed when used in the Schema Explorer for Action.Submit:
In Microsoft Teams, the Flow bot will display the ticket to the user to be filled in:
How can I get the values from the inputs and reuse them in Power Automate. Does anyone know how to get those values and reuse in the next step (see first image) ?
Thank you in advance for your assistance. Would appreciate any help.
Basically, the problem is that the "submit" action of the Adaptive Card returns the response to the original source, in this case the "Flow Bot". However, Flow Bot is a general bot, and doesn't have a way to route the response back to your individual Flow, and specifically to the instance of the Flow. Thankfully, this is changing - see here for information. It's not clear from the post whether it will handle the "Bot-to-user" scenario in version 1 though, which I see you use in your solution, and also, as stated in the blog, it's only expected in Feb. So, it would seem there are two options:
Wait till Feb for the new feature
Create your own Bot to send the cards from, and handle the responses - there are a few small tricky parts here as you need to send the initial message on a schedule, so you'd be using something called "pro-active messaging", but it's not too complex and something there's good guidance on here in Stack Overflow (I've myself answered a few questions recently on it so can help more if you go this route)
Not an ideal answer I'm sure you were looking for, but hopefully it helped
#Carike, There is one more way you can implement this scenario is by handling all your action of adaptive card submission event in different flow. You can set the trigger as "When HTTP request received" for the second flow. When you set this trigger, you receive one url - which you can set as the submit URL of the first flow's adaptive card.
In my app, multiple people can chat on a topic. However once the topic has been closed by its owner, chat should also be disabled on that topic.
My Tables -
ChatComment - a new comment is stored here as a record - it contains pointer to Topic
Topic - details related to topic for eg. body, owner, status - open/closed
I'm using cloud functions to create a new comment made by a person on its owner. So everytime I call the cloud function to write new comment, it first queries 'Topic' class to check if topic is still open or not, if its open itll go forward to create new comment in comment class, or else it will throw error.
My problem is that in realtime so many people chat on the topic so frequently that the first query(that checks if topic is still open) occurs for each comment and adds a delay. It really kills user experience.
Can we write a filter to meet above conditions? Please advice me how to deal with this in any other way if possible?
A common pattern is to fake it, the idea works like this:
For the user making the comment, as soon as they enter a comment show it in the topic as if it was added normally. Then start the async call to your cloud function and update the status based on the result.
You might choose to do nothing with the confirmation, or do something like iOS Messages app that shows a "Delivered" tag.
If the cloud function comes back with an error because the topic was closed, update the message to highlight that it was rejected (strikethrough is appropriate here) and disable the ability to add more comments.
This gives the illusion of speed in a delayed system.