Convenience Method
The all-in-one method to make audio queries.
The sendAudioQuery
method on VoysisSession
is a convenience method which will create a new audio query and start streaming audio, without you having to do each step individually.
To function takes the same parameters as createAudioQuery
, and the callback gets the same query results as streamAudio
. For example:
voysisSession.sendAudioQuery('en-us').then(function (queryResult) {
console.log('You said: ' + queryResult['textQuery']['text']);
}).catch(function (error) {
console.log("ERROR: " + JSON.stringify(error));
});
The objects passed to the callback will be the result of the query:
{
"id": "6bd98943-caaa-4058-a32b-9c540cc0f8db",
"queryType": "audio",
"textQuery": {
"text": "show me freshly squeezed orange juice"
},
"audioQuery": {
"mimeType": "audio/pcm;bits=16;rate=16000"
},
"intent": "newSearch",
"reply": {
"text": "Here's what I found"
},
"entities": {
"keywords": ["freshly", "squeezed", "orange", "juice"],
"products": [],
"queryString": "freshly squeezed orange juice",
"sortBy": ""
},
"_links": {
"self": {
"href": "/conversations/bb30b7de-ae01-4868-9b6a-bf16ecd95126/queries/6bd98943-caaa-4058-a32b-9c540cc0f8db"
},
"audio": {
"href": "/conversations/bb30b7de-ae01-4868-9b6a-bf16ecd95126/queries/6bd98943-caaa-4058-a32b-9c540cc0f8db/audio"
},
"conversation": {
"href": "/conversations/bb30b7de-ae01-4868-9b6a-bf16ecd95126"
}
},
"_embedded": {}
}
Updated about 7 years ago