blob: c9bc3b7df69927e69570a887a9048cd65547bddc [file] [log] [blame]
// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
edition = "2023";
package optimization_guide.proto;
import "components/optimization_guide/proto/features/common_quality_data.proto";
import "components/optimization_guide/proto/model_quality_metadata.proto";
option optimize_for = LITE_RUNTIME;
option java_package = "org.chromium.components.optimization_guide.features.proto";
option java_outer_classname = "FormsClassificationsProto";
// DO NOT EDIT THIS FILE DIRECTLY!
//
// This file is generated in g3 and then synced to Chrome. Instead, please refer to
// http://go/chrome-mqls-onboarding (Google-internal link), and then changes will
// be synced with Chrome automatically.
// Next ID: 6
message FormsClassificationsLoggingData {
AutofillAiTypeRequest request = 1 [features = { field_presence: EXPLICIT }];
AutofillAiTypeResponse response = 2 [features = { field_presence: EXPLICIT }];
FormTypeQuality quality = 3 [features = { field_presence: EXPLICIT }];
ModelExecutionInfo model_execution_info = 4 [features = { field_presence: EXPLICIT }];
}
// Next ID: 8
message AutofillAiTypeRequest {
// The context of the page that the form is on.
// In practice, only the PageContext::url is set. Notably, annotated page
// content is passed through AutofillAiTypeRequest::annotated_page_content.
// TODO(crbug.com/389625970): Remove in favor of `url` once most clients set it.
PageContext page_context = 1 [features = { field_presence: EXPLICIT }];
// The form to predict values for. It is expected that the values for each
// field are empty.
FormData form_data = 2 [features = { field_presence: EXPLICIT }];
// A screenshot of the form.
// This is optional and may be used by the model to improve predictions.
FormMedia media = 3 [features = { field_presence: EXPLICIT }];
// The annotated page content of the page that the form is on.
AnnotatedPageContent annotated_page_content = 5 [features = { field_presence: EXPLICIT }];
// Should include reasoning for debugging purposes.
bool include_reasoning = 6 [features = { field_presence: IMPLICIT }];
// The URL of the page that the form is on. This field should replace
// `page_context` once most clients set it.
string url = 7 [features = { field_presence: IMPLICIT }];
reserved 4;
}
message FormMedia {
// Screenshots in base64-encoded PNG format
repeated bytes screenshots = 1;
}
message AutofillAiTypeResponse {
// A list of field-level type predictions for the form.
repeated FieldTypeResponse field_responses = 1;
}
// Next ID: 8
message FieldTypeResponse {
// The (zero-based) index of the field among those passed in the request that
// this prediction refers to.
int32 field_index = 5 [features = { field_presence: EXPLICIT }];
// The predicted type for the field. For backwards compatibility, this will
// contain the first or most confident prediction from the model.
// This field is deprecated in favor of `all_field_types`.
int32 field_type = 2 [features = { field_presence: EXPLICIT }];
// Optional formatting metadata for downstream use.
// Example formats: "dd/mm/yyyy" for dates, "NAME_FIRST_LAST" for names.
string formatting_meta = 3 [features = { field_presence: EXPLICIT }];
// The confidence score for the prediction, ranging from 0.0 to 1.0.
// Higher values indicate greater confidence in the predicted type.
float confidence = 4 [features = { field_presence: IMPLICIT }];
// All predicted types for the field, including the one in `field_type`.
// This is the field that should be used for all new multi-type logic.
repeated int32 all_field_types = 7;
reserved 1, 6;
}
message FormTypeQuality {
// User-provided feedback on the predictions.
UserFeedback user_feedback = 1 [features = { field_presence: IMPLICIT }];
AutofillAiFieldEvent field_event = 2 [features = { field_presence: EXPLICIT }];
AutofillAiKeyMetrics key_metrics = 3 [features = { field_presence: EXPLICIT }];
}
// See `AutofillAiUkmLogger::FieldEvent`.
message AutofillAiFieldEvent {
// The server AI type of the field as classified by autofill's ML model.
int32 ai_field_type = 1 [features = { field_presence: EXPLICIT }];
// Type of the event being recorded.
AutofillAiFieldEventType event_type = 2 [features = { field_presence: IMPLICIT }];
// A random variable assigned to a specific instance of a form control (e.g.
// a HTML input element). This should be globally unique and suitable for
// distinguishing fields. Two different users would have different values.
// For the same user, the same field in the same form in two different tabs
// would have two different values.
uint64 field_session_identifier = 3 [features = { field_presence: IMPLICIT }];
// The signature of the field. This is the hash identifier used to denote this
// field for query and voting purposes. See
// components/autofill/core/common/signatures.cc for more details.
uint64 field_signature = 4 [features = { field_presence: IMPLICIT }];
// The type of the field as classified by autofill.
int32 field_type = 5 [features = { field_presence: EXPLICIT }];
// The source of the format string of the field, see `FormatStringSource` in
// components/autofill/core/browser/autofill_field.h for more info.
FormatStringSource format_string_source = 6 [features = { field_presence: IMPLICIT }];
// The order of the event in the sequence of events sharing the same
// FormSessionIdentifier.
int32 form_session_event_order = 7 [features = { field_presence: IMPLICIT }];
// A random variable assigned to a specific instance of a HTML form in a
// specific renderer. This should be globally unique and suitable for
// counting distinct forms. Two different users would have different values.
// A single user loading the same form in two different tabs would have two
// different values. This is used to link the fields to a form in
// AutofillAi.KeyMetrics.
uint64 form_session_identifier = 8 [features = { field_presence: IMPLICIT }];
// The signature of the form. This is the hash identifier used to denote this
// form for query and voting purposes. See
// components/autofill/core/common/signatures.cc for more details.
uint64 form_signature = 9 [features = { field_presence: IMPLICIT }];
// The index of the field in the list of fields of the form built by Autofill.
uint32 field_rank = 10 [features = { field_presence: IMPLICIT }];
// The index of the field in the list of fields of the form having the same
// FieldSignature.
uint32 field_rank_in_signature_group = 11 [features = { field_presence: IMPLICIT }];
// The type of the underlying HTML element representing the field (e.g.,
// input text, select one, etc.)
FormControlType form_control_type = 12 [features = { field_presence: IMPLICIT }];
// The registered domain of the page that the form is on.
string domain = 13 [features = { field_presence: IMPLICIT }];
// The type of entity for which the metrics are being recorded. This is useful
// in forms that ask about multiple entity types (e.g. driver's license and
// vehicle information).
AutofillAiEntityType entity_type = 14 [features = { field_presence: IMPLICIT }];
}
message AutofillAiKeyMetrics {
// True if user accepted the suggestion to fill values on a submitted form,
// and false otherwise. This is counted as true if the user accepted such a
// suggestion at any time, regardless whether other suggestions were ignored
// or whether the accepted suggestion was reverted afterwards.
// Only recorded if suggestions were shown to the user.
bool filling_acceptance = 1 [features = { field_presence: EXPLICIT }];
// True if the user filled any fields via Autofill on a submitted form, and
// false otherwise. If the user reverts the filling, the form is still
// counted as filled.
//
// This metric is different from FillingAcceptance in the sense that the
// latter is only recorded if the user has actually seen a prompt to fill
// data.
bool filling_assistance = 2 [features = { field_presence: IMPLICIT }];
// False for submitted and autofilled forms if user edited at least one
// filled value before submitting the form, true otherwise.
// Only recorded if any suggestion was filled.
bool filling_correctness = 3 [features = { field_presence: EXPLICIT }];
// True for submitted forms when Autofill had any Autofill AI data to fill,
// and false otherwise.
//
// It does not matter whether the user actually requested to fill the data.
// It does not matter either whether the data available for filling
// corresponded to the submitted data.
bool filling_readiness = 4 [features = { field_presence: IMPLICIT }];
// A random variable assigned to a specific instance of a HTML form in a
// specific renderer. This should be globally unique and suitable for
// counting distinct forms. Two different users would have different values.
// A single user loading the same form in two different tabs would have two
// different values. This is used to link the fields to a form in
// AutofillAi.FieldInfo.
uint64 form_session_identifier = 5 [features = { field_presence: IMPLICIT }];
// The signature of the form. This is the hash identifier used to denote this
// form for query and voting purposes. See
// components/autofill/core/common/signatures.cc for more details.
uint64 form_signature = 6 [features = { field_presence: IMPLICIT }];
// The registered domain of the page that the form is on.
string domain = 7 [features = { field_presence: IMPLICIT }];
// The number of fields that were filled by Autofill at form submission. This
// will include fields that are autofilled by any source except Autocomplete,
// including AutofillAi.
int32 autofill_filled_field_count = 8 [features = { field_presence: IMPLICIT }];
// The number of fields that were filled by Autofill AI at form submission
// specifically, all fields autofilled by other sources will be excluded.
int32 autofill_ai_filled_field_count = 9 [features = { field_presence: IMPLICIT }];
// The type of entity for which the metrics are being recorded. This is useful
// in forms that ask about multiple entity types (e.g. driver's license and
// vehicle information).
AutofillAiEntityType entity_type = 10 [features = { field_presence: IMPLICIT }];
}
enum AutofillAiFieldEventType {
AUTOFILL_AI_FIELD_EVENT_TYPE_SUGGESTION_SHOWN = 0;
AUTOFILL_AI_FIELD_EVENT_TYPE_SUGGESTION_FILLED = 1;
AUTOFILL_AI_FIELD_EVENT_TYPE_EDITED_AUTOFILLED_FIELD = 2;
AUTOFILL_AI_FIELD_EVENT_TYPE_FIELD_FILLED = 3;
}
enum FormatStringSource {
FORMAT_STRING_SOURCE_UNSET = 0;
FORMAT_STRING_SOURCE_HEURISTICS = 1;
FORMAT_STRING_SOURCE_ML_MODEL = 2;
FORMAT_STRING_SOURCE_SERVER = 3;
}
// This is a copy of autofill::EntityTypeName that is auto-generated by
// components/autofill/core/browser/data_model/autofill_ai/transpile_entity_schema.py
// Additionally, we add an UNKNOWN value as a bucket to support cases where the
// client does not set the entity type.
enum AutofillAiEntityType {
AUTOFILL_AI_ENTITY_TYPE_UNKNOWN = 0;
AUTOFILL_AI_ENTITY_TYPE_PASSPORT = 1;
AUTOFILL_AI_ENTITY_TYPE_DRIVERS_LICENSE = 2;
AUTOFILL_AI_ENTITY_TYPE_VEHICLE = 3;
AUTOFILL_AI_ENTITY_TYPE_NATIONAL_ID_CARD = 4;
AUTOFILL_AI_ENTITY_TYPE_KNOWN_TRAVELER_NUMBER = 5;
AUTOFILL_AI_ENTITY_TYPE_REDRESS_NUMBER = 6;
}