Wednesday, May 16, 2018

Oracle Bot Cloud (IBCS): Switching Intents while in conversation (Nested Intent)

Problem Description: If we see IBCS flow generally tries to find user intent first. Once it identifies and intent, it tries to complete intent based on flow defined. There are all reasons that end user may want to switch his intent before completing first intent. For example, I am ordering pizza but while system asks me for pizza type, I decide to verify their payment options and I changed my intent. Something like below

Me: I would like to order a pizza
       
                   Bot: Which type of pizza would you like to have?

Me: Hold on, What are your payment options
     
               
In ideal conversation bot should provide me details of payment. Once payment options information is provided, it can ask me if I want to continue with Pizza order.

But in general we use either System.Text or System.List component when we want to take user input. This is the time when user can change his mind (or intent).

It looks like
askPizzaType:
    component: "System.List"
    properties:
      options: "${pizzaType.type.enumValues}"
      prompt: "Which type of pizza would you like to have?"
      variable: "pizzaType"
    transitions: {}

with this state, bot will provide a list of pizza types (say small, medium or large). Now even if user changes his mind and asks about payment options, bot will ask pizza type again and again. Very annoying.

In this blog we want to make it a bit realistic and introduce intelligence of user intent switching.

Lets say we have following initial bot configuration

1. Intents: OrderPizza, ProvideInfo
2. Entity: PizzaType (Associated with OrderPizza Intent)

3. Dialog-Flow:

Its able to complete payment option enquiry and pizza order but if user tries to switch from OrderPizza intent to ProvideInfo, bot keeps on asking about pizza type as shown below


Now lets improve it to handle intent switching.
a. To stop bot asking for pizzaType repeatedly, we can introduce maxPrompts=1 with askPizzaType (System.List) component.

b. We can add cancel action with askPizzaType (System.List) component to perform a transition, if bot can't find pizzaType even after max number of attempts ( NOTE: here we have already set max attempt as 1, so user can only provide one input. If that is not small/medium/large, cancel transition will take place)
askPizzaType:
    component: "System.List"
    properties:
      options: "${pizzaType.type.enumValues}"
      prompt: "Which type of pizza would you like to have?"
      variable: "pizzaType" 
      maxPrompts: 1
    transitions: 
      actions:
        cancel: "verifyIntentWhileOrderPizzaInProgress"    

c. verifyIntentWhileOrderPizzaInProgress can set uncompletedIntent in a variable and then perform an nlp intent-matching on user input. If its unresolved in NLP matching assume that user is trying to answer pizzaType question but some typo etc happened so lets take him back to askPizzaType.

verifyIntentWhileOrderPizzaInProgress:
    component: "System.SetVariable"
    properties:
      variable: "uncompletedIntent"
      value: "OrderPizza"
    transitions: {}        
  verifyIntent:
    component: "System.Intent"
    properties:
      variable: "iResult2"
      confidenceThreshold: 0.4
    transitions:
      actions:
        OrderPizza: "orderPizza"
        ProvideInfo: "provideInfo"
        unresolvedIntent: "askPizzaType"

d. Lets improve provideInfo state as well to handle uncompleted intent (OrderPizza). After providing information of payment option, verify if there is any uncompleted intent. If yes suggest to continue with that intent else done
provideInfo:
    component: "System.Output"
    properties:
      text: "We support credit card, debit card and cash on delivery. "
      keepTurn: true
    transitions: 
       next: "isAnyIncompleteIntent"

e. Lets introduce few states to gracefully end conversation or ask for any pending intent completion.
  isAnyIncompleteIntent:
    component: "System.ConditionEquals"
    properties:
      variable: "uncompletedIntent"
      value: "OrderPizza"
    transitions:
      actions:
        equal: "askToStartPizzaOrderAgain"
        notequal: "done"  
  askToStartPizzaOrderAgain:
    component: "System.Output"
    properties:
      text: "Lets continue with Pizza ordering."
      keepTurn: true
    transitions: 
       next: "orderPizza"   
  done:
    component: "System.Output"
    properties:
      text: "Is there any other way I can help you?"
    transitions:
      actions:
       return: "done"

Complete flow looks like below

Effectively by above improvements in flow we are trying to enable user to switch intent while in between conversation.
After above change flow looks like this.
Thats all

25 comments:

  1. Easy "water hack" burns 2 lbs OVERNIGHT

    Over 160000 men and women are losing weight with a easy and SECRET "liquids hack" to drop 2 lbs each night in their sleep.

    It's simple and works on anybody.

    This is how to do it yourself:

    1) Get a drinking glass and fill it with water half the way

    2) And then follow this proven hack

    so you'll become 2 lbs thinner as soon as tomorrow!

    ReplyDelete
  2. Trying to say thanks won't simply be adequate, for the fantasti c clarity in your written work. I will immediately snatch your rss channel to remain educated of any updates. Best SMS Messages Online

    ReplyDelete
  3. Nice article. Studying artificial intelligence opens a world of opportunities. Join
    ai training in kolkata

    ReplyDelete
  4. You have write an amazing article which is very helpful for me. You have done a proper research and you have took all the point in your article. I has cleared my all questions. Thanks for your article.

    Technology

    ReplyDelete
  5. Amazing Article. Thanks for sharing this one. It will be very much useful for everyone.
    If anyone is looking to build apps with the latest trends & technologies, reach Way2Smile Solutions. No.1 iPhone App Development Company in Chennai

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. Very informative post.Really very happy to say,about your info regarding Rich text editor JavaScript is very interesting to read.

    ReplyDelete
  8. Ich löse meine vielen Probleme, nachdem ich Ihren Blog gelesen habe. Ihr Blog ist sehr informativ. Ihr Blog ist sehr hilfreich für Website-Designer und -Entwickler.legrand-schaltermaterial

    ReplyDelete
  9. Well, thanks for sharing it is working on my laptop and successfully implement in my program which will for the mobile.

    ReplyDelete
  10. Nice blog! The blog is very informative, I enjoyed reading something that is new to me.We offer you good condition bikes that are suitable on the rash roads of mountains. Read our blogs all about Manali.
    Bike on rent in Manali
    Bike Rentals in Manali

    ReplyDelete
  11. Top 10 Advanced Technology Countries
    Technology
    NEWS

    दोस्तों, आज के दिन हमारी लाइफ स्टाइल टेक्नोलॉजी के चलते ही काफी ज्यादा एडवांस और काफी ज्यादा आसान हो रही है, क्योंकि नई नई टेक्नोलॉजीज के चलते ही हमारे लिए हर काम करना काफी ज्यादा आसान होता जा रहा है और मैं अगर आज से कुछ साल पहले की बात करूँ तो जब ये टेक्नोलॉजीज हमारे बीच नहीं आई थी तो हमारी लाइफ इतनी ज्यादा एडवांस कभी नहीं थी वैसे तो हम सभी मानते हैं कि हमारी जिंदगी को इतना ज्यादा इट पांच बनाने में एक देश का बहुत ही मेन छोड़ रहा है और दोस्तों ये देश है अमेरिका।

    ReplyDelete
  12. Trying to say thanks won't simply be adequate, for the fantasti c clarity in your written work. I will immediately snatch your rss channel to remain educated of any updates. I am also working on my own project techmoog which gives all the information about technology such as How Long Does iOs 15 Take To Install? , laptop issues, How to use DSLR cameras, etc.

    ReplyDelete
  13. Amazing Article. Thanks for sharing this one. It will be very much useful for everyone.I would like to share my blog how to fix the last line no longer available error on iPhone.

    ReplyDelete

  14. Choose our MacBook Logic Repair service for a comprehensive solution backed by expertise, efficiency, and a commitment to quality. Trust us to breathe new life into your MacBook, extending its longevity and ensuring a smooth, trouble-free computing experience.MacBook Repair

    ReplyDelete
  15. Nice information. Thank you so much for sharing this post. Know about Bitwissend, website design company in cochin.

    ReplyDelete
  16. Thank you so much for sharing this article. Get to know about AK Smartshala, best kindergarten in sahibabad. Download Nursery worksheets from AK Smartshala Worksheets.

    ReplyDelete
  17. That’s Iversær. A strange, slippery syllable tearing through TikTok like a digital wildfire. It’s not in the dictionary. It’s not in your textbook. Heck, it might not even be real. And that’s why it owns your feed.

    ReplyDelete
  18. Enter Legal Tech—a disruptive force shattering centuries-old traditions. Imagine artificial intelligence parsing precedent in seconds, blockchain contracts that self-execute without a single pen stroke, or law firms with no office address—existing entirely online.

    ReplyDelete
  19. Great explanation of handling nested intents and making chatbot conversations more natural. The way you manage intent switching without breaking the flow is really smart and practical. This kind of structured approach reminds me of how precision matters in Custom PCB Design Services for Startups, where flexibility and smart design decisions are key to building efficient systems.

    ReplyDelete