Skip to content

Commit 509f002

Browse files
Google APIscopybara-github
authored andcommitted
feat: add answer generation APIs
feat: add standalone grounding API feat: add project provision and terms APIs fix!: remove some unused LRO metadata/response docs: keep the API doc up-to-date with recent changes PiperOrigin-RevId: 624207111
1 parent 7715536 commit 509f002

19 files changed

Lines changed: 1524 additions & 57 deletions

google/cloud/discoveryengine/v1alpha/BUILD.bazel

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ proto_library(
2626
srcs = [
2727
"acl_config.proto",
2828
"acl_config_service.proto",
29+
"answer.proto",
2930
"chunk.proto",
3031
"chunk_service.proto",
3132
"common.proto",
@@ -41,7 +42,11 @@ proto_library(
4142
"engine.proto",
4243
"engine_service.proto",
4344
"estimate_billing_service.proto",
45+
"grounded_generation_service.proto",
46+
"grounding.proto",
4447
"import_config.proto",
48+
"project.proto",
49+
"project_service.proto",
4550
"purge_config.proto",
4651
"rank_service.proto",
4752
"recommendation_service.proto",
@@ -51,6 +56,7 @@ proto_library(
5156
"search_tuning_service.proto",
5257
"serving_config.proto",
5358
"serving_config_service.proto",
59+
"session.proto",
5460
"site_search_engine.proto",
5561
"site_search_engine_service.proto",
5662
"user_event.proto",
@@ -144,6 +150,10 @@ java_gapic_test(
144150
"com.google.cloud.discoveryengine.v1alpha.EngineServiceClientTest",
145151
"com.google.cloud.discoveryengine.v1alpha.EstimateBillingServiceClientHttpJsonTest",
146152
"com.google.cloud.discoveryengine.v1alpha.EstimateBillingServiceClientTest",
153+
"com.google.cloud.discoveryengine.v1alpha.GroundedGenerationServiceClientHttpJsonTest",
154+
"com.google.cloud.discoveryengine.v1alpha.GroundedGenerationServiceClientTest",
155+
"com.google.cloud.discoveryengine.v1alpha.ProjectServiceClientHttpJsonTest",
156+
"com.google.cloud.discoveryengine.v1alpha.ProjectServiceClientTest",
147157
"com.google.cloud.discoveryengine.v1alpha.RankServiceClientHttpJsonTest",
148158
"com.google.cloud.discoveryengine.v1alpha.RankServiceClientTest",
149159
"com.google.cloud.discoveryengine.v1alpha.RecommendationServiceClientHttpJsonTest",
@@ -406,7 +416,6 @@ load(
406416

407417
csharp_proto_library(
408418
name = "discoveryengine_csharp_proto",
409-
extra_opts = [],
410419
deps = [":discoveryengine_proto"],
411420
)
412421

Lines changed: 328 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,328 @@
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.v1alpha;
18+
19+
import "google/api/field_behavior.proto";
20+
import "google/api/resource.proto";
21+
import "google/protobuf/timestamp.proto";
22+
23+
option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1Alpha";
24+
option go_package = "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb;discoveryenginepb";
25+
option java_multiple_files = true;
26+
option java_outer_classname = "AnswerProto";
27+
option java_package = "com.google.cloud.discoveryengine.v1alpha";
28+
option objc_class_prefix = "DISCOVERYENGINE";
29+
option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1alpha";
30+
option ruby_package = "Google::Cloud::DiscoveryEngine::V1alpha";
31+
32+
// Defines an answer.
33+
message Answer {
34+
option (google.api.resource) = {
35+
type: "discoveryengine.googleapis.com/Answer"
36+
pattern: "projects/{project}/locations/{location}/dataStores/{data_store}/sessions/{session}/answers/{answer}"
37+
pattern: "projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/sessions/{session}/answers/{answer}"
38+
pattern: "projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session}/answers/{answer}"
39+
};
40+
41+
// Citation info for a segment.
42+
message Citation {
43+
// Index indicates the start of the segment, measured in bytes (UTF-8
44+
// unicode).
45+
int64 start_index = 1;
46+
47+
// End of the attributed segment, exclusive.
48+
int64 end_index = 2;
49+
50+
// Citation sources for the attributed segment.
51+
repeated CitationSource sources = 3;
52+
}
53+
54+
// Citation source.
55+
message CitationSource {
56+
// ID of the citation source.
57+
string reference_id = 1;
58+
}
59+
60+
// Reference.
61+
message Reference {
62+
// Unstructured document information.
63+
message UnstructuredDocumentInfo {
64+
// Chunk content.
65+
message ChunkContent {
66+
// Chunk textual content.
67+
string content = 1;
68+
69+
// Page identifier.
70+
string page_identifier = 2;
71+
}
72+
73+
// Document resource name.
74+
string document = 1 [(google.api.resource_reference) = {
75+
type: "discoveryengine.googleapis.com/Document"
76+
}];
77+
78+
// URI for the document.
79+
string uri = 2;
80+
81+
// Title.
82+
string title = 3;
83+
84+
// List of cited chunk contents derived from document content.
85+
repeated ChunkContent chunk_contents = 4;
86+
}
87+
88+
// Chunk information.
89+
message ChunkInfo {
90+
// Document metadata.
91+
message DocumentMetadata {
92+
// Document resource name.
93+
string document = 1 [(google.api.resource_reference) = {
94+
type: "discoveryengine.googleapis.com/Document"
95+
}];
96+
97+
// URI for the document.
98+
string uri = 2;
99+
100+
// Title.
101+
string title = 3;
102+
103+
// Page identifier.
104+
string page_identifier = 4;
105+
}
106+
107+
// Chunk resource name.
108+
string chunk = 1 [(google.api.resource_reference) = {
109+
type: "discoveryengine.googleapis.com/Chunk"
110+
}];
111+
112+
// Chunk textual content.
113+
string content = 2;
114+
115+
// Relevance score.
116+
optional float relevance_score = 3;
117+
118+
// Document metadata.
119+
DocumentMetadata document_metadata = 4;
120+
}
121+
122+
// Search result content.
123+
oneof content {
124+
// Unstructured document information.
125+
UnstructuredDocumentInfo unstructured_document_info = 1;
126+
127+
// Chunk information.
128+
ChunkInfo chunk_info = 2;
129+
}
130+
}
131+
132+
// Step information.
133+
message Step {
134+
// Action.
135+
message Action {
136+
// Search action.
137+
message SearchAction {
138+
// The query to search.
139+
string query = 1;
140+
}
141+
142+
// Observation.
143+
message Observation {
144+
message SearchResult {
145+
// Snippet information.
146+
message SnippetInfo {
147+
// Snippet content.
148+
string snippet = 1;
149+
150+
// Status of the snippet defined by the search team.
151+
string snippet_status = 2;
152+
}
153+
154+
// Chunk information.
155+
message ChunkInfo {
156+
// Chunk resource name.
157+
string chunk = 1;
158+
159+
// Chunk textual content.
160+
string content = 2;
161+
162+
// Relevance score.
163+
optional float relevance_score = 3;
164+
}
165+
166+
// Document resource name.
167+
string document = 1;
168+
169+
// URI for the document.
170+
string uri = 2;
171+
172+
// Title.
173+
string title = 3;
174+
175+
// If citation_type is DOCUMENT_LEVEL_CITATION, populate document
176+
// level snippets.
177+
repeated SnippetInfo snippet_info = 4;
178+
179+
// If citation_type is CHUNK_LEVEL_CITATION and chunk mode is on,
180+
// populate chunk info.
181+
repeated ChunkInfo chunk_info = 5;
182+
}
183+
184+
// Search results observed by the search action, it can be snippets info
185+
// or chunk info, depending on the citation type set by the user.
186+
repeated SearchResult search_results = 2;
187+
}
188+
189+
// The action.
190+
oneof action {
191+
// Search action.
192+
SearchAction search_action = 2;
193+
}
194+
195+
// Observation.
196+
Observation observation = 3;
197+
}
198+
199+
// Enumeration of the state of the step.
200+
enum State {
201+
// Unknown.
202+
STATE_UNSPECIFIED = 0;
203+
204+
// Step is currently in progress.
205+
IN_PROGRESS = 1;
206+
207+
// Step currently failed.
208+
FAILED = 2;
209+
210+
// Step has succeeded.
211+
SUCCEEDED = 3;
212+
}
213+
214+
// The state of the step.
215+
State state = 1;
216+
217+
// The description of the step.
218+
string description = 2;
219+
220+
// The thought of the step.
221+
string thought = 3;
222+
223+
// Actions.
224+
repeated Action actions = 4;
225+
}
226+
227+
// Query understanding information.
228+
message QueryUnderstandingInfo {
229+
// Query classification information.
230+
message QueryClassificationInfo {
231+
// Query classification types.
232+
enum Type {
233+
// Unspecified query classification type.
234+
TYPE_UNSPECIFIED = 0;
235+
236+
// Adversarial query classification type.
237+
ADVERSARIAL_QUERY = 1;
238+
239+
// Non-answer-seeking query classification type.
240+
NON_ANSWER_SEEKING_QUERY = 2;
241+
}
242+
243+
// Query classification type.
244+
Type type = 1;
245+
246+
// Classification output.
247+
bool positive = 2;
248+
}
249+
250+
// Query classification information.
251+
repeated QueryClassificationInfo query_classification_info = 1;
252+
}
253+
254+
// Enumeration of the state of the answer generation.
255+
enum State {
256+
// Unknown.
257+
STATE_UNSPECIFIED = 0;
258+
259+
// Answer generation is currently in progress.
260+
IN_PROGRESS = 1;
261+
262+
// Answer generation currently failed.
263+
FAILED = 2;
264+
265+
// Answer generation has succeeded.
266+
SUCCEEDED = 3;
267+
}
268+
269+
// An enum for answer skipped reasons.
270+
enum AnswerSkippedReason {
271+
// Default value. The answer skipped reason is not specified.
272+
ANSWER_SKIPPED_REASON_UNSPECIFIED = 0;
273+
274+
// The adversarial query ignored case.
275+
ADVERSARIAL_QUERY_IGNORED = 1;
276+
277+
// The non-answer seeking query ignored case.
278+
NON_ANSWER_SEEKING_QUERY_IGNORED = 2;
279+
280+
// The out-of-domain query ignored case.
281+
//
282+
// Google skips the answer if there are no high-relevance search results.
283+
OUT_OF_DOMAIN_QUERY_IGNORED = 3;
284+
285+
// The potential policy violation case.
286+
//
287+
// Google skips the answer if there is a potential policy violation
288+
// detected. This includes content that may be violent or toxic.
289+
POTENTIAL_POLICY_VIOLATION = 4;
290+
}
291+
292+
// Immutable. Fully qualified name
293+
// `projects/{project}/locations/global/collections/{collection}/engines/{engine}/sessions/*/answers/*`
294+
string name = 1 [(google.api.field_behavior) = IMMUTABLE];
295+
296+
// The state of the answer generation.
297+
State state = 2;
298+
299+
// The textual answer.
300+
string answer_text = 3;
301+
302+
// Citations.
303+
repeated Citation citations = 4;
304+
305+
// References.
306+
repeated Reference references = 5;
307+
308+
// Suggested related questions.
309+
repeated string related_questions = 6;
310+
311+
// Answer generation steps.
312+
repeated Step steps = 7;
313+
314+
// Query understanding information.
315+
QueryUnderstandingInfo query_understanding_info = 10;
316+
317+
// Additional answer-skipped reasons. This provides the reason for ignored
318+
// cases. If nothing is skipped, this field is not set.
319+
repeated AnswerSkippedReason answer_skipped_reasons = 11;
320+
321+
// Output only. Answer creation timestamp.
322+
google.protobuf.Timestamp create_time = 8
323+
[(google.api.field_behavior) = OUTPUT_ONLY];
324+
325+
// Output only. Answer completed timestamp.
326+
google.protobuf.Timestamp complete_time = 9
327+
[(google.api.field_behavior) = OUTPUT_ONLY];
328+
}

google/cloud/discoveryengine/v1alpha/chunk.proto

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ message Chunk {
4646

4747
// Title of the document.
4848
string title = 2;
49+
50+
// Data representation.
51+
// The structured JSON data for the document. It should conform to the
52+
// registered [Schema][google.cloud.discoveryengine.v1alpha.Schema] or an
53+
// `INVALID_ARGUMENT` error is thrown.
54+
google.protobuf.Struct struct_data = 3;
4955
}
5056

5157
// Page span of the chunk.

google/cloud/discoveryengine/v1alpha/common.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ enum SolutionType {
9090
}
9191

9292
// Tiers of search features. Different tiers might have different
93-
// pricing. To learn more, please check the pricing documentation.
93+
// pricing. To learn more, check the pricing documentation.
9494
enum SearchTier {
9595
// Default value when the enum is unspecified. This is invalid to use.
9696
SEARCH_TIER_UNSPECIFIED = 0;

0 commit comments

Comments
 (0)