I've implemented the QAPI using a node server back end and i'm requesting the answer to a question using the following request body:
var questionEntity = {
"question" : {
"evidenceRequest" : { // Ask Watson to return evidence
"items" : 2 // Ask for 5 answers with evidence
}
,"questionText" : "What is the meaning off life?" // The question
,"items" : 1 // only return a single answer?
}
};
I'm not entirely sure this is the best request to make to return the highest confidence answer. Can you even make a request to Watson to only return the single highest confidence answer, if so what would the request be?
If not, then how do i process the answers and evidence list, to return the expected answer text?
Answer by German Attanasio Ruiz (4975) | Oct 10, 2014 at 02:54 PM
Hi Emilie
Currently the sample code you are using/looking at is based on an evidence list, so if you want to get 1 answer you need to send:
var questionEntity = {
"question" : {
"evidenceRequest" : { "items" : 1 },
"questionText" : "What is the meaning off life?",
"items" : 1
}
};
And check the evidence list to find the answer.