1 // Copyright 2018 Google Inc.
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
7 // http://www.apache.org/licenses/LICENSE-2.0
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.
17 package google.cloud.dialogflow.v2;
19 import "google/api/annotations.proto";
20 import "google/longrunning/operations.proto";
21 import "google/protobuf/empty.proto";
22 import "google/protobuf/field_mask.proto";
23 import "google/protobuf/struct.proto";
25 option cc_enable_arenas = true;
26 option csharp_namespace = "Google.Cloud.Dialogflow.V2";
27 option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow";
28 option java_multiple_files = true;
29 option java_outer_classname = "AgentProto";
30 option java_package = "com.google.cloud.dialogflow.v2";
31 option objc_class_prefix = "DF";
33 // Agents are best described as Natural Language Understanding (NLU) modules
34 // that transform user requests into actionable data. You can include agents
35 // in your app, product, or service to determine user intent and respond to the
36 // user in a natural way.
38 // After you create an agent, you can add
39 // [Intents][google.cloud.dialogflow.v2.Intents],
40 // [Contexts][google.cloud.dialogflow.v2.Contexts], [Entity
41 // Types][google.cloud.dialogflow.v2.EntityTypes],
42 // [Webhooks][google.cloud.dialogflow.v2.WebhookRequest], and so on to manage
43 // the flow of a conversation and match user input to predefined intents and
46 // You can create an agent using both Dialogflow Standard Edition and
47 // Dialogflow Enterprise Edition. For details, see
48 // [Dialogflow Editions](/dialogflow-enterprise/docs/editions).
50 // You can save your agent for backup or versioning by exporting the agent by
51 // using the [ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent]
52 // method. You can import a saved agent by using the
53 // [ImportAgent][google.cloud.dialogflow.v2.Agents.ImportAgent] method.
55 // Dialogflow provides several
56 // [prebuilt agents](https://dialogflow.com/docs/prebuilt-agents) for common
57 // conversation scenarios such as determining a date and time, converting
58 // currency, and so on.
60 // For more information about agents, see the
61 // [Dialogflow documentation](https://dialogflow.com/docs/agents).
63 // Retrieves the specified agent.
64 rpc GetAgent(GetAgentRequest) returns (Agent) {
65 option (google.api.http) = {
66 get: "/v2/{parent=projects/*}/agent"
70 // Returns the list of agents.
72 // Since there is at most one conversational agent per project, this method is
73 // useful primarily for listing all agents across projects the caller has
74 // access to. One can achieve that with a wildcard project collection id "-".
76 // Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).
77 rpc SearchAgents(SearchAgentsRequest) returns (SearchAgentsResponse) {
78 option (google.api.http) = {
79 get: "/v2/{parent=projects/*}/agent:search"
83 // Trains the specified agent.
85 // Operation <response: [google.protobuf.Empty][google.protobuf.Empty],
86 // metadata: [google.protobuf.Struct][google.protobuf.Struct]>
87 rpc TrainAgent(TrainAgentRequest) returns (google.longrunning.Operation) {
88 option (google.api.http) = {
89 post: "/v2/{parent=projects/*}/agent:train"
94 // Exports the specified agent to a ZIP file.
96 // Operation <response:
97 // [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse],
98 // metadata: [google.protobuf.Struct][google.protobuf.Struct]>
99 rpc ExportAgent(ExportAgentRequest) returns (google.longrunning.Operation) {
100 option (google.api.http) = {
101 post: "/v2/{parent=projects/*}/agent:export"
106 // Imports the specified agent from a ZIP file.
108 // Uploads new intents and entity types without deleting the existing ones.
109 // Intents and entity types with the same name are replaced with the new
110 // versions from ImportAgentRequest.
112 // Operation <response: [google.protobuf.Empty][google.protobuf.Empty],
113 // metadata: [google.protobuf.Struct][google.protobuf.Struct]>
114 rpc ImportAgent(ImportAgentRequest) returns (google.longrunning.Operation) {
115 option (google.api.http) = {
116 post: "/v2/{parent=projects/*}/agent:import"
121 // Restores the specified agent from a ZIP file.
123 // Replaces the current agent version with a new one. All the intents and
124 // entity types in the older version are deleted.
126 // Operation <response: [google.protobuf.Empty][google.protobuf.Empty],
127 // metadata: [google.protobuf.Struct][google.protobuf.Struct]>
128 rpc RestoreAgent(RestoreAgentRequest) returns (google.longrunning.Operation) {
129 option (google.api.http) = {
130 post: "/v2/{parent=projects/*}/agent:restore"
136 // Represents a conversational agent.
138 // Match mode determines how intents are detected from user queries.
141 MATCH_MODE_UNSPECIFIED = 0;
143 // Best for agents with a small number of examples in intents and/or wide
144 // use of templates syntax and composite entities.
145 MATCH_MODE_HYBRID = 1;
147 // Can be used for agents with a large number of examples in intents,
148 // especially the ones using @sys.any or very large developer entities.
149 MATCH_MODE_ML_ONLY = 2;
152 // Required. The project of this agent.
153 // Format: `projects/<Project ID>`.
156 // Required. The name of this agent.
157 string display_name = 2;
159 // Required. The default language of the agent as a language tag. See
160 // [Language Support](https://dialogflow.com/docs/reference/language) for a
161 // list of the currently supported language codes.
162 // This field cannot be set by the `Update` method.
163 string default_language_code = 3;
165 // Optional. The list of all languages supported by this agent (except for the
166 // `default_language_code`).
167 repeated string supported_language_codes = 4;
169 // Required. The time zone of this agent from the
170 // [time zone database](https://www.iana.org/time-zones), e.g.,
171 // America/New_York, Europe/Paris.
172 string time_zone = 5;
174 // Optional. The description of this agent.
175 // The maximum length is 500 characters. If exceeded, the request is rejected.
176 string description = 6;
178 // Optional. The URI of the agent's avatar.
179 // Avatars are used throughout the Dialogflow console and in the self-hosted
180 // [Web Demo](https://dialogflow.com/docs/integrations/web-demo) integration.
181 string avatar_uri = 7;
183 // Optional. Determines whether this agent should log conversation queries.
184 bool enable_logging = 8;
186 // Optional. Determines how intents are detected from user queries.
187 MatchMode match_mode = 9;
189 // Optional. To filter out false positive results and still get variety in
190 // matched natural language inputs for your agent, you can tune the machine
191 // learning classification threshold. If the returned score value is less than
192 // the threshold value, then a fallback intent is be triggered or, if there
193 // are no fallback intents defined, no intent will be triggered. The score
194 // values range from 0.0 (completely uncertain) to 1.0 (completely certain).
195 // If set to 0.0, the default of 0.3 is used.
196 float classification_threshold = 10;
199 // The request message for
200 // [Agents.GetAgent][google.cloud.dialogflow.v2.Agents.GetAgent].
201 message GetAgentRequest {
202 // Required. The project that the agent to fetch is associated with.
203 // Format: `projects/<Project ID>`.
207 // The request message for
208 // [Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents].
209 message SearchAgentsRequest {
210 // Required. The project to list agents from.
211 // Format: `projects/<Project ID or '-'>`.
214 // Optional. The maximum number of items to return in a single page. By
215 // default 100 and at most 1000.
218 // Optional. The next_page_token value returned from a previous list request.
219 string page_token = 3;
222 // The response message for
223 // [Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents].
224 message SearchAgentsResponse {
225 // The list of agents. There will be a maximum number of items returned based
226 // on the page_size field in the request.
227 repeated Agent agents = 1;
229 // Token to retrieve the next page of results, or empty if there are no
230 // more results in the list.
231 string next_page_token = 2;
234 // The request message for
235 // [Agents.TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent].
236 message TrainAgentRequest {
237 // Required. The project that the agent to train is associated with.
238 // Format: `projects/<Project ID>`.
242 // The request message for
243 // [Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent].
244 message ExportAgentRequest {
245 // Required. The project that the agent to export is associated with.
246 // Format: `projects/<Project ID>`.
249 // Optional. The Google Cloud Storage URI to export the agent to.
250 // Note: The URI must start with
251 // "gs://". If left unspecified, the serialized agent is returned inline.
252 string agent_uri = 2;
255 // The response message for
256 // [Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent].
257 message ExportAgentResponse {
258 // Required. The exported agent.
260 // The URI to a file containing the exported agent. This field is populated
261 // only if `agent_uri` is specified in `ExportAgentRequest`.
262 string agent_uri = 1;
264 // The exported agent.
266 // Example for how to export an agent to a zip file via a command line:
269 // 'https://dialogflow.googleapis.com/v2/projects/<project_name>/agent:export'\
271 // -H 'Authorization: Bearer '$(gcloud auth print-access-token) \
272 // -H 'Accept: application/json' \
273 // -H 'Content-Type: application/json' \
275 // --data-binary '{}' \
276 // | grep agentContent | sed -e 's/.*"agentContent": "\([^"]*\)".*/\1/' \
277 // | base64 --decode > <agent zip file>
278 bytes agent_content = 2;
282 // The request message for
283 // [Agents.ImportAgent][google.cloud.dialogflow.v2.Agents.ImportAgent].
284 message ImportAgentRequest {
285 // Required. The project that the agent to import is associated with.
286 // Format: `projects/<Project ID>`.
289 // Required. The agent to import.
291 // The URI to a Google Cloud Storage file containing the agent to import.
292 // Note: The URI must start with "gs://".
293 string agent_uri = 2;
295 // The agent to import.
297 // Example for how to import an agent via the command line:
300 // 'https://dialogflow.googleapis.com/v2/projects/<project_name>/agent:import\
302 // -H 'Authorization: Bearer '$(gcloud auth print-access-token) \
303 // -H 'Accept: application/json' \
304 // -H 'Content-Type: application/json' \
307 // 'agentContent': '$(cat <agent zip file> | base64 -w 0)'
309 bytes agent_content = 3;
313 // The request message for
314 // [Agents.RestoreAgent][google.cloud.dialogflow.v2.Agents.RestoreAgent].
315 message RestoreAgentRequest {
316 // Required. The project that the agent to restore is associated with.
317 // Format: `projects/<Project ID>`.
320 // Required. The agent to restore.
322 // The URI to a Google Cloud Storage file containing the agent to restore.
323 // Note: The URI must start with "gs://".
324 string agent_uri = 2;
326 // The agent to restore.
328 // Example for how to restore an agent via the command line:
331 // 'https://dialogflow.googleapis.com/v2/projects/<project_name>/agent:restore\
333 // -H 'Authorization: Bearer '$(gcloud auth print-access-token) \
334 // -H 'Accept: application/json' \
335 // -H 'Content-Type: application/json' \
338 // 'agentContent': '$(cat <agent zip file> | base64 -w 0)'
340 bytes agent_content = 3;