chromium/components/optimization_guide/proto/model_execution.proto

// 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 = "proto2";
option optimize_for = LITE_RUNTIME;
option java_package = "org.chromium.components.optimization_guide.proto";
option java_outer_classname = "ModelExecutionProto";

package optimization_guide.proto;

import "components/optimization_guide/proto/common_types.proto";

message ExecuteRequest {
  // The feature that this execution request is for.
  optional ModelExecutionFeature feature = 1;

  // The metadata associated with this request used to understand how to
  // execute the necessary feature models.
  optional Any request_metadata = 2;
}

message ExecuteResponse {
  reserved 3;

  optional int64 model_version = 1;

  oneof response {
    // The metadata for the response returned for the feature.
    Any response_metadata = 2;
    ErrorResponse error_response = 5;
  }

  optional string server_execution_id = 4;
}

message ErrorResponse {
  optional ErrorState error_state = 1;
}

// Possible failure modes of the service
enum ErrorState {
  ERROR_STATE_UNSPECIFIED = 0;
  ERROR_STATE_INTERNAL_SERVER_ERROR_RETRY = 1;
  ERROR_STATE_INTERNAL_SERVER_ERROR_NO_RETRY = 2;
  ERROR_STATE_UNSUPPORTED_LANGUAGE = 3;
  ERROR_STATE_FILTERED = 4;
  ERROR_STATE_REQUEST_THROTTLED = 5;
  ERROR_STATE_DISABLED = 6;
}

enum ModelExecutionFeature {
  reserved 11;

  MODEL_EXECUTION_FEATURE_UNSPECIFIED = 0;
  MODEL_EXECUTION_FEATURE_COMPOSE = 1;
  MODEL_EXECUTION_FEATURE_TAB_ORGANIZATION = 2;
  MODEL_EXECUTION_FEATURE_WALLPAPER_SEARCH = 3;
  // This test feature cannot be used for launch but can be used for
  // prototyping. Please reach out to optimization_guide OWNERS when looking to
  // use this enum or want to go beyond prototyping.
  MODEL_EXECUTION_FEATURE_TEST = 4;
  // This feature does not map to a user-visible feature that is being
  // launched, but instead is an internal detail to support other model
  // execution features.
  MODEL_EXECUTION_FEATURE_TEXT_SAFETY = 5;
  MODEL_EXECUTION_FEATURE_PROMPT_API = 6;
  MODEL_EXECUTION_FEATURE_HISTORY_SEARCH = 7;
  MODEL_EXECUTION_FEATURE_SUMMARIZE = 8;
  MODEL_EXECUTION_FEATURE_FORMS_ANNOTATIONS = 9;
  MODEL_EXECUTION_FEATURE_FORMS_PREDICTIONS = 10;
}