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/cloud/dialogflow/cx/v3beta1/data_store_connection.proto"; 24import "google/cloud/dialogflow/cx/v3beta1/inline.proto"; 25import "google/longrunning/operations.proto"; 26import "google/protobuf/empty.proto"; 27import "google/protobuf/field_mask.proto"; 28import "google/protobuf/struct.proto"; 29 30option cc_enable_arenas = true; 31option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3Beta1"; 32option go_package = "cloud.google.com/go/dialogflow/cx/apiv3beta1/cxpb;cxpb"; 33option java_multiple_files = true; 34option java_outer_classname = "ToolProto"; 35option java_package = "com.google.cloud.dialogflow.cx.v3beta1"; 36option objc_class_prefix = "DF"; 37 38// Service for managing [Tools][google.cloud.dialogflow.cx.v3beta1.Tool]. 39service Tools { 40 option (google.api.default_host) = "dialogflow.googleapis.com"; 41 option (google.api.oauth_scopes) = 42 "https://www.googleapis.com/auth/cloud-platform," 43 "https://www.googleapis.com/auth/dialogflow"; 44 45 // Creates a [Tool][google.cloud.dialogflow.cx.v3beta1.Tool] in the specified 46 // agent. 47 rpc CreateTool(CreateToolRequest) returns (Tool) { 48 option (google.api.http) = { 49 post: "/v3beta1/{parent=projects/*/locations/*/agents/*}/tools" 50 body: "tool" 51 }; 52 option (google.api.method_signature) = "parent,tool"; 53 } 54 55 // Returns a list of [Tools][google.cloud.dialogflow.cx.v3beta1.Tool] in the 56 // specified agent. 57 rpc ListTools(ListToolsRequest) returns (ListToolsResponse) { 58 option (google.api.http) = { 59 get: "/v3beta1/{parent=projects/*/locations/*/agents/*}/tools" 60 }; 61 option (google.api.method_signature) = "parent"; 62 } 63 64 // Exports the selected tools. 65 rpc ExportTools(ExportToolsRequest) returns (google.longrunning.Operation) { 66 option (google.api.http) = { 67 post: "/v3beta1/{parent=projects/*/locations/*/agents/*}/tools:export" 68 body: "*" 69 }; 70 option (google.longrunning.operation_info) = { 71 response_type: "ExportToolsResponse" 72 metadata_type: "ExportToolsMetadata" 73 }; 74 } 75 76 // Retrieves the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool]. 77 rpc GetTool(GetToolRequest) returns (Tool) { 78 option (google.api.http) = { 79 get: "/v3beta1/{name=projects/*/locations/*/agents/*/tools/*}" 80 }; 81 option (google.api.method_signature) = "name"; 82 } 83 84 // Update the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool]. 85 rpc UpdateTool(UpdateToolRequest) returns (Tool) { 86 option (google.api.http) = { 87 patch: "/v3beta1/{tool.name=projects/*/locations/*/agents/*/tools/*}" 88 body: "tool" 89 }; 90 option (google.api.method_signature) = "tool,update_mask"; 91 } 92 93 // Deletes a specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool]. 94 rpc DeleteTool(DeleteToolRequest) returns (google.protobuf.Empty) { 95 option (google.api.http) = { 96 delete: "/v3beta1/{name=projects/*/locations/*/agents/*/tools/*}" 97 }; 98 option (google.api.method_signature) = "name"; 99 } 100} 101 102// The request message for 103// [Tools.CreateTool][google.cloud.dialogflow.cx.v3beta1.Tools.CreateTool]. 104message CreateToolRequest { 105 // Required. The agent to create a Tool for. 106 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`. 107 string parent = 1 [ 108 (google.api.field_behavior) = REQUIRED, 109 (google.api.resource_reference) = { 110 child_type: "dialogflow.googleapis.com/Tool" 111 } 112 ]; 113 114 // Required. The Tool to be created. 115 Tool tool = 2 [(google.api.field_behavior) = REQUIRED]; 116} 117 118// The request message for 119// [Tools.ListTools][google.cloud.dialogflow.cx.v3beta1.Tools.ListTools]. 120message ListToolsRequest { 121 // Required. The agent to list the Tools from. 122 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`. 123 string parent = 1 [ 124 (google.api.field_behavior) = REQUIRED, 125 (google.api.resource_reference) = { 126 child_type: "dialogflow.googleapis.com/Tool" 127 } 128 ]; 129 130 // The maximum number of items to return in a single page. By default 100 and 131 // at most 1000. 132 int32 page_size = 2; 133 134 // The next_page_token value returned from a previous list request. 135 string page_token = 3; 136} 137 138// The response message for 139// [Tools.ListTools][google.cloud.dialogflow.cx.v3beta1.Tools.ListTools]. 140message ListToolsResponse { 141 // The list of Tools. There will be a maximum number of items returned 142 // based on the page_size field in the request. 143 repeated Tool tools = 1; 144 145 // Token to retrieve the next page of results, or empty if there are no more 146 // results in the list. 147 string next_page_token = 2; 148} 149 150// The request message for 151// [Tools.GetTool][google.cloud.dialogflow.cx.v3beta1.Tools.GetTool]. 152message GetToolRequest { 153 // Required. The name of the Tool. 154 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 155 // ID>/tools/<Tool ID>`. 156 string name = 1 [ 157 (google.api.field_behavior) = REQUIRED, 158 (google.api.resource_reference) = { type: "dialogflow.googleapis.com/Tool" } 159 ]; 160} 161 162// The request message for 163// [Tools.ExportTools][google.cloud.dialogflow.cx.v3beta1.Tools.ExportTools]. 164message ExportToolsRequest { 165 // Data format of the exported tools. 166 enum DataFormat { 167 // Unspecified format. Treated as `BLOB`. 168 DATA_FORMAT_UNSPECIFIED = 0; 169 170 // Tools will be exported as raw bytes. 171 BLOB = 1; 172 173 // Tools will be exported in JSON format. 174 JSON = 2; 175 } 176 177 // Required. The agent to export tools from. 178 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 179 // ID>`. 180 string parent = 1 [ 181 (google.api.field_behavior) = REQUIRED, 182 (google.api.resource_reference) = { 183 child_type: "dialogflow.googleapis.com/Tool" 184 } 185 ]; 186 187 // Required. The name of the tools to export. 188 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 189 // ID>/tools/<Tool ID>`. 190 repeated string tools = 2 [ 191 (google.api.field_behavior) = REQUIRED, 192 (google.api.resource_reference) = { type: "dialogflow.googleapis.com/Tool" } 193 ]; 194 195 // The destination to export. 196 oneof destination { 197 // Optional. The [Google Cloud 198 // Storage](https://cloud.google.com/storage/docs/) URI to export the tools 199 // to. The format of this URI must be `gs://<bucket-name>/<object-name>`. 200 // 201 // Dialogflow performs a write operation for the Cloud Storage object 202 // on the caller's behalf, so your request authentication must 203 // have write permissions for the object. For more information, see 204 // [Dialogflow access 205 // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). 206 string tools_uri = 3 [(google.api.field_behavior) = OPTIONAL]; 207 208 // Optional. The option to return the serialized tools inline. 209 bool tools_content_inline = 4 [(google.api.field_behavior) = OPTIONAL]; 210 } 211 212 // Optional. The data format of the exported tools. If not specified, `BLOB` 213 // is assumed. 214 DataFormat data_format = 5 [(google.api.field_behavior) = OPTIONAL]; 215} 216 217// The response message for 218// [Tools.ExportTools][google.cloud.dialogflow.cx.v3beta1.Tools.ExportTools]. 219message ExportToolsResponse { 220 // The exported tools. 221 oneof tools { 222 // The URI to a file containing the exported tools. This field is 223 // populated only if `tools_uri` is specified in 224 // [ExportToolsRequest][google.cloud.dialogflow.cx.v3beta1.ExportToolsRequest]. 225 string tools_uri = 1; 226 227 // Uncompressed byte content for tools. This field is populated only if 228 // `tools_content_inline` is set to true in 229 // [ExportToolsRequest][google.cloud.dialogflow.cx.v3beta1.ExportToolsRequest]. 230 InlineDestination tools_content = 2; 231 } 232} 233 234// The request message for 235// [Tools.UpdateTool][google.cloud.dialogflow.cx.v3beta1.Tools.UpdateTool]. 236message UpdateToolRequest { 237 // Required. The Tool to be updated. 238 Tool tool = 1 [(google.api.field_behavior) = REQUIRED]; 239 240 // The mask to control which fields get updated. If the mask is not present, 241 // all fields will be updated. 242 google.protobuf.FieldMask update_mask = 2; 243} 244 245// The request message for 246// [Tools.DeleteTool][google.cloud.dialogflow.cx.v3beta1.Tools.DeleteTool]. 247message DeleteToolRequest { 248 // Required. The name of the Tool to be deleted. 249 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 250 // ID>/tools/<Tool ID>`. 251 string name = 1 [ 252 (google.api.field_behavior) = REQUIRED, 253 (google.api.resource_reference) = { type: "dialogflow.googleapis.com/Tool" } 254 ]; 255 256 // This field has no effect for Tools not being used. 257 // For Tools that are used: 258 // 259 // * If `force` is set to false, an error will be returned with message 260 // indicating the referenced resources. 261 // * If `force` is set to true, Dialogflow will remove the tool, as well 262 // as any references to the tool. 263 bool force = 2; 264} 265 266// A tool provides a list of actions which are available to the 267// [Playbook][google.cloud.dialogflow.cx.v3beta1.Playbook] to attain its goal. A 268// Tool consists of a description of the tool's usage and a specification of the 269// tool which contains the schema and authentication information. 270message Tool { 271 option (google.api.resource) = { 272 type: "dialogflow.googleapis.com/Tool" 273 pattern: "projects/{project}/locations/{location}/agents/{agent}/tools/{tool}" 274 }; 275 276 // An OpenAPI tool is a way to provide the Tool specifications in the Open API 277 // schema format. 278 message OpenApiTool { 279 // Schema representation. 280 oneof schema { 281 // Required. The OpenAPI schema specified as a text. 282 string text_schema = 1 [(google.api.field_behavior) = REQUIRED]; 283 } 284 285 // Optional. Authentication information required by the API. 286 Authentication authentication = 2 [(google.api.field_behavior) = OPTIONAL]; 287 288 // Optional. TLS configuration for the HTTPS verification. 289 TLSConfig tls_config = 3 [(google.api.field_behavior) = OPTIONAL]; 290 } 291 292 // A DataStoreTool is a way to provide specifications needed to search a 293 // list of data stores. 294 message DataStoreTool { 295 // A FallbackPrompt is a way to provide specifications for the Data Store 296 // fallback prompt when generating responses. 297 message FallbackPrompt {} 298 299 // Required. List of data stores to search. 300 repeated DataStoreConnection data_store_connections = 1 301 [(google.api.field_behavior) = REQUIRED]; 302 303 // Required. Fallback prompt configurations to use. 304 FallbackPrompt fallback_prompt = 3 [(google.api.field_behavior) = REQUIRED]; 305 } 306 307 // An ExtensionTool is a way to use Vertex Extensions as a tool. 308 message ExtensionTool { 309 // Required. The full name of the referenced vertex extension. 310 // Formats: 311 // `projects/{project}/locations/{location}/extensions/{extension}` 312 string name = 1 [(google.api.field_behavior) = REQUIRED]; 313 } 314 315 // A Function tool describes the functions to be invoked on the client side. 316 message FunctionTool { 317 // Optional. The JSON schema is encapsulated in a 318 // [google.protobuf.Struct][google.protobuf.Struct] to describe the input of 319 // the function. This input is a JSON object that contains the function's 320 // parameters as properties of the object. 321 google.protobuf.Struct input_schema = 1 322 [(google.api.field_behavior) = OPTIONAL]; 323 324 // Optional. The JSON schema is encapsulated in a 325 // [google.protobuf.Struct][google.protobuf.Struct] to describe the output 326 // of the function. This output is a JSON object that contains the 327 // function's parameters as properties of the object. 328 google.protobuf.Struct output_schema = 2 329 [(google.api.field_behavior) = OPTIONAL]; 330 } 331 332 // Authentication information required for API calls 333 message Authentication { 334 // Config for authentication with API key. 335 message ApiKeyConfig { 336 // Required. The parameter name or the header name of the API key. 337 // E.g., If the API request is "https://example.com/act?X-Api-Key=<API 338 // KEY>", "X-Api-Key" would be the parameter name. 339 string key_name = 1 [(google.api.field_behavior) = REQUIRED]; 340 341 // Required. The API key. 342 string api_key = 2 [(google.api.field_behavior) = REQUIRED]; 343 344 // Required. Key location in the request. 345 RequestLocation request_location = 3 346 [(google.api.field_behavior) = REQUIRED]; 347 } 348 349 // The location of the API key in the request. 350 enum RequestLocation { 351 // Default value. This value is unused. 352 REQUEST_LOCATION_UNSPECIFIED = 0; 353 354 // Represents the key in http header. 355 HEADER = 1; 356 357 // Represents the key in query string. 358 QUERY_STRING = 2; 359 } 360 361 // Config for authentication with OAuth. 362 message OAuthConfig { 363 // OAuth grant types. Only [client credential 364 // grant](https://oauth.net/2/grant-types/client-credentials) is 365 // supported. 366 enum OauthGrantType { 367 // Default value. This value is unused. 368 OAUTH_GRANT_TYPE_UNSPECIFIED = 0; 369 370 // Represents the [client credential 371 // flow](https://oauth.net/2/grant-types/client-credentials). 372 CLIENT_CREDENTIAL = 1; 373 } 374 375 // Required. OAuth grant types. 376 OauthGrantType oauth_grant_type = 1 377 [(google.api.field_behavior) = REQUIRED]; 378 379 // Required. The client ID from the OAuth provider. 380 string client_id = 2 [(google.api.field_behavior) = REQUIRED]; 381 382 // Required. The client secret from the OAuth provider. 383 string client_secret = 3 [(google.api.field_behavior) = REQUIRED]; 384 385 // Required. The token endpoint in the OAuth provider to exchange for an 386 // access token. 387 string token_endpoint = 4 [(google.api.field_behavior) = REQUIRED]; 388 } 389 390 // Config for auth using [Diglogflow service 391 // agent](https://cloud.google.com/iam/docs/service-agents#dialogflow-service-agent). 392 message ServiceAgentAuthConfig {} 393 394 // The auth configuration. 395 oneof auth_config { 396 // Config for API key auth. 397 ApiKeyConfig api_key_config = 1; 398 399 // Config for OAuth. 400 OAuthConfig oauth_config = 2; 401 402 // Config for [Diglogflow service 403 // agent](https://cloud.google.com/iam/docs/service-agents#dialogflow-service-agent) 404 // auth. 405 ServiceAgentAuthConfig service_agent_auth_config = 3; 406 } 407 } 408 409 // The TLS configuration. 410 message TLSConfig { 411 // The CA certificate. 412 message CACert { 413 // Required. The name of the allowed custom CA certificates. This 414 // can be used to disambiguate the custom CA certificates. 415 string display_name = 1 [(google.api.field_behavior) = REQUIRED]; 416 417 // Required. The allowed custom CA certificates (in DER format) for 418 // HTTPS verification. This overrides the default SSL trust store. If this 419 // is empty or unspecified, Dialogflow will use Google's default trust 420 // store to verify certificates. N.B. Make sure the HTTPS server 421 // certificates are signed with "subject alt name". For instance a 422 // certificate can be self-signed using the following command, 423 // openssl x509 -req -days 200 -in example.com.csr \ 424 // -signkey example.com.key \ 425 // -out example.com.crt \ 426 // -extfile <(printf "\nsubjectAltName='DNS:www.example.com'") 427 bytes cert = 2 [(google.api.field_behavior) = REQUIRED]; 428 } 429 430 // Required. Specifies a list of allowed custom CA certificates for HTTPS 431 // verification. 432 repeated CACert ca_certs = 1 [(google.api.field_behavior) = REQUIRED]; 433 } 434 435 // Represents the type of the tool. 436 enum ToolType { 437 // Default value. This value is unused. 438 TOOL_TYPE_UNSPECIFIED = 0; 439 440 // Customer provided tool. 441 CUSTOMIZED_TOOL = 1; 442 443 // First party built-in tool created by Dialogflow which cannot be modified. 444 BUILTIN_TOOL = 2; 445 } 446 447 // The unique identifier of the Tool. 448 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 449 // ID>/tools/<Tool ID>`. 450 string name = 1; 451 452 // Required. The human-readable name of the Tool, unique within an agent. 453 string display_name = 2 [(google.api.field_behavior) = REQUIRED]; 454 455 // Required. High level description of the Tool and its usage. 456 string description = 3 [(google.api.field_behavior) = REQUIRED]; 457 458 // The list of derived action names for the tool. 459 repeated string actions = 6 [deprecated = true]; 460 461 // The list of derived type schemas for the tool. 462 repeated string schemas = 7 [deprecated = true]; 463 464 // Specification of the Tool. 465 oneof specification { 466 // OpenAPI specification of the Tool. 467 OpenApiTool open_api_spec = 4; 468 469 // Data store search tool specification. 470 DataStoreTool data_store_spec = 8; 471 472 // Vertex extension tool specification. 473 ExtensionTool extension_spec = 11; 474 475 // Client side executed function specification. 476 FunctionTool function_spec = 13; 477 } 478 479 // Output only. The tool type. 480 ToolType tool_type = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; 481} 482 483// Metadata returned for the 484// [Tools.ExportTools][google.cloud.dialogflow.cx.v3beta1.Tools.ExportTools] 485// long running operation. 486message ExportToolsMetadata {} 487