Skip to content

Commit 98e5657

Browse files
Google APIscopybara-github
authored andcommitted
feat: support natural language understanding in search
feat: support search as you type feature feat: allow set relevance threshold on search feat: support import and purge autocomplete data feat: populate more metadata in answer services feat: allow providing language info in data stores feat: add requirement service feat: support import data from AlloyDB feat: support add metadata for website uris docs: keep the API doc up-to-date with recent changes PiperOrigin-RevId: 658428107
1 parent 24c5ee0 commit 98e5657

19 files changed

Lines changed: 940 additions & 34 deletions

google/cloud/discoveryengine/v1alpha/answer.proto

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ message Answer {
6969

7070
// Page identifier.
7171
string page_identifier = 2;
72+
73+
// The relevance of the chunk for a given query. Values range from 0.0
74+
// (completely irrelevant) to 1.0 (completely relevant).
75+
// This value is for informational purpose only. It may change for
76+
// the same query and chunk at any time due to a model retraining or
77+
// change in implementation.
78+
optional float relevance_score = 3;
7279
}
7380

7481
// Document resource name.
@@ -121,20 +128,38 @@ message Answer {
121128
// Chunk textual content.
122129
string content = 2;
123130

124-
// Relevance score.
131+
// The relevance of the chunk for a given query. Values range from 0.0
132+
// (completely irrelevant) to 1.0 (completely relevant).
133+
// This value is for informational purpose only. It may change for
134+
// the same query and chunk at any time due to a model retraining or
135+
// change in implementation.
125136
optional float relevance_score = 3;
126137

127138
// Document metadata.
128139
DocumentMetadata document_metadata = 4;
129140
}
130141

142+
// Structured search information.
143+
message StructuredDocumentInfo {
144+
// Document resource name.
145+
string document = 1 [(google.api.resource_reference) = {
146+
type: "discoveryengine.googleapis.com/Document"
147+
}];
148+
149+
// Structured search data.
150+
google.protobuf.Struct struct_data = 2;
151+
}
152+
131153
// Search result content.
132154
oneof content {
133155
// Unstructured document information.
134156
UnstructuredDocumentInfo unstructured_document_info = 1;
135157

136158
// Chunk information.
137159
ChunkInfo chunk_info = 2;
160+
161+
// Structured document information.
162+
StructuredDocumentInfo structured_document_info = 3;
138163
}
139164
}
140165

@@ -168,7 +193,11 @@ message Answer {
168193
// Chunk textual content.
169194
string content = 2;
170195

171-
// Relevance score.
196+
// The relevance of the chunk for a given query. Values range from
197+
// 0.0 (completely irrelevant) to 1.0 (completely relevant).
198+
// This value is for informational purpose only. It may change for
199+
// the same query and chunk at any time due to a model retraining or
200+
// change in implementation.
172201
optional float relevance_score = 3;
173202
}
174203

@@ -188,6 +217,14 @@ message Answer {
188217
// If citation_type is CHUNK_LEVEL_CITATION and chunk mode is on,
189218
// populate chunk info.
190219
repeated ChunkInfo chunk_info = 5;
220+
221+
// Data representation.
222+
// The structured JSON data for the document.
223+
// It's populated from the struct data from the Document
224+
// , or the Chunk in
225+
// search result
226+
// .
227+
google.protobuf.Struct struct_data = 6;
191228
}
192229

193230
// Search results observed by the search action, it can be snippets info
@@ -247,6 +284,9 @@ message Answer {
247284

248285
// Non-answer-seeking query classification type.
249286
NON_ANSWER_SEEKING_QUERY = 2;
287+
288+
// Jail-breaking query classification type.
289+
JAIL_BREAKING_QUERY = 3;
250290
}
251291

252292
// Query classification type.
@@ -296,6 +336,19 @@ message Answer {
296336
// Google skips the answer if there is a potential policy violation
297337
// detected. This includes content that may be violent or toxic.
298338
POTENTIAL_POLICY_VIOLATION = 4;
339+
340+
// The no relevant content case.
341+
//
342+
// Google skips the answer if there is no relevant content in the
343+
// retrieved search results.
344+
NO_RELEVANT_CONTENT = 5;
345+
346+
// The jail-breaking query ignored case.
347+
//
348+
// For example, "Reply in the tone of a competing company's CEO".
349+
// Google skips the answer if the query is classified as a jail-breaking
350+
// query.
351+
JAIL_BREAKING_QUERY_IGNORED = 6;
299352
}
300353

301354
// Immutable. Fully qualified name

google/cloud/discoveryengine/v1alpha/chunk.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ message Chunk {
9696
// Content is a string from a document (parsed content).
9797
string content = 3;
9898

99-
// The relevance score based on similarity.
99+
// Output only. Represents the relevance score based on similarity.
100100
// Higher score indicates higher chunk relevance.
101101
// The score is in range [-1.0, 1.0].
102102
// Only populated on [SearchService.SearchResponse][].

google/cloud/discoveryengine/v1alpha/completion.proto

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,34 @@ message SuggestionDenyListEntry {
5050
// exact phrase, or block any suggestions containing this phrase.
5151
MatchOperator match_operator = 2 [(google.api.field_behavior) = REQUIRED];
5252
}
53+
54+
// Autocomplete suggestions that are imported from Customer.
55+
message CompletionSuggestion {
56+
// Ranking metrics of this suggestion.
57+
oneof ranking_info {
58+
// Global score of this suggestion. Control how this suggestion would be
59+
// scored / ranked.
60+
double global_score = 2;
61+
62+
// Frequency of this suggestion. Will be used to rank suggestions when score
63+
// is not available.
64+
int64 frequency = 3;
65+
}
66+
67+
// Required. The suggestion text.
68+
string suggestion = 1 [(google.api.field_behavior) = REQUIRED];
69+
70+
// BCP-47 language code of this suggestion.
71+
string language_code = 4;
72+
73+
// If two suggestions have the same groupId, they will not be
74+
// returned together. Instead the one ranked higher will be returned. This can
75+
// be used to deduplicate semantically identical suggestions.
76+
string group_id = 5;
77+
78+
// The score of this suggestion within its group.
79+
double group_score = 6;
80+
81+
// Alternative matching phrases for this suggestion.
82+
repeated string alternative_phrases = 7;
83+
}

google/cloud/discoveryengine/v1alpha/completion_service.proto

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,44 @@ service CompletionService {
8686
metadata_type: "google.cloud.discoveryengine.v1alpha.PurgeSuggestionDenyListEntriesMetadata"
8787
};
8888
}
89+
90+
// Imports
91+
// [CompletionSuggestion][google.cloud.discoveryengine.v1alpha.CompletionSuggestion]s
92+
// for a DataStore.
93+
rpc ImportCompletionSuggestions(ImportCompletionSuggestionsRequest)
94+
returns (google.longrunning.Operation) {
95+
option (google.api.http) = {
96+
post: "/v1alpha/{parent=projects/*/locations/*/collections/*/dataStores/*}/completionSuggestions:import"
97+
body: "*"
98+
additional_bindings {
99+
post: "/v1alpha/{parent=projects/*/locations/*/dataStores/*}/completionSuggestions:import"
100+
body: "*"
101+
}
102+
};
103+
option (google.longrunning.operation_info) = {
104+
response_type: "google.cloud.discoveryengine.v1alpha.ImportCompletionSuggestionsResponse"
105+
metadata_type: "google.cloud.discoveryengine.v1alpha.ImportCompletionSuggestionsMetadata"
106+
};
107+
}
108+
109+
// Permanently deletes all
110+
// [CompletionSuggestion][google.cloud.discoveryengine.v1alpha.CompletionSuggestion]s
111+
// for a DataStore.
112+
rpc PurgeCompletionSuggestions(PurgeCompletionSuggestionsRequest)
113+
returns (google.longrunning.Operation) {
114+
option (google.api.http) = {
115+
post: "/v1alpha/{parent=projects/*/locations/*/collections/*/dataStores/*}/completionSuggestions:purge"
116+
body: "*"
117+
additional_bindings {
118+
post: "/v1alpha/{parent=projects/*/locations/*/dataStores/*}/completionSuggestions:purge"
119+
body: "*"
120+
}
121+
};
122+
option (google.longrunning.operation_info) = {
123+
response_type: "google.cloud.discoveryengine.v1alpha.PurgeCompletionSuggestionsResponse"
124+
metadata_type: "google.cloud.discoveryengine.v1alpha.PurgeCompletionSuggestionsMetadata"
125+
};
126+
}
89127
}
90128

91129
// Request message for

google/cloud/discoveryengine/v1alpha/conversational_search_service.proto

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -589,12 +589,7 @@ message AnswerQueryRequest {
589589
string order_by = 4;
590590

591591
// Specifies the search result mode. If unspecified, the
592-
// search result mode is based on
593-
// [DataStore.DocumentProcessingConfig.chunking_config][]:
594-
// * If [DataStore.DocumentProcessingConfig.chunking_config][] is
595-
// specified,
596-
// it defaults to `CHUNKS`.
597-
// * Otherwise, it defaults to `DOCUMENTS`.
592+
// search result mode defaults to `DOCUMENTS`.
598593
// See [parse and chunk
599594
// documents](https://cloud.google.com/generative-ai-app-builder/docs/parse-chunk-documents)
600595
SearchRequest.ContentSearchSpec.SearchResultMode search_result_mode = 5;
@@ -715,6 +710,9 @@ message AnswerQueryRequest {
715710

716711
// Non-answer-seeking query classification type.
717712
NON_ANSWER_SEEKING_QUERY = 2;
713+
714+
// Jail-breaking query classification type.
715+
JAIL_BREAKING_QUERY = 3;
718716
}
719717

720718
// Enabled query classification types.
@@ -801,16 +799,37 @@ message AnswerQueryRequest {
801799
// The field must be a UTF-8 encoded string with a length limit of 128
802800
// characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
803801
string user_pseudo_id = 12;
802+
803+
// The user labels applied to a resource must meet the following requirements:
804+
//
805+
// * Each resource can have multiple labels, up to a maximum of 64.
806+
// * Each label must be a key-value pair.
807+
// * Keys have a minimum length of 1 character and a maximum length of 63
808+
// characters and cannot be empty. Values can be empty and have a maximum
809+
// length of 63 characters.
810+
// * Keys and values can contain only lowercase letters, numeric characters,
811+
// underscores, and dashes. All characters must use UTF-8 encoding, and
812+
// international characters are allowed.
813+
// * The key portion of a label must be unique. However, you can use the same
814+
// key with multiple resources.
815+
// * Keys must start with a lowercase letter or international character.
816+
//
817+
// See [Google Cloud
818+
// Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
819+
// for more details.
820+
map<string, string> user_labels = 13;
804821
}
805822

806823
// Response message for
807824
// [ConversationalSearchService.AnswerQuery][google.cloud.discoveryengine.v1alpha.ConversationalSearchService.AnswerQuery]
808825
// method.
809826
message AnswerQueryResponse {
810827
// Answer resource object.
811-
// If [AnswerQueryRequest.StepSpec.max_step_count][] is greater than 1,
812-
// use [Answer.name][google.cloud.discoveryengine.v1alpha.Answer.name] to
813-
// fetch answer information using
828+
// If
829+
// [AnswerQueryRequest.QueryUnderstandingSpec.QueryRephraserSpec.max_rephrase_steps][google.cloud.discoveryengine.v1alpha.AnswerQueryRequest.QueryUnderstandingSpec.QueryRephraserSpec.max_rephrase_steps]
830+
// is greater than 1, use
831+
// [Answer.name][google.cloud.discoveryengine.v1alpha.Answer.name] to fetch
832+
// answer information using
814833
// [ConversationalSearchService.GetAnswer][google.cloud.discoveryengine.v1alpha.ConversationalSearchService.GetAnswer]
815834
// API.
816835
Answer answer = 1;

google/cloud/discoveryengine/v1alpha/custom_tuning_model.proto

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ message CustomTuningModel {
5656

5757
// The model training failed.
5858
TRAINING_FAILED = 5;
59+
60+
// The model training finished successfully but metrics did not improve.
61+
NO_IMPROVEMENT = 6;
5962
}
6063

6164
// Required. The fully qualified resource name of the model.
@@ -80,8 +83,11 @@ message CustomTuningModel {
8083
ModelState model_state = 4;
8184

8285
// Timestamp the Model was created at.
83-
google.protobuf.Timestamp create_time = 5;
86+
google.protobuf.Timestamp create_time = 5 [deprecated = true];
8487

8588
// Timestamp the model training was initiated.
8689
google.protobuf.Timestamp training_start_time = 6;
90+
91+
// The metrics of the trained model.
92+
map<string, double> metrics = 7;
8793
}

google/cloud/discoveryengine/v1alpha/data_store.proto

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ message DataStore {
9898
google.protobuf.Timestamp create_time = 4
9999
[(google.api.field_behavior) = OUTPUT_ONLY];
100100

101+
// Language info for DataStore.
102+
LanguageInfo language_info = 14;
103+
101104
// Output only. Data store level identity provider config.
102105
IdpConfig idp_config = 21 [(google.api.field_behavior) = OUTPUT_ONLY];
103106

@@ -140,3 +143,23 @@ message DataStore {
140143
// doc](https://cloud.google.com/generative-ai-app-builder/docs/provide-schema).
141144
Schema starting_schema = 28;
142145
}
146+
147+
// Language info for DataStore.
148+
message LanguageInfo {
149+
// The language code for the DataStore.
150+
string language_code = 1;
151+
152+
// Output only. This is the normalized form of language_code.
153+
// E.g.: language_code of `en-GB`, `en_GB`, `en-UK` or `en-gb`
154+
// will have normalized_language_code of `en-GB`.
155+
string normalized_language_code = 2
156+
[(google.api.field_behavior) = OUTPUT_ONLY];
157+
158+
// Output only. Language part of normalized_language_code.
159+
// E.g.: `en-US` -> `en`, `zh-Hans-HK` -> `zh`, `en` -> `en`.
160+
string language = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
161+
162+
// Output only. Region part of normalized_language_code, if present.
163+
// E.g.: `en-US` -> `US`, `zh-Hans-HK` -> `HK`, `en` -> ``.
164+
string region = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
165+
}

google/cloud/discoveryengine/v1alpha/data_store_service.proto

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,16 @@ message CreateDataStoreRequest {
189189
// search (GENERIC vertical and PUBLIC_WEBSITE content_config), this flag will
190190
// be ignored.
191191
bool create_advanced_site_search = 4;
192+
193+
// A boolean flag indicating whether to skip the default schema creation for
194+
// the data store. Only enable this flag if you are certain that the default
195+
// schema is incompatible with your use case.
196+
//
197+
// If set to true, you must manually create a schema for the data store before
198+
// any documents can be ingested.
199+
//
200+
// This flag cannot be specified if `data_store.starting_schema` is specified.
201+
bool skip_default_schema_creation = 7;
192202
}
193203

194204
// Request message for
@@ -265,7 +275,7 @@ message ListDataStoresRequest {
265275
// INVALID_ARGUMENT error is returned.
266276
string page_token = 3;
267277

268-
// Filter by solution type.
278+
// Filter by solution type .
269279
// For example: `filter = 'solution_type:SOLUTION_TYPE_SEARCH'`
270280
string filter = 4;
271281
}

google/cloud/discoveryengine/v1alpha/discoveryengine_v1alpha.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ types:
5656
- name: google.cloud.discoveryengine.v1alpha.EstimateDataSizeResponse
5757
- name: google.cloud.discoveryengine.v1alpha.Evaluation
5858
- name: google.cloud.discoveryengine.v1alpha.FieldConfig
59+
- name: google.cloud.discoveryengine.v1alpha.GetUriPatternDocumentDataResponse
60+
- name: google.cloud.discoveryengine.v1alpha.ImportCompletionSuggestionsMetadata
61+
- name: google.cloud.discoveryengine.v1alpha.ImportCompletionSuggestionsResponse
5962
- name: google.cloud.discoveryengine.v1alpha.ImportDocumentsMetadata
6063
- name: google.cloud.discoveryengine.v1alpha.ImportDocumentsResponse
6164
- name: google.cloud.discoveryengine.v1alpha.ImportSampleQueriesMetadata
@@ -67,6 +70,8 @@ types:
6770
- name: google.cloud.discoveryengine.v1alpha.ListCustomModelsResponse
6871
- name: google.cloud.discoveryengine.v1alpha.Project
6972
- name: google.cloud.discoveryengine.v1alpha.ProvisionProjectMetadata
73+
- name: google.cloud.discoveryengine.v1alpha.PurgeCompletionSuggestionsMetadata
74+
- name: google.cloud.discoveryengine.v1alpha.PurgeCompletionSuggestionsResponse
7075
- name: google.cloud.discoveryengine.v1alpha.PurgeDocumentsMetadata
7176
- name: google.cloud.discoveryengine.v1alpha.PurgeDocumentsResponse
7277
- name: google.cloud.discoveryengine.v1alpha.PurgeSuggestionDenyListEntriesMetadata
@@ -77,6 +82,8 @@ types:
7782
- name: google.cloud.discoveryengine.v1alpha.RecrawlUrisResponse
7883
- name: google.cloud.discoveryengine.v1alpha.Schema
7984
- name: google.cloud.discoveryengine.v1alpha.Session
85+
- name: google.cloud.discoveryengine.v1alpha.SetUriPatternDocumentDataMetadata
86+
- name: google.cloud.discoveryengine.v1alpha.SetUriPatternDocumentDataResponse
8087
- name: google.cloud.discoveryengine.v1alpha.TargetSite
8188
- name: google.cloud.discoveryengine.v1alpha.TrainCustomModelMetadata
8289
- name: google.cloud.discoveryengine.v1alpha.TrainCustomModelResponse
@@ -111,6 +118,7 @@ http:
111118
- get: '/v1alpha/{name=projects/*/locations/*/dataStores/*/models/*/operations/*}'
112119
- get: '/v1alpha/{name=projects/*/locations/*/dataStores/*/operations/*}'
113120
- get: '/v1alpha/{name=projects/*/locations/*/evaluations/*/operations/*}'
121+
- get: '/v1alpha/{name=projects/*/locations/*/identity_mapping_stores/*/operations/*}'
114122
- get: '/v1alpha/{name=projects/*/locations/*/operations/*}'
115123
- get: '/v1alpha/{name=projects/*/locations/*/sampleQuerySets/*/operations/*}'
116124
- get: '/v1alpha/{name=projects/*/operations/*}'
@@ -128,6 +136,7 @@ http:
128136
- get: '/v1alpha/{name=projects/*/locations/*/dataStores/*/branches/*}/operations'
129137
- get: '/v1alpha/{name=projects/*/locations/*/dataStores/*/models/*}/operations'
130138
- get: '/v1alpha/{name=projects/*/locations/*/dataStores/*}/operations'
139+
- get: '/v1alpha/{name=projects/*/locations/*/identity_mapping_stores/*}/operations'
131140
- get: '/v1alpha/{name=projects/*/locations/*}/operations'
132141
- get: '/v1alpha/{name=projects/*}/operations'
133142

0 commit comments

Comments
 (0)