prediction_service_messages.proto 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. // Copyright (c) 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. syntax = "proto2";
  5. option optimize_for = LITE_RUNTIME;
  6. package permissions;
  7. // Features that depend on the site that triggered the permission request.
  8. // Currently empty but added proactively for future versions.
  9. message SiteFeatures {}
  10. // Statistical features about client's interactions with permission prompts.
  11. // These features are computed on all permission actions that happened before
  12. // the current permission request.
  13. message StatsFeatures {
  14. // Average deny rate for the client.
  15. optional float avg_deny_rate = 1;
  16. // Average grant rate for the client.
  17. optional float avg_grant_rate = 2;
  18. // Average dismiss rate for the client.
  19. optional float avg_dismiss_rate = 3;
  20. // Average ignore rate for the client.
  21. optional float avg_ignore_rate = 4;
  22. // Number of permission prompts seen by the client.
  23. optional int32 prompts_count = 5;
  24. }
  25. // Features representing the overall (not permission-specific) client state at
  26. // the time the permission was requested.
  27. message ClientFeatures {
  28. // Statistical features about client's previous interactions with permission
  29. // prompts, aggregated across all permission types.
  30. optional StatsFeatures client_stats = 1;
  31. // Enum defining the client platforms.
  32. enum Platform {
  33. PLATFORM_UNSPECIFIED = 0;
  34. PLATFORM_MOBILE = 1;
  35. PLATFORM_DESKTOP = 2;
  36. }
  37. // The platform run by the client that originated the suggestion request.
  38. optional Platform platform = 2;
  39. // Enum defining gesture types.
  40. enum Gesture {
  41. GESTURE_UNSPECIFIED = 0;
  42. NO_GESTURE = 1;
  43. GESTURE = 2;
  44. }
  45. // The type of gesture performed by the user on the page before the permission
  46. // prompt was shown.
  47. optional Gesture gesture = 3;
  48. enum GestureEnum {
  49. GESTURE_V2 = 0;
  50. GESTURE_UNSPECIFIED_V2 = 1;
  51. }
  52. optional GestureEnum gesture_enum = 4;
  53. enum PlatformEnum {
  54. PLATFORM_MOBILE_V2 = 0;
  55. PLATFORM_DESKTOP_V2 = 1;
  56. PLATFORM_UNSPECIFIED_V2 = 3;
  57. }
  58. optional PlatformEnum platform_enum = 5;
  59. }
  60. // Features related to a specific permission type.
  61. message PermissionFeatures {
  62. // Statistical features about client's previous interactions with permission
  63. // prompts of the specific permission type.
  64. optional StatsFeatures permission_stats = 1;
  65. // Features related to the notification permission.
  66. message NotificationPermission {}
  67. // Features related to the geolocation permission.
  68. message GeolocationPermission {}
  69. // This field has two purposes:
  70. // * it specifies the permission type
  71. // * it contains the possible additional features for the specified type.
  72. oneof permission_type {
  73. NotificationPermission notification_permission = 2;
  74. GeolocationPermission geolocation_permission = 3;
  75. }
  76. }
  77. // Permission suggestion with the predicted likelihood that the user will grant
  78. // the permission prompt (more details at go/hedgehog-backend).
  79. message PermissionPrediction {
  80. // Additional information regarding the notification suggestion.
  81. message NotificationPrediction {}
  82. // Additional information regarding the geolocation prediction.
  83. message GeolocationPrediction {}
  84. // This field has two purposes:
  85. // * it specifies the permission type for which we generated the suggestion
  86. // * it contains the possible additional information for the specified type.
  87. oneof prediction_type {
  88. NotificationPrediction notification_prediction = 1;
  89. GeolocationPrediction geolocation_prediction = 3;
  90. }
  91. // Information about how likely a user is to perform a specific action.
  92. message Likelihood {
  93. // Discretized likelihood values (see go/hedgehog-provider-browser). The ML
  94. // models generate predictions as floats in the range [0, 1]; the service
  95. // maps these floats to the discretized likelihood values in this enum using
  96. // thresholds that are defined in the implementation.
  97. enum DiscretizedLikelihood {
  98. DISCRETIZED_LIKELIHOOD_UNSPECIFIED = 0;
  99. VERY_UNLIKELY = 1;
  100. UNLIKELY = 2;
  101. NEUTRAL = 3;
  102. LIKELY = 4;
  103. VERY_LIKELY = 5;
  104. }
  105. // Discretized likelihood of the user performing the action.
  106. optional DiscretizedLikelihood discretized_likelihood = 1;
  107. }
  108. // The ML predicts the likelihood of the user NOT granting the permission. We
  109. // then convert it to how likely the user is to GRANT the permission request.
  110. optional Likelihood grant_likelihood = 2;
  111. }
  112. // Message sent from the client to get suggestions for one or more permissions.
  113. message GeneratePredictionsRequest {
  114. // Features representing the overall (not permission-specific) client state.
  115. optional ClientFeatures client_features = 1;
  116. // Features that depend on the site that the client was visiting when the
  117. // permission request was triggered.
  118. optional SiteFeatures site_features = 2;
  119. // Each PermissionFeatures message details a specific permission for which the
  120. // client wants to receive a suggestion.
  121. repeated PermissionFeatures permission_features = 3;
  122. }
  123. // The response message returned by the ChromePermissionsSuggestionsService to
  124. // the Chrome client.
  125. message GeneratePredictionsResponse {
  126. // One PermissionSuggestion is generated for each PermissionFeatures in the
  127. // request. The order is kept between the input and output lists.
  128. repeated PermissionPrediction prediction = 1;
  129. }