experiment.proto 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503
  1. // Copyright 2022 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.cloud.dialogflow.cx.v3beta1;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/resource.proto";
  20. import "google/protobuf/duration.proto";
  21. import "google/protobuf/empty.proto";
  22. import "google/protobuf/field_mask.proto";
  23. import "google/protobuf/timestamp.proto";
  24. option cc_enable_arenas = true;
  25. option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3Beta1";
  26. option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1;cx";
  27. option java_multiple_files = true;
  28. option java_outer_classname = "ExperimentProto";
  29. option java_package = "com.google.cloud.dialogflow.cx.v3beta1";
  30. option objc_class_prefix = "DF";
  31. option ruby_package = "Google::Cloud::Dialogflow::CX::V3beta1";
  32. // Service for managing [Experiments][google.cloud.dialogflow.cx.v3beta1.Experiment].
  33. service Experiments {
  34. option (google.api.default_host) = "dialogflow.googleapis.com";
  35. option (google.api.oauth_scopes) =
  36. "https://www.googleapis.com/auth/cloud-platform,"
  37. "https://www.googleapis.com/auth/dialogflow";
  38. // Returns the list of all experiments in the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment].
  39. rpc ListExperiments(ListExperimentsRequest) returns (ListExperimentsResponse) {
  40. option (google.api.http) = {
  41. get: "/v3beta1/{parent=projects/*/locations/*/agents/*/environments/*}/experiments"
  42. };
  43. option (google.api.method_signature) = "parent";
  44. }
  45. // Retrieves the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment].
  46. rpc GetExperiment(GetExperimentRequest) returns (Experiment) {
  47. option (google.api.http) = {
  48. get: "/v3beta1/{name=projects/*/locations/*/agents/*/environments/*/experiments/*}"
  49. };
  50. option (google.api.method_signature) = "name";
  51. }
  52. // Creates an [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment] in the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment].
  53. rpc CreateExperiment(CreateExperimentRequest) returns (Experiment) {
  54. option (google.api.http) = {
  55. post: "/v3beta1/{parent=projects/*/locations/*/agents/*/environments/*}/experiments"
  56. body: "experiment"
  57. };
  58. option (google.api.method_signature) = "parent,experiment";
  59. }
  60. // Updates the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment].
  61. rpc UpdateExperiment(UpdateExperimentRequest) returns (Experiment) {
  62. option (google.api.http) = {
  63. patch: "/v3beta1/{experiment.name=projects/*/locations/*/agents/*/environments/*/experiments/*}"
  64. body: "experiment"
  65. };
  66. option (google.api.method_signature) = "experiment,update_mask";
  67. }
  68. // Deletes the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment].
  69. rpc DeleteExperiment(DeleteExperimentRequest) returns (google.protobuf.Empty) {
  70. option (google.api.http) = {
  71. delete: "/v3beta1/{name=projects/*/locations/*/agents/*/environments/*/experiments/*}"
  72. };
  73. option (google.api.method_signature) = "name";
  74. }
  75. // Starts the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment]. This rpc only changes the state of
  76. // experiment from PENDING to RUNNING.
  77. rpc StartExperiment(StartExperimentRequest) returns (Experiment) {
  78. option (google.api.http) = {
  79. post: "/v3beta1/{name=projects/*/locations/*/agents/*/environments/*/experiments/*}:start"
  80. body: "*"
  81. };
  82. option (google.api.method_signature) = "name";
  83. }
  84. // Stops the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment]. This rpc only changes the state of
  85. // experiment from RUNNING to DONE.
  86. rpc StopExperiment(StopExperimentRequest) returns (Experiment) {
  87. option (google.api.http) = {
  88. post: "/v3beta1/{name=projects/*/locations/*/agents/*/environments/*/experiments/*}:stop"
  89. body: "*"
  90. };
  91. option (google.api.method_signature) = "name";
  92. }
  93. }
  94. // Represents an experiment in an environment.
  95. message Experiment {
  96. option (google.api.resource) = {
  97. type: "dialogflow.googleapis.com/Experiment"
  98. pattern: "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/experiments/{experiment}"
  99. };
  100. // The state of the experiment.
  101. enum State {
  102. // State unspecified.
  103. STATE_UNSPECIFIED = 0;
  104. // The experiment is created but not started yet.
  105. DRAFT = 1;
  106. // The experiment is running.
  107. RUNNING = 2;
  108. // The experiment is done.
  109. DONE = 3;
  110. // The experiment with auto-rollout enabled has failed.
  111. ROLLOUT_FAILED = 4;
  112. }
  113. // Definition of the experiment.
  114. message Definition {
  115. // The condition defines which subset of sessions are selected for
  116. // this experiment. If not specified, all sessions are eligible. E.g.
  117. // "query_input.language_code=en" See the [conditions
  118. // reference](https://cloud.google.com/dialogflow/cx/docs/reference/condition).
  119. string condition = 1;
  120. // The variants of the experiment. We currently only support single variant
  121. // experiment.
  122. oneof variants {
  123. // The flow versions as the variants of this experiment.
  124. VersionVariants version_variants = 2;
  125. }
  126. }
  127. // The inference result which includes an objective metric to optimize and the
  128. // confidence interval.
  129. message Result {
  130. // Types of ratio-based metric for Dialogflow experiment.
  131. enum MetricType {
  132. // Metric unspecified.
  133. METRIC_UNSPECIFIED = 0;
  134. // Percentage of contained sessions without user calling back in 24 hours.
  135. CONTAINED_SESSION_NO_CALLBACK_RATE = 1;
  136. // Percentage of sessions that were handed to a human agent.
  137. LIVE_AGENT_HANDOFF_RATE = 2;
  138. // Percentage of sessions with the same user calling back.
  139. CALLBACK_SESSION_RATE = 3;
  140. // Percentage of sessions where user hung up.
  141. ABANDONED_SESSION_RATE = 4;
  142. // Percentage of sessions reached Dialogflow 'END_PAGE' or
  143. // 'END_SESSION'.
  144. SESSION_END_RATE = 5;
  145. }
  146. // types of count-based metric for Dialogflow experiment.
  147. enum CountType {
  148. // Count type unspecified.
  149. COUNT_TYPE_UNSPECIFIED = 0;
  150. // Total number of occurrences of a 'NO_MATCH'.
  151. TOTAL_NO_MATCH_COUNT = 1;
  152. // Total number of turn counts.
  153. TOTAL_TURN_COUNT = 2;
  154. // Average turn count in a session.
  155. AVERAGE_TURN_COUNT = 3;
  156. }
  157. // A confidence interval is a range of possible values for the experiment
  158. // objective you are trying to measure.
  159. message ConfidenceInterval {
  160. // The confidence level used to construct the interval, i.e. there is X%
  161. // chance that the true value is within this interval.
  162. double confidence_level = 1;
  163. // The percent change between an experiment metric's value and the value
  164. // for its control.
  165. double ratio = 2;
  166. // Lower bound of the interval.
  167. double lower_bound = 3;
  168. // Upper bound of the interval.
  169. double upper_bound = 4;
  170. }
  171. // Metric and corresponding confidence intervals.
  172. message Metric {
  173. // Ratio-based metric type. Only one of type or count_type is specified in
  174. // each Metric.
  175. MetricType type = 1;
  176. // Count-based metric type. Only one of type or count_type is specified in
  177. // each Metric.
  178. CountType count_type = 5;
  179. // The actual value of the metric.
  180. oneof value {
  181. // Ratio value of a metric.
  182. double ratio = 2;
  183. // Count value of a metric.
  184. double count = 4;
  185. }
  186. // The probability that the treatment is better than all other treatments
  187. // in the experiment
  188. ConfidenceInterval confidence_interval = 3;
  189. }
  190. // Version variant and associated metrics.
  191. message VersionMetrics {
  192. // The name of the flow [Version][google.cloud.dialogflow.cx.v3beta1.Version].
  193. // Format: `projects/<Project ID>/locations/<Location
  194. // ID>/agents/<Agent ID>/flows/<Flow ID>/versions/<Version ID>`.
  195. string version = 1 [(google.api.resource_reference) = {
  196. type: "dialogflow.googleapis.com/Version"
  197. }];
  198. // The metrics and corresponding confidence intervals in the inference
  199. // result.
  200. repeated Metric metrics = 2;
  201. // Number of sessions that were allocated to this version.
  202. int32 session_count = 3;
  203. }
  204. // Version variants and metrics.
  205. repeated VersionMetrics version_metrics = 1;
  206. // The last time the experiment's stats data was updated. Will have default
  207. // value if stats have never been computed for this experiment.
  208. google.protobuf.Timestamp last_update_time = 2;
  209. }
  210. // The name of the experiment.
  211. // Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent
  212. // ID>/environments/<Environment ID>/experiments/<Experiment ID>..
  213. string name = 1;
  214. // Required. The human-readable name of the experiment (unique in an environment). Limit
  215. // of 64 characters.
  216. string display_name = 2 [(google.api.field_behavior) = REQUIRED];
  217. // The human-readable description of the experiment.
  218. string description = 3;
  219. // The current state of the experiment.
  220. // Transition triggered by Experiments.StartExperiment: DRAFT->RUNNING.
  221. // Transition triggered by Experiments.CancelExperiment: DRAFT->DONE or
  222. // RUNNING->DONE.
  223. State state = 4;
  224. // The definition of the experiment.
  225. Definition definition = 5;
  226. // The configuration for auto rollout. If set, there should be exactly two
  227. // variants in the experiment (control variant being the default version of
  228. // the flow), the traffic allocation for the non-control variant will
  229. // gradually increase to 100% when conditions are met, and eventually
  230. // replace the control variant to become the default version of the flow.
  231. RolloutConfig rollout_config = 14;
  232. // State of the auto rollout process.
  233. RolloutState rollout_state = 15;
  234. // The reason why rollout has failed. Should only be set when state is
  235. // ROLLOUT_FAILED.
  236. string rollout_failure_reason = 16;
  237. // Inference result of the experiment.
  238. Result result = 6;
  239. // Creation time of this experiment.
  240. google.protobuf.Timestamp create_time = 7;
  241. // Start time of this experiment.
  242. google.protobuf.Timestamp start_time = 8;
  243. // End time of this experiment.
  244. google.protobuf.Timestamp end_time = 9;
  245. // Last update time of this experiment.
  246. google.protobuf.Timestamp last_update_time = 10;
  247. // Maximum number of days to run the experiment. If auto-rollout is
  248. // not enabled, default value and maximum will be 30 days. If auto-rollout is
  249. // enabled, default value and maximum will be 6 days.
  250. google.protobuf.Duration experiment_length = 11;
  251. // The history of updates to the experiment variants.
  252. repeated VariantsHistory variants_history = 12;
  253. }
  254. // A list of flow version variants.
  255. message VersionVariants {
  256. // A single flow version with specified traffic allocation.
  257. message Variant {
  258. // The name of the flow version.
  259. // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
  260. // ID>/flows/<Flow ID>/versions/<Version ID>`.
  261. string version = 1;
  262. // Percentage of the traffic which should be routed to this
  263. // version of flow. Traffic allocation for a single flow must sum up to 1.0.
  264. float traffic_allocation = 2;
  265. // Whether the variant is for the control group.
  266. bool is_control_group = 3;
  267. }
  268. // A list of flow version variants.
  269. repeated Variant variants = 1;
  270. }
  271. // The configuration for auto rollout.
  272. message RolloutConfig {
  273. // A single rollout step with specified traffic allocation.
  274. message RolloutStep {
  275. // The name of the rollout step;
  276. string display_name = 1;
  277. // The percentage of traffic allocated to the flow version of this rollout
  278. // step. (0%, 100%].
  279. int32 traffic_percent = 2;
  280. // The minimum time that this step should last. Should be longer than 1
  281. // hour. If not set, the default minimum duration for each step will be 1
  282. // hour.
  283. google.protobuf.Duration min_duration = 3;
  284. }
  285. // Steps to roll out a flow version. Steps should be sorted by percentage in
  286. // ascending order.
  287. repeated RolloutStep rollout_steps = 1;
  288. // The conditions that are used to evaluate the success of a rollout
  289. // step. If not specified, all rollout steps will proceed to the next one
  290. // unless failure conditions are met. E.g. "containment_rate > 60% AND
  291. // callback_rate < 20%". See the [conditions
  292. // reference](https://cloud.google.com/dialogflow/cx/docs/reference/condition).
  293. string rollout_condition = 2;
  294. // The conditions that are used to evaluate the failure of a rollout
  295. // step. If not specified, no rollout steps will fail. E.g. "containment_rate
  296. // < 10% OR average_turn_count < 3". See the [conditions
  297. // reference](https://cloud.google.com/dialogflow/cx/docs/reference/condition).
  298. string failure_condition = 3;
  299. }
  300. // State of the auto-rollout process.
  301. message RolloutState {
  302. // Display name of the current auto rollout step.
  303. string step = 1;
  304. // Index of the current step in the auto rollout steps list.
  305. int32 step_index = 3;
  306. // Start time of the current step.
  307. google.protobuf.Timestamp start_time = 2;
  308. }
  309. // The history of variants update.
  310. message VariantsHistory {
  311. // The variants updated. We currently only support single variant
  312. // experiment.
  313. oneof variants {
  314. // The flow versions as the variants.
  315. VersionVariants version_variants = 1;
  316. }
  317. // Update time of the variants.
  318. google.protobuf.Timestamp update_time = 2;
  319. }
  320. // The request message for [Experiments.ListExperiments][google.cloud.dialogflow.cx.v3beta1.Experiments.ListExperiments].
  321. message ListExperimentsRequest {
  322. // Required. The [Environment][google.cloud.dialogflow.cx.v3beta1.Environment] to list all environments for.
  323. // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
  324. // ID>/environments/<Environment ID>`.
  325. string parent = 1 [
  326. (google.api.field_behavior) = REQUIRED,
  327. (google.api.resource_reference) = {
  328. child_type: "dialogflow.googleapis.com/Experiment"
  329. }
  330. ];
  331. // The maximum number of items to return in a single page. By default 20 and
  332. // at most 100.
  333. int32 page_size = 2;
  334. // The next_page_token value returned from a previous list request.
  335. string page_token = 3;
  336. }
  337. // The response message for [Experiments.ListExperiments][google.cloud.dialogflow.cx.v3beta1.Experiments.ListExperiments].
  338. message ListExperimentsResponse {
  339. // The list of experiments. There will be a maximum number of items
  340. // returned based on the page_size field in the request. The list may in some
  341. // cases be empty or contain fewer entries than page_size even if this isn't
  342. // the last page.
  343. repeated Experiment experiments = 1;
  344. // Token to retrieve the next page of results, or empty if there are no more
  345. // results in the list.
  346. string next_page_token = 2;
  347. }
  348. // The request message for [Experiments.GetExperiment][google.cloud.dialogflow.cx.v3beta1.Experiments.GetExperiment].
  349. message GetExperimentRequest {
  350. // Required. The name of the [Environment][google.cloud.dialogflow.cx.v3beta1.Environment].
  351. // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
  352. // ID>/environments/<Environment ID>/experiments/<Experiment ID>`.
  353. string name = 1 [
  354. (google.api.field_behavior) = REQUIRED,
  355. (google.api.resource_reference) = {
  356. type: "dialogflow.googleapis.com/Experiment"
  357. }
  358. ];
  359. }
  360. // The request message for [Experiments.CreateExperiment][google.cloud.dialogflow.cx.v3beta1.Experiments.CreateExperiment].
  361. message CreateExperimentRequest {
  362. // Required. The [Agent][google.cloud.dialogflow.cx.v3beta1.Agent] to create an [Environment][google.cloud.dialogflow.cx.v3beta1.Environment] for.
  363. // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
  364. // ID>/environments/<Environment ID>`.
  365. string parent = 1 [
  366. (google.api.field_behavior) = REQUIRED,
  367. (google.api.resource_reference) = {
  368. child_type: "dialogflow.googleapis.com/Experiment"
  369. }
  370. ];
  371. // Required. The experiment to create.
  372. Experiment experiment = 2 [(google.api.field_behavior) = REQUIRED];
  373. }
  374. // The request message for [Experiments.UpdateExperiment][google.cloud.dialogflow.cx.v3beta1.Experiments.UpdateExperiment].
  375. message UpdateExperimentRequest {
  376. // Required. The experiment to update.
  377. Experiment experiment = 1 [(google.api.field_behavior) = REQUIRED];
  378. // Required. The mask to control which fields get updated.
  379. google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
  380. }
  381. // The request message for [Experiments.DeleteExperiment][google.cloud.dialogflow.cx.v3beta1.Experiments.DeleteExperiment].
  382. message DeleteExperimentRequest {
  383. // Required. The name of the [Environment][google.cloud.dialogflow.cx.v3beta1.Environment] to delete.
  384. // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
  385. // ID>/environments/<Environment ID>/experiments/<Experiment ID>`.
  386. string name = 1 [
  387. (google.api.field_behavior) = REQUIRED,
  388. (google.api.resource_reference) = {
  389. type: "dialogflow.googleapis.com/Experiment"
  390. }
  391. ];
  392. }
  393. // The request message for [Experiments.StartExperiment][google.cloud.dialogflow.cx.v3beta1.Experiments.StartExperiment].
  394. message StartExperimentRequest {
  395. // Required. Resource name of the experiment to start.
  396. // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
  397. // ID>/environments/<Environment ID>/experiments/<Experiment ID>`.
  398. string name = 1 [
  399. (google.api.field_behavior) = REQUIRED,
  400. (google.api.resource_reference) = {
  401. type: "dialogflow.googleapis.com/Experiment"
  402. }
  403. ];
  404. }
  405. // The request message for [Experiments.StopExperiment][google.cloud.dialogflow.cx.v3beta1.Experiments.StopExperiment].
  406. message StopExperimentRequest {
  407. // Required. Resource name of the experiment to stop.
  408. // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
  409. // ID>/environments/<Environment ID>/experiments/<Experiment ID>`.
  410. string name = 1 [
  411. (google.api.field_behavior) = REQUIRED,
  412. (google.api.resource_reference) = {
  413. type: "dialogflow.googleapis.com/Experiment"
  414. }
  415. ];
  416. }