markp3rry
markp3rry

Reputation: 734

Watson conversation API returns empty output for yes and no input

I've set up a very simple script and part of it requires a yes or no response from the user.

When I test the script through the script builder at ibmwatsonconversation.com the script works fine.

But when I'm testing it through Postman making HTTP POST requests when I get to the part that requires a yes or no answer the output node is always

"output": {
"log_messages": [],
"text": [],
"nodes_visited": [
  "node_25_1480610375023"
]},

The previous two nodes in the conversation work fine.

I have set up intents for yes and no, see images below: yes intent no intent

The dialog is as follows:

dialog

Here's the chain of requests / responses:

{"input": {"text": "hello"}}

"output": {"log_messages": [],"text": ["Welcome to the KMBC IT help desk.How can I help you?"],"nodes_visited": ["node_1_1480509441272"]},

then

{"input": {"text": "my laptop is broken"}}

"output": {
"log_messages": [],
"text": [
  "I'm sorry to hear that your laptop isn't working. \n\nI need you to check a couple of things for me, is that ok?"
],
"nodes_visited": [
  "node_3_1480509642420",
  "node_19_1480518011225"
]},

finally

{"input": {"text": "yes"}}

"output": {
"log_messages": [],
"text": [],
"nodes_visited": [
  "node_25_1480610375023"
]},

Works fine inside the "Try it out" panel within the workspace:

enter image description here

Full JSON request / response:

{"input": {"text": "hello"}}

{"intents": [{"intent": "greetings","confidence": 1}],"entities": [],"input": {"text": "hello"},"output": {"log_messages": [],"text": ["Welcome to the KMBC IT help desk. How can I help you?"],"nodes_visited": ["node_1_1480509441272"]},"context": {"conversation_id": "4b5b1858-ae4e-4907-a3ab-c49abf601fd3","system": {
  "dialog_stack": [
    {
      "dialog_node": "root"
    }
  ],
  "dialog_turn_counter": 1,
  "dialog_request_counter": 1
}}}


{"input": {"text": "laptop broken"}}
{"intents": [{"intent": "complaint","confidence": 0.989692384334575}],"entities": [
{"entity": "hardware",
  "location": [
    0,
    6
  ],
  "value": "laptop"
}],"input": {"text": "laptop broken"},"output": {"log_messages": [],"text": ["I'm sorry to hear that your laptop isn't working. \n\nI need you to check a couple of things for me, is that ok?"],"nodes_visited": ["node_3_1480509642420",
  "node_19_1480518011225"]},"context": {
"conversation_id": "b53dff12-9252-4b7e-abe8-7b45f561d394",
"system": {"dialog_stack": [{"dialog_node": "node_19_1480518011225"}],
  "dialog_turn_counter": 1,
  "dialog_request_counter": 1}}}


{"input": {"text": "yes"}}
{"intents": [{"intent": "yes","confidence": 1}],"entities": [],"input": {"text": "yes"},"output": {"log_messages": [],"text": [],"nodes_visited": ["node_25_1480610375023"]},"context": {"conversation_id": "b9ddc5b0-5f3c-423f-9bbe-5a1ef013c175","system": {"dialog_stack": [{"dialog_node": "root"}],"dialog_turn_counter": 1,"dialog_request_counter": 1}}}

Upvotes: 0

Views: 1117

Answers (2)

Simon O'Doherty
Simon O'Doherty

Reputation: 9349

Based on the full JSON request/response, your issue is here (actually it's also in the previous call, but that works by concidence):

{"input": {"text": "yes"}}

Conversation is stateless, so you need to send back in the context object you received previously. Otherwise the system doesn't know where to continue. The following request object should look like this:

{
"input": {"text": "yes"},
"context": {
    "conversation_id": "b53dff12-9252-4b7e-abe8-7b45f561d394",
    "system": {
        "dialog_stack": [{"dialog_node": "node_19_1480518011225"}],
        "dialog_turn_counter": 1,
        "dialog_request_counter": 1
    }
}

I would recommend to use the Watson Developer Cloud SDK to manage this for you.

https://github.com/watson-developer-cloud

Upvotes: 1

timd
timd

Reputation: 376

Have you actually created a yes and no intent ?
There is a lot of debate about the best process to handle yes and no responses. But I have found that by creating a yes and no intent, with example "yes" and "No" responses works well. Your example questions for these intents could include responses like "ok", "yess", "on no","yes please" etc.

Upvotes: 1

Related Questions