actions_testing.proto 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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. syntax = "proto3";
  15. package google.actions.sdk.v2;
  16. import "google/actions/sdk/v2/conversation/intent.proto";
  17. import "google/actions/sdk/v2/conversation/prompt/content/canvas.proto";
  18. import "google/actions/sdk/v2/conversation/prompt/prompt.proto";
  19. import "google/actions/sdk/v2/event_logs.proto";
  20. import "google/api/annotations.proto";
  21. import "google/api/client.proto";
  22. import "google/api/field_behavior.proto";
  23. import "google/protobuf/empty.proto";
  24. import "google/type/latlng.proto";
  25. option go_package = "google.golang.org/genproto/googleapis/actions/sdk/v2;sdk";
  26. option java_multiple_files = true;
  27. option java_outer_classname = "ActionsTestingProto";
  28. option java_package = "com.google.actions.sdk.v2";
  29. // Actions Testing API which allows developers to run automated tests.
  30. service ActionsTesting {
  31. option (google.api.default_host) = "actions.googleapis.com";
  32. // Plays one round of the conversation.
  33. rpc SendInteraction(SendInteractionRequest) returns (SendInteractionResponse) {
  34. option (google.api.http) = {
  35. post: "/v2/{project=projects/*}:sendInteraction"
  36. body: "*"
  37. };
  38. }
  39. // Finds the intents that match a given query.
  40. rpc MatchIntents(MatchIntentsRequest) returns (MatchIntentsResponse) {
  41. option (google.api.http) = {
  42. post: "/v2/{project=projects/*}:matchIntents"
  43. body: "*"
  44. };
  45. option (google.api.method_signature) = "project,query,locale";
  46. }
  47. // Sets the Web & App Activity control on a service account.
  48. //
  49. // It is necessary to have this setting enabled in order to use call Actions.
  50. // The setting is originally disabled for service accounts, and it is
  51. // preserved until set to a different value. This means it only needs to be
  52. // enabled once per account (and not necessarily once per test), unless it is
  53. // later disabled.
  54. //
  55. // Returns an error if the caller is not a service account. User accounts can
  56. // change this setting via the Activity Controls page. See
  57. // https://support.google.com/websearch/answer/54068.
  58. rpc SetWebAndAppActivityControl(SetWebAndAppActivityControlRequest) returns (google.protobuf.Empty) {
  59. option (google.api.http) = {
  60. post: "/v2:setWebAndAppActivityControl"
  61. body: "*"
  62. };
  63. option (google.api.method_signature) = "enabled";
  64. }
  65. }
  66. // Request for playing a round of the conversation.
  67. message SendInteractionRequest {
  68. // Required. The project being tested, indicated by the Project ID.
  69. // Format: projects/{project}
  70. string project = 1 [(google.api.field_behavior) = REQUIRED];
  71. // Required. Input provided by the user.
  72. UserInput input = 2 [(google.api.field_behavior) = REQUIRED];
  73. // Required. Properties of the device used for interacting with the Action.
  74. DeviceProperties device_properties = 3 [(google.api.field_behavior) = REQUIRED];
  75. // Opaque token that must be passed as received from SendInteractionResponse
  76. // on the previous interaction. This can be left unset in order to start a new
  77. // conversation, either as the first interaction of a testing session or to
  78. // abandon a previous conversation and start a new one.
  79. string conversation_token = 4;
  80. }
  81. // User input provided on a conversation round.
  82. message UserInput {
  83. // Indicates the input source, typed query or voice query.
  84. enum InputType {
  85. // Unspecified input source.
  86. INPUT_TYPE_UNSPECIFIED = 0;
  87. // Query from a GUI interaction.
  88. TOUCH = 1;
  89. // Voice query.
  90. VOICE = 2;
  91. // Typed query.
  92. KEYBOARD = 3;
  93. // The action was triggered by a URL link.
  94. URL = 4;
  95. }
  96. // Content of the input sent by the user.
  97. string query = 1;
  98. // Type of the input.
  99. InputType type = 2;
  100. }
  101. // Properties of device relevant to a conversation round.
  102. message DeviceProperties {
  103. // Possible surfaces used to interact with the Action.
  104. // Additional values may be included in the future.
  105. enum Surface {
  106. // Default value. This value is unused.
  107. SURFACE_UNSPECIFIED = 0;
  108. // Speaker (e.g. Google Home).
  109. SPEAKER = 1;
  110. // Phone.
  111. PHONE = 2;
  112. // Allo Chat.
  113. ALLO = 3;
  114. // Smart Display Device.
  115. SMART_DISPLAY = 4;
  116. // KaiOS.
  117. KAI_OS = 5;
  118. }
  119. // Surface used for interacting with the Action.
  120. Surface surface = 1;
  121. // Device location such as latitude, longitude, and formatted address.
  122. Location location = 2;
  123. // Locale as set on the device.
  124. // The format should follow BCP 47: https://tools.ietf.org/html/bcp47
  125. // Examples: en, en-US, es-419 (more examples at
  126. // https://tools.ietf.org/html/bcp47#appendix-A).
  127. string locale = 3;
  128. // Time zone as set on the device.
  129. // The format should follow the IANA Time Zone Database, e.g.
  130. // "America/New_York": https://www.iana.org/time-zones
  131. string time_zone = 4;
  132. }
  133. // Container that represents a location.
  134. message Location {
  135. // Geo coordinates.
  136. // Requires the [DEVICE_PRECISE_LOCATION]
  137. // [google.actions.v2.Permission.DEVICE_PRECISE_LOCATION] permission.
  138. google.type.LatLng coordinates = 1;
  139. // Display address, e.g., "1600 Amphitheatre Pkwy, Mountain View, CA 94043".
  140. // Requires the [DEVICE_PRECISE_LOCATION]
  141. // [google.actions.v2.Permission.DEVICE_PRECISE_LOCATION] permission.
  142. string formatted_address = 2;
  143. // Zip code.
  144. // Requires the [DEVICE_PRECISE_LOCATION]
  145. // [google.actions.v2.Permission.DEVICE_PRECISE_LOCATION] or
  146. // [DEVICE_COARSE_LOCATION]
  147. // [google.actions.v2.Permission.DEVICE_COARSE_LOCATION] permission.
  148. string zip_code = 3;
  149. // City.
  150. // Requires the [DEVICE_PRECISE_LOCATION]
  151. // [google.actions.v2.Permission.DEVICE_PRECISE_LOCATION] or
  152. // [DEVICE_COARSE_LOCATION]
  153. // [google.actions.v2.Permission.DEVICE_COARSE_LOCATION] permission.
  154. string city = 4;
  155. }
  156. // Response to a round of the conversation.
  157. message SendInteractionResponse {
  158. // Output provided to the user.
  159. Output output = 1;
  160. // Diagnostics information that explains how the request was handled.
  161. Diagnostics diagnostics = 2;
  162. // Opaque token to be set on SendInteractionRequest on the next RPC call in
  163. // order to continue the same conversation.
  164. string conversation_token = 3;
  165. }
  166. // User-visible output to the conversation round.
  167. message Output {
  168. // Spoken response sent to user as a plain string.
  169. string text = 1;
  170. // Speech content produced by the Action. This may include markup elements
  171. // such as SSML.
  172. repeated string speech = 2;
  173. // Interactive Canvas content.
  174. google.actions.sdk.v2.conversation.Canvas canvas = 3;
  175. // State of the prompt at the end of the conversation round.
  176. // More information about the prompt:
  177. // https://developers.google.com/assistant/conversational/prompts
  178. google.actions.sdk.v2.conversation.Prompt actions_builder_prompt = 4;
  179. }
  180. // Diagnostics information related to the conversation round.
  181. message Diagnostics {
  182. // List of events with details about processing of the conversation round
  183. // throughout the stages of the Actions Builder interaction model.
  184. // Populated for Actions Builder & Actions SDK apps only.
  185. repeated ExecutionEvent actions_builder_events = 1;
  186. }
  187. // Request for finding matching intents.
  188. message MatchIntentsRequest {
  189. // Required. The project being tested, indicated by the Project ID.
  190. // Format: projects/{project}
  191. string project = 1 [(google.api.field_behavior) = REQUIRED];
  192. // Required. User query as plain text.
  193. string query = 2 [(google.api.field_behavior) = REQUIRED];
  194. // Required. Locale to use to evaluate the query, such as "en".
  195. // The format should follow BCP 47: https://tools.ietf.org/html/bcp47
  196. // See the list of supported languages in
  197. // https://developers.google.com/assistant/console/languages-locales
  198. string locale = 3 [(google.api.field_behavior) = REQUIRED];
  199. }
  200. // Response for finding matching intents.
  201. message MatchIntentsResponse {
  202. // Intents matched, ordered from most to least relevant. Only the first
  203. // 50 matches are returned.
  204. repeated google.actions.sdk.v2.conversation.Intent matched_intents = 1;
  205. }
  206. // Request for setting Web & App Activity preferences.
  207. message SetWebAndAppActivityControlRequest {
  208. // Whether the setting should be set to an enabled or disabled state.
  209. bool enabled = 1;
  210. }