// 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.ces.v1beta;

import "google/api/field_behavior.proto";

option go_package = "cloud.google.com/go/ces/apiv1beta/cespb;cespb";
option java_multiple_files = true;
option java_outer_classname = "EvaluationMetricsConfigProto";
option java_package = "com.google.cloud.ces.v1beta";

// Configures the metrics for an evaluation.
message EvaluationMetricsConfig {
  // Configuration for similarity metrics for the evaluation.
  // To disable the metric, set the message but do not set the
  // `enable_semantic_similarity_metrics` field to true (or explicitly set it to
  // false). To unset the configuration and fallback to the default behavior,
  // omit the message entirely.
  message SemanticSimilarityMetricsConfig {
    // Optional. Whether to calculate semantic similarity metrics for the
    // evaluation.
    bool enable_semantic_similarity_metrics = 1
        [(google.api.field_behavior) = OPTIONAL];
  }

  // Configuration for correctness metrics for the evaluation.
  // To disable the metric, set the message but do not set the
  // `enable_tool_correctness_metrics` field to true (or explicitly set it to
  // false). To unset the configuration and fallback to the default behavior,
  // omit the message entirely.
  message ToolCorrectnessMetricsConfig {
    // Optional. Whether to calculate tool correctness metrics for the
    // evaluation.
    bool enable_tool_correctness_metrics = 1
        [(google.api.field_behavior) = OPTIONAL];
  }

  // Configuration for the hallucination metrics for the evaluation.
  // To disable the metric, set the message but do not set the
  // `enable_hallucination_metrics` field to true (or explicitly set it to
  // false). To unset the configuration and fallback to the default behavior,
  // omit the message entirely.
  message HallucinationMetricsConfig {
    // Optional. Whether to calculate hallucination metrics for the evaluation.
    bool enable_hallucination_metrics = 1
        [(google.api.field_behavior) = OPTIONAL];
  }

  // Configuration for the user goal met metrics for the evaluation.
  // To disable the metric, set the message but do not set the
  // `enable_user_goal_met_metrics` field to true (or explicitly set it to
  // false). To unset the configuration and fallback to the default behavior,
  // omit the message entirely.
  message UserGoalMetMetricsConfig {
    // Optional. Whether to calculate the user goal met metrics for the
    // evaluation.
    bool enable_user_goal_met_metrics = 1
        [(google.api.field_behavior) = OPTIONAL];
  }

  // Configuration for the expectation level metrics for the evaluation.
  // To disable the metric, set the message but do not set the
  // `enable_expectations_met_metrics` field to true (or explicitly set it to
  // false). To unset the configuration and fallback to the default behavior,
  // omit the message entirely.
  message ExpectationsMetMetricsConfig {
    // Optional. Whether to calculate the expectation level metrics for the
    // evaluation.
    bool enable_expectations_met_metrics = 1
        [(google.api.field_behavior) = OPTIONAL];
  }

  // Configuration for the golden metrics for the evaluation.
  message GoldenMetricsConfig {
    // Optional. Global configuration for semantic similarity metrics.
    SemanticSimilarityMetricsConfig semantic_similarity_metrics_config = 1
        [(google.api.field_behavior) = OPTIONAL];

    // Optional. Configuration for turn level tool correctness metrics.
    ToolCorrectnessMetricsConfig tool_correctness_metrics_config = 2
        [(google.api.field_behavior) = OPTIONAL];

    // Optional. Configuration for step level tool correctness metrics.
    ToolCorrectnessMetricsConfig step_tool_correctness_metrics_config = 6
        [(google.api.field_behavior) = OPTIONAL];
  }

  // Configuration for the scenario metrics for the evaluation.
  message ScenarioMetricsConfig {
    // Optional. Configuration for user goal met metrics.
    UserGoalMetMetricsConfig user_goal_met_metrics_config = 2
        [(google.api.field_behavior) = OPTIONAL];

    // Optional. Configuration for expectation level metrics.
    ExpectationsMetMetricsConfig expectations_met_metrics_config = 3
        [(google.api.field_behavior) = OPTIONAL];
  }

  // Supported comparison types for checking the agent's response.
  enum ComparisonType {
    // Unspecified comparison type. Behavior defaults to SEMANTIC_SIMILARITY
    // for agent responses and tool calls.
    COMPARISON_TYPE_UNSPECIFIED = 0;

    // Exact string match.
    EQUALS = 1;

    // Substring match (checks if the expected string is contained in the
    // actual response).
    CONTAINS = 2;

    // Semantic similarity match (evaluates meaning similarity using an LLM).
    SEMANTIC_SIMILARITY = 3;
  }

  // Optional. Configuration for the golden metrics for the evaluation.
  GoldenMetricsConfig golden_metrics_config = 1
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Configuration for the scenario metrics for the evaluation.
  ScenarioMetricsConfig scenario_metrics_config = 2
      [(google.api.field_behavior) = OPTIONAL];
}
