dimanche 29 octobre 2017

Microsoft QnA Active Learning Bot Node.js

i have the following code for the Microsoft QnA Bot but i want to know how can i integrate the active learning feature.I found some tutorials and some code samples but i really don't know how to add it to my bot!

var demo=JSON.stringify({"question":"Hi"});

var extServerOptionsPost={
    host:'westus.api.cognitive.microsoft.com',
    path:'/knowledgebases/*my_id*/generateAnswer',
    method:'POST',
    headers:{
        'Ocp-Apim-Subscription-Key':'*my_sub*',
        'Content-Type':'application/json',
        'Content-Length':Buffer.byteLength(demo)
}
};

var reqPost=http.request(extServerOptionsPost,function(res){
    console.log("response statusCode: ",res.statusCode);
    res.on('data',function(data){
        console.log('Posting Result:\n');
        process.stdout.write(data);
        console.log('\n\n POST Operation Completed');
    });
});


reqPost.write(demo);


reqPost.end();
reqPost.on('error',function(e){
    console.error(e);
});




Aucun commentaire:

Enregistrer un commentaire