From fb7050a200b6d9a54455a1eb821c2578d1ef8c77 Mon Sep 17 00:00:00 2001 From: Sydney Lister Date: Mon, 11 May 2026 11:59:37 -0400 Subject: [PATCH] Fix code-based evaluator sample: add missing data_mapping The sample at sample_eval_catalog_code_based_evaluators.py failed with HTTP 400 'MissingRequiredDataMapping: Data mapping for required field item is missing' because the testing criterion had no data_mapping for the evaluator's required 'item' field. Also correct pass_threshold init_parameter schema from 'string' to 'number' to match the float value (0.5) actually passed at runtime. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../evaluations/sample_eval_catalog_code_based_evaluators.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/ai/azure-ai-projects/samples/evaluations/sample_eval_catalog_code_based_evaluators.py b/sdk/ai/azure-ai-projects/samples/evaluations/sample_eval_catalog_code_based_evaluators.py index f1ffe187b7f0..36aa0f0108c8 100644 --- a/sdk/ai/azure-ai-projects/samples/evaluations/sample_eval_catalog_code_based_evaluators.py +++ b/sdk/ai/azure-ai-projects/samples/evaluations/sample_eval_catalog_code_based_evaluators.py @@ -63,7 +63,7 @@ "init_parameters": { "required": ["deployment_name", "pass_threshold"], "type": "object", - "properties": {"deployment_name": {"type": "string"}, "pass_threshold": {"type": "string"}}, + "properties": {"deployment_name": {"type": "string"}, "pass_threshold": {"type": "number"}}, }, "metrics": { "result": { @@ -116,6 +116,7 @@ type="azure_ai_evaluator", name="my_custom_evaluator_code", evaluator_name="my_custom_evaluator_code", + data_mapping={"item": "{{item}}"}, initialization_parameters={ "deployment_name": f"{model_deployment_name}", "pass_threshold": 0.5,