Skip to content

Commit

Permalink
feat: [dialogflow] added speech endpointing setting (#9760)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

feat: added Knowledge Search API

PiperOrigin-RevId: 561112943

Source-Link: https://togithub.com/googleapis/googleapis/commit/6d69526f72f05cd22a9ef2e4ca7af6ae19d8e612

Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/5d3ab0d9ffda232d36cb148ce192ea8771510402
Copy-Tag: eyJwIjoiamF2YS1kaWFsb2dmbG93Ly5Pd2xCb3QueWFtbCIsImgiOiI1ZDNhYjBkOWZmZGEyMzJkMzZjYjE0OGNlMTkyZWE4NzcxNTEwNDAyIn0=

BEGIN_NESTED_COMMIT
feat: [dialogflow] added speech endpointing setting
feat: added Knowledge Search API

PiperOrigin-RevId: 560215389

Source-Link: https://togithub.com/googleapis/googleapis/commit/b1666e6f4fe427dd942e0afe9f5177acd954fadb

Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/07e82b4d4917494d85039722f673d409c4c7305f
Copy-Tag: eyJwIjoiamF2YS1kaWFsb2dmbG93Ly5Pd2xCb3QueWFtbCIsImgiOiIwN2U4MmI0ZDQ5MTc0OTRkODUwMzk3MjJmNjczZDQwOWM0YzczMDVmIn0=
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
feat: [dialogflow] added baseline model version used to generate the summary
feat: added the platform of the virtual agent response messages

PiperOrigin-RevId: 556882279

Source-Link: https://togithub.com/googleapis/googleapis/commit/c8eccdafc3d1365aea0b006b2d1fec515d7ad0f7

Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/754eb3340d76e6da69f081041d97f018022a55da
Copy-Tag: eyJwIjoiamF2YS1kaWFsb2dmbG93Ly5Pd2xCb3QueWFtbCIsImgiOiI3NTRlYjMzNDBkNzZlNmRhNjlmMDgxMDQxZDk3ZjAxODAyMmE1NWRhIn0=
END_NESTED_COMMIT
BEGIN_NESTED_COMMIT
feat: [dialogflow] added baseline model version used to generate the summary
feat: added the platform of the virtual agent response messages

PiperOrigin-RevId: 555788605

Source-Link: https://togithub.com/googleapis/googleapis/commit/90a551c2a02613507a2f0f05fd25d133113a1a1c

Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/30620b4f34713860083fff036982900b1004cbf5
Copy-Tag: eyJwIjoiamF2YS1kaWFsb2dmbG93Ly5Pd2xCb3QueWFtbCIsImgiOiIzMDYyMGI0ZjM0NzEzODYwMDgzZmZmMDM2OTgyOTAwYjEwMDRjYmY1In0=
END_NESTED_COMMIT
  • Loading branch information
gcf-owl-bot[bot] authored Aug 30, 2023
1 parent e434587 commit 411a707
Show file tree
Hide file tree
Showing 109 changed files with 26,612 additions and 1,876 deletions.
4 changes: 2 additions & 2 deletions java-dialogflow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.21.0</version>
<version>26.22.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down 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.28.0
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-dialogflow/4.29.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
Original file line number Diff line number Diff line change
Expand Up @@ -1273,6 +1273,89 @@ public final GenerateStatelessSummaryResponse generateStatelessSummary(
return stub.generateStatelessSummaryCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Get answers for the given query based on knowledge documents.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ConversationsClient conversationsClient = ConversationsClient.create()) {
* SearchKnowledgeRequest request =
* SearchKnowledgeRequest.newBuilder()
* .setParent("parent-995424086")
* .setQuery(TextInput.newBuilder().build())
* .setConversationProfile(
* ConversationProfileName.ofProjectConversationProfileName(
* "[PROJECT]", "[CONVERSATION_PROFILE]")
* .toString())
* .setSessionId("sessionId607796817")
* .setConversation(
* ConversationName.ofProjectConversationName("[PROJECT]", "[CONVERSATION]")
* .toString())
* .setLatestMessage(
* MessageName.ofProjectConversationMessageName(
* "[PROJECT]", "[CONVERSATION]", "[MESSAGE]")
* .toString())
* .build();
* SearchKnowledgeResponse response = conversationsClient.searchKnowledge(request);
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final SearchKnowledgeResponse searchKnowledge(SearchKnowledgeRequest request) {
return searchKnowledgeCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Get answers for the given query based on knowledge documents.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ConversationsClient conversationsClient = ConversationsClient.create()) {
* SearchKnowledgeRequest request =
* SearchKnowledgeRequest.newBuilder()
* .setParent("parent-995424086")
* .setQuery(TextInput.newBuilder().build())
* .setConversationProfile(
* ConversationProfileName.ofProjectConversationProfileName(
* "[PROJECT]", "[CONVERSATION_PROFILE]")
* .toString())
* .setSessionId("sessionId607796817")
* .setConversation(
* ConversationName.ofProjectConversationName("[PROJECT]", "[CONVERSATION]")
* .toString())
* .setLatestMessage(
* MessageName.ofProjectConversationMessageName(
* "[PROJECT]", "[CONVERSATION]", "[MESSAGE]")
* .toString())
* .build();
* ApiFuture<SearchKnowledgeResponse> future =
* conversationsClient.searchKnowledgeCallable().futureCall(request);
* // Do something.
* SearchKnowledgeResponse response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<SearchKnowledgeRequest, SearchKnowledgeResponse>
searchKnowledgeCallable() {
return stub.searchKnowledgeCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists information about the supported locations for this service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ public UnaryCallSettings<GetConversationRequest, Conversation> getConversationSe
return ((ConversationsStubSettings) getStubSettings()).generateStatelessSummarySettings();
}

/** Returns the object with the settings used for calls to searchKnowledge. */
public UnaryCallSettings<SearchKnowledgeRequest, SearchKnowledgeResponse>
searchKnowledgeSettings() {
return ((ConversationsStubSettings) getStubSettings()).searchKnowledgeSettings();
}

/** Returns the object with the settings used for calls to listLocations. */
public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings() {
Expand Down Expand Up @@ -293,6 +299,12 @@ public Builder applyToAllUnaryMethods(
return getStubSettingsBuilder().generateStatelessSummarySettings();
}

/** Returns the builder for the settings used for calls to searchKnowledge. */
public UnaryCallSettings.Builder<SearchKnowledgeRequest, SearchKnowledgeResponse>
searchKnowledgeSettings() {
return getStubSettingsBuilder().searchKnowledgeSettings();
}

/** Returns the builder for the settings used for calls to listLocations. */
public PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@
"ListMessages": {
"methods": ["listMessages", "listMessages", "listMessages", "listMessagesPagedCallable", "listMessagesCallable"]
},
"SearchKnowledge": {
"methods": ["searchKnowledge", "searchKnowledgeCallable"]
},
"SuggestConversationSummary": {
"methods": ["suggestConversationSummary", "suggestConversationSummary", "suggestConversationSummary", "suggestConversationSummaryCallable"]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import com.google.cloud.dialogflow.v2.ListConversationsResponse;
import com.google.cloud.dialogflow.v2.ListMessagesRequest;
import com.google.cloud.dialogflow.v2.ListMessagesResponse;
import com.google.cloud.dialogflow.v2.SearchKnowledgeRequest;
import com.google.cloud.dialogflow.v2.SearchKnowledgeResponse;
import com.google.cloud.dialogflow.v2.SuggestConversationSummaryRequest;
import com.google.cloud.dialogflow.v2.SuggestConversationSummaryResponse;
import com.google.cloud.location.GetLocationRequest;
Expand Down Expand Up @@ -90,6 +92,10 @@ public UnaryCallable<ListMessagesRequest, ListMessagesResponse> listMessagesCall
throw new UnsupportedOperationException("Not implemented: generateStatelessSummaryCallable()");
}

public UnaryCallable<SearchKnowledgeRequest, SearchKnowledgeResponse> searchKnowledgeCallable() {
throw new UnsupportedOperationException("Not implemented: searchKnowledgeCallable()");
}

public UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
listLocationsPagedCallable() {
throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
import com.google.cloud.dialogflow.v2.ListMessagesRequest;
import com.google.cloud.dialogflow.v2.ListMessagesResponse;
import com.google.cloud.dialogflow.v2.Message;
import com.google.cloud.dialogflow.v2.SearchKnowledgeRequest;
import com.google.cloud.dialogflow.v2.SearchKnowledgeResponse;
import com.google.cloud.dialogflow.v2.SuggestConversationSummaryRequest;
import com.google.cloud.dialogflow.v2.SuggestConversationSummaryResponse;
import com.google.cloud.location.GetLocationRequest;
Expand Down Expand Up @@ -133,6 +135,8 @@ public class ConversationsStubSettings extends StubSettings<ConversationsStubSet
suggestConversationSummarySettings;
private final UnaryCallSettings<GenerateStatelessSummaryRequest, GenerateStatelessSummaryResponse>
generateStatelessSummarySettings;
private final UnaryCallSettings<SearchKnowledgeRequest, SearchKnowledgeResponse>
searchKnowledgeSettings;
private final PagedCallSettings<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings;
Expand Down Expand Up @@ -346,6 +350,12 @@ public UnaryCallSettings<GetConversationRequest, Conversation> getConversationSe
return generateStatelessSummarySettings;
}

/** Returns the object with the settings used for calls to searchKnowledge. */
public UnaryCallSettings<SearchKnowledgeRequest, SearchKnowledgeResponse>
searchKnowledgeSettings() {
return searchKnowledgeSettings;
}

/** Returns the object with the settings used for calls to listLocations. */
public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings() {
Expand Down Expand Up @@ -471,6 +481,7 @@ protected ConversationsStubSettings(Builder settingsBuilder) throws IOException
suggestConversationSummarySettings =
settingsBuilder.suggestConversationSummarySettings().build();
generateStatelessSummarySettings = settingsBuilder.generateStatelessSummarySettings().build();
searchKnowledgeSettings = settingsBuilder.searchKnowledgeSettings().build();
listLocationsSettings = settingsBuilder.listLocationsSettings().build();
getLocationSettings = settingsBuilder.getLocationSettings().build();
}
Expand All @@ -496,6 +507,8 @@ public static class Builder extends StubSettings.Builder<ConversationsStubSettin
private final UnaryCallSettings.Builder<
GenerateStatelessSummaryRequest, GenerateStatelessSummaryResponse>
generateStatelessSummarySettings;
private final UnaryCallSettings.Builder<SearchKnowledgeRequest, SearchKnowledgeResponse>
searchKnowledgeSettings;
private final PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings;
Expand Down Expand Up @@ -545,6 +558,7 @@ protected Builder(ClientContext clientContext) {
listMessagesSettings = PagedCallSettings.newBuilder(LIST_MESSAGES_PAGE_STR_FACT);
suggestConversationSummarySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
generateStatelessSummarySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
searchKnowledgeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT);
getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();

Expand All @@ -557,6 +571,7 @@ protected Builder(ClientContext clientContext) {
listMessagesSettings,
suggestConversationSummarySettings,
generateStatelessSummarySettings,
searchKnowledgeSettings,
listLocationsSettings,
getLocationSettings);
initDefaults(this);
Expand All @@ -572,6 +587,7 @@ protected Builder(ConversationsStubSettings settings) {
listMessagesSettings = settings.listMessagesSettings.toBuilder();
suggestConversationSummarySettings = settings.suggestConversationSummarySettings.toBuilder();
generateStatelessSummarySettings = settings.generateStatelessSummarySettings.toBuilder();
searchKnowledgeSettings = settings.searchKnowledgeSettings.toBuilder();
listLocationsSettings = settings.listLocationsSettings.toBuilder();
getLocationSettings = settings.getLocationSettings.toBuilder();

Expand All @@ -584,6 +600,7 @@ protected Builder(ConversationsStubSettings settings) {
listMessagesSettings,
suggestConversationSummarySettings,
generateStatelessSummarySettings,
searchKnowledgeSettings,
listLocationsSettings,
getLocationSettings);
}
Expand Down Expand Up @@ -650,6 +667,11 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));

builder
.searchKnowledgeSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));

builder
.listLocationsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
Expand Down Expand Up @@ -724,6 +746,12 @@ public Builder applyToAllUnaryMethods(
return generateStatelessSummarySettings;
}

/** Returns the builder for the settings used for calls to searchKnowledge. */
public UnaryCallSettings.Builder<SearchKnowledgeRequest, SearchKnowledgeResponse>
searchKnowledgeSettings() {
return searchKnowledgeSettings;
}

/** Returns the builder for the settings used for calls to listLocations. */
public PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
import com.google.cloud.dialogflow.v2.ListConversationsResponse;
import com.google.cloud.dialogflow.v2.ListMessagesRequest;
import com.google.cloud.dialogflow.v2.ListMessagesResponse;
import com.google.cloud.dialogflow.v2.SearchKnowledgeRequest;
import com.google.cloud.dialogflow.v2.SearchKnowledgeResponse;
import com.google.cloud.dialogflow.v2.SuggestConversationSummaryRequest;
import com.google.cloud.dialogflow.v2.SuggestConversationSummaryResponse;
import com.google.cloud.location.GetLocationRequest;
Expand Down Expand Up @@ -137,6 +139,17 @@ public class GrpcConversationsStub extends ConversationsStub {
ProtoUtils.marshaller(GenerateStatelessSummaryResponse.getDefaultInstance()))
.build();

private static final MethodDescriptor<SearchKnowledgeRequest, SearchKnowledgeResponse>
searchKnowledgeMethodDescriptor =
MethodDescriptor.<SearchKnowledgeRequest, SearchKnowledgeResponse>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.dialogflow.v2.Conversations/SearchKnowledge")
.setRequestMarshaller(
ProtoUtils.marshaller(SearchKnowledgeRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(SearchKnowledgeResponse.getDefaultInstance()))
.build();

private static final MethodDescriptor<ListLocationsRequest, ListLocationsResponse>
listLocationsMethodDescriptor =
MethodDescriptor.<ListLocationsRequest, ListLocationsResponse>newBuilder()
Expand Down Expand Up @@ -171,6 +184,8 @@ public class GrpcConversationsStub extends ConversationsStub {
suggestConversationSummaryCallable;
private final UnaryCallable<GenerateStatelessSummaryRequest, GenerateStatelessSummaryResponse>
generateStatelessSummaryCallable;
private final UnaryCallable<SearchKnowledgeRequest, SearchKnowledgeResponse>
searchKnowledgeCallable;
private final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable;
private final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
listLocationsPagedCallable;
Expand Down Expand Up @@ -296,6 +311,18 @@ protected GrpcConversationsStub(
return builder.build();
})
.build();
GrpcCallSettings<SearchKnowledgeRequest, SearchKnowledgeResponse>
searchKnowledgeTransportSettings =
GrpcCallSettings.<SearchKnowledgeRequest, SearchKnowledgeResponse>newBuilder()
.setMethodDescriptor(searchKnowledgeMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("conversation", String.valueOf(request.getConversation()));
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings<ListLocationsRequest, ListLocationsResponse> listLocationsTransportSettings =
GrpcCallSettings.<ListLocationsRequest, ListLocationsResponse>newBuilder()
.setMethodDescriptor(listLocationsMethodDescriptor)
Expand Down Expand Up @@ -356,6 +383,9 @@ protected GrpcConversationsStub(
generateStatelessSummaryTransportSettings,
settings.generateStatelessSummarySettings(),
clientContext);
this.searchKnowledgeCallable =
callableFactory.createUnaryCallable(
searchKnowledgeTransportSettings, settings.searchKnowledgeSettings(), clientContext);
this.listLocationsCallable =
callableFactory.createUnaryCallable(
listLocationsTransportSettings, settings.listLocationsSettings(), clientContext);
Expand Down Expand Up @@ -423,6 +453,11 @@ public UnaryCallable<ListMessagesRequest, ListMessagesPagedResponse> listMessage
return generateStatelessSummaryCallable;
}

@Override
public UnaryCallable<SearchKnowledgeRequest, SearchKnowledgeResponse> searchKnowledgeCallable() {
return searchKnowledgeCallable;
}

@Override
public UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() {
return listLocationsCallable;
Expand Down
Loading

0 comments on commit 411a707

Please sign in to comment.