In the sample code for detecting intents from text, the node.js version copies the response-output-contexts into the request-input-contexts of the next request, however the other languages' samples omit that part. What is this context-copying good for?
Contexts are supposed to be kept alive for the specified lifespanCount requests by the agent anyhow, so I have trouble seeing the use for it. Or is it something required only for the older v1 API, not for the current v2 API?
Extracts from the sample code linked above:
// First query.
promise = sessionClient.detectIntent(request);
// and for the rest of the queries...
promise = promise.then(responses => {
const response = responses[0];
// Use output contexts as input contexts for the next query.
request.queryParams = {
contexts: response.queryResult.outputContexts,
};
return sessionClient.detectIntent(request);
});
from Why does the node.js dialogflow sample code copy output contexts to input contexts?
No comments:
Post a Comment