xref: /aosp_15_r20/external/googleapis/google/cloud/dialogflow/cx/v3beta1/data_store_connection.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 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
15syntax = "proto3";
16
17package google.cloud.dialogflow.cx.v3beta1;
18
19import "google/api/field_behavior.proto";
20
21option cc_enable_arenas = true;
22option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3Beta1";
23option go_package = "cloud.google.com/go/dialogflow/cx/apiv3beta1/cxpb;cxpb";
24option java_multiple_files = true;
25option java_outer_classname = "DataStoreConnectionProto";
26option java_package = "com.google.cloud.dialogflow.cx.v3beta1";
27option objc_class_prefix = "DF";
28option ruby_package = "Google::Cloud::Dialogflow::CX::V3beta1";
29
30// A data store connection. It represents a data store in Discovery Engine and
31// the type of the contents it contains.
32message DataStoreConnection {
33  // The type of the connected data store.
34  DataStoreType data_store_type = 1;
35
36  // The full name of the referenced data store.
37  // Formats:
38  // `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`
39  // `projects/{project}/locations/{location}/dataStores/{data_store}`
40  string data_store = 2;
41}
42
43// Type of a data store.
44// Determines how search is performed in the data store.
45enum DataStoreType {
46  // Not specified. This value indicates that the data store type is not
47  // specified, so it will not be used during search.
48  DATA_STORE_TYPE_UNSPECIFIED = 0;
49
50  // A data store that contains public web content.
51  PUBLIC_WEB = 1;
52
53  // A data store that contains unstructured private data.
54  UNSTRUCTURED = 2;
55
56  // A data store that contains structured data (for example FAQ).
57  STRUCTURED = 3;
58}
59
60// Data store connection feature output signals.
61// Might be only partially field if processing stop before the final answer.
62// Reasons for this can be, but are not limited to: empty UCS search results,
63// positive RAI check outcome, grounding failure, ...
64message DataStoreConnectionSignals {
65  // Diagnostic info related to the rewriter model call.
66  message RewriterModelCallSignals {
67    // Prompt as sent to the model.
68    string rendered_prompt = 1;
69
70    // Output of the generative model.
71    string model_output = 2;
72  }
73
74  // Search snippet details.
75  message SearchSnippet {
76    // Title of the enclosing document.
77    string document_title = 1;
78
79    // Uri for the document. Present if specified for the document.
80    string document_uri = 2;
81
82    // Text included in the prompt.
83    string text = 3;
84  }
85
86  // Diagnostic info related to the answer generation model call.
87  message AnswerGenerationModelCallSignals {
88    // Prompt as sent to the model.
89    string rendered_prompt = 1;
90
91    // Output of the generative model.
92    string model_output = 2;
93  }
94
95  // Answer part with citation.
96  message AnswerPart {
97    // Substring of the answer.
98    string text = 1;
99
100    // Citations for this answer part. Indices of `search_snippets`.
101    repeated int32 supporting_indices = 2;
102  }
103
104  // Snippet cited by the answer generation model.
105  message CitedSnippet {
106    // Details of the snippet.
107    SearchSnippet search_snippet = 1;
108
109    // Index of the snippet in `search_snippets` field.
110    int32 snippet_index = 2;
111  }
112
113  // Grounding signals.
114  message GroundingSignals {
115    // Represents the decision of the grounding check.
116    enum GroundingDecision {
117      // Decision not specified.
118      GROUNDING_DECISION_UNSPECIFIED = 0;
119
120      // Grounding have accepted the answer.
121      ACCEPTED_BY_GROUNDING = 1;
122
123      // Grounding have rejected the answer.
124      REJECTED_BY_GROUNDING = 2;
125    }
126
127    // Grounding score buckets.
128    enum GroundingScoreBucket {
129      // Score not specified.
130      GROUNDING_SCORE_BUCKET_UNSPECIFIED = 0;
131
132      // We have very low confidence that the answer is grounded.
133      VERY_LOW = 1;
134
135      // We have low confidence that the answer is grounded.
136      LOW = 3;
137
138      // We have medium confidence that the answer is grounded.
139      MEDIUM = 4;
140
141      // We have high confidence that the answer is grounded.
142      HIGH = 5;
143
144      // We have very high confidence that the answer is grounded.
145      VERY_HIGH = 6;
146    }
147
148    // Represents the decision of the grounding check.
149    GroundingDecision decision = 1;
150
151    // Grounding score bucket setting.
152    GroundingScoreBucket score = 2;
153  }
154
155  // Safety check results.
156  message SafetySignals {
157    // Safety decision.
158    // All kinds of check are incorporated into this final decision, including
159    // banned phrases check.
160    enum SafetyDecision {
161      // Decision not specified.
162      SAFETY_DECISION_UNSPECIFIED = 0;
163
164      // No manual or automatic safety check fired.
165      ACCEPTED_BY_SAFETY_CHECK = 1;
166
167      // One ore more safety checks fired.
168      REJECTED_BY_SAFETY_CHECK = 2;
169    }
170
171    // Specifies banned phrase match subject.
172    enum BannedPhraseMatch {
173      // No banned phrase check was executed.
174      BANNED_PHRASE_MATCH_UNSPECIFIED = 0;
175
176      // All banned phrase checks led to no match.
177      BANNED_PHRASE_MATCH_NONE = 1;
178
179      // A banned phrase matched the query.
180      BANNED_PHRASE_MATCH_QUERY = 2;
181
182      // A banned phrase matched the response.
183      BANNED_PHRASE_MATCH_RESPONSE = 3;
184    }
185
186    // Safety decision.
187    SafetyDecision decision = 1;
188
189    // Specifies banned phrase match subject.
190    BannedPhraseMatch banned_phrase_match = 2;
191
192    // The matched banned phrase if there was a match.
193    string matched_banned_phrase = 3;
194  }
195
196  // Optional. Diagnostic info related to the rewriter model call.
197  RewriterModelCallSignals rewriter_model_call_signals = 1
198      [(google.api.field_behavior) = OPTIONAL];
199
200  // Optional. Rewritten string query used for search.
201  string rewritten_query = 2 [(google.api.field_behavior) = OPTIONAL];
202
203  // Optional. Search snippets included in the answer generation prompt.
204  repeated SearchSnippet search_snippets = 3
205      [(google.api.field_behavior) = OPTIONAL];
206
207  // Optional. Diagnostic info related to the answer generation model call.
208  AnswerGenerationModelCallSignals answer_generation_model_call_signals = 4
209      [(google.api.field_behavior) = OPTIONAL];
210
211  // Optional. The final compiled answer.
212  string answer = 5 [(google.api.field_behavior) = OPTIONAL];
213
214  // Optional. Answer parts with relevant citations.
215  // Concatenation of texts should add up the `answer` (not counting
216  // whitespaces).
217  repeated AnswerPart answer_parts = 6 [(google.api.field_behavior) = OPTIONAL];
218
219  // Optional. Snippets cited by the answer generation model from the most to
220  // least relevant.
221  repeated CitedSnippet cited_snippets = 7
222      [(google.api.field_behavior) = OPTIONAL];
223
224  // Optional. Grounding signals.
225  GroundingSignals grounding_signals = 8
226      [(google.api.field_behavior) = OPTIONAL];
227
228  // Optional. Safety check result.
229  SafetySignals safety_signals = 9 [(google.api.field_behavior) = OPTIONAL];
230}
231