Class ChoiceAnswer

java.lang.Object
com.google.genai.gaos.models.decisions.ChoiceAnswer
All Implemented Interfaces:
Answer

public class ChoiceAnswer extends Object implements Answer
ChoiceAnswer

Calibrated result for a `ChoiceQuestion`.

  • Constructor Details

    • ChoiceAnswer

      public ChoiceAnswer(@Nonnull String choice, double confidence, @Nonnull Map<String,Double> probabilities)
  • Method Details

    • choice

      public Optional<String> choice()
      Required. Output only. The option ID with the highest probability.
    • confidence

      public Optional<Double> confidence()
      Required. Output only. Closed-world confidence score in `[0, 1]`, equal to the calibrated probability of the winning outcome: - `NoulAnswer`: `max(noul, 1 - noul)` - `ChoiceAnswer`: `p_max` (the probability of `choice`) - `ScoreAnswer`: `p_max` (the highest probability in `probabilities`).
    • probabilities

      public Optional<Map<String,Double>> probabilities()
      Required. Output only. Closed-world normalized probability in `[0, 1]` for each option ID.
    • type

      public String type()
      Specified by:
      type in interface Answer
    • builder

      public static ChoiceAnswer.Builder builder()
    • withChoice

      public ChoiceAnswer withChoice(@Nonnull String choice)
      Required. Output only. The option ID with the highest probability.
    • withConfidence

      public ChoiceAnswer withConfidence(double confidence)
      Required. Output only. Closed-world confidence score in `[0, 1]`, equal to the calibrated probability of the winning outcome: - `NoulAnswer`: `max(noul, 1 - noul)` - `ChoiceAnswer`: `p_max` (the probability of `choice`) - `ScoreAnswer`: `p_max` (the highest probability in `probabilities`).
    • withProbabilities

      public ChoiceAnswer withProbabilities(@Nonnull Map<String,Double> probabilities)
      Required. Output only. Closed-world normalized probability in `[0, 1]` for each option ID.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object