Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [dialogflow] Add the enable_partial_automated_agent_reply flag #9924

Merged
merged 4 commits into from Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion java-dialogflow/README.md
Expand Up @@ -195,7 +195,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html
[stability-image]: https://img.shields.io/badge/stability-stable-green
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-dialogflow.svg
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-dialogflow/4.30.0
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-dialogflow/4.33.0
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
Expand Down
Expand Up @@ -978,6 +978,7 @@ public final AnalyzeContentResponse analyzeContent(AnalyzeContentRequest request
* .setQueryParams(QueryParameters.newBuilder().build())
* .setAssistQueryParams(AssistQueryParameters.newBuilder().build())
* .setCxParameters(Struct.newBuilder().build())
* .setEnableExtendedStreaming(true)
* .setEnablePartialAutomatedAgentReply(true)
* .setEnableDebuggingInfo(true)
* .build();
Expand Down
Expand Up @@ -642,6 +642,7 @@ public void streamingAnalyzeContentTest() throws Exception {
.setQueryParams(QueryParameters.newBuilder().build())
.setAssistQueryParams(AssistQueryParameters.newBuilder().build())
.setCxParameters(Struct.newBuilder().build())
.setEnableExtendedStreaming(true)
.setEnablePartialAutomatedAgentReply(true)
.setEnableDebuggingInfo(true)
.build();
Expand Down Expand Up @@ -676,6 +677,7 @@ public void streamingAnalyzeContentExceptionTest() throws Exception {
.setQueryParams(QueryParameters.newBuilder().build())
.setAssistQueryParams(AssistQueryParameters.newBuilder().build())
.setCxParameters(Struct.newBuilder().build())
.setEnableExtendedStreaming(true)
.setEnablePartialAutomatedAgentReply(true)
.setEnableDebuggingInfo(true)
.build();
Expand Down

Large diffs are not rendered by default.

Expand Up @@ -765,6 +765,42 @@ public com.google.protobuf.StructOrBuilder getCxParametersOrBuilder() {
return cxParameters_ == null ? com.google.protobuf.Struct.getDefaultInstance() : cxParameters_;
}

public static final int ENABLE_EXTENDED_STREAMING_FIELD_NUMBER = 11;
private boolean enableExtendedStreaming_ = false;
/**
*
*
* <pre>
* Optional. Enable full bidirectional streaming. You can keep streaming the
* audio until timeout, and there's no need to half close the stream to get
* the response.
*
* Restrictions:
*
* - Timeout: 3 mins.
* - Audio Encoding: only supports
* [AudioEncoding.AUDIO_ENCODING_LINEAR_16][google.cloud.dialogflow.v2.AudioEncoding.AUDIO_ENCODING_LINEAR_16]
* and
* [AudioEncoding.AUDIO_ENCODING_MULAW][google.cloud.dialogflow.v2.AudioEncoding.AUDIO_ENCODING_MULAW]
* - Lifecycle: conversation should be in `Assist Stage`, go to
* [Conversation.CreateConversation][] for more information.
*
* InvalidArgument Error will be returned if the one of restriction checks
* failed.
*
* You can find more details in
* https://cloud.google.com/agent-assist/docs/extended-streaming
* </pre>
*
* <code>bool enable_extended_streaming = 11 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return The enableExtendedStreaming.
*/
@java.lang.Override
public boolean getEnableExtendedStreaming() {
return enableExtendedStreaming_;
}

public static final int ENABLE_PARTIAL_AUTOMATED_AGENT_REPLY_FIELD_NUMBER = 12;
private boolean enablePartialAutomatedAgentReply_ = false;
/**
Expand Down Expand Up @@ -846,6 +882,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io
if (inputCase_ == 9) {
output.writeMessage(9, (com.google.cloud.dialogflow.v2.TelephonyDtmfEvents) input_);
}
if (enableExtendedStreaming_ != false) {
output.writeBool(11, enableExtendedStreaming_);
}
if (enablePartialAutomatedAgentReply_ != false) {
output.writeBool(12, enablePartialAutomatedAgentReply_);
}
Expand Down Expand Up @@ -899,6 +938,9 @@ public int getSerializedSize() {
com.google.protobuf.CodedOutputStream.computeMessageSize(
9, (com.google.cloud.dialogflow.v2.TelephonyDtmfEvents) input_);
}
if (enableExtendedStreaming_ != false) {
size += com.google.protobuf.CodedOutputStream.computeBoolSize(11, enableExtendedStreaming_);
}
if (enablePartialAutomatedAgentReply_ != false) {
size +=
com.google.protobuf.CodedOutputStream.computeBoolSize(
Expand Down Expand Up @@ -943,6 +985,7 @@ public boolean equals(final java.lang.Object obj) {
if (hasCxParameters()) {
if (!getCxParameters().equals(other.getCxParameters())) return false;
}
if (getEnableExtendedStreaming() != other.getEnableExtendedStreaming()) return false;
if (getEnablePartialAutomatedAgentReply() != other.getEnablePartialAutomatedAgentReply())
return false;
if (getEnableDebuggingInfo() != other.getEnableDebuggingInfo()) return false;
Expand Down Expand Up @@ -1000,6 +1043,8 @@ public int hashCode() {
hash = (37 * hash) + CX_PARAMETERS_FIELD_NUMBER;
hash = (53 * hash) + getCxParameters().hashCode();
}
hash = (37 * hash) + ENABLE_EXTENDED_STREAMING_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getEnableExtendedStreaming());
hash = (37 * hash) + ENABLE_PARTIAL_AUTOMATED_AGENT_REPLY_FIELD_NUMBER;
hash =
(53 * hash)
Expand Down Expand Up @@ -1242,6 +1287,7 @@ public Builder clear() {
cxParametersBuilder_.dispose();
cxParametersBuilder_ = null;
}
enableExtendedStreaming_ = false;
enablePartialAutomatedAgentReply_ = false;
enableDebuggingInfo_ = false;
configCase_ = 0;
Expand Down Expand Up @@ -1309,9 +1355,12 @@ private void buildPartial0(
cxParametersBuilder_ == null ? cxParameters_ : cxParametersBuilder_.build();
}
if (((from_bitField0_ & 0x00000400) != 0)) {
result.enablePartialAutomatedAgentReply_ = enablePartialAutomatedAgentReply_;
result.enableExtendedStreaming_ = enableExtendedStreaming_;
}
if (((from_bitField0_ & 0x00000800) != 0)) {
result.enablePartialAutomatedAgentReply_ = enablePartialAutomatedAgentReply_;
}
if (((from_bitField0_ & 0x00001000) != 0)) {
result.enableDebuggingInfo_ = enableDebuggingInfo_;
}
}
Expand Down Expand Up @@ -1397,6 +1446,9 @@ public Builder mergeFrom(com.google.cloud.dialogflow.v2.StreamingAnalyzeContentR
if (other.hasCxParameters()) {
mergeCxParameters(other.getCxParameters());
}
if (other.getEnableExtendedStreaming() != false) {
setEnableExtendedStreaming(other.getEnableExtendedStreaming());
}
if (other.getEnablePartialAutomatedAgentReply() != false) {
setEnablePartialAutomatedAgentReply(other.getEnablePartialAutomatedAgentReply());
}
Expand Down Expand Up @@ -1525,10 +1577,16 @@ public Builder mergeFrom(
inputCase_ = 9;
break;
} // case 74
case 88:
{
enableExtendedStreaming_ = input.readBool();
bitField0_ |= 0x00000400;
break;
} // case 88
case 96:
{
enablePartialAutomatedAgentReply_ = input.readBool();
bitField0_ |= 0x00000400;
bitField0_ |= 0x00000800;
break;
} // case 96
case 106:
Expand All @@ -1540,7 +1598,7 @@ public Builder mergeFrom(
case 152:
{
enableDebuggingInfo_ = input.readBool();
bitField0_ |= 0x00000800;
bitField0_ |= 0x00001000;
break;
} // case 152
default:
Expand Down Expand Up @@ -3426,6 +3484,113 @@ public com.google.protobuf.StructOrBuilder getCxParametersOrBuilder() {
return cxParametersBuilder_;
}

private boolean enableExtendedStreaming_;
/**
*
*
* <pre>
* Optional. Enable full bidirectional streaming. You can keep streaming the
* audio until timeout, and there's no need to half close the stream to get
* the response.
*
* Restrictions:
*
* - Timeout: 3 mins.
* - Audio Encoding: only supports
* [AudioEncoding.AUDIO_ENCODING_LINEAR_16][google.cloud.dialogflow.v2.AudioEncoding.AUDIO_ENCODING_LINEAR_16]
* and
* [AudioEncoding.AUDIO_ENCODING_MULAW][google.cloud.dialogflow.v2.AudioEncoding.AUDIO_ENCODING_MULAW]
* - Lifecycle: conversation should be in `Assist Stage`, go to
* [Conversation.CreateConversation][] for more information.
*
* InvalidArgument Error will be returned if the one of restriction checks
* failed.
*
* You can find more details in
* https://cloud.google.com/agent-assist/docs/extended-streaming
* </pre>
*
* <code>bool enable_extended_streaming = 11 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return The enableExtendedStreaming.
*/
@java.lang.Override
public boolean getEnableExtendedStreaming() {
return enableExtendedStreaming_;
}
/**
*
*
* <pre>
* Optional. Enable full bidirectional streaming. You can keep streaming the
* audio until timeout, and there's no need to half close the stream to get
* the response.
*
* Restrictions:
*
* - Timeout: 3 mins.
* - Audio Encoding: only supports
* [AudioEncoding.AUDIO_ENCODING_LINEAR_16][google.cloud.dialogflow.v2.AudioEncoding.AUDIO_ENCODING_LINEAR_16]
* and
* [AudioEncoding.AUDIO_ENCODING_MULAW][google.cloud.dialogflow.v2.AudioEncoding.AUDIO_ENCODING_MULAW]
* - Lifecycle: conversation should be in `Assist Stage`, go to
* [Conversation.CreateConversation][] for more information.
*
* InvalidArgument Error will be returned if the one of restriction checks
* failed.
*
* You can find more details in
* https://cloud.google.com/agent-assist/docs/extended-streaming
* </pre>
*
* <code>bool enable_extended_streaming = 11 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @param value The enableExtendedStreaming to set.
* @return This builder for chaining.
*/
public Builder setEnableExtendedStreaming(boolean value) {

enableExtendedStreaming_ = value;
bitField0_ |= 0x00000400;
onChanged();
return this;
}
/**
*
*
* <pre>
* Optional. Enable full bidirectional streaming. You can keep streaming the
* audio until timeout, and there's no need to half close the stream to get
* the response.
*
* Restrictions:
*
* - Timeout: 3 mins.
* - Audio Encoding: only supports
* [AudioEncoding.AUDIO_ENCODING_LINEAR_16][google.cloud.dialogflow.v2.AudioEncoding.AUDIO_ENCODING_LINEAR_16]
* and
* [AudioEncoding.AUDIO_ENCODING_MULAW][google.cloud.dialogflow.v2.AudioEncoding.AUDIO_ENCODING_MULAW]
* - Lifecycle: conversation should be in `Assist Stage`, go to
* [Conversation.CreateConversation][] for more information.
*
* InvalidArgument Error will be returned if the one of restriction checks
* failed.
*
* You can find more details in
* https://cloud.google.com/agent-assist/docs/extended-streaming
* </pre>
*
* <code>bool enable_extended_streaming = 11 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return This builder for chaining.
*/
public Builder clearEnableExtendedStreaming() {
bitField0_ = (bitField0_ & ~0x00000400);
enableExtendedStreaming_ = false;
onChanged();
return this;
}

private boolean enablePartialAutomatedAgentReply_;
/**
*
Expand Down Expand Up @@ -3463,7 +3628,7 @@ public boolean getEnablePartialAutomatedAgentReply() {
public Builder setEnablePartialAutomatedAgentReply(boolean value) {

enablePartialAutomatedAgentReply_ = value;
bitField0_ |= 0x00000400;
bitField0_ |= 0x00000800;
onChanged();
return this;
}
Expand All @@ -3482,7 +3647,7 @@ public Builder setEnablePartialAutomatedAgentReply(boolean value) {
* @return This builder for chaining.
*/
public Builder clearEnablePartialAutomatedAgentReply() {
bitField0_ = (bitField0_ & ~0x00000400);
bitField0_ = (bitField0_ & ~0x00000800);
enablePartialAutomatedAgentReply_ = false;
onChanged();
return this;
Expand Down Expand Up @@ -3521,7 +3686,7 @@ public boolean getEnableDebuggingInfo() {
public Builder setEnableDebuggingInfo(boolean value) {

enableDebuggingInfo_ = value;
bitField0_ |= 0x00000800;
bitField0_ |= 0x00001000;
onChanged();
return this;
}
Expand All @@ -3538,7 +3703,7 @@ public Builder setEnableDebuggingInfo(boolean value) {
* @return This builder for chaining.
*/
public Builder clearEnableDebuggingInfo() {
bitField0_ = (bitField0_ & ~0x00000800);
bitField0_ = (bitField0_ & ~0x00001000);
enableDebuggingInfo_ = false;
onChanged();
return this;
Expand Down
Expand Up @@ -412,6 +412,37 @@ public interface StreamingAnalyzeContentRequestOrBuilder
*/
com.google.protobuf.StructOrBuilder getCxParametersOrBuilder();

/**
*
*
* <pre>
* Optional. Enable full bidirectional streaming. You can keep streaming the
* audio until timeout, and there's no need to half close the stream to get
* the response.
*
* Restrictions:
*
* - Timeout: 3 mins.
* - Audio Encoding: only supports
* [AudioEncoding.AUDIO_ENCODING_LINEAR_16][google.cloud.dialogflow.v2.AudioEncoding.AUDIO_ENCODING_LINEAR_16]
* and
* [AudioEncoding.AUDIO_ENCODING_MULAW][google.cloud.dialogflow.v2.AudioEncoding.AUDIO_ENCODING_MULAW]
* - Lifecycle: conversation should be in `Assist Stage`, go to
* [Conversation.CreateConversation][] for more information.
*
* InvalidArgument Error will be returned if the one of restriction checks
* failed.
*
* You can find more details in
* https://cloud.google.com/agent-assist/docs/extended-streaming
* </pre>
*
* <code>bool enable_extended_streaming = 11 [(.google.api.field_behavior) = OPTIONAL];</code>
*
* @return The enableExtendedStreaming.
*/
boolean getEnableExtendedStreaming();

/**
*
*
Expand Down
Expand Up @@ -605,6 +605,27 @@ message StreamingAnalyzeContentRequest {
// CX agent.
google.protobuf.Struct cx_parameters = 13;

// Optional. Enable full bidirectional streaming. You can keep streaming the
// audio until timeout, and there's no need to half close the stream to get
// the response.
//
// Restrictions:
//
// - Timeout: 3 mins.
// - Audio Encoding: only supports
// [AudioEncoding.AUDIO_ENCODING_LINEAR_16][google.cloud.dialogflow.v2.AudioEncoding.AUDIO_ENCODING_LINEAR_16]
// and
// [AudioEncoding.AUDIO_ENCODING_MULAW][google.cloud.dialogflow.v2.AudioEncoding.AUDIO_ENCODING_MULAW]
// - Lifecycle: conversation should be in `Assist Stage`, go to
// [Conversation.CreateConversation][] for more information.
//
// InvalidArgument Error will be returned if the one of restriction checks
// failed.
//
// You can find more details in
// https://cloud.google.com/agent-assist/docs/extended-streaming
bool enable_extended_streaming = 11 [(google.api.field_behavior) = OPTIONAL];

// Enable partial virtual agent responses. If this flag is not enabled,
// response stream still contains only one final response even if some
// `Fulfillment`s in Dialogflow virtual agent have been configured to return
Expand Down
Expand Up @@ -52,6 +52,7 @@ public static void asyncStreamingAnalyzeContent() throws Exception {
.setQueryParams(QueryParameters.newBuilder().build())
.setAssistQueryParams(AssistQueryParameters.newBuilder().build())
.setCxParameters(Struct.newBuilder().build())
.setEnableExtendedStreaming(true)
.setEnablePartialAutomatedAgentReply(true)
.setEnableDebuggingInfo(true)
.build();
Expand Down