Skip to content

Commit 5f29cc9

Browse files
Google APIscopybara-github
authored andcommitted
feat: add discovery engine v1 library for enterprise search
PiperOrigin-RevId: 534896621
1 parent eb5ac9d commit 5f29cc9

14 files changed

Lines changed: 2950 additions & 0 deletions

google/cloud/discoveryengine/v1/BUILD.bazel

Lines changed: 421 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
// Copyright 2022 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package google.cloud.discoveryengine.v1;
18+
19+
import "google/api/resource.proto";
20+
21+
option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1";
22+
option go_package = "cloud.google.com/go/discoveryengine/apiv1/discoveryenginepb;discoveryenginepb";
23+
option java_multiple_files = true;
24+
option java_outer_classname = "CommonProto";
25+
option java_package = "com.google.cloud.discoveryengine.v1";
26+
option objc_class_prefix = "DISCOVERYENGINE";
27+
option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1";
28+
option ruby_package = "Google::Cloud::DiscoveryEngine::V1";
29+
option (google.api.resource_definition) = {
30+
type: "discoveryengine.googleapis.com/Branch"
31+
pattern: "projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}"
32+
pattern: "projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}"
33+
};
34+
option (google.api.resource_definition) = {
35+
type: "discoveryengine.googleapis.com/DataStore"
36+
pattern: "projects/{project}/locations/{location}/dataStores/{data_store}"
37+
pattern: "projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}"
38+
};
39+
option (google.api.resource_definition) = {
40+
type: "discoveryengine.googleapis.com/ServingConfig"
41+
pattern: "projects/{project}/locations/{location}/dataStores/{data_store}/servingConfigs/{serving_config}"
42+
pattern: "projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/servingConfigs/{serving_config}"
43+
};
44+
45+
// A custom attribute that is not explicitly modeled in a resource, e.g.
46+
// [UserEvent][google.cloud.discoveryengine.v1.UserEvent].
47+
message CustomAttribute {
48+
// The textual values of this custom attribute. For example, `["yellow",
49+
// "green"]` when the key is "color".
50+
//
51+
// Empty string is not allowed. Otherwise, an `INVALID_ARGUMENT` error is
52+
// returned.
53+
//
54+
// Exactly one of
55+
// [CustomAttribute.text][google.cloud.discoveryengine.v1.CustomAttribute.text]
56+
// or
57+
// [CustomAttribute.numbers][google.cloud.discoveryengine.v1.CustomAttribute.numbers]
58+
// should be set. Otherwise, an `INVALID_ARGUMENT` error is returned.
59+
repeated string text = 1;
60+
61+
// The numerical values of this custom attribute. For example, `[2.3, 15.4]`
62+
// when the key is "lengths_cm".
63+
//
64+
// Exactly one of
65+
// [CustomAttribute.text][google.cloud.discoveryengine.v1.CustomAttribute.text]
66+
// or
67+
// [CustomAttribute.numbers][google.cloud.discoveryengine.v1.CustomAttribute.numbers]
68+
// should be set. Otherwise, an `INVALID_ARGUMENT` error is returned.
69+
repeated double numbers = 2;
70+
}
71+
72+
// Information of an end user.
73+
message UserInfo {
74+
// Highly recommended for logged-in users. Unique identifier for logged-in
75+
// user, such as a user name. Don't set for anonymous users.
76+
//
77+
// Always use a hashed value for this ID.
78+
//
79+
// Don't set the field to the same fixed ID for different users. This mixes
80+
// the event history of those users together, which results in degraded
81+
// model quality.
82+
//
83+
// The field must be a UTF-8 encoded string with a length limit of 128
84+
// characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
85+
string user_id = 1;
86+
87+
// User agent as included in the HTTP header. Required for getting
88+
// [SearchResponse.sponsored_results][].
89+
//
90+
// The field must be a UTF-8 encoded string with a length limit of 1,000
91+
// characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
92+
//
93+
// This should not be set when using the client side event reporting with
94+
// GTM or JavaScript tag in
95+
// [UserEventService.CollectUserEvent][google.cloud.discoveryengine.v1.UserEventService.CollectUserEvent]
96+
// or if
97+
// [UserEvent.direct_user_request][google.cloud.discoveryengine.v1.UserEvent.direct_user_request]
98+
// is set.
99+
string user_agent = 2;
100+
}
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
// Copyright 2022 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package google.cloud.discoveryengine.v1;
18+
19+
import "google/api/annotations.proto";
20+
import "google/api/client.proto";
21+
import "google/api/field_behavior.proto";
22+
import "google/api/resource.proto";
23+
24+
option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1";
25+
option go_package = "cloud.google.com/go/discoveryengine/apiv1/discoveryenginepb;discoveryenginepb";
26+
option java_multiple_files = true;
27+
option java_outer_classname = "CompletionServiceProto";
28+
option java_package = "com.google.cloud.discoveryengine.v1";
29+
option objc_class_prefix = "DISCOVERYENGINE";
30+
option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1";
31+
option ruby_package = "Google::Cloud::DiscoveryEngine::V1";
32+
33+
// Service for Auto-Completion.
34+
service CompletionService {
35+
option (google.api.default_host) = "discoveryengine.googleapis.com";
36+
option (google.api.oauth_scopes) =
37+
"https://www.googleapis.com/auth/cloud-platform";
38+
39+
// Completes the specified user input with keyword suggestions.
40+
rpc CompleteQuery(CompleteQueryRequest) returns (CompleteQueryResponse) {
41+
option (google.api.http) = {
42+
get: "/v1/{data_store=projects/*/locations/*/dataStores/*}:completeQuery"
43+
additional_bindings {
44+
get: "/v1/{data_store=projects/*/locations/*/collections/*/dataStores/*}:completeQuery"
45+
}
46+
};
47+
}
48+
}
49+
50+
// Request message for
51+
// [CompletionService.CompleteQuery][google.cloud.discoveryengine.v1.CompletionService.CompleteQuery]
52+
// method.
53+
message CompleteQueryRequest {
54+
// Required. The parent data store resource name for which the completion is
55+
// performed, such as
56+
// `projects/*/locations/global/collections/default_collection/dataStores/default_data_store`.
57+
string data_store = 1 [
58+
(google.api.field_behavior) = REQUIRED,
59+
(google.api.resource_reference) = {
60+
type: "discoveryengine.googleapis.com/DataStore"
61+
}
62+
];
63+
64+
// Required. The typeahead input used to fetch suggestions. Maximum length is
65+
// 128 characters.
66+
string query = 2 [(google.api.field_behavior) = REQUIRED];
67+
68+
// Selects data model of query suggestions for serving. Currently supported
69+
// values:
70+
//
71+
// * `document` - Using suggestions generated from user-imported documents.
72+
// * `search-history` - Using suggestions generated from the past history of
73+
// [SearchService.Search][google.cloud.discoveryengine.v1.SearchService.Search]
74+
// API calls. Do not use it when there is no traffic for Search API.
75+
// * `user-event` - Using suggestions generated from user-imported search
76+
// events.
77+
//
78+
// Default values:
79+
//
80+
// * `document` is the default model for regular dataStores.
81+
// * `search-history` is the default model for
82+
// [IndustryVertical.SITE_SEARCH][google.cloud.discoveryengine.v1.IndustryVertical.SITE_SEARCH]
83+
// dataStores.
84+
string query_model = 3;
85+
86+
// A unique identifier for tracking visitors. For example, this could be
87+
// implemented with an HTTP cookie, which should be able to uniquely identify
88+
// a visitor on a single device. This unique identifier should not change if
89+
// the visitor logs in or out of the website.
90+
//
91+
// This field should NOT have a fixed value such as `unknown_visitor`.
92+
//
93+
// This should be the same identifier as
94+
// [UserEvent.user_pseudo_id][google.cloud.discoveryengine.v1.UserEvent.user_pseudo_id]
95+
// and
96+
// [SearchRequest.user_pseudo_id][google.cloud.discoveryengine.v1.SearchRequest.user_pseudo_id].
97+
//
98+
// The field must be a UTF-8 encoded string with a length limit of 128
99+
// characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
100+
string user_pseudo_id = 4;
101+
}
102+
103+
// Response message for
104+
// [CompletionService.CompleteQuery][google.cloud.discoveryengine.v1.CompletionService.CompleteQuery]
105+
// method.
106+
message CompleteQueryResponse {
107+
// Suggestions as search queries.
108+
message QuerySuggestion {
109+
// The suggestion for the query.
110+
string suggestion = 1;
111+
}
112+
113+
// Results of the matched query suggestions. The result list is ordered and
114+
// the first result is a top suggestion.
115+
repeated QuerySuggestion query_suggestions = 1;
116+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"methodConfig": [
3+
{
4+
"name": [
5+
{ "service": "google.cloud.discoveryengine.v1.CompletionService" },
6+
{ "service": "google.cloud.discoveryengine.v1.SearchService" }
7+
],
8+
"timeout": "5s",
9+
"retryPolicy": {
10+
"initialBackoff": "0.100s",
11+
"maxBackoff": "5s",
12+
"backoffMultiplier": 1.3,
13+
"retryableStatusCodes": ["UNAVAILABLE"]
14+
}
15+
},
16+
{
17+
"name": [
18+
{ "service": "google.cloud.discoveryengine.v1.DocumentService" },
19+
{ "service": "google.cloud.discoveryengine.v1.SchemaService" },
20+
{ "service": "google.cloud.discoveryengine.v1.UserEventService" },
21+
{ "service": "google.longrunning.Operations"}
22+
],
23+
"timeout": "30s",
24+
"retryPolicy": {
25+
"initialBackoff": "1s",
26+
"maxBackoff": "10s",
27+
"backoffMultiplier": 1.3,
28+
"retryableStatusCodes": ["UNAVAILABLE"]
29+
}
30+
},
31+
{
32+
"name": [
33+
{
34+
"service": "google.cloud.discoveryengine.v1.DocumentService",
35+
"method": "ImportDocuments"
36+
},
37+
{
38+
"service": "google.cloud.discoveryengine.v1.UserEventService",
39+
"method": "ImportUserEvents"
40+
},
41+
{
42+
"service": "google.longrunning.Operations",
43+
"method": "ListOperations"
44+
}
45+
],
46+
"timeout": "300s",
47+
"retryPolicy": {
48+
"initialBackoff": "1s",
49+
"maxBackoff": "30s",
50+
"backoffMultiplier": 1.3,
51+
"retryableStatusCodes": ["UNAVAILABLE"]
52+
}
53+
}
54+
]
55+
}

0 commit comments

Comments
 (0)