File: prediction_service_messages.proto

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (183 lines) | stat: -rw-r--r-- 6,478 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto2";

package permissions;

option optimize_for = LITE_RUNTIME;

// Features that depend on the site that triggered the permission request.
// Currently empty but added proactively for future versions.
message SiteFeatures {
  // This field must be an origin-only URL with a `http` or `https` scheme
  // Example of valid value: `https://example.org`.
  optional string origin = 1;
}

// Statistical features about client's interactions with permission prompts.
// These features are computed on all permission actions that happened before
// the current permission request.
message StatsFeatures {
  // Average deny rate for the client.
  optional float avg_deny_rate = 1;
  // Average grant rate for the client.
  optional float avg_grant_rate = 2;
  // Average dismiss rate for the client.
  optional float avg_dismiss_rate = 3;
  // Average ignore rate for the client.
  optional float avg_ignore_rate = 4;
  // Number of permission prompts seen by the client.
  optional int32 prompts_count = 5;
}

// Features representing the overall (not permission-specific) client state at
// the time the permission was requested.
message ClientFeatures {
  // Statistical features about client's previous interactions with permission
  // prompts, aggregated across all permission types.
  optional StatsFeatures client_stats = 1;

  // Enum defining the client platforms.
  enum Platform {
    PLATFORM_UNSPECIFIED = 0;
    PLATFORM_MOBILE = 1;
    PLATFORM_DESKTOP = 2;
  }

  // The platform run by the client that originated the suggestion request.
  optional Platform platform = 2;

  // Enum defining gesture types.
  enum Gesture {
    GESTURE_UNSPECIFIED = 0;
    NO_GESTURE = 1;
    GESTURE = 2;
  }

  // The type of gesture performed by the user on the page before the permission
  // prompt was shown.
  optional Gesture gesture = 3;

  // Similar to the above declared `Gesture` enum but is used only for on-device
  // model.
  enum GestureEnum {
    GESTURE_V2 = 0;
    GESTURE_UNSPECIFIED_V2 = 1;
  }

  optional GestureEnum gesture_enum = 4;

  // Similar to the above declared `Platform` enum but is used only for
  // on-device model.
  enum PlatformEnum {
    PLATFORM_MOBILE_V2 = 0;
    PLATFORM_DESKTOP_V2 = 1;
    PLATFORM_UNSPECIFIED_V2 = 3;
  }

  optional PlatformEnum platform_enum = 5;

  // Message containing the experiment config for the client request.
  message ExperimentConfig {
    // Optional. If set, the experiment id used to generate the predictions.
    optional int32 experiment_id = 1;
  }

  // Optional. The client experiment config.
  optional ExperimentConfig experiment_config = 6;
}

// Features related to a specific permission type.
message PermissionFeatures {
  // Statistical features about client's previous interactions with permission
  // prompts of the specific permission type.
  optional StatsFeatures permission_stats = 1;

  // Features related to the notification permission.
  message NotificationPermission {}

  // Features related to the geolocation permission.
  message GeolocationPermission {}

  // This field has two purposes:
  //   * it specifies the permission type
  //   * it contains the possible additional features for the specified type.
  oneof permission_type {
    NotificationPermission notification_permission = 2;
    GeolocationPermission geolocation_permission = 3;
  }

  // Enum defining the permission relevance generated by an AI and/or TFLite
  // on-device model.
  enum Relevance {
    RELEVANCE_UNSPECIFIED = 0;
    RELEVANCE_VERY_LOW = 1;
    RELEVANCE_LOW = 2;
    RELEVANCE_MEDIUM = 3;
    RELEVANCE_HIGH = 4;
    RELEVANCE_VERY_HIGH = 5;
  }

  // Optional. The permission relevance generated by an on-device model.
  optional Relevance permission_relevance = 4;
}
// Permission suggestion with the predicted likelihood that the user will grant
// the permission prompt (more details at go/hedgehog-backend).
message PermissionPrediction {
  // Additional information regarding the notification suggestion.
  message NotificationPrediction {}

  // Additional information regarding the geolocation prediction.
  message GeolocationPrediction {}

  // This field has two purposes:
  //   * it specifies the permission type for which we generated the suggestion
  //   * it contains the possible additional information for the specified type.
  oneof prediction_type {
    NotificationPrediction notification_prediction = 1;
    GeolocationPrediction geolocation_prediction = 3;
  }

  // Information about how likely a user is to perform a specific action.
  message Likelihood {
    // Discretized likelihood values (see go/hedgehog-provider-browser). The ML
    // models generate predictions as floats in the range [0, 1]; the service
    // maps these floats to the discretized likelihood values in this enum using
    // thresholds that are defined in the implementation.
    enum DiscretizedLikelihood {
      DISCRETIZED_LIKELIHOOD_UNSPECIFIED = 0;
      VERY_UNLIKELY = 1;
      UNLIKELY = 2;
      NEUTRAL = 3;
      LIKELY = 4;
      VERY_LIKELY = 5;
    }
    // Discretized likelihood of the user performing the action.
    optional DiscretizedLikelihood discretized_likelihood = 1;
  }

  // The ML predicts the likelihood of the user NOT granting the permission. We
  // then convert it to how likely the user is to GRANT the permission request.
  optional Likelihood grant_likelihood = 2;
}

// Message sent from the client to get suggestions for one or more permissions.
message GeneratePredictionsRequest {
  // Features representing the overall (not permission-specific) client state.
  optional ClientFeatures client_features = 1;
  // Features that depend on the site that the client was visiting when the
  // permission request was triggered.
  optional SiteFeatures site_features = 2;
  // Each PermissionFeatures message details a specific permission for which the
  // client wants to receive a suggestion.
  repeated PermissionFeatures permission_features = 3;
}
// The response message returned by the ChromePermissionsSuggestionsService to
// the Chrome client.
message GeneratePredictionsResponse {
  // One PermissionSuggestion is generated for each PermissionFeatures in the
  // request. The order is kept between the input and output lists.
  repeated PermissionPrediction prediction = 1;
}