watson-developer-cloud / assistant-with-discovery-openwhisk

DEPRECATED: this repo is no longer actively maintained
Apache License 2.0
21 stars 43 forks source link

The sample does not work with my discovery collection. #62

Closed LTepliakov closed 5 years ago

LTepliakov commented 5 years ago

I am a newbie and trying to study this sample technology by changing its configuration... I have built it from sources and tried to run with serve -s build It works fine. Then I changed .env and credentials.json so that it points to my assistant conversation. In my conversation I created #out_of_scope intent and configured it so, that it returns the same json as in your sample, with below key pattern:

"action": {
      "call_discovery": ""
    }

Re-built and run, it works fine! But calls your sample discovery collection. As next step, I created my collection, placed one-word document into it, changed .env and credentials.json accordingly and rebuilt. Watson dialog itself works, but when I ask a #out_of_scope question it does not reply me at all... I checked the log with Kibana a can see below error messages below. I did not do any changes in the code, with my Watson dialog it does search in your Discovery collection, but fails to search in my one. What could be wrong?

Appreciate any advice!

Below are messages from Kibana log together with json, returned from Watson dialog:

{
  "_index": "logstash-s-6cb2fb63-e32b-4944-bf19-6e5b23b1c39d-2018.12.06.05",
  "_type": "activation_record",
  "_id": "5acd60f7-0882-4cd2-8462-333aba2705e4",
  "_score": null,
  "_source": {
    "end_date": "2018-12-06T17:56:53.926Z",
    "cause_str": "512554e0f9e54ff0a554e0f9e53ff0aa",
    "name_str": "discovery",
    "time_date": "2018-12-06T17:56:52.936Z",
    "status_str": "2",
    "message": "{\"error\":\"The action did not produce a valid response and exited unexpectedly.\"}",
    "type": "activation_record",
    "duration_int": 990,
    "event_uuid": "5acd60f7-0882-4cd2-8462-333aba2705e4",
    "namespace_str": "IBM-ServicesIW_dev",
    "activationId_str": "7d903c552d0b469a903c552d0bf69a39",
    "subject_str": "siwadmig@us.ibm.com",
    "ALCH_TENANT_ID": "6cb2fb63-e32b-4944-bf19-6e5b23b1c39d",
    "logmet_cluster": "topic2-elasticsearch_2",
    "@timestamp": "2018-12-06T17:57:11.248Z",
    "@version": "1",
    "ALCH_ACCOUNT_ID_str": "",
    "version_str": "0.0.2",
    "timestamp": "2018-12-06T17:57:08.710Z"
  },
  "fields": {
    "@timestamp": [
      1544119031248
    ]
  },
  "sort": [
    1544119031248
  ]
},
{
  "_index": "logstash-s-6cb2fb63-e32b-4944-bf19-6e5b23b1c39d-2018.12.06.05",
  "_type": "user_logs",
  "_id": "9537a3a7-4394-4fe9-b7af-10bc6847a420",
  "_score": null,
  "_source": {
    "time_date": "2018-12-06T17:57:07.870Z",
    "message": "There was an issue while collecting your logs. Data might be missing.",
    "type": "user_logs",
    "event_uuid": "9537a3a7-4394-4fe9-b7af-10bc6847a420",
    "activationId_str": "7d903c552d0b469a903c552d0bf69a39",
    "action_str": "IBM-ServicesIW_dev/assistant-with-discovery-openwhisk/discovery",
    "ALCH_TENANT_ID": "6cb2fb63-e32b-4944-bf19-6e5b23b1c39d",
    "logmet_cluster": "topic2-elasticsearch_2",
    "@timestamp": "2018-12-06T17:57:09.460Z",
    "@version": "1",
    "ALCH_ACCOUNT_ID_str": "",
    "stream_str": "stderr",
    "timestamp": "2018-12-06T17:57:08.710Z"
  },
  "fields": {
    "@timestamp": [
      1544119029460
    ]
  },
  "sort": [
    1544119029460
  ]
},
{
  "_index": "logstash-s-6cb2fb63-e32b-4944-bf19-6e5b23b1c39d-2018.12.06.05",
  "_type": "user_logs",
  "_id": "b3bba025-7264-4bfc-b8f8-eccdecb8869a",
  "_score": null,
  "_source": {
    "time_date": "2018-12-06T17:56:53.922729858Z",
    "message": "TypeError: Cannot read property 'length' of undefined\n",
    "type": "user_logs",
    "event_uuid": "b3bba025-7264-4bfc-b8f8-eccdecb8869a",
    "activationId_str": "7d903c552d0b469a903c552d0bf69a39",
    "action_str": "IBM-ServicesIW_dev/assistant-with-discovery-openwhisk/discovery",
    "ALCH_TENANT_ID": "6cb2fb63-e32b-4944-bf19-6e5b23b1c39d",
    "logmet_cluster": "topic2-elasticsearch_2",
    "@timestamp": "2018-12-06T17:57:08.133Z",
    "@version": "1",
    "ALCH_ACCOUNT_ID_str": "",
    "stream_str": "stderr",
    "timestamp": "2018-12-06T17:57:06.707Z"
  },
  "fields": {
    "@timestamp": [
      1544119028133
    ]
  },
  "sort": [
    1544119028133
  ]
}

And here is json message from my Watson dialog, shown in Kibana log:

{
  "_index": "logstash-s-6cb2fb63-e32b-4944-bf19-6e5b23b1c39d-2018.12.06.05",
  "_type": "activation_record",
  "_id": "e6424371-c489-4790-91c6-1983d38539de",
  "_score": null,
  "_source": {
    "end_date": "2018-12-06T17:56:52.419Z",
    "cause_str": "512554e0f9e54ff0a554e0f9e53ff0aa",
    "name_str": "conversation",
    "time_date": "2018-12-06T17:56:51.721Z",
    "status_str": "0",
    "message": "{\"context\":{\"conversation_id\":\"752f629a-5336-43f8-ad2f-ea82591d9125\",\"system\":{\"_node_output_map\":{\"Anything else\":{\"0\":[0,4,1,0,2,3]},\"Welcome\":{\"0\":[0,5,4,2,3,1,0]},\"node_4_1543998983662\":[0]},\"branch_exited\":true,\"branch_exited_reason\":\"completed\",\"dialog_request_counter\":3,\"dialog_stack\":[{\"dialog_node\":\"root\"}],\"dialog_turn_counter\":3,\"initialized\":true}},\"entities\":[],\"input\":{\"text\":\"Glossary\"},\"intents\":[{\"confidence\":0.5520805358886719,\"intent\":\"Out_of_scope\"}],\"output\":{\"action\":{\"call_discovery\":\"\"},\"generic\":[{\"response_type\":\"text\",\"text\":\"That question is out of scope for this application, take a look at the Conversation Enhanced application to handle questions like these.\"}],\"log_messages\":[],\"nodes_visited\":[\"node_1_1543942502836\",\"node_3_1543998291788\",\"node_4_1543998983662\"],\"text\":[\"That question is out of scope for this application, take a look at the Conversation Enhanced application to handle questions like these.\"]}}",
    "type": "activation_record",
    "duration_int": 698,
    "event_uuid": "e6424371-c489-4790-91c6-1983d38539de",
    "namespace_str": "IBM-ServicesIW_dev",
    "activationId_str": "dea8a909de3747fca8a909de37c7fcc9",
    "subject_str": "siwadmig@us.ibm.com",
    "ALCH_TENANT_ID": "6cb2fb63-e32b-4944-bf19-6e5b23b1c39d",
    "logmet_cluster": "topic2-elasticsearch_2",
    "@timestamp": "2018-12-06T17:56:53.509Z",
    "@version": "1",
    "ALCH_ACCOUNT_ID_str": "",
    "version_str": "0.0.2",
    "timestamp": "2018-12-06T17:56:52.871Z"
  },
  "fields": {
    "@timestamp": [
      1544119013509
    ]
  },
  "sort": [
    1544119013509
  ]
}
LTepliakov commented 5 years ago

Looks like the sample is designed to work only with this specific json document format that are placed in discovery collection with this sample... Java code tries to unpack result of discovery query, does not find expected values and crashes... Appreciate your comment. Please close the issue if my guess is correct.

germanattanasio commented 5 years ago

Are you using the code in this repo? This is Node.js not Java

LTepliakov commented 5 years ago

Looks like the sample is designed to work only with this specific json document format that are placed in discovery collection with this sample... Java code tries to unpack result of discovery query, does not find expected values and crashes... Appreciate your comment. Please close the issue if my guess is correct.

LTepliakov commented 5 years ago

I confirmed my guess above. I have created my personal discovery collection, placed my documents into it in same json format as in athor's one and the sample worked fine on my data fine without any code changes. @germanattanasio Yes that is node.js, sorry for this typo in my comment. I am closing the question. Thank you very much for your sample!