// 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/on_device_model_execution_config.proto";

option optimize_for = LITE_RUNTIME;
option java_package = "org.chromium.components.optimization_guide.features.proto";

option java_outer_classname = "SummarizeProto";

// 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.

message SummarizeLoggingData {
  SummarizeRequest request = 1 [features = { field_presence: EXPLICIT }];

  SummarizeResponse response = 2 [features = { field_presence: EXPLICIT }];
}

message SummarizeRequest {
  string article = 1 [features = { field_presence: EXPLICIT }];

  string context = 2 [features = { field_presence: EXPLICIT }];

  SummarizeOptions options = 3 [features = { field_presence: EXPLICIT }];
}

message SummarizeOptions {
  SummarizerOutputType output_type = 1 [features = { field_presence: EXPLICIT }];

  SummarizerOutputFormat output_format = 2 [features = { field_presence: EXPLICIT }];

  SummarizerOutputLength output_length = 3 [features = { field_presence: EXPLICIT }];

  // Language to use for the prompt. Caller should only provide a value
  // configured in the configured SummarizeMetadata::available_prompt_languages.
  string output_language = 4 [features = { field_presence: EXPLICIT }];
}

message SummarizeResponse {
  string output = 1 [features = { field_presence: EXPLICIT }];
}

// Type for OnDeviceModelExecutionFeatureConfig::feature_metadata.
message SummarizeMetadata {
  // A version for config changes that require implementor updates.
  int32 version = 1 [features = { field_presence: EXPLICIT }];

  // Supported localizations for the prompt.
  repeated string available_prompt_languages = 2;

  // Grouped constraints to keep the top-level metadata clean.
  SummarizeConstraints constraints = 3 [features = { field_presence: EXPLICIT }];
}

// Container for all mode-specific constraints.
message SummarizeConstraints {
  ResponseConstraint tldr_constraint = 1 [features = { field_presence: EXPLICIT }];

  ResponseConstraint keypoints_constraint = 2 [features = { field_presence: EXPLICIT }];

  ResponseConstraint teaser_constraint = 3 [features = { field_presence: EXPLICIT }];

  ResponseConstraint headlines_constraint = 4 [features = { field_presence: EXPLICIT }];
}

enum SummarizerOutputType {
  SUMMARIZER_OUTPUT_TYPE_NOT_SPECIFIED = 0;

  SUMMARIZER_OUTPUT_TYPE_TL_DR = 1;

  SUMMARIZER_OUTPUT_TYPE_KEYPOINTS = 2;

  SUMMARIZER_OUTPUT_TYPE_TEASER = 3;

  SUMMARIZER_OUTPUT_TYPE_HEADLINES = 4;
}

enum SummarizerOutputFormat {
  SUMMARIZER_OUTPUT_FORMAT_NOT_SPECIFIED = 0;

  SUMMARIZER_OUTPUT_FORMAT_PLAIN_TEXT = 1;

  SUMMARIZER_OUTPUT_FORMAT_MARKDOWN = 2;
}

enum SummarizerOutputLength {
  SUMMARIZER_OUTPUT_LENGTH_NOT_SPECIFIED = 0;

  SUMMARIZER_OUTPUT_LENGTH_SHORT = 1;

  SUMMARIZER_OUTPUT_LENGTH_MEDIUM = 2;

  SUMMARIZER_OUTPUT_LENGTH_LONG = 3;
}
