Skip to content

Commit 0c142cc

Browse files
Google APIscopybara-github
authored andcommitted
feat: add stream answer API
feat: support query rephraser model for answer API feat: support end user spec for answer API feat: support grounding and safety rating for answer API feat: support relevance threshold in search feat: support boosting for blended search feat: support auto mode in search as your type feat: support model scores in search feat: support search highlighting feat: support enterprise web retrieval source for grounding feat: support images in web search grounding feat: add sitemap APIs feat: add interpolation boost action and promotion action feat: allow FHIR import to use latest predefined schema feat: allow unstructured data import to force refresh all content feat: support conversion user event feat: support panel aware user event docs: keep the API doc up-to-date with recent changes PiperOrigin-RevId: 740152749
1 parent 7a92b96 commit 0c142cc

23 files changed

Lines changed: 1005 additions & 55 deletions

google/cloud/discoveryengine/v1/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ proto_library(
4949
"purge_config.proto",
5050
"rank_service.proto",
5151
"recommendation_service.proto",
52+
"safety.proto",
5253
"schema.proto",
5354
"schema_service.proto",
5455
"search_service.proto",
@@ -407,7 +408,6 @@ load(
407408

408409
csharp_proto_library(
409410
name = "discoveryengine_csharp_proto",
410-
extra_opts = [],
411411
deps = [":discoveryengine_proto"],
412412
)
413413

google/cloud/discoveryengine/v1/answer.proto

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package google.cloud.discoveryengine.v1;
1818

1919
import "google/api/field_behavior.proto";
2020
import "google/api/resource.proto";
21+
import "google/cloud/discoveryengine/v1/safety.proto";
2122
import "google/protobuf/struct.proto";
2223
import "google/protobuf/timestamp.proto";
2324

@@ -42,10 +43,13 @@ message Answer {
4243
// Citation info for a segment.
4344
message Citation {
4445
// Index indicates the start of the segment, measured in bytes (UTF-8
45-
// unicode).
46+
// unicode). If there are multi-byte characters,such as non-ASCII
47+
// characters, the index measurement is longer than the string length.
4648
int64 start_index = 1;
4749

48-
// End of the attributed segment, exclusive.
50+
// End of the attributed segment, exclusive. Measured in bytes (UTF-8
51+
// unicode). If there are multi-byte characters,such as non-ASCII
52+
// characters, the index measurement is longer than the string length.
4953
int64 end_index = 2;
5054

5155
// Citation sources for the attributed segment.
@@ -58,6 +62,33 @@ message Answer {
5862
string reference_id = 1;
5963
}
6064

65+
// Grounding support for a claim in `answer_text`.
66+
message GroundingSupport {
67+
// Required. Index indicates the start of the claim, measured in bytes
68+
// (UTF-8 unicode).
69+
int64 start_index = 1 [(google.api.field_behavior) = REQUIRED];
70+
71+
// Required. End of the claim, exclusive.
72+
int64 end_index = 2 [(google.api.field_behavior) = REQUIRED];
73+
74+
// A score in the range of [0, 1] describing how grounded is a specific
75+
// claim by the references.
76+
// Higher value means that the claim is better supported by the reference
77+
// chunks.
78+
optional double grounding_score = 3;
79+
80+
// Indicates that this claim required grounding check. When the
81+
// system decided this claim didn't require attribution/grounding check,
82+
// this field is set to false. In that case, no grounding check was
83+
// done for the claim and therefore `grounding_score`, `sources` is not
84+
// returned.
85+
optional bool grounding_check_required = 4;
86+
87+
// Optional. Citation sources for the claim.
88+
repeated CitationSource sources = 5
89+
[(google.api.field_behavior) = OPTIONAL];
90+
}
91+
6192
// Reference.
6293
message Reference {
6394
// Unstructured document information.
@@ -148,6 +179,12 @@ message Answer {
148179

149180
// Structured search data.
150181
google.protobuf.Struct struct_data = 2;
182+
183+
// Output only. The title of the document.
184+
string title = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
185+
186+
// Output only. The URI of the document.
187+
string uri = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
151188
}
152189

153190
// Search result content.
@@ -314,6 +351,9 @@ message Answer {
314351

315352
// Answer generation has succeeded.
316353
SUCCEEDED = 3;
354+
355+
// Answer generation is currently in progress.
356+
STREAMING = 4;
317357
}
318358

319359
// An enum for answer skipped reasons.
@@ -381,9 +421,17 @@ message Answer {
381421
// The textual answer.
382422
string answer_text = 3;
383423

424+
// A score in the range of [0, 1] describing how grounded the answer is by the
425+
// reference chunks.
426+
optional double grounding_score = 12;
427+
384428
// Citations.
385429
repeated Citation citations = 4;
386430

431+
// Optional. Grounding supports.
432+
repeated GroundingSupport grounding_supports = 13
433+
[(google.api.field_behavior) = OPTIONAL];
434+
387435
// References.
388436
repeated Reference references = 5;
389437

@@ -407,4 +455,8 @@ message Answer {
407455
// Output only. Answer completed timestamp.
408456
google.protobuf.Timestamp complete_time = 9
409457
[(google.api.field_behavior) = OUTPUT_ONLY];
458+
459+
// Optional. Safety ratings.
460+
repeated SafetyRating safety_ratings = 14
461+
[(google.api.field_behavior) = OPTIONAL];
410462
}

google/cloud/discoveryengine/v1/chunk.proto

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ message Chunk {
9999
// 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].
102-
// Only populated on [SearchService.SearchResponse][].
102+
// Only populated on
103+
// [SearchResponse][google.cloud.discoveryengine.v1.SearchResponse].
103104
optional double relevance_score = 8
104105
[(google.api.field_behavior) = OUTPUT_ONLY];
105106

google/cloud/discoveryengine/v1/common.proto

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ syntax = "proto3";
1616

1717
package google.cloud.discoveryengine.v1;
1818

19+
import "google/api/field_behavior.proto";
1920
import "google/api/resource.proto";
2021

2122
option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1";
@@ -221,3 +222,34 @@ message UserInfo {
221222
// is set.
222223
string user_agent = 2;
223224
}
225+
226+
// Double list.
227+
message DoubleList {
228+
// Double values.
229+
repeated double values = 1;
230+
}
231+
232+
// Promotion proto includes uri and other helping information to display the
233+
// promotion.
234+
message SearchLinkPromotion {
235+
// Required. The title of the promotion.
236+
// Maximum length: 160 characters.
237+
string title = 1 [(google.api.field_behavior) = REQUIRED];
238+
239+
// Optional. The URL for the page the user wants to promote. Must be set for
240+
// site search. For other verticals, this is optional.
241+
string uri = 2 [(google.api.field_behavior) = OPTIONAL];
242+
243+
// Optional. The promotion thumbnail image url.
244+
string image_uri = 3 [(google.api.field_behavior) = OPTIONAL];
245+
246+
// Optional. The Promotion description.
247+
// Maximum length: 200 characters.
248+
string description = 4 [(google.api.field_behavior) = OPTIONAL];
249+
250+
// Optional. The enabled promotion will be returned for any serving configs
251+
// associated with the parent of the control this promotion is attached to.
252+
//
253+
// This flag is used for basic site search only.
254+
bool enabled = 5 [(google.api.field_behavior) = OPTIONAL];
255+
}

google/cloud/discoveryengine/v1/control.proto

Lines changed: 113 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,97 @@ message Control {
9595

9696
// Adjusts order of products in returned list.
9797
message BoostAction {
98-
// Required. Strength of the boost, which should be in [-1, 1]. Negative
98+
// Specification for custom ranking based on customer specified attribute
99+
// value. It provides more controls for customized ranking than the simple
100+
// (condition, boost) combination above.
101+
message InterpolationBoostSpec {
102+
// The control points used to define the curve. The curve defined
103+
// through these control points can only be monotonically increasing
104+
// or decreasing(constant values are acceptable).
105+
message ControlPoint {
106+
// Optional. Can be one of:
107+
// 1. The numerical field value.
108+
// 2. The duration spec for freshness:
109+
// The value must be formatted as an XSD `dayTimeDuration` value (a
110+
// restricted subset of an ISO 8601 duration value). The pattern for
111+
// this is: `[nD][T[nH][nM][nS]]`.
112+
string attribute_value = 1 [(google.api.field_behavior) = OPTIONAL];
113+
114+
// Optional. The value between -1 to 1 by which to boost the score if
115+
// the attribute_value evaluates to the value specified above.
116+
float boost_amount = 2 [(google.api.field_behavior) = OPTIONAL];
117+
}
118+
119+
// The attribute(or function) for which the custom ranking is to be
120+
// applied.
121+
enum AttributeType {
122+
// Unspecified AttributeType.
123+
ATTRIBUTE_TYPE_UNSPECIFIED = 0;
124+
125+
// The value of the numerical field will be used to dynamically update
126+
// the boost amount. In this case, the attribute_value (the x value)
127+
// of the control point will be the actual value of the numerical
128+
// field for which the boost_amount is specified.
129+
NUMERICAL = 1;
130+
131+
// For the freshness use case the attribute value will be the duration
132+
// between the current time and the date in the datetime field
133+
// specified. The value must be formatted as an XSD `dayTimeDuration`
134+
// value (a restricted subset of an ISO 8601 duration value). The
135+
// pattern for this is: `[nD][T[nH][nM][nS]]`.
136+
// For example, `5D`, `3DT12H30M`, `T24H`.
137+
FRESHNESS = 2;
138+
}
139+
140+
// The interpolation type to be applied. Default will be linear
141+
// (Piecewise Linear).
142+
enum InterpolationType {
143+
// Interpolation type is unspecified. In this case, it defaults to
144+
// Linear.
145+
INTERPOLATION_TYPE_UNSPECIFIED = 0;
146+
147+
// Piecewise linear interpolation will be applied.
148+
LINEAR = 1;
149+
}
150+
151+
// Optional. The name of the field whose value will be used to determine
152+
// the boost amount.
153+
string field_name = 1 [(google.api.field_behavior) = OPTIONAL];
154+
155+
// Optional. The attribute type to be used to determine the boost amount.
156+
// The attribute value can be derived from the field value of the
157+
// specified field_name. In the case of numerical it is straightforward
158+
// i.e. attribute_value = numerical_field_value. In the case of freshness
159+
// however, attribute_value = (time.now() - datetime_field_value).
160+
AttributeType attribute_type = 2 [(google.api.field_behavior) = OPTIONAL];
161+
162+
// Optional. The interpolation type to be applied to connect the control
163+
// points listed below.
164+
InterpolationType interpolation_type = 3
165+
[(google.api.field_behavior) = OPTIONAL];
166+
167+
// Optional. The control points used to define the curve. The monotonic
168+
// function (defined through the interpolation_type above) passes through
169+
// the control points listed here.
170+
repeated ControlPoint control_points = 4
171+
[(google.api.field_behavior) = OPTIONAL];
172+
}
173+
174+
// Constant value boost or custom ranking based boost specifications.
175+
oneof boost_spec {
176+
// Optional. Strength of the boost, which should be in [-1, 1]. Negative
177+
// boost means demotion. Default is 0.0 (No-op).
178+
float fixed_boost = 4 [(google.api.field_behavior) = OPTIONAL];
179+
180+
// Optional. Complex specification for custom ranking based on customer
181+
// defined attribute value.
182+
InterpolationBoostSpec interpolation_boost_spec = 5
183+
[(google.api.field_behavior) = OPTIONAL];
184+
}
185+
186+
// Strength of the boost, which should be in [-1, 1]. Negative
99187
// boost means demotion. Default is 0.0 (No-op).
100-
float boost = 1 [(google.api.field_behavior) = REQUIRED];
188+
float boost = 1 [deprecated = true];
101189

102190
// Required. Specifies which products to apply the boost to.
103191
//
@@ -164,6 +252,24 @@ message Control {
164252
repeated string synonyms = 1;
165253
}
166254

255+
// Promote certain links based on some trigger queries.
256+
//
257+
// Example: Promote shoe store link when searching for `shoe` keyword.
258+
// The link can be outside of associated data store.
259+
message PromoteAction {
260+
// Required. Data store with which this promotion is attached to.
261+
string data_store = 1 [
262+
(google.api.field_behavior) = REQUIRED,
263+
(google.api.resource_reference) = {
264+
type: "discoveryengine.googleapis.com/DataStore"
265+
}
266+
];
267+
268+
// Required. Promotion attached to this action.
269+
SearchLinkPromotion search_link_promotion = 2
270+
[(google.api.field_behavior) = REQUIRED];
271+
}
272+
167273
// Actions are restricted by Vertical and Solution
168274
//
169275
// Required.
@@ -180,6 +286,11 @@ message Control {
180286

181287
// Treats a group of terms as synonyms of one another.
182288
SynonymsAction synonyms_action = 10;
289+
290+
// Promote certain links based on predefined trigger queries.
291+
//
292+
// This now only supports basic site search.
293+
PromoteAction promote_action = 15;
183294
}
184295

185296
// Immutable. Fully qualified name

0 commit comments

Comments
 (0)