In node.js we can set context using agent.setContext(), what will be python alternative of using this way?
Currently I am using below code to set new context:
res = {
"fulfillmentText = "This is a test",
"outputContexts": [
{
"name": "projects/project_id/agent/sessions/session_id/contexts/your_context",
"lifespanCount": 5,
"parameters": {
"foo": "bar",
"foo1": "bar1"
}
}
],
}
return res
Is there any simpler way?
Thanks in advance.
Note : It seems like node.js have dialogflow-fulfillment library to ease up the things. Is there any similar fulfillment library for python as well?
The Node.js dialogflow-fulfillment library is owned and maintained by Dialogflow/Google. There is no "official" Dialogflow Python fulfillment library but there are a couple community efforts you can fork:
There is no standard python fulfillment library at this time. Sounds like an opportunity for you!
The format for setting output contexts looks correct, and isn't really much more difficult than the equivalent in JavaScript. How much simpler do you want it?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With