xref: /aosp_15_r20/external/googleapis/google/actions/sdk/v2/interactionmodel/slot.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2020 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.actions.sdk.v2.interactionmodel;
18
19import "google/actions/sdk/v2/interactionmodel/event_handler.proto";
20import "google/actions/sdk/v2/interactionmodel/type/class_reference.proto";
21import "google/api/field_behavior.proto";
22import "google/protobuf/struct.proto";
23
24option go_package = "google.golang.org/genproto/googleapis/actions/sdk/v2/interactionmodel;interactionmodel";
25option java_multiple_files = true;
26option java_outer_classname = "SlotProto";
27option java_package = "com.google.actions.sdk.v2.interactionmodel";
28
29// Configuration for a slot. Slots are single units of data that can be filled
30// through natural language (ie. intent parameters), session parameters, and
31// other sources.
32message Slot {
33  // A single place where slot prompts are defined.
34  message PromptSettings {
35    // Prompt for the slot value itself. Example: "What size did you want?"
36    EventHandler initial_prompt = 1;
37
38    // Prompt to give when the user's input does not match the expected
39    // value type for the slot for the first time. Example: "Sorry, I
40    // didn't get that."
41    EventHandler no_match_prompt1 = 2;
42
43    // Prompt to give when the user's input does not match the expected
44    // value type for the slot for the second time. Example: "Sorry, I
45    // didn't get that."
46    EventHandler no_match_prompt2 = 3;
47
48    // Prompt to give when the user's input does not match the expected
49    // value type for the slot for the last time. Example: "Sorry, I
50    // didn't get that."
51    EventHandler no_match_final_prompt = 4;
52
53    // Prompt to give when the user does not provide an input for the first
54    // time. Example: "Sorry, I didn't get that."
55    EventHandler no_input_prompt1 = 5;
56
57    // Prompt to give when the user does not provide an input for the second
58    // time. Example: "Sorry, I didn't get that."
59    EventHandler no_input_prompt2 = 6;
60
61    // Prompt to give when the user does not provide an input for the last
62    // time. Example: "Sorry, I didn't get that."
63    EventHandler no_input_final_prompt = 7;
64  }
65
66  // Message describing the commit behavior associated with the slot after it
67  // has been successfully filled.
68  message CommitBehavior {
69    // The session parameter to write the slot value after it is filled. Note
70    // that nested paths are not currently supported. "$$" is used to write the
71    // slot value to a session parameter with same name as the slot.
72    // Eg: write_session_param = "fruit" corresponds to "$session.params.fruit".
73    // write_session_param = "ticket" corresponds to "$session.params.ticket".
74    string write_session_param = 1;
75  }
76
77  // Configuration to populate a default value for this slot.
78  message DefaultValue {
79    // Optional. The session parameter to be used to initialize the slot value, if it has
80    // a non-empty value. The type of the value must match the type of the slot.
81    // Note that nested paths are not currently supported.
82    // Eg: `session_param = "fruit"` corresponds to `$session.params.fruit`.
83    // `session_param = "ticket"` corresponds to `$session.params.ticket`.
84    string session_param = 1 [(google.api.field_behavior) = OPTIONAL];
85
86    // Optional. Constant default value for the slot. This will only be used if a value
87    // for this slot was not populated through the `session_param`. The
88    // type for this value must match the type of the slot.
89    google.protobuf.Value constant = 2 [(google.api.field_behavior) = OPTIONAL];
90  }
91
92  // Required. Name of the slot.
93  string name = 1 [(google.api.field_behavior) = REQUIRED];
94
95  // Required. Declares the data type of this slot.
96  google.actions.sdk.v2.interactionmodel.type.ClassReference type = 2 [(google.api.field_behavior) = REQUIRED];
97
98  // Optional. Indicates whether the slot is required to be filled before
99  // advancing. Required slots that are not filled will trigger a customizable
100  // prompt to the user.
101  bool required = 3 [(google.api.field_behavior) = OPTIONAL];
102
103  // Optional. Registers Prompts for different stages of slot filling.
104  PromptSettings prompt_settings = 4 [(google.api.field_behavior) = OPTIONAL];
105
106  // Optional. Commit behavior associated with the slot.
107  CommitBehavior commit_behavior = 5 [(google.api.field_behavior) = OPTIONAL];
108
109  // Optional. Additional configuration associated with the slot which is
110  // used for filling the slot. The format of the config is specific to the
111  // type of the slot. Resource references to user or session parameter can be
112  // added to this config. This config is needed for filling slots related to
113  // transactions and user engagement.
114  //
115  // Example:
116  //  For a slot of type actions.type.CompletePurchaseValue, the following
117  //  config proposes a digital good order with a reference to a client defined
118  //  session parameter `userSelectedSkuId`:
119  //
120  //    {
121  //      "@type": "type.googleapis.com/
122  //                  google.actions.transactions.v3.CompletePurchaseValueSpec",
123  //      "skuId": {
124  //        "skuType": "SKU_TYPE_IN_APP",
125  //        "id": "$session.params.userSelectedSkuId",
126  //        "packageName": "com.example.company"
127  //      }
128  //    }
129  google.protobuf.Value config = 6 [(google.api.field_behavior) = OPTIONAL];
130
131  // Optional. Configuration to populate a default value for this slot.
132  DefaultValue default_value = 7 [(google.api.field_behavior) = OPTIONAL];
133}
134