google-cloud-dialogflow QueryInput set context

2019-07-24 00:30发布

问题:

Actually, i am using the V1 Dialogflow Client Java SDK.

<dependency>
    <groupId>ai.api</groupId>
    <artifactId>libai</artifactId>
    <version>1.6.12</version>
</dependency>

In the current stable version (1.6.12) we have the possibility to set the Contexts before the query is sent to the server, using the method

AIRequest setContexts(List<AIContext> contexts)

This is usefull because we can set (prepare) the status of the dialogflow (chatbot).

How can i do the same with the new V2 DialogFlow Beta version?

<dependency>
    <groupId>com.google.cloud</groupId>
    <artifactId>google-cloud-dialogflow</artifactId>
    <version>0.29.0-alpha</version>
</dependency>

The samples for the new version are here https://github.com/dialogflow/dialogflow-java-client-v2 but i dont find the way to do that using the new library java version (2).