// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.cloud.aiplatform.v1beta1;

import "google/api/field_behavior.proto";

option csharp_namespace = "Google.Cloud.AIPlatform.V1Beta1";
option go_package = "cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb;aiplatformpb";
option java_multiple_files = true;
option java_outer_classname = "EvaluationRubricProto";
option java_package = "com.google.cloud.aiplatform.v1beta1";
option php_namespace = "Google\\Cloud\\AIPlatform\\V1beta1";
option ruby_package = "Google::Cloud::AIPlatform::V1beta1";

// Message representing a single testable criterion for evaluation.
// One input prompt could have multiple rubrics.
message Rubric {
  // Content of the rubric, defining the testable criteria.
  message Content {
    // Defines criteria based on a specific property.
    message Property {
      // Description of the property being evaluated.
      // Example: "The model's response is grammatically correct."
      string description = 1;
    }

    oneof content_type {
      // Evaluation criteria based on a specific property.
      Property property = 1;
    }
  }

  // Importance level of the rubric.
  enum Importance {
    // Importance is not specified.
    IMPORTANCE_UNSPECIFIED = 0;

    // High importance.
    HIGH = 1;

    // Medium importance.
    MEDIUM = 2;

    // Low importance.
    LOW = 3;
  }

  // Unique identifier for the rubric.
  // This ID is used to refer to this rubric, e.g., in RubricVerdict.
  string rubric_id = 1;

  // Required. The actual testable criteria for the rubric.
  Content content = 2;

  // Optional. A type designator for the rubric, which can inform how it's
  // evaluated or interpreted by systems or users.
  // It's recommended to use consistent, well-defined, upper snake_case strings.
  // Examples: "SUMMARIZATION_QUALITY", "SAFETY_HARMFUL_CONTENT",
  // "INSTRUCTION_ADHERENCE".
  optional string type = 3;

  // Optional. The relative importance of this rubric.
  optional Importance importance = 4;
}

// A group of rubrics, used for grouping rubrics based on a metric or a version.
message RubricGroup {
  // Unique identifier for the group.
  string group_id = 1;

  // Human-readable name for the group. This should be unique
  //  within a given context if used for display or selection.
  //  Example: "Instruction Following V1", "Content Quality - Summarization
  //  Task".
  string display_name = 2;

  // Rubrics that are part of this group.
  repeated Rubric rubrics = 3;
}

// Represents the verdict of an evaluation against a single rubric.
message RubricVerdict {
  // Required. The full rubric definition that was evaluated.
  // Storing this ensures the verdict is self-contained and understandable,
  // especially if the original rubric definition changes or was dynamically
  // generated.
  Rubric evaluated_rubric = 1;

  // Required. Outcome of the evaluation against the rubric, represented as a
  // boolean. `true` indicates a "Pass", `false` indicates a "Fail".
  bool verdict = 2;

  // Optional. Human-readable reasoning or explanation for the verdict.
  // This can include specific examples or details from the evaluated content
  // that justify the given verdict.
  optional string reasoning = 3;
}
