watsonx Assistant

 View Only
  • 1.  Dialogue set up for re-using/classifying previous user input

    Posted Tue September 05, 2023 12:40 PM

    Hello everyone!

    I am trying to set up language detection for a chatbot using Watson Language Translator. Although the language detection/translation does work, I am having trouble getting the dialogue set up the way I want. 

    Currently, I have a "Check language" node where I connect to the Language Translator via a webhook. If the webhook result is not equal to "en", I want the chatbot to prompt the user to type their input in English. This works! If the input is English, I want it to proceed as it normally would (go through intent detection and present the flow for that intent). However, I cannot find a way to do this without requesting the user to type their input again. 

    I tried to do this with context variables, but could not get it to work.

    I was hoping that somebody here might have an insight into how to re-use old user input re-evaluate it without any additional effort from the user's side. I am not familiar with the forums but do let me know if I need to share more details and I will be happy to do that as well!

    Thank you all!



    ------------------------------
    Gökçe Kuşcu
    ------------------------------


  • 2.  RE: Dialogue set up for re-using/classifying previous user input

    Posted Tue September 05, 2023 01:14 PM

    Can you say more about why using context variables did not work? This sounds like the way to go. 



    ------------------------------
    Patricia Goldweic
    ------------------------------



  • 3.  RE: Dialogue set up for re-using/classifying previous user input

    Posted Wed September 06, 2023 10:57 AM

    Thank you both for your answers!

    My problem was not so much with setting up the variable itself, but more so about how to use it as if it is a new input so it can get classified as normal. 

    I do use the user's input as a parameter to the Translator tool webhook, for example, but I don't know how to "transfer" this -either on the same node or in a following node - so that it gets treated as if it is new and proceeds with the intent classification. 

    Jumping onto another node did not work for me because none of them do intent classification without any input from the user. So, I am wondering if there is a special type of node, function, etc. that can force intent classification. 

    I will also provide some screenshots below for a little more context: 

    I hope these at least clear it up a little. Thank you once again for any help you can offer!


    ------------------------------
    Gökçe Kuşcu
    ------------------------------



  • 4.  RE: Dialogue set up for re-using/classifying previous user input

    Posted Fri September 08, 2023 10:19 AM

    Hi again,

    Glad you showed your code since that explains what you were trying to describe. My way to resolve this would be as follows:

    1- before calling your webhook, store the "input.text" value in a variable (instead of doing it afterwards)

    2- In addition, store in another variable the current intent/intents that are being recognized at that time (presumably these are the intents you want to act on, correct?). Call it something like 'currentIntent'. 

    3- After your webhook executes, and within your response condition that is associated with 'EN', you need to be able to do 2 things i) (most important one) ensure that somehow you can ensure that the intent/intents that you saved before can be acted upon, and then ii) jump to the beginning of your dialog. 

    I am aware of 2 different ways of getting i) to work above:

    1. (more work but doesn't use undocumented features): ensure that every one of your response nodes doesn't just trigger when an intent gets triggered but also when the variable you set in step 2 above (let's call it 'currentIntent') has the associated intent name as the value.
    2. (less work but uses undocumented features): use the '_eval'  function within your json, to tell Watson to set the (evaluated) intents to be exactly what you want them to be (that is, the value of the 'currentIntent' variable you set in step 2). Here's an example of how you could use this feature:   

    {
      "output": {},
      "context": {
        "_eval": [
          "intents[0].intentId = $currentIntent",
          "intents[0].confidence = 1"
        ]
      }
    }

    Hope this helps,

    -Patricia



    ------------------------------
    Patricia Goldweic
    ------------------------------



  • 5.  RE: Dialogue set up for re-using/classifying previous user input

    Posted Tue September 05, 2023 01:27 PM

    Saving the user input in a variable should work, it's the way to go. Sometimes the spelling of the variable, the way it gets in the code might generate errors:  <? input.text ?>

    This documentation should help:

    https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-manage-info



    ------------------------------
    Antonel Neculai
    ------------------------------