I have created a Date entity which expects a date from the user, and I am facing 2 problems:
How can I make the entity process a string from a user (e.g., I don’t know, I forgot the date, I don’t have it on me, etc…), without using a confirmation node?
how can I make the date entity process a user input if the user did not provide a full date (e.g., 16th October, 16-10) without the year provided by the user.
The Date entity will be able to process the user’s utterance if a year is not present, it will just default the year.
That default will be based on the proximity to the current date, looking 9 months into the future or 3 months in the past. For example today is October 16th 2023.
If the user says Oct 23rd, then the year will default to 2023
If the user says Jan 5th, then the year will default to 2024
If the user says Sep 17th, then the year will default to 2023
If the user says Jul 4th, then the year will default to 2024
Now that default can also be impacted by other hints. If it is clear from the utterance that the user is talking in the past, then that will influence the year.
The entity rule named range can be used to indicate what type of date makes semantic sense and that will influence the year defaulting. For example, flights can only be booked in the future, bank statements are only available for the past.
The first issue is more down to the conversation design and whether you want to handle these specific cases. How much effort to spend on that will come down to your domain and how frequent it is that a user would not know the date.
An entity can be made optional, which means that it will prompt the user but if no valid value is found then the flow just moves on. The connection rules can check for a value or not and transition to other nodes accordingly.
If you want to trap those specific phrases then you have several alternatives:
Use a List of Items entity after the Date entity with choices for each condition.
Use a Custom Concept entity after the Date entity with a concept containing all of the phrases.
Use a Composite entity with a combination of the Date entity and either of the first two secondary entities.
Use Traits with those phrases as the training, the connection on the Date entity can be based on the presence of a trait as it is held in context.
Use subintents. The Intent connection rule type will allow you to add Intent nodes which can be trained with appropriate phrases. You can have multiple subintents for the different types of phrasings.
Personally I would prefer 4 or 5. The difference is that Traits are more general purpose, which is handy for reusability, whereas the specific subintents can be tailored to the specific scenario.
Can i use these case in same entity,
like the bot ask for Date and the user say ~i dont know, how can i let the bot take these word and take it as input not as errore couse the entity node only take date, and make a condition to go another node or message (if the user say ~i dont know the bot will go to node)
I’m still new to the platform and I have read the documentation on how to use Traits and subintents but I was unable to implement your solution.
Can you help me with showing me a step-by-step procedure on how I can use Traits or Subintents for this scenario?
“A banking bot needs to intake the date of the transaction from the user in order to verify the user. if the user says that they do not know the date or is unable to provide it, the bot will ask for the transaction reference number. if the user is also unable to provide the reference number, the bot will transfer the call to an agent.”
A date entity only looks for and extracts a date. It can only store a date value in context.entities. (Entity values are evaluated and passed around to other dialogs, so it is important for interoperability for them to be a valid value.)