Roopika Chari
Roopika Chari

Reputation: 11

Managing Context in Dialogflow

I want to know if the context of the conversation can be maintained in Dialog-flow like for example:

User: Total cost

Bot: Total cost for which Account:

 1.ABC
 2.XYZ
 3.PQR

User: Clicks the account name

Bot: Total cost for ABC is ####(some amount)

User: I want to know more

Bot: Previous Month total cost was ####, this month is ****

This way the context is to be maintained. But as I see the documents the context can be maintained only till two conversational flow. Is there any way that I can follow to implement this?

Upvotes: 0

Views: 163

Answers (1)

marksy_91
marksy_91

Reputation: 226

You can set the lifespan of the context either in the DialogFlow agent UI, or via the API.

See https://cloud.google.com/dialogflow/docs/contexts-input-output#lifespan for the description of context lifespan. As you mention, the default lifespan for each context is 2 conversational units, but you can modify this to any number as you see fit. See the following image as an example.

DialogFlow output context

It is also referenced in the API documentation here: https://cloud.google.com/dialogflow/docs/reference/rest/v2/projects.agent.environments.users.sessions.contexts#Context.

Upvotes: 2

Related Questions