watson-developer-cloud / assistant-with-discovery-openwhisk Goto Github PK
View Code? Open in Web Editor NEWDEPRECATED: this repo is no longer actively maintained
License: Apache License 2.0
DEPRECATED: this repo is no longer actively maintained
License: Apache License 2.0
i am not able to run this code in bluemix cloud. please help me with the steps to run the application in cloud directly instead of running it in locally.
I have followed all steps and managed to do all steps with no errors. When i do npm start it works fine and opens the browser window, however it does not return any conversation. Where can i check logs for an error?
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": "[email protected]",
"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": "[email protected]",
"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
]
}
alexv@LAPTOP-FHN7KDT7 /cygdrive/c/Users/alexv/assistant-with-discovery-openwhisk-master
$ sh create-openwhisk-actions.sh
create-openwhisk-actions.sh: line 1: source: /usr/bin/env: cannot execute binary file
Creating OpenWhisk Actions...
error: Unable to create package 'assistant-with-discovery-openwhisk': resource already exists (code 3acc0aba5250971fd70d11a9da4c5a2b)
error: Unable to create action 'assistant-with-discovery-openwhisk/conversation': resource already exists (code f35fce403e0a50ddc019900b002f8200)
Run 'wsk --help' for usage.
error: Unable to create action 'assistant-with-discovery-openwhisk/discovery': resource already exists (code ef85a6158bc4a8a07d34648ffab815c4)
Run 'wsk --help' for usage.
Setting default parameters...
error: Failed to parse arguments: The parameter arguments are invalid: Arguments for '--param' must be a key/value pair
Run 'wsk --help' for usage.
error: Invalid argument(s). File 'collection_id' is not a valid file or it does not exist
Run 'wsk --help' for usage.
Creating OpenWhisk Sequence...
error: Unable to create action 'assistant-with-discovery-openwhisk/assistant-with-discovery-sequence': resource already exists (code e44c843d0378c24ab1e6c2cb463a320d)
Run 'wsk --help' for usage.
Retrieving OpenWhisk WebAction URL...
I'm trying to build Customer Support Agent with Watson Conversation and Discovery Service and uploading FAQs documents (.docx, .pdf, .html) to Discovery service.
I would like to know, how can I have the right answer of a question asked, from documents (html, docx, pdf, ...) uploaded on discovery service ? How can I configure discovery service or discovery.query (){} to return the best answer of user's question ? Should I use another service such as WKS or not ? Please find below my discovery.js file code:
function sendToDiscovery(query) {
return new Promise(function(resolve, reject) {
var DiscoveryV1 = require('watson-developer-cloud/discovery/v1');
var discovery = new DiscoveryV1({
username: process.env.DISCOVERY_USERNAME,
password: process.env.DISCOVERY_PASSWORD,
version_date: '2018-03-05'
});
var environment_id = process.env.ENVIRONMENT_ID;
var collection_id = process.env.COLLECTION_ID;
var params = {query: query,
//natural_language_query: query
//filter: score>0.8,
highlight: true,
passages_count: 1,
passages: true,
return_fields: ['text'],
count:1,
return: 'text'
//aggregation:
//'[term(enriched_text.entities.text).term(enriched_text.sentiment.document.label),' +
//'term(enriched_text.categories.label).term(enriched_text.sentiment.document.label),' +
//'term(enriched_text.concepts.text).term(enriched_text.sentiment.document.label),' +
//'term(enriched_text.keywords.text).term(enriched_text.sentiment.document.label),' +
//'term(enriched_text.entities.type).term(enriched_text.sentiment.document.label)]'
}
discovery.query({
environment_id: environment_id,
collection_id: collection_id,
configuration_id: process.env.DISCOVERY_CONFIGURATION_ID,
query : params
}, function(error, response) {
if (error) {
reject(error);
} else {
if (response.results == null) {
console.log("The call to the Discovery service is complete, but he has not returned any replies. Check the format of the data injected into the Discovery service.");
reject(error);
} else {
console.log(response.results[0].text);
resolve(response.results[0].text);
}
}
});
});
}
module.exports = sendToDiscovery;
Could you help me please ?
Best regards.
Hello Team.
I complied the sample successfully and can start it as development version
npm start
It works fine. It also works fine when I build it for production with
npm run build
and then start with
serve -s build
I had no problem also to deploy it on another host under Apache web server.
The problems start when I try to deploy to bluemix.
I have created manifest.yml file:
applications:
and try to deploy it with
ibmcloud cf push
It looks to build successfully but fails to start:
Waiting for app to start...
Start unsuccessful
TIP: use 'cf logs assistant-with-discovery-openwhisk --recent' for more information
FAILED
In the logs I can see:
2019-02-26T15:36:29.95+0300 [CELL/0] OUT Starting health monitoring of container
2019-02-26T15:36:31.56+0300 [APP/PROC/WEB/0] OUT > @ibm-watson/[email protected] start /home/vcap/app
2019-02-26T15:36:31.56+0300 [APP/PROC/WEB/0] OUT > npm-run-all -p watch-css start-js
2019-02-26T15:36:33.76+0300 [APP/PROC/WEB/0] OUT > @ibm-watson/[email protected] start-js /home/vcap/app
2019-02-26T15:36:33.76+0300 [APP/PROC/WEB/0] OUT > react-scripts start
2019-02-26T15:36:33.77+0300 [APP/PROC/WEB/0] OUT > @ibm-watson/[email protected] watch-css /home/vcap/app
2019-02-26T15:36:33.77+0300 [APP/PROC/WEB/0] OUT > npm run build-css && node-sass-chokidar src/ -o src/ --watch --recursive
2019-02-26T15:36:33.83+0300 [APP/PROC/WEB/0] ERR sh: 1: react-scripts: not found
2019-02-26T15:36:33.85+0300 [APP/PROC/WEB/0] ERR npm ERR! Linux 4.15.0-43-generic
2019-02-26T15:36:33.85+0300 [APP/PROC/WEB/0] ERR npm ERR! argv "/home/vcap/app/vendor/node/bin/node" "/home/vcap/app/vendor/node/lib/node_modules/npm/bin/npm-cli.js" "run" "start-js"
2019-02-26T15:36:33.85+0300 [APP/PROC/WEB/0] ERR npm ERR! node v6.16.0
2019-02-26T15:36:33.85+0300 [APP/PROC/WEB/0] ERR npm ERR! npm v3.10.10
2019-02-26T15:36:33.85+0300 [APP/PROC/WEB/0] ERR npm ERR! file sh
2019-02-26T15:36:33.85+0300 [APP/PROC/WEB/0] ERR npm ERR! code ELIFECYCLE
2019-02-26T15:36:33.85+0300 [APP/PROC/WEB/0] ERR npm ERR! errno ENOENT
2019-02-26T15:36:33.85+0300 [APP/PROC/WEB/0] ERR npm ERR! syscall spawn
Also in the build process there was a warning, not sure it has relation to above problem...
2019-02-26T15:35:55.53+0300 [STG/0] OUT -----> Installing App Management
2019-02-26T15:35:55.64+0300 [STG/0] OUT WARN: App Management cannot be installed because the start script cannot be found.
2019-02-26T15:35:55.64+0300 [STG/0] OUT To install App Management utilities, specify your 'node' start script in 'package.json' or 'Procfile'.
2019-02-26T15:35:55.64+0300 [STG/0] OUT Checking for Dynatrace credentials
2019-02-26T15:35:55.65+0300 [STG/0] OUT No Dynatrace Service Found (service with substring dynatrace not found in VCAP_SERVICES)
Appreciate any advice or to share a hint how did you install this sample on bulemix!
Got the attached error when running npm run train
Can anybody help?
2018-03-23T15_58_44_318Z-debug.log
I have followed the steps in the readme up to npm run train
.
When executing the train command, the step of uploading documents to Watson Discovery is not working for me. I get the error Error: Callback function "uploadDocumentAsync" timed out.
See attached full console output.
The script does successfully create the Discovery container "demoCollection", but none of the documents are uploaded into it.
Any ideas why the upload would be timing out? I don't know where to start. Let me know if you need more info. Thanks!
sh create-openwhisk-actions.sh
Creating OpenWhisk Actions...
error: Unable to create package 'assistant-with-discovery-openwhisk': resource already exists (code 0610bf7ca8d3da49e1c7c2312d573dbb)
error: Unable to create action 'assistant-with-discovery-openwhisk/conversation': resource already exists (code 9cf847df74b87f2532be469ab74af978)
Run 'wsk --help' for usage.
error: Unable to create action 'assistant-with-discovery-openwhisk/discovery': resource already exists (code e4b07b61398c97c93d9e2c7a9cf2cb01)
Run 'wsk --help' for usage.
Setting default parameters...
ok: updated action assistant-with-discovery-openwhisk/conversation
ok: updated action assistant-with-discovery-openwhisk/discovery
Creating OpenWhisk Sequence...
error: Unable to create action 'assistant-with-discovery-openwhisk/assistant-with-discovery-sequence': resource already exists (code 9ddd76fdd1d73ef1b40ac853495ef1b9)
Run 'wsk --help' for usage.
Retrieving OpenWhisk WebAction URL...
Hello Team.
Can you please share how did you pull the web pages from car support site into json documents that you place into Watson Discovery Collection?
Did you use some tool for that, or did it manually?
Hi, got this error while running sh create-openwhisk-actions.sh
create-openwhisk-actions.sh: line 1: source: .env: file not found
I do have an env file generated in the instructions before.
If creation of the discovery-for-demo
service fails, e.g. due to hitting limit for # services, the polling for service creation still continues (though it looks like it tries to check creation message).
As a result, the deployment job runs for ~60 mins before timing out.
Completed all instructions as outlined with no complying issues, the only substitute was using the new OpenWhisk replacement service, Cloud Functions. You can test my app here, https://watsonnradvisorconversationapp.mybluemix.net/ to verify issue. Any ideas on where to start looking for the break would be appreciated, thanks!
I am trying to run "npm run train" as per the guide but I am getting the following error message....does it have to do that I only have username and password for both the assistant and discovery services and replaced the "ApiKey" and "ApiKeyName" with "username" and "password" in the "credentials.json"....IBM cloud does not appear to automatically provide API keys....
Creating environment
{ Error: {"context":{"requestId":"90799aceff134319b5f363d559f7698a","requestType":"incoming.Identity_Token","userAgent":"watson-developer-cloud-nodejs-3.7.0;","clientIp":"105.227.108.57","url":"https://iam.bluemix.net","instanceId":"iamid-9955f7b67-zlkqv","threadId":"230185","host":"iamid-9955f7b67-zlkqv","startTime":"22.10.2018 15:06:32:158 UTC","endTime":"22.10.2018 15:06:32:236 UTC","elapsedTime":"78","locale":"en_US","clusterName":"iam-id-prfra04-h7e1"},"errorCode":"BXNIM0415E","errorMessage":"Provided API key could not be found"}
i am not able to run this code in bluemix cloud. please help me with the steps to run the application in cloud directly instead of running it in locally.
same as assistant-simple, please add clickable buttons instead of standard list. if people wants lists they can use html formatting
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.