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/annotations.proto"; 20import "google/api/client.proto"; 21import "google/api/field_behavior.proto"; 22import "google/api/resource.proto"; 23import "google/protobuf/empty.proto"; 24import "google/protobuf/field_mask.proto"; 25import "google/protobuf/struct.proto"; 26import "google/protobuf/timestamp.proto"; 27 28option cc_enable_arenas = true; 29option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3Beta1"; 30option go_package = "cloud.google.com/go/dialogflow/cx/apiv3beta1/cxpb;cxpb"; 31option java_multiple_files = true; 32option java_outer_classname = "ExampleProto"; 33option java_package = "com.google.cloud.dialogflow.cx.v3beta1"; 34option objc_class_prefix = "DF"; 35 36// Service for managing [Examples][google.cloud.dialogflow.cx.v3beta1.Example]. 37service Examples { 38 option (google.api.default_host) = "dialogflow.googleapis.com"; 39 option (google.api.oauth_scopes) = 40 "https://www.googleapis.com/auth/cloud-platform," 41 "https://www.googleapis.com/auth/dialogflow"; 42 43 // Creates an example in the specified playbook. 44 rpc CreateExample(CreateExampleRequest) returns (Example) { 45 option (google.api.http) = { 46 post: "/v3beta1/{parent=projects/*/locations/*/agents/*/playbooks/*}/examples" 47 body: "example" 48 }; 49 option (google.api.method_signature) = "parent,example"; 50 } 51 52 // Deletes the specified example. 53 rpc DeleteExample(DeleteExampleRequest) returns (google.protobuf.Empty) { 54 option (google.api.http) = { 55 delete: "/v3beta1/{name=projects/*/locations/*/agents/*/playbooks/*/examples/*}" 56 }; 57 option (google.api.method_signature) = "name"; 58 } 59 60 // Returns a list of examples in the specified playbook. 61 rpc ListExamples(ListExamplesRequest) returns (ListExamplesResponse) { 62 option (google.api.http) = { 63 get: "/v3beta1/{parent=projects/*/locations/*/agents/*/playbooks/*}/examples" 64 }; 65 option (google.api.method_signature) = "parent"; 66 } 67 68 // Retrieves the specified example. 69 rpc GetExample(GetExampleRequest) returns (Example) { 70 option (google.api.http) = { 71 get: "/v3beta1/{name=projects/*/locations/*/agents/*/playbooks/*/examples/*}" 72 }; 73 option (google.api.method_signature) = "name"; 74 } 75 76 // Update the specified example. 77 rpc UpdateExample(UpdateExampleRequest) returns (Example) { 78 option (google.api.http) = { 79 patch: "/v3beta1/{example.name=projects/*/locations/*/agents/*/playbooks/*/examples/*}" 80 body: "example" 81 }; 82 option (google.api.method_signature) = "example,update_mask"; 83 } 84} 85 86// The request message for 87// [Examples.CreateExample][google.cloud.dialogflow.cx.v3beta1.Examples.CreateExample]. 88message CreateExampleRequest { 89 // Required. The playbook to create an example for. 90 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 91 // ID>/playbooks/<Playbook ID>`. 92 string parent = 1 [ 93 (google.api.field_behavior) = REQUIRED, 94 (google.api.resource_reference) = { 95 child_type: "dialogflow.googleapis.com/Example" 96 } 97 ]; 98 99 // Required. The example to create. 100 Example example = 2 [(google.api.field_behavior) = REQUIRED]; 101} 102 103// The request message for 104// [Examples.DeleteExample][google.cloud.dialogflow.cx.v3beta1.Examples.DeleteExample]. 105message DeleteExampleRequest { 106 // Required. The name of the example to delete. 107 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 108 // ID>/playbooks/<Playbook ID>/examples/<Example ID>`. 109 string name = 1 [ 110 (google.api.field_behavior) = REQUIRED, 111 (google.api.resource_reference) = { 112 type: "dialogflow.googleapis.com/Example" 113 } 114 ]; 115} 116 117// The request message for 118// [Examples.ListExamples][google.cloud.dialogflow.cx.v3beta1.Examples.ListExamples]. 119message ListExamplesRequest { 120 // Required. The playbook to list the examples from. 121 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 122 // ID>/playbooks/<Playbook ID>`. 123 string parent = 1 [ 124 (google.api.field_behavior) = REQUIRED, 125 (google.api.resource_reference) = { 126 child_type: "dialogflow.googleapis.com/Example" 127 } 128 ]; 129 130 // Optional. The maximum number of items to return in a single page. By 131 // default 100 and at most 1000. 132 int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; 133 134 // Optional. The [next_page_token][ListExampleResponse.next_page_token] value 135 // returned from a previous list request. 136 string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; 137 138 // Optional. The language to list examples for. 139 // If not specified, the agent's default language is used. 140 // Note: languages must be enabled in the agent before they can be used. 141 string language_code = 4 [(google.api.field_behavior) = OPTIONAL]; 142} 143 144// The response message for 145// [Examples.ListExamples][google.cloud.dialogflow.cx.v3beta1.Examples.ListExamples]. 146message ListExamplesResponse { 147 // The list of examples. There will be a maximum number of items returned 148 // based on the 149 // [page_size][google.cloud.dialogflow.cx.v3beta1.ListExamplesRequest.page_size] 150 // field in the request. 151 repeated Example examples = 1; 152 153 // Token to retrieve the next page of results, or empty if there are no more 154 // results in the list. 155 string next_page_token = 2; 156} 157 158// The request message for 159// [Examples.GetExample][google.cloud.dialogflow.cx.v3beta1.Examples.GetExample]. 160message GetExampleRequest { 161 // Required. The name of the example. 162 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 163 // ID>/playbooks/<Playbook ID>/examples/<Example ID>`. 164 string name = 1 [ 165 (google.api.field_behavior) = REQUIRED, 166 (google.api.resource_reference) = { 167 type: "dialogflow.googleapis.com/Example" 168 } 169 ]; 170} 171 172// The request message for 173// [Examples.UpdateExample][google.cloud.dialogflow.cx.v3beta1.Examples.UpdateExample]. 174message UpdateExampleRequest { 175 // Required. The example to update. 176 Example example = 1 [(google.api.field_behavior) = REQUIRED]; 177 178 // Optional. The mask to control which fields get updated. If the mask is not 179 // present, all fields will be updated. 180 google.protobuf.FieldMask update_mask = 2 181 [(google.api.field_behavior) = OPTIONAL]; 182} 183 184// Example represents a sample execution of the playbook in the conversation. 185// 186// An example consists of a list of ordered actions performed by end user 187// or Dialogflow agent according the playbook instructions to fulfill the task. 188message Example { 189 option (google.api.resource) = { 190 type: "dialogflow.googleapis.com/Example" 191 pattern: "projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook}/examples/{example}" 192 plural: "examples" 193 singular: "example" 194 }; 195 196 // The unique identifier of the playbook example. 197 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 198 // ID>/playbooks/<Playbook ID>/examples/<Example ID>`. 199 string name = 1; 200 201 // Optional. The input to the playbook in the example. 202 PlaybookInput playbook_input = 3 [(google.api.field_behavior) = OPTIONAL]; 203 204 // Optional. The output of the playbook in the example. 205 PlaybookOutput playbook_output = 4 [(google.api.field_behavior) = OPTIONAL]; 206 207 // Required. The ordered list of actions performed by the end user and the 208 // Dialogflow agent. 209 repeated Action actions = 2 [(google.api.field_behavior) = REQUIRED]; 210 211 // Required. The display name of the example. 212 string display_name = 6 [(google.api.field_behavior) = REQUIRED]; 213 214 // Optional. The high level concise description of the example. The max number 215 // of characters is 200. 216 string description = 8 [(google.api.field_behavior) = OPTIONAL]; 217 218 // Output only. Estimated number of tokes current example takes when sent to 219 // the LLM. 220 int64 token_count = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; 221 222 // Output only. The timestamp of initial example creation. 223 google.protobuf.Timestamp create_time = 10 224 [(google.api.field_behavior) = OUTPUT_ONLY]; 225 226 // Output only. Last time the example was updated. 227 google.protobuf.Timestamp update_time = 11 228 [(google.api.field_behavior) = OUTPUT_ONLY]; 229 230 // Required. Example's output state. 231 OutputState conversation_state = 12 [(google.api.field_behavior) = REQUIRED]; 232 233 // Optional. The language code of the example. 234 // If not specified, the agent's default language is used. 235 // Note: languages must be enabled in the agent before they can be used. 236 string language_code = 13 [(google.api.field_behavior) = OPTIONAL]; 237} 238 239// Input of the playbook. 240message PlaybookInput { 241 // Optional. Summary string of the preceding conversation for the child 242 // playbook invocation. 243 string preceding_conversation_summary = 1 244 [(google.api.field_behavior) = OPTIONAL]; 245 246 // Optional. A list of input parameters for the invocation. 247 repeated ActionParameter parameters = 2 248 [(google.api.field_behavior) = OPTIONAL]; 249} 250 251// Output of the playbook. 252message PlaybookOutput { 253 // Optional. Summary string of the execution result of the child playbook. 254 string execution_summary = 1 [(google.api.field_behavior) = OPTIONAL]; 255 256 // Optional. A list of output parameters for the invocation. 257 repeated ActionParameter parameters = 3 258 [(google.api.field_behavior) = OPTIONAL]; 259} 260 261// Action performed by end user or Dialogflow agent in the conversation. 262message Action { 263 // Action details. 264 oneof action { 265 // Optional. Agent obtained a message from the customer. 266 UserUtterance user_utterance = 1 [(google.api.field_behavior) = OPTIONAL]; 267 268 // Optional. Action performed by the agent as a message. 269 AgentUtterance agent_utterance = 2 [(google.api.field_behavior) = OPTIONAL]; 270 271 // Optional. Action performed on behalf of the agent by calling a plugin 272 // tool. 273 ToolUse tool_use = 3 [(google.api.field_behavior) = OPTIONAL]; 274 275 // Optional. Action performed on behalf of the agent by invoking a child 276 // playbook. 277 PlaybookInvocation playbook_invocation = 4 278 [(google.api.field_behavior) = OPTIONAL]; 279 280 // Optional. Action performed on behalf of the agent by invoking a CX flow. 281 FlowInvocation flow_invocation = 5 [(google.api.field_behavior) = OPTIONAL]; 282 } 283} 284 285// UserUtterance represents one message sent by the customer. 286message UserUtterance { 287 // Required. Message content in text. 288 string text = 1 [(google.api.field_behavior) = REQUIRED]; 289} 290 291// AgentUtterance represents one message sent by the agent. 292message AgentUtterance { 293 // Required. Message content in text. 294 string text = 1 [(google.api.field_behavior) = REQUIRED]; 295} 296 297// Stores metadata of the invocation of an action supported by a tool. 298message ToolUse { 299 // Required. The [tool][google.cloud.dialogflow.cx.v3beta1.Tool] that should 300 // be used. Format: `projects/<Project ID>/locations/<Location 301 // ID>/agents/<Agent ID>/tools/<Tool ID>`. 302 string tool = 1 [ 303 (google.api.field_behavior) = REQUIRED, 304 (google.api.resource_reference) = { type: "dialogflow.googleapis.com/Tool" } 305 ]; 306 307 // Optional. Name of the action to be called during the tool use. 308 string action = 2 [(google.api.field_behavior) = OPTIONAL]; 309 310 // A list of input parameters for the action. 311 repeated ActionParameter input_parameters = 3; 312 313 // A list of output parameters generated by the action. 314 repeated ActionParameter output_parameters = 4; 315} 316 317// Parameter associated with action. 318message ActionParameter { 319 // Required. Name of the parameter. 320 string name = 1 [(google.api.field_behavior) = REQUIRED]; 321 322 // Required. Value of the parameter. 323 google.protobuf.Value value = 2 [(google.api.field_behavior) = REQUIRED]; 324} 325 326// Stores metadata of the invocation of a child playbook. 327// Next Id: 5 328message PlaybookInvocation { 329 // Required. The unique identifier of the playbook. 330 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 331 // ID>/playbooks/<Playbook ID>`. 332 string playbook = 1 [ 333 (google.api.field_behavior) = REQUIRED, 334 (google.api.resource_reference) = { 335 type: "dialogflow.googleapis.com/Playbook" 336 } 337 ]; 338 339 // Optional. Input of the child playbook invocation. 340 PlaybookInput playbook_input = 2 [(google.api.field_behavior) = OPTIONAL]; 341 342 // Optional. Output of the child playbook invocation. 343 PlaybookOutput playbook_output = 3 [(google.api.field_behavior) = OPTIONAL]; 344 345 // Required. Playbook invocation's output state. 346 OutputState playbook_state = 4 [(google.api.field_behavior) = REQUIRED]; 347} 348 349// Stores metadata of the invocation of a CX flow. 350// Next Id: 7 351message FlowInvocation { 352 // Required. The unique identifier of the flow. 353 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 354 // flows/<Flow ID>`. 355 string flow = 1 [ 356 (google.api.field_behavior) = REQUIRED, 357 (google.api.resource_reference) = { type: "dialogflow.googleapis.com/Flow" } 358 ]; 359 360 // A list of input parameters for the flow invocation. 361 repeated ActionParameter input_parameters = 2; 362 363 // A list of output parameters generated by the flow invocation. 364 repeated ActionParameter output_parameters = 3; 365 366 // Required. Flow invocation's output state. 367 OutputState flow_state = 4 [(google.api.field_behavior) = REQUIRED]; 368} 369 370// Output state. 371enum OutputState { 372 // Unspecified output. 373 OUTPUT_STATE_UNSPECIFIED = 0; 374 375 // Succeeded. 376 OUTPUT_STATE_OK = 1; 377 378 // Cancelled. 379 OUTPUT_STATE_CANCELLED = 2; 380 381 // Failed. 382 OUTPUT_STATE_FAILED = 3; 383 384 // Escalated. 385 OUTPUT_STATE_ESCALATED = 4; 386 387 // Pending. 388 OUTPUT_STATE_PENDING = 5; 389} 390