xref: /aosp_15_r20/external/googleapis/google/cloud/dialogflow/v2/agent.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.v2;
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/v2/validation_result.proto";
24import "google/longrunning/operations.proto";
25import "google/protobuf/empty.proto";
26import "google/protobuf/field_mask.proto";
27import "google/protobuf/struct.proto";
28
29option cc_enable_arenas = true;
30option csharp_namespace = "Google.Cloud.Dialogflow.V2";
31option go_package = "cloud.google.com/go/dialogflow/apiv2/dialogflowpb;dialogflowpb";
32option java_multiple_files = true;
33option java_outer_classname = "AgentProto";
34option java_package = "com.google.cloud.dialogflow.v2";
35option objc_class_prefix = "DF";
36
37// Service for managing [Agents][google.cloud.dialogflow.v2.Agent].
38service Agents {
39  option (google.api.default_host) = "dialogflow.googleapis.com";
40  option (google.api.oauth_scopes) =
41      "https://www.googleapis.com/auth/cloud-platform,"
42      "https://www.googleapis.com/auth/dialogflow";
43
44  // Retrieves the specified agent.
45  rpc GetAgent(GetAgentRequest) returns (Agent) {
46    option (google.api.http) = {
47      get: "/v2/{parent=projects/*}/agent"
48      additional_bindings { get: "/v2/{parent=projects/*/locations/*}/agent" }
49    };
50    option (google.api.method_signature) = "parent";
51  }
52
53  // Creates/updates the specified agent.
54  //
55  // Note: You should always train an agent prior to sending it queries. See the
56  // [training
57  // documentation](https://cloud.google.com/dialogflow/es/docs/training).
58  rpc SetAgent(SetAgentRequest) returns (Agent) {
59    option (google.api.http) = {
60      post: "/v2/{agent.parent=projects/*}/agent"
61      body: "agent"
62      additional_bindings {
63        post: "/v2/{agent.parent=projects/*/locations/*}/agent"
64        body: "agent"
65      }
66    };
67    option (google.api.method_signature) = "agent";
68  }
69
70  // Deletes the specified agent.
71  rpc DeleteAgent(DeleteAgentRequest) returns (google.protobuf.Empty) {
72    option (google.api.http) = {
73      delete: "/v2/{parent=projects/*}/agent"
74      additional_bindings {
75        delete: "/v2/{parent=projects/*/locations/*}/agent"
76      }
77    };
78    option (google.api.method_signature) = "parent";
79  }
80
81  // Returns the list of agents.
82  //
83  // Since there is at most one conversational agent per project, this method is
84  // useful primarily for listing all agents across projects the caller has
85  // access to. One can achieve that with a wildcard project collection id "-".
86  // Refer to [List
87  // Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).
88  rpc SearchAgents(SearchAgentsRequest) returns (SearchAgentsResponse) {
89    option (google.api.http) = {
90      get: "/v2/{parent=projects/*}/agent:search"
91      additional_bindings {
92        get: "/v2/{parent=projects/*/locations/*}/agent:search"
93      }
94    };
95    option (google.api.method_signature) = "parent";
96  }
97
98  // Trains the specified agent.
99  //
100  // This method is a [long-running
101  // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
102  // The returned `Operation` type has the following method-specific fields:
103  //
104  // - `metadata`: An empty [Struct
105  //   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
106  // - `response`: An [Empty
107  //   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
108  //
109  // Note: You should always train an agent prior to sending it queries. See the
110  // [training
111  // documentation](https://cloud.google.com/dialogflow/es/docs/training).
112  rpc TrainAgent(TrainAgentRequest) returns (google.longrunning.Operation) {
113    option (google.api.http) = {
114      post: "/v2/{parent=projects/*}/agent:train"
115      body: "*"
116      additional_bindings {
117        post: "/v2/{parent=projects/*/locations/*}/agent:train"
118        body: "*"
119      }
120    };
121    option (google.api.method_signature) = "parent";
122    option (google.longrunning.operation_info) = {
123      response_type: "google.protobuf.Empty"
124      metadata_type: "google.protobuf.Struct"
125    };
126  }
127
128  // Exports the specified agent to a ZIP file.
129  //
130  // This method is a [long-running
131  // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
132  // The returned `Operation` type has the following method-specific fields:
133  //
134  // - `metadata`: An empty [Struct
135  //   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
136  // - `response`:
137  // [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
138  rpc ExportAgent(ExportAgentRequest) returns (google.longrunning.Operation) {
139    option (google.api.http) = {
140      post: "/v2/{parent=projects/*}/agent:export"
141      body: "*"
142      additional_bindings {
143        post: "/v2/{parent=projects/*/locations/*}/agent:export"
144        body: "*"
145      }
146    };
147    option (google.api.method_signature) = "parent";
148    option (google.longrunning.operation_info) = {
149      response_type: "google.cloud.dialogflow.v2.ExportAgentResponse"
150      metadata_type: "google.protobuf.Struct"
151    };
152  }
153
154  // Imports the specified agent from a ZIP file.
155  //
156  // Uploads new intents and entity types without deleting the existing ones.
157  // Intents and entity types with the same name are replaced with the new
158  // versions from
159  // [ImportAgentRequest][google.cloud.dialogflow.v2.ImportAgentRequest]. After
160  // the import, the imported draft agent will be trained automatically (unless
161  // disabled in agent settings). However, once the import is done, training may
162  // not be completed yet. Please call
163  // [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the
164  // operation it returns in order to train explicitly.
165  //
166  // This method is a [long-running
167  // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
168  // The returned `Operation` type has the following method-specific fields:
169  //
170  // - `metadata`: An empty [Struct
171  //   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
172  // - `response`: An [Empty
173  //   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
174  //
175  // The operation only tracks when importing is complete, not when it is done
176  // training.
177  //
178  // Note: You should always train an agent prior to sending it queries. See the
179  // [training
180  // documentation](https://cloud.google.com/dialogflow/es/docs/training).
181  rpc ImportAgent(ImportAgentRequest) returns (google.longrunning.Operation) {
182    option (google.api.http) = {
183      post: "/v2/{parent=projects/*}/agent:import"
184      body: "*"
185      additional_bindings {
186        post: "/v2/{parent=projects/*/locations/*}/agent:import"
187        body: "*"
188      }
189    };
190    option (google.longrunning.operation_info) = {
191      response_type: "google.protobuf.Empty"
192      metadata_type: "google.protobuf.Struct"
193    };
194  }
195
196  // Restores the specified agent from a ZIP file.
197  //
198  // Replaces the current agent version with a new one. All the intents and
199  // entity types in the older version are deleted. After the restore, the
200  // restored draft agent will be trained automatically (unless disabled in
201  // agent settings). However, once the restore is done, training may not be
202  // completed yet. Please call
203  // [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the
204  // operation it returns in order to train explicitly.
205  //
206  // This method is a [long-running
207  // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
208  // The returned `Operation` type has the following method-specific fields:
209  //
210  // - `metadata`: An empty [Struct
211  //   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
212  // - `response`: An [Empty
213  //   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
214  //
215  // The operation only tracks when restoring is complete, not when it is done
216  // training.
217  //
218  // Note: You should always train an agent prior to sending it queries. See the
219  // [training
220  // documentation](https://cloud.google.com/dialogflow/es/docs/training).
221  rpc RestoreAgent(RestoreAgentRequest) returns (google.longrunning.Operation) {
222    option (google.api.http) = {
223      post: "/v2/{parent=projects/*}/agent:restore"
224      body: "*"
225      additional_bindings {
226        post: "/v2/{parent=projects/*/locations/*}/agent:restore"
227        body: "*"
228      }
229    };
230    option (google.longrunning.operation_info) = {
231      response_type: "google.protobuf.Empty"
232      metadata_type: "google.protobuf.Struct"
233    };
234  }
235
236  // Gets agent validation result. Agent validation is performed during
237  // training time and is updated automatically when training is completed.
238  rpc GetValidationResult(GetValidationResultRequest)
239      returns (ValidationResult) {
240    option (google.api.http) = {
241      get: "/v2/{parent=projects/*}/agent/validationResult"
242      additional_bindings {
243        get: "/v2/{parent=projects/*/locations/*}/agent/validationResult"
244      }
245    };
246  }
247}
248
249// A Dialogflow agent is a virtual agent that handles conversations with your
250// end-users. It is a natural language understanding module that understands the
251// nuances of human language. Dialogflow translates end-user text or audio
252// during a conversation to structured data that your apps and services can
253// understand. You design and build a Dialogflow agent to handle the types of
254// conversations required for your system.
255//
256// For more information about agents, see the
257// [Agent guide](https://cloud.google.com/dialogflow/docs/agents-overview).
258//
259message Agent {
260  option (google.api.resource) = {
261    type: "dialogflow.googleapis.com/Agent"
262    pattern: "projects/{project}/agent"
263    pattern: "projects/{project}/locations/{location}/agent"
264  };
265
266  // Match mode determines how intents are detected from user queries.
267  enum MatchMode {
268    // Not specified.
269    MATCH_MODE_UNSPECIFIED = 0;
270
271    // Best for agents with a small number of examples in intents and/or wide
272    // use of templates syntax and composite entities.
273    MATCH_MODE_HYBRID = 1;
274
275    // Can be used for agents with a large number of examples in intents,
276    // especially the ones using @sys.any or very large custom entities.
277    MATCH_MODE_ML_ONLY = 2;
278  }
279
280  // API version for the agent.
281  enum ApiVersion {
282    // Not specified.
283    API_VERSION_UNSPECIFIED = 0;
284
285    // Legacy V1 API.
286    API_VERSION_V1 = 1;
287
288    // V2 API.
289    API_VERSION_V2 = 2;
290
291    // V2beta1 API.
292    API_VERSION_V2_BETA_1 = 3;
293  }
294
295  // Represents the agent tier.
296  enum Tier {
297    // Not specified. This value should never be used.
298    TIER_UNSPECIFIED = 0;
299
300    // Trial Edition, previously known as Standard Edition.
301    TIER_STANDARD = 1;
302
303    // Essentials Edition, previously known as Enterprise Essential Edition.
304    TIER_ENTERPRISE = 2;
305
306    // Essentials Edition (same as TIER_ENTERPRISE), previously known as
307    // Enterprise Plus Edition.
308    TIER_ENTERPRISE_PLUS = 3 [deprecated = true];
309  }
310
311  // Required. The project of this agent.
312  // Format: `projects/<Project ID>`.
313  string parent = 1 [
314    (google.api.field_behavior) = REQUIRED,
315    (google.api.resource_reference) = {
316      type: "cloudresourcemanager.googleapis.com/Project"
317    }
318  ];
319
320  // Required. The name of this agent.
321  string display_name = 2 [(google.api.field_behavior) = REQUIRED];
322
323  // Required. The default language of the agent as a language tag. See
324  // [Language
325  // Support](https://cloud.google.com/dialogflow/docs/reference/language)
326  // for a list of the currently supported language codes. This field cannot be
327  // set by the `Update` method.
328  string default_language_code = 3 [(google.api.field_behavior) = REQUIRED];
329
330  // Optional. The list of all languages supported by this agent (except for the
331  // `default_language_code`).
332  repeated string supported_language_codes = 4
333      [(google.api.field_behavior) = OPTIONAL];
334
335  // Required. The time zone of this agent from the
336  // [time zone database](https://www.iana.org/time-zones), e.g.,
337  // America/New_York, Europe/Paris.
338  string time_zone = 5 [(google.api.field_behavior) = REQUIRED];
339
340  // Optional. The description of this agent.
341  // The maximum length is 500 characters. If exceeded, the request is rejected.
342  string description = 6 [(google.api.field_behavior) = OPTIONAL];
343
344  // Optional. The URI of the agent's avatar.
345  // Avatars are used throughout the Dialogflow console and in the self-hosted
346  // [Web
347  // Demo](https://cloud.google.com/dialogflow/docs/integrations/web-demo)
348  // integration.
349  string avatar_uri = 7 [(google.api.field_behavior) = OPTIONAL];
350
351  // Optional. Determines whether this agent should log conversation queries.
352  bool enable_logging = 8 [(google.api.field_behavior) = OPTIONAL];
353
354  // Optional. Determines how intents are detected from user queries.
355  MatchMode match_mode = 9
356      [deprecated = true, (google.api.field_behavior) = OPTIONAL];
357
358  // Optional. To filter out false positive results and still get variety in
359  // matched natural language inputs for your agent, you can tune the machine
360  // learning classification threshold. If the returned score value is less than
361  // the threshold value, then a fallback intent will be triggered or, if there
362  // are no fallback intents defined, no intent will be triggered. The score
363  // values range from 0.0 (completely uncertain) to 1.0 (completely certain).
364  // If set to 0.0, the default of 0.3 is used.
365  float classification_threshold = 10 [(google.api.field_behavior) = OPTIONAL];
366
367  // Optional. API version displayed in Dialogflow console. If not specified,
368  // V2 API is assumed. Clients are free to query different service endpoints
369  // for different API versions. However, bots connectors and webhook calls will
370  // follow the specified API version.
371  ApiVersion api_version = 14 [(google.api.field_behavior) = OPTIONAL];
372
373  // Optional. The agent tier. If not specified, TIER_STANDARD is assumed.
374  Tier tier = 15 [(google.api.field_behavior) = OPTIONAL];
375}
376
377// The request message for
378// [Agents.GetAgent][google.cloud.dialogflow.v2.Agents.GetAgent].
379message GetAgentRequest {
380  // Required. The project that the agent to fetch is associated with.
381  // Format: `projects/<Project ID>`.
382  string parent = 1 [
383    (google.api.field_behavior) = REQUIRED,
384    (google.api.resource_reference) = {
385      child_type: "dialogflow.googleapis.com/Agent"
386    }
387  ];
388}
389
390// The request message for
391// [Agents.SetAgent][google.cloud.dialogflow.v2.Agents.SetAgent].
392message SetAgentRequest {
393  // Required. The agent to update.
394  Agent agent = 1 [(google.api.field_behavior) = REQUIRED];
395
396  // Optional. The mask to control which fields get updated.
397  google.protobuf.FieldMask update_mask = 2
398      [(google.api.field_behavior) = OPTIONAL];
399}
400
401// The request message for
402// [Agents.DeleteAgent][google.cloud.dialogflow.v2.Agents.DeleteAgent].
403message DeleteAgentRequest {
404  // Required. The project that the agent to delete is associated with.
405  // Format: `projects/<Project ID>`.
406  string parent = 1 [
407    (google.api.field_behavior) = REQUIRED,
408    (google.api.resource_reference) = {
409      child_type: "dialogflow.googleapis.com/Agent"
410    }
411  ];
412}
413
414// The request message for
415// [Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents].
416message SearchAgentsRequest {
417  // Required. The project to list agents from.
418  // Format: `projects/<Project ID or '-'>`.
419  string parent = 1 [
420    (google.api.field_behavior) = REQUIRED,
421    (google.api.resource_reference) = {
422      child_type: "dialogflow.googleapis.com/Agent"
423    }
424  ];
425
426  // Optional. The maximum number of items to return in a single page. By
427  // default 100 and at most 1000.
428  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
429
430  // The next_page_token value returned from a previous list request.
431  string page_token = 3;
432}
433
434// The response message for
435// [Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents].
436message SearchAgentsResponse {
437  // The list of agents. There will be a maximum number of items returned based
438  // on the page_size field in the request.
439  repeated Agent agents = 1;
440
441  // Token to retrieve the next page of results, or empty if there are no
442  // more results in the list.
443  string next_page_token = 2;
444}
445
446// The request message for
447// [Agents.TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent].
448message TrainAgentRequest {
449  // Required. The project that the agent to train is associated with.
450  // Format: `projects/<Project ID>`.
451  string parent = 1 [
452    (google.api.field_behavior) = REQUIRED,
453    (google.api.resource_reference) = {
454      child_type: "dialogflow.googleapis.com/Agent"
455    }
456  ];
457}
458
459// The request message for
460// [Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent].
461message ExportAgentRequest {
462  // Required. The project that the agent to export is associated with.
463  // Format: `projects/<Project ID>`.
464  string parent = 1 [
465    (google.api.field_behavior) = REQUIRED,
466    (google.api.resource_reference) = {
467      child_type: "dialogflow.googleapis.com/Agent"
468    }
469  ];
470
471  // Required. The [Google Cloud
472  // Storage](https://cloud.google.com/storage/docs/) URI to export the agent
473  // to. The format of this URI must be `gs://<bucket-name>/<object-name>`. If
474  // left unspecified, the serialized agent is returned inline.
475  //
476  // Dialogflow performs a write operation for the Cloud Storage object
477  // on the caller's behalf, so your request authentication must
478  // have write permissions for the object. For more information, see
479  // [Dialogflow access
480  // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage).
481  string agent_uri = 2 [(google.api.field_behavior) = REQUIRED];
482}
483
484// The response message for
485// [Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent].
486message ExportAgentResponse {
487  // The exported agent.
488  oneof agent {
489    // The URI to a file containing the exported agent. This field is populated
490    // only if `agent_uri` is specified in `ExportAgentRequest`.
491    string agent_uri = 1;
492
493    // Zip compressed raw byte content for agent.
494    bytes agent_content = 2;
495  }
496}
497
498// The request message for
499// [Agents.ImportAgent][google.cloud.dialogflow.v2.Agents.ImportAgent].
500message ImportAgentRequest {
501  // Required. The project that the agent to import is associated with.
502  // Format: `projects/<Project ID>`.
503  string parent = 1 [
504    (google.api.field_behavior) = REQUIRED,
505    (google.api.resource_reference) = {
506      child_type: "dialogflow.googleapis.com/Agent"
507    }
508  ];
509
510  // Required. The agent to import.
511  oneof agent {
512    // The URI to a Google Cloud Storage file containing the agent to import.
513    // Note: The URI must start with "gs://".
514    //
515    // Dialogflow performs a read operation for the Cloud Storage object
516    // on the caller's behalf, so your request authentication must
517    // have read permissions for the object. For more information, see
518    // [Dialogflow access
519    // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage).
520    string agent_uri = 2;
521
522    // Zip compressed raw byte content for agent.
523    bytes agent_content = 3;
524  }
525}
526
527// The request message for
528// [Agents.RestoreAgent][google.cloud.dialogflow.v2.Agents.RestoreAgent].
529message RestoreAgentRequest {
530  // Required. The project that the agent to restore is associated with.
531  // Format: `projects/<Project ID>`.
532  string parent = 1 [
533    (google.api.field_behavior) = REQUIRED,
534    (google.api.resource_reference) = {
535      child_type: "dialogflow.googleapis.com/Agent"
536    }
537  ];
538
539  // Required. The agent to restore.
540  oneof agent {
541    // The URI to a Google Cloud Storage file containing the agent to restore.
542    // Note: The URI must start with "gs://".
543    //
544    // Dialogflow performs a read operation for the Cloud Storage object
545    // on the caller's behalf, so your request authentication must
546    // have read permissions for the object. For more information, see
547    // [Dialogflow access
548    // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage).
549    string agent_uri = 2;
550
551    // Zip compressed raw byte content for agent.
552    bytes agent_content = 3;
553  }
554}
555
556// The request message for
557// [Agents.GetValidationResult][google.cloud.dialogflow.v2.Agents.GetValidationResult].
558message GetValidationResultRequest {
559  // Required. The project that the agent is associated with.
560  // Format: `projects/<Project ID>`.
561  string parent = 1 [
562    (google.api.field_behavior) = REQUIRED,
563    (google.api.resource_reference) = {
564      child_type: "dialogflow.googleapis.com/Agent"
565    }
566  ];
567
568  // Optional. The language for which you want a validation result. If not
569  // specified, the agent's default language is used. [Many
570  // languages](https://cloud.google.com/dialogflow/docs/reference/language)
571  // are supported. Note: languages must be enabled in the agent before they can
572  // be used.
573  string language_code = 3 [(google.api.field_behavior) = OPTIONAL];
574}
575