Open AlaGarali opened 6 years ago
Dear @desmarchris : I fixed the error data.results[0].text by data.results.text but no result shown as mentioned in this picture:
This figure shows that, in the discovery service, the results.text variable is not NULL or Undefined
Help me please ...
it may have to do with no entities being detected, can you try just using the discovery.js
and delete the other two files?
@desmarchris I deleted the other two files and this is the code in discovery.js :
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 qopts = {query: query, //natural_language_query: query,
highlight: true,
passages_count: 1,
passages: true,
return_fields: ['text'],
count:1
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,
query : qopts
}, function(error, response) {
if (error) {
reject(error);
} else {
if (response.results == null) {
console.log("L'appel au service Discovery est terminé, mais il n'a pas retourné de réponses. Vérifier le format des données injectées dans le service Discovery.");
reject(error);
} else {
console.log(response.results.text);
resolve(response.results.text);
}
}
});
}); } module.exports = sendToDiscovery;
The response.result.text returned is undefined as shown in this picture:
Please help me ...
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.
Dear Sir @desmarchris : I created a chatbot application according to your tutorial. Conversation service is working but Discovery service is not working knowing that I have added discovery intent and questions and in dialog i have discovery dialog node. The extensions of documents uploaded in discovery service are .json (containing title, text and url). You find here the error found. Please help me to find the solution.