| // Copyright 2021 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 = "PageTopicsModelMetadataProto"; |
| |
| package optimization_guide.proto; |
| |
| enum PageTopicsSupportedOutput { |
| PAGE_TOPICS_SUPPORTED_OUTPUT_UNKNOWN = 0; |
| // Supports evaluating the visibility score of a page. |
| PAGE_TOPICS_SUPPORTED_OUTPUT_VISIBILITY = 1; |
| // Supports evaluating categories of page content. |
| PAGE_TOPICS_SUPPORTED_OUTPUT_CATEGORIES = 2; |
| } |
| |
| message PageTopicsVisibilityPostprocessingParams { |
| // The name of the category to evaluate whether page content's visibility |
| // score. |
| optional string category_name = 1; |
| } |
| |
| message PageTopicsCategoryPostprocessingParams { |
| // Output at most max_categories, and only those with min_category_weight. |
| optional int32 max_categories = 1; |
| // The minimum weight a category must have for it to be in the output. |
| optional float min_category_weight = 2; |
| // The minimum weight after category weights are normalized that the top N |
| // categories must have. |
| optional float min_normalized_weight_within_top_n = 3; |
| // The minimum weight for the NONE label has to be to remove all labels. |
| optional float min_none_weight = 4; |
| } |
| |
| message PageTopicsOutputPostprocessingParams { |
| // The parameters to use to post-process the visibility score of the page |
| // content is. |
| // |
| // Will only be included if PAGE_TOPICS_SUPPORTED_OUTPUT_VISIBILITY is |
| // supported by the model. |
| optional PageTopicsVisibilityPostprocessingParams visibility_params = 1; |
| // The parameters to use to post-process categories. |
| // |
| // Will only be included if PAGE_TOPICS_SUPPORTED_OUTPUT_CATEGORIES is |
| // supported by the model. |
| optional PageTopicsCategoryPostprocessingParams category_params = 2; |
| } |
| |
| message Topic { |
| // The user-visible string of the taxonomy topic. |
| optional string topic_name = 1; |
| // The id of the topic. |
| optional int64 topic_id = 2; |
| } |
| |
| message TopicTaxonomy { |
| // The version of this specific taxonomy, which is separate from the model |
| // version. |
| optional int64 version = 1; |
| // The topics supported by this taxonomy. |
| repeated Topic topics = 2; |
| } |
| |
| message PageTopicsModelMetadata { |
| reserved 4; |
| |
| // The version is specified by the client as what functionality outside the |
| // model the client supports (e.g., pre/post processing). When provided from |
| // the server, it specifies which of these support functions for the model is |
| // expected to use. |
| optional int64 version = 1; |
| // The supported output. |
| // |
| // If sent by the client, this represents the output that the client knows |
| // how to support. If sent by the server, this represents the outputs of the |
| // model. |
| repeated PageTopicsSupportedOutput supported_output = 2; |
| // A set of postprocessing parameters per supported output and will only be |
| // populated by the server. |
| optional PageTopicsOutputPostprocessingParams output_postprocessing_params = |
| 3; |
| // The taxonomy used by this model. |
| optional TopicTaxonomy topic_taxonomy = 5; |
| } |