xref: /aosp_15_r20/external/googleapis/google/cloud/dialogflow/cx/v3beta1/playbook.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.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/example.proto";
24import "google/cloud/dialogflow/cx/v3beta1/generative_settings.proto";
25import "google/cloud/dialogflow/cx/v3beta1/parameter_definition.proto";
26import "google/protobuf/empty.proto";
27import "google/protobuf/field_mask.proto";
28import "google/protobuf/timestamp.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 = "PlaybookProto";
35option java_package = "com.google.cloud.dialogflow.cx.v3beta1";
36option objc_class_prefix = "DF";
37
38// Service for managing
39// [Playbooks][google.cloud.dialogflow.cx.v3beta1.Playbook].
40service Playbooks {
41  option (google.api.default_host) = "dialogflow.googleapis.com";
42  option (google.api.oauth_scopes) =
43      "https://www.googleapis.com/auth/cloud-platform,"
44      "https://www.googleapis.com/auth/dialogflow";
45
46  // Creates a playbook in a specified agent.
47  rpc CreatePlaybook(CreatePlaybookRequest) returns (Playbook) {
48    option (google.api.http) = {
49      post: "/v3beta1/{parent=projects/*/locations/*/agents/*}/playbooks"
50      body: "playbook"
51    };
52    option (google.api.method_signature) = "parent,playbook";
53  }
54
55  // Deletes a specified playbook.
56  rpc DeletePlaybook(DeletePlaybookRequest) returns (google.protobuf.Empty) {
57    option (google.api.http) = {
58      delete: "/v3beta1/{name=projects/*/locations/*/agents/*/playbooks/*}"
59    };
60    option (google.api.method_signature) = "name";
61  }
62
63  // Returns a list of playbooks in the specified agent.
64  rpc ListPlaybooks(ListPlaybooksRequest) returns (ListPlaybooksResponse) {
65    option (google.api.http) = {
66      get: "/v3beta1/{parent=projects/*/locations/*/agents/*}/playbooks"
67    };
68    option (google.api.method_signature) = "parent";
69  }
70
71  // Retrieves the specified Playbook.
72  rpc GetPlaybook(GetPlaybookRequest) returns (Playbook) {
73    option (google.api.http) = {
74      get: "/v3beta1/{name=projects/*/locations/*/agents/*/playbooks/*}"
75    };
76    option (google.api.method_signature) = "name";
77  }
78
79  // Updates the specified Playbook.
80  rpc UpdatePlaybook(UpdatePlaybookRequest) returns (Playbook) {
81    option (google.api.http) = {
82      patch: "/v3beta1/{playbook.name=projects/*/locations/*/agents/*/playbooks/*}"
83      body: "playbook"
84    };
85    option (google.api.method_signature) = "playbook,update_mask";
86  }
87
88  // Creates a version for the specified Playbook.
89  rpc CreatePlaybookVersion(CreatePlaybookVersionRequest)
90      returns (PlaybookVersion) {
91    option (google.api.http) = {
92      post: "/v3beta1/{parent=projects/*/locations/*/agents/*/playbooks/*}/versions"
93      body: "playbook_version"
94    };
95    option (google.api.method_signature) = "parent,playbook_version";
96  }
97
98  // Retrieves the specified version of the Playbook.
99  rpc GetPlaybookVersion(GetPlaybookVersionRequest) returns (PlaybookVersion) {
100    option (google.api.http) = {
101      get: "/v3beta1/{name=projects/*/locations/*/agents/*/playbooks/*/versions/*}"
102    };
103    option (google.api.method_signature) = "name";
104  }
105
106  // Lists versions for the specified Playbook.
107  rpc ListPlaybookVersions(ListPlaybookVersionsRequest)
108      returns (ListPlaybookVersionsResponse) {
109    option (google.api.http) = {
110      get: "/v3beta1/{parent=projects/*/locations/*/agents/*/playbooks/*}/versions"
111    };
112    option (google.api.method_signature) = "parent";
113  }
114
115  // Deletes the specified version of the Playbook.
116  rpc DeletePlaybookVersion(DeletePlaybookVersionRequest)
117      returns (google.protobuf.Empty) {
118    option (google.api.http) = {
119      delete: "/v3beta1/{name=projects/*/locations/*/agents/*/playbooks/*/versions/*}"
120    };
121    option (google.api.method_signature) = "name";
122  }
123}
124
125// The request message for
126// [Playbooks.CreatePlaybook][google.cloud.dialogflow.cx.v3beta1.Playbooks.CreatePlaybook].
127message CreatePlaybookRequest {
128  // Required. The agent to create a playbook for.
129  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
130  string parent = 1 [
131    (google.api.field_behavior) = REQUIRED,
132    (google.api.resource_reference) = {
133      child_type: "dialogflow.googleapis.com/Playbook"
134    }
135  ];
136
137  // Required. The playbook to create.
138  Playbook playbook = 2 [(google.api.field_behavior) = REQUIRED];
139}
140
141// The request message for
142// [Playbooks.DeletePlaybook][google.cloud.dialogflow.cx.v3beta1.Playbooks.DeletePlaybook].
143message DeletePlaybookRequest {
144  // Required. The name of the playbook to delete.
145  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
146  // ID>/playbooks/<Playbook ID>`.
147  string name = 1 [
148    (google.api.field_behavior) = REQUIRED,
149    (google.api.resource_reference) = {
150      type: "dialogflow.googleapis.com/Playbook"
151    }
152  ];
153}
154
155// The request message for
156// [Playbooks.ListPlaybooks][google.cloud.dialogflow.cx.v3beta1.Playbooks.ListPlaybooks].
157message ListPlaybooksRequest {
158  // Required. The agent to list playbooks from.
159  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
160  string parent = 1 [
161    (google.api.field_behavior) = REQUIRED,
162    (google.api.resource_reference) = {
163      child_type: "dialogflow.googleapis.com/Playbook"
164    }
165  ];
166
167  // The maximum number of items to return in a single page. By default 100 and
168  // at most 1000.
169  int32 page_size = 2;
170
171  // The next_page_token value returned from a previous list request.
172  string page_token = 3;
173}
174
175// The response message for
176// [Playbooks.ListPlaybooks][google.cloud.dialogflow.cx.v3beta1.Playbooks.ListPlaybooks].
177message ListPlaybooksResponse {
178  // The list of playbooks. There will be a maximum number of items returned
179  // based on the page_size field in the request.
180  repeated Playbook playbooks = 1;
181
182  // Token to retrieve the next page of results, or empty if there are no more
183  // results in the list.
184  string next_page_token = 2;
185}
186
187// The request message for
188// [Playbooks.GetPlaybook][google.cloud.dialogflow.cx.v3beta1.Playbooks.GetPlaybook].
189message GetPlaybookRequest {
190  // Required. The name of the playbook.
191  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
192  // ID>/playbooks/<Playbook ID>`.
193  string name = 1 [
194    (google.api.field_behavior) = REQUIRED,
195    (google.api.resource_reference) = {
196      type: "dialogflow.googleapis.com/Playbook"
197    }
198  ];
199}
200
201// The request message for
202// [Playbooks.UpdatePlaybook][google.cloud.dialogflow.cx.v3beta1.Playbooks.UpdatePlaybook].
203message UpdatePlaybookRequest {
204  // Required. The playbook to update.
205  Playbook playbook = 1 [(google.api.field_behavior) = REQUIRED];
206
207  // The mask to control which fields get updated. If the mask is not present,
208  // all fields will be updated.
209  google.protobuf.FieldMask update_mask = 2;
210}
211
212// Playbook is the basic building block to instruct the LLM how to execute a
213// certain task.
214//
215// A playbook consists of a goal to accomplish, an optional list of step by step
216// instructions (the step instruction may refers to name of the custom or
217// default plugin tools to use) to perform the task,
218// a list of contextual input data to be passed in at the beginning of the
219// invoked, and a list of output parameters to store the playbook result.
220message Playbook {
221  option (google.api.resource) = {
222    type: "dialogflow.googleapis.com/Playbook"
223    pattern: "projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook}"
224  };
225
226  // Message of single step execution.
227  message Step {
228    // Instruction on how to execute current step.
229    oneof instruction {
230      // Step instruction in text format.
231      string text = 1;
232    }
233
234    // Sub-processing needed to execute the current step.
235    repeated Step steps = 2;
236  }
237
238  // The unique identifier of the playbook.
239  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
240  // ID>/playbooks/<Playbook ID>`.
241  string name = 1;
242
243  // Required. The human-readable name of the playbook, unique within an agent.
244  string display_name = 2 [(google.api.field_behavior) = REQUIRED];
245
246  // Required. High level description of the goal the playbook intend to
247  // accomplish.
248  string goal = 3 [(google.api.field_behavior) = REQUIRED];
249
250  // Optional. Defined structured input parameters for this playbook.
251  repeated google.cloud.dialogflow.cx.v3beta1.ParameterDefinition
252      input_parameter_definitions = 5 [(google.api.field_behavior) = OPTIONAL];
253
254  // Optional. Defined structured output parameters for this playbook.
255  repeated google.cloud.dialogflow.cx.v3beta1.ParameterDefinition
256      output_parameter_definitions = 6 [(google.api.field_behavior) = OPTIONAL];
257
258  // Ordered list of step by step execution instructions to accomplish
259  // target goal.
260  repeated Step steps = 4;
261
262  // Output only. Estimated number of tokes current playbook takes when sent to
263  // the LLM.
264  int64 token_count = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
265
266  // Output only. The timestamp of initial playbook creation.
267  google.protobuf.Timestamp create_time = 9
268      [(google.api.field_behavior) = OUTPUT_ONLY];
269
270  // Output only. Last time the playbook version was updated.
271  google.protobuf.Timestamp update_time = 10
272      [(google.api.field_behavior) = OUTPUT_ONLY];
273
274  // Output only. The resource name of other playbooks referenced by the current
275  // playbook in the instructions.
276  repeated string referenced_playbooks = 11 [
277    (google.api.field_behavior) = OUTPUT_ONLY,
278    (google.api.resource_reference) = {
279      type: "dialogflow.googleapis.com/Playbook"
280    }
281  ];
282
283  // Output only. The resource name of flows referenced by the current playbook
284  // in the instructions.
285  repeated string referenced_flows = 12 [
286    (google.api.field_behavior) = OUTPUT_ONLY,
287    (google.api.resource_reference) = { type: "dialogflow.googleapis.com/Flow" }
288  ];
289
290  // Optional. The resource name of tools referenced by the current playbook in
291  // the instructions. If not provided explicitly, they are will
292  // be implied using the tool being referenced in goal and steps.
293  repeated string referenced_tools = 13 [
294    (google.api.field_behavior) = OPTIONAL,
295    (google.api.resource_reference) = { type: "dialogflow.googleapis.com/Tool" }
296  ];
297
298  // Optional. Llm model settings for the playbook.
299  LlmModelSettings llm_model_settings = 14
300      [(google.api.field_behavior) = OPTIONAL];
301}
302
303// The request message for
304// [Playbooks.CreatePlaybookVersion][google.cloud.dialogflow.cx.v3beta1.Playbooks.CreatePlaybookVersion].
305message CreatePlaybookVersionRequest {
306  // Required. The playbook to create a version for.
307  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
308  // ID>/playbooks/<Playbook ID>`.
309  string parent = 1 [
310    (google.api.field_behavior) = REQUIRED,
311    (google.api.resource_reference) = {
312      child_type: "dialogflow.googleapis.com/PlaybookVersion"
313    }
314  ];
315
316  // Required. The playbook version to create.
317  PlaybookVersion playbook_version = 2 [(google.api.field_behavior) = REQUIRED];
318}
319
320// Playbook version is a snapshot of the playbook at certain timestamp.
321message PlaybookVersion {
322  option (google.api.resource) = {
323    type: "dialogflow.googleapis.com/PlaybookVersion"
324    pattern: "projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook}/versions/{version}"
325    plural: "playbookVersions"
326    singular: "playbookVersion"
327  };
328
329  // The unique identifier of the playbook version.
330  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
331  // ID>/playbooks/<Playbook ID>/versions/<Version ID>`.
332  string name = 1;
333
334  // Optional. The description of the playbook version.
335  string description = 2 [(google.api.field_behavior) = OPTIONAL];
336
337  // Output only. Snapshot of the playbook when the playbook version is created.
338  Playbook playbook = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
339
340  // Output only. Snapshot of the examples belonging to the playbook when the
341  // playbook version is created.
342  repeated Example examples = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
343
344  // Output only. Last time the playbook version was created or modified.
345  google.protobuf.Timestamp update_time = 5
346      [(google.api.field_behavior) = OUTPUT_ONLY];
347}
348
349// The request message for
350// [Playbooks.GetPlaybookVersion][google.cloud.dialogflow.cx.v3beta1.Playbooks.GetPlaybookVersion].
351message GetPlaybookVersionRequest {
352  // Required. The name of the playbook version.
353  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
354  // ID>/playbooks/<Playbook ID>/versions/<Version ID>`.
355  string name = 1 [
356    (google.api.field_behavior) = REQUIRED,
357    (google.api.resource_reference) = {
358      type: "dialogflow.googleapis.com/PlaybookVersion"
359    }
360  ];
361}
362
363// The request message for
364// [Playbooks.ListPlaybookVersions][google.cloud.dialogflow.cx.v3beta1.Playbooks.ListPlaybookVersions].
365message ListPlaybookVersionsRequest {
366  // Required. The playbook to list versions for.
367  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
368  // ID>/playbooks/<Playbook ID>`.
369  string parent = 1 [
370    (google.api.field_behavior) = REQUIRED,
371    (google.api.resource_reference) = {
372      child_type: "dialogflow.googleapis.com/PlaybookVersion"
373    }
374  ];
375
376  // Optional. The maximum number of items to return in a single page. By
377  // default 100 and at most 1000.
378  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
379
380  // Optional. The next_page_token value returned from a previous list request.
381  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
382}
383
384// The response message for
385// [Playbooks.ListPlaybookVersions][google.cloud.dialogflow.cx.v3beta1.Playbooks.ListPlaybookVersions].
386message ListPlaybookVersionsResponse {
387  // The list of playbook version. There will be a maximum number of items
388  // returned based on the page_size field in the request.
389  repeated PlaybookVersion playbook_versions = 1;
390
391  // Token to retrieve the next page of results, or empty if there are no more
392  // results in the list.
393  string next_page_token = 2;
394}
395
396// The request message for
397// [Playbooks.DeletePlaybookVersion][google.cloud.dialogflow.cx.v3beta1.Playbooks.DeletePlaybookVersion].
398message DeletePlaybookVersionRequest {
399  // Required. The name of the playbook version to delete.
400  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
401  // ID>/playbooks/<Playbook ID>/versions/<Version ID>`.
402  string name = 1 [
403    (google.api.field_behavior) = REQUIRED,
404    (google.api.resource_reference) = {
405      type: "dialogflow.googleapis.com/PlaybookVersion"
406    }
407  ];
408}
409