From 95ea1b81fe4941292c01fca3f7780df2408c8120 Mon Sep 17 00:00:00 2001 From: Ethan Winters Date: Wed, 20 Nov 2024 09:50:37 -0800 Subject: [PATCH] add handling of optional param (#3608) --- .../evaluations-built-in/context/evaluate_on_data.py | 5 ++--- .../evaluations-built-in/context/requirements.txt | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/assets/evaluation_on_cloud/environments/evaluations-built-in/context/evaluate_on_data.py b/assets/evaluation_on_cloud/environments/evaluations-built-in/context/evaluate_on_data.py index 8cf17d708d..85897abcce 100644 --- a/assets/evaluation_on_cloud/environments/evaluations-built-in/context/evaluate_on_data.py +++ b/assets/evaluation_on_cloud/environments/evaluations-built-in/context/evaluate_on_data.py @@ -56,6 +56,7 @@ def initialize_evaluators(command_line_args): """Initialize the evaluators using correct parameters and credentials for rai evaluators.""" evaluators = {} evaluators_o = json.loads(command_line_args.evaluators) + rai_evaluators = json.loads(command_line_args.rai_evaluators) for evaluator_name, evaluator in evaluators_o.items(): init_params = evaluator["InitParams"] update_value_in_dict(init_params, "AZURE_OPENAI_API_KEY", lambda x: os.environ[x.upper()]) @@ -122,11 +123,9 @@ parser.add_argument("--eval_data", type=str) parser.add_argument("--eval_output", type=str) parser.add_argument("--evaluators", type=str) parser.add_argument("--evaluator_name_id_map", type=str) +parser.add_argument("--rai_evaluators", type=str, help="Comma-separated list of RAI evaluators", required=False) args = parser.parse_args() -rai_evaluators = ['Sexual-Content-Evaluator', 'Hate-and-Unfairness-Evaluator', - 'Violent-Content-Evaluator', 'Self-Harm-Related-Content-Evaluator', - 'Groundedness-Pro-Evaluator', 'Protected-Material-Evaluator', 'Indirect-Attack-Evaluator'] if __name__ == '__main__': copy_evaluator_files(args) diff --git a/assets/evaluation_on_cloud/environments/evaluations-built-in/context/requirements.txt b/assets/evaluation_on_cloud/environments/evaluations-built-in/context/requirements.txt index f9d94f9e36..903db1dc3f 100644 --- a/assets/evaluation_on_cloud/environments/evaluations-built-in/context/requirements.txt +++ b/assets/evaluation_on_cloud/environments/evaluations-built-in/context/requirements.txt @@ -1,4 +1,4 @@ -azure-ai-evaluation~=1.0.0b5 +azure-ai-evaluation==1.0.0b5 azureml-mlflow=={{latest-pypi-version}} azure-ai-ml=={{latest-pypi-version}}