How to pass DateTimeExpression to set value on on-click in Bixby - bixby

I want to pass a few values like(today, this weekend) to the goal using on-click. But unable to pass MyDateTimeExpression on Bixby.
on-click{
intent{
goal:DateSearch
value-set:CategoryName{CategoryName(clients)}
value-set:MyDateTimeExpression{$expr(today)}
}
}
Anyone can help me out on this.

You can only use DateTimeExpression to resolve words like "today", "this weekend", etc as part of a natural language utterance. You can train with Bixby to expect DateTimeExpression in your user's utterances as described in the documentation here: https://bixbydevelopers.com/dev/docs/dev-guide/developers/library.datetime#training
In other words, you can't pass a string "today" like that in an intent as your example shows - that is not natural language coming from the user (instead, it's a string).

Related

How to set a System Entity in a JSON response?

I have a composite entity working fine. But when I try to change its value by another composition in fulfillment, it's been interpreted as a string value:
const entity = {
"name":"projects/myproject/agent/sessions/" + sessionID +
"/entityTypes/lia_parametro1",
"entities":[{
"value":"#sys.email:email",
"synonyms":[
"#sys.email:email"
]
},
When I put this value directly in Dialogflow Console(#sys.email:email) it works fine, but when I try to do this dynamically as above, it understands "#sys.email:email" as a value, instead of a System Entity.
Is there a special way to declare System Entities in Json format?
Many thanks for any tip!
Diego Mesquita
I think you're getting confused about what the purpose of entities are.
Entities are used when extracting parameters - they're hints to Dialogflow to say "I'm trying to grab a piece of data from whatever the user has said, by the way the piece of data I want you to extract looks like this -> [the values of #sys.email]".
When something reaches your fulfillment code, that whole data extraction process has been done, and therefore entities become irrelevant. You can run whatever code you wish to extract data (for example a regex), then assign that as a parameter value to some output context.
To quote the documentation:
Each intent parameter has a type, called the entity type, which dictates exactly how data from an end-user expression is extracted.
I hope this helps - if not, can you give a little more info about your use-case?

Dialogflow Agent regex entities definition

I have created an agent in dialogflow, for which I want to define an entity based on regex values, I know we have regex capability in defining the entities, but I don't know how to use it or how to define regex while defining the entity. There are no examples or blogs available to help me with this. I want to see an example or syntax of how to define regex entities so that I can replicate the same for my case. Any help will be highly appreciated.
Try this. Go to the Entity page. Create a new Entity an call it whatever you want. In the entity screen select regex and enter this value [A-Za-z]{3}[0-9]{7,10}$. Save the Entity. This regex will validate any value that begins with three letters and 7 to 10 character. Example PAP1234567 or DWL123456789.
Now go to an, intent or create one, and on the training phrases add one that says:
My number is PAP12345678. Select the PAP12345678 to highlighted and the entities menu will appeared. Select the new regex entity and save.
Test the intent on DialogFlow. Hope this help.

Entity with excluded values in Dialogflow

I want to create an entity that has any value except the values that are defined in another entity.
For example, i have an entity that contains all the possible products categories that i use in the bot, and if the user type a value that is not in that entity i want to react in some way.
It's like a fallback but only triggered when that condition is met.
Any suggestion?
Entity extraction is based on some definite value that can be identified and separated. There should be some basic features defined for the agent to train on. Based on these trained features, the agent will look for an entity and extract it from the user's response.
If you have already defined an entity to look for, it will be extracted by the Dialogflow based on the training data. If there is nothing defined it will not be identified as an entity as the agent will be not sure what to look for.
So, what you can do is,
Make the entity (already defined) as not required. Uncheck the "required" checkbox in the Dialogflow.
Add the "#sys.any" in the Entity you defined and make it a composite Entity with the combination of your Entity and "#sys.any" something in the line of
Train your agent to look for this new Entity with your Basic Entity data and Anything else data.
Collect this in the webhook.
OR
You when you want to collect anything else, you can collect user utterance from the agent object and parse the data using Regex pattern of your choice.

dialogflow ambiguity with same synonyms for different entity values

I have an issue developing an agent with dialogflow (api.ai). I am using a lot of entity values which are all different from one another. however there are similar synonyms for some entity values but the agent is returning only one value.
How can i get all the possible matches or ask question to resolve the ambiguity
for example i have an intent like: tell me the location of ABC express train
if my entity values are :
entity synonym
15127 ABC express
12345 ABC express
I want it to return two values or ask question to resolve such ambiguity
how can i work this out
Thanks in advance
If you enable fulfillment for this intent, you can take a look at the value the user said and ask a further question if you need to disambiguate between entities.
Let's imagine you are extracting an entity called "trains". The parameters table in your intent might look like this:
By default, if the user says ABC express, the fulfillment webhook will be called with the following parameter hash:
"parameters": {
"trains": "15127"
}
This isn't enough information to decide if the request was ambiguous, since train 15127 might also have non-ambiguous synonyms.
You can configure Dialogflow to send the original text of the entity, alongside the resolved value. This means you will receive the following information to your webhook:
"parameters": {
"trains": "15127",
"original": "ABC express"
}
You can then use some simple logic to ask a further question if the value of original appears in a list of known ambiguous synonyms.
To have Dialogflow send this data, modify your parameters table so it looks like the following:
This will cause the original synonym to be sent to Dialogflow alongside the resolved value.

How to use Dialogflow queries with special characters like '#'?

if I use a query string like:
Does John know to code in C#?
Dialogflow cannot match the C# as an entity parameter. But if I ask like:
Does John know to code in C#
Without any following characters, Dialogflow can match C# as entity parameter. What can be the reason for this? I have tried template and also example queries for training the intent but the result is the same for both.

Resources