Skip to content
v2.278.0

EvaluatorRatingScale Class ​

Represents a rating scale for custom LLM-as-a-Judge evaluators.

Rating scales define how the evaluator scores agent performance. Use either categorical (discrete labels) or numerical (labeled numeric values) scales.

Example ​

ts
// Categorical rating scale
const categorical = agentcore.EvaluatorRatingScale.categorical([
  { label: 'Good', definition: 'The response fully addresses the query.' },
  { label: 'Bad', definition: 'The response fails to address the query.' },
]);

// Numerical rating scale
const numerical = agentcore.EvaluatorRatingScale.numerical([
  { label: 'Poor', definition: 'Inadequate response.', value: 1 },
  { label: 'Good', definition: 'Adequate response.', value: 3 },
  { label: 'Excellent', definition: 'Outstanding response.', value: 5 },
]);
python
# Categorical rating scale
categorical = agentcore.EvaluatorRatingScale.categorical([agentcore.CategoricalRatingOption(label="Good", definition="The response fully addresses the query."), agentcore.CategoricalRatingOption(label="Bad", definition="The response fails to address the query.")
])

# Numerical rating scale
numerical = agentcore.EvaluatorRatingScale.numerical([agentcore.NumericalRatingOption(label="Poor", definition="Inadequate response.", value=1), agentcore.NumericalRatingOption(label="Good", definition="Adequate response.", value=3), agentcore.NumericalRatingOption(label="Excellent", definition="Outstanding response.", value=5)
])
java
// Categorical rating scale
EvaluatorRatingScale categorical = EvaluatorRatingScale.categorical(List.of(CategoricalRatingOption.builder().label("Good").definition("The response fully addresses the query.").build(), CategoricalRatingOption.builder().label("Bad").definition("The response fails to address the query.").build()));

// Numerical rating scale
EvaluatorRatingScale numerical = EvaluatorRatingScale.numerical(List.of(NumericalRatingOption.builder().label("Poor").definition("Inadequate response.").value(1).build(), NumericalRatingOption.builder().label("Good").definition("Adequate response.").value(3).build(), NumericalRatingOption.builder().label("Excellent").definition("Outstanding response.").value(5).build()));
csharp
// Install: dotnet add package Amazon.CDK.AWS.Bedrock.Agentcore.Alpha
// Categorical rating scale
var categorical = EvaluatorRatingScale.Categorical(new [] { new CategoricalRatingOption { Label = "Good", Definition = "The response fully addresses the query." }, new CategoricalRatingOption { Label = "Bad", Definition = "The response fails to address the query." } });

// Numerical rating scale
var numerical = EvaluatorRatingScale.Numerical(new [] { new NumericalRatingOption { Label = "Poor", Definition = "Inadequate response.", Value = 1 }, new NumericalRatingOption { Label = "Good", Definition = "Adequate response.", Value = 3 }, new NumericalRatingOption { Label = "Excellent", Definition = "Outstanding response.", Value = 5 } });
go
// Install: go get github.com/aws/aws-cdk-go/awsbedrockagentcorealpha/v2
// Categorical rating scale
categorical := agentcore.EvaluatorRatingScale_Categorical([]CategoricalRatingOption{
	&CategoricalRatingOption{
		Label: jsii.String("Good"),
		Definition: jsii.String("The response fully addresses the query."),
	},
	&CategoricalRatingOption{
		Label: jsii.String("Bad"),
		Definition: jsii.String("The response fails to address the query."),
	},
})

// Numerical rating scale
numerical := agentcore.EvaluatorRatingScale_Numerical([]NumericalRatingOption{
	&NumericalRatingOption{
		Label: jsii.String("Poor"),
		Definition: jsii.String("Inadequate response."),
		Value: jsii.Number(1),
	},
	&NumericalRatingOption{
		Label: jsii.String("Good"),
		Definition: jsii.String("Adequate response."),
		Value: jsii.Number(3),
	},
	&NumericalRatingOption{
		Label: jsii.String("Excellent"),
		Definition: jsii.String("Outstanding response."),
		Value: jsii.Number(5),
	},
})

Methods ​

categorical(options: CategoricalRatingOption[]): EvaluatorRatingScale // chainable@staticmethod def categorical(options: typing.List[CategoricalRatingOption]) -> EvaluatorRatingScalepublic static EvaluatorRatingScale categorical(List<CategoricalRatingOption> options)public static EvaluatorRatingScale Categorical(CategoricalRatingOption[] options)func Categorical(Options *[]CategoricalRatingOption) EvaluatorRatingScale static #
Creates a categorical rating scale.

Categorical scales define discrete labels for scoring, such as "Good" / "Bad" or "Pass" / "Fail".

1 parameter

Parameters

  • optionsoptionsoptionsoptionsOptions — - The categorical rating options (at least 1 required).
numerical(options: NumericalRatingOption[]): EvaluatorRatingScale // chainable@staticmethod def numerical(options: typing.List[NumericalRatingOption]) -> EvaluatorRatingScalepublic static EvaluatorRatingScale numerical(List<NumericalRatingOption> options)public static EvaluatorRatingScale Numerical(NumericalRatingOption[] options)func Numerical(Options *[]NumericalRatingOption) EvaluatorRatingScale static #
Creates a numerical rating scale.

Numerical scales define labeled numeric values for scoring, such as 1 (Poor) through 5 (Excellent).

1 parameter

Parameters

  • optionsoptionsoptionsoptionsOptions — - The numerical rating options (at least 1 required).