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