// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
syntax = "proto3";
package optimization_guide.proto;
import "components/optimization_guide/proto/features/common_quality_data.proto";
option optimize_for = LITE_RUNTIME;
option java_package = "org.chromium.components.optimization_guide.features.proto";
option java_outer_classname = "ComposeProto";
// DO NOT EDIT THIS FILE DIRECTLY!
//
// This file is generated in g3 and then synced to Chrome. Instead, please
// refer to http://go/chrome-intelligence-feature-protos (Google-internal link),
// and then changes will be synced with Chrome automatically.
message ComposeLoggingData {
ComposeRequest request = 1;
ComposeResponse response = 2;
ComposeQuality quality = 3;
}
// Stores all data associated with a single call to the model execution run for
// compose.
//
// Next ID: 9
message ComposeRequest {
oneof request_params {
GenerateParams generate_params = 7;
RewriteParams rewrite_params = 8;
}
// Contains information scraped from the page.
ComposePageMetadata page_metadata = 3;
// Next ID: 2
message GenerateParams {
// User written input text.
string user_input = 1;
}
// Next ID: 5
message RewriteParams {
// Rewrite with one of the below modifiers.
oneof modifier {
ComposeTone tone = 2;
ComposeLength length = 3;
bool regenerate = 4;
}
// A previously received ComposeResponse response_text, which will be
// rewritten.
string previous_response = 1;
}
reserved 1, 2, 4, 5, 6;
}
// Stores the metadata associated with a single call to the model execution.
// This excludes any explicit user input.
// Next Id: 7
message ComposePageMetadata {
// URL of the page the input field is on.
string page_url = 1;
// The title of the page the input field is on.
string page_title = 2;
// The innerText of the page the input field is on. This is temporary. We do
// not intend to send inner text in the long run.
string page_inner_text = 3;
// The offset into the inner text of the selected input field.
uint64 page_inner_text_offset = 4;
// A trimmed innerText of the page the input field is on, to be used by
// on device models.
string trimmed_page_inner_text = 5;
// An accessibility tree snapshot of the page.
optional AXTreeUpdate ax_tree_update = 6;
}
// Stores the response text from the model execution run.
// Next Id: 2
message ComposeResponse {
string output = 1;
}
// Any data collected on the client outside of the model request and response.
// This includes user feedback, and metrics about feature usage.
// Next Id: 10
message ComposeQuality {
FinalStatus final_status = 1;
UserFeedback user_feedback = 2;
// How long the user had to wait before seeing the model response.
int64 request_latency_ms = 4;
// How much was the text modified before commit only valid iff
// final_status = INSERTED
optional int64 edit_distance = 5;
// A unique ID for each compose session.
Int128 session_id = 6;
// Was this request generated via an edit action.
bool was_generated_via_edit = 7;
// The status of this request.
ClientRequestStatus client_request_status = 8;
// Was this session started with a proactive nudge UI.
bool started_with_proactive_nudge = 9;
reserved 3;
}
// A helper message to store the int64 high and uint64 low bits of an int128
// since protos do not natively handle int128. The underlying value is split
// into a `low` uint64 holding the low bits, and `high` int64 holding the bits
// beyond what an int64 can hold. Can easily create an int128 via
// absl::MakeInt128(high, low) and be created from an int128 using
// absl::Int128Low64() and absl::Int128High64().
// Next ID: 3
message Int128 {
uint64 high = 1;
uint64 low = 2;
}
// User selected tone. Here the UNSPECIFIED entry is used to specify the tone is
// unaltered or 'default'.
// Next ID: 3
enum ComposeTone {
COMPOSE_UNSPECIFIED_TONE = 0;
COMPOSE_FORMAL = 1;
COMPOSE_INFORMAL = 2;
}
// User selected length. Here the UNSPECIFIED entry is used to specify the
// tone is unaltered or 'default'.
// Next ID: 3
enum ComposeLength {
COMPOSE_UNSPECIFIED_LENGTH = 0;
COMPOSE_SHORTER = 1;
COMPOSE_LONGER = 2;
}
// The final status of the feature.
// Next ID: 4
enum FinalStatus {
// The dialog was not closed, and a subsequent model request should be
// logged.
STATUS_UNSPECIFIED = 0;
// The user inserted this response into the page.
STATUS_INSERTED = 1;
// User pressed 'X' or started a new session with a selection.
STATUS_ABANDONED = 2;
// This case includes: close tab, navigation, etc.
// Used after M124.
STATUS_FINISHED_WITHOUT_INSERT = 3;
}
// Status code used in compose responses.
// Next ID: 17
enum ClientRequestStatus {
CLIENT_REQUEST_STATUS_UNSPECIFIED = 0;
CLIENT_REQUEST_STATUS_OK = 1;
// Generic client error, not specified.
CLIENT_REQUEST_STATUS_CLIENT_ERROR = 2;
// If the feature is somehow disabled.
CLIENT_REQUEST_STATUS_MISCONFIGURATION = 3;
// If permission is denied (e.g. user is not logged in.)
CLIENT_REQUEST_STATUS_PERMISSION_DENIED = 4;
// Generic server error, not specified.
CLIENT_REQUEST_STATUS_SERVER_ERROR = 5;
// Invalid request sent, likely a client issue where ComposeRequest is
// incorrect.
CLIENT_REQUEST_STATUS_INVALID_REQUEST = 6;
// Request was throttled.
CLIENT_REQUEST_STATUS_REQUEST_THROTTLED = 7;
// Retryable error occurred in the server.
CLIENT_REQUEST_STATUS_RETRYABLE_ERROR = 8;
// Non-retryable error occurred in the server (eg. server down).
CLIENT_REQUEST_STATUS_NON_RETRYABLE_ERROR = 9;
// Unsupported language used.
CLIENT_REQUEST_STATUS_UNSUPPORTED_LANGUAGE = 10;
// Request was filtered (eg. due to T&S).
CLIENT_REQUEST_STATUS_FILTERED = 11;
// Compose service was disabled.
CLIENT_REQUEST_STATUS_DISABLED = 12;
// Request was cancelled.
CLIENT_REQUEST_STATUS_CANCELLED = 13;
// No response received from the server.
CLIENT_REQUEST_STATUS_NO_RESPONSE = 14;
// If the user is offline.
CLIENT_REQUEST_STATUS_OFFLINE = 15;
// The request timed out.
CLIENT_REQUEST_STATUS_REQUEST_TIMED_OUT = 16;
}