diff --git a/sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/_aoai/python_grader.py b/sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/_aoai/python_grader.py index ccc1d87fb639..f5884a7ec2a8 100644 --- a/sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/_aoai/python_grader.py +++ b/sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/_aoai/python_grader.py @@ -30,8 +30,8 @@ class AzureOpenAIPythonGrader(AzureOpenAIGrader): ~azure.ai.evaluation.OpenAIModelConfiguration] :param name: The name of the grader. :type name: str - :param image_tag: The image tag for the Python execution environment. - :type image_tag: str + :param image_tag: The image tag for the Python execution environment. Defaults to "2025-05-08". + :type image_tag: Optional[str] :param pass_threshold: Score threshold for pass/fail classification. Scores >= threshold are considered passing. :type pass_threshold: float :param source: Python source code containing the grade function. @@ -63,7 +63,7 @@ def __init__( name: str, pass_threshold: float, source: str, - image_tag: Optional[str] = None, + image_tag: Optional[str] = "2025-05-08", credential: Optional[TokenCredential] = None, **kwargs: Any, ): diff --git a/sdk/evaluation/azure-ai-evaluation/tests/unittests/test_aoai_python_grader.py b/sdk/evaluation/azure-ai-evaluation/tests/unittests/test_aoai_python_grader.py index 48e69a0ac14f..ad5aeded70a5 100644 --- a/sdk/evaluation/azure-ai-evaluation/tests/unittests/test_aoai_python_grader.py +++ b/sdk/evaluation/azure-ai-evaluation/tests/unittests/test_aoai_python_grader.py @@ -52,3 +52,28 @@ def test_invalid_pass_threshold(self): pass_threshold=1.5, source=source_code, ) + + def test_default_image_tag(self): + """Test that image_tag has a default value of '2025-05-08'.""" + model_config = AzureOpenAIModelConfiguration( + azure_endpoint="https://test.openai.azure.com", + api_key="test-key", + azure_deployment="test-deployment", + ) + + source_code = """ +def grade(sample: dict, item: dict) -> float: + return 1.0 +""" + + # Create grader without specifying image_tag + grader = AzureOpenAIPythonGrader( + model_config=model_config, + name="python_test", + pass_threshold=0.5, + source=source_code, + ) + + # Verify the grader was created successfully + assert grader.pass_threshold == 0.5 + assert grader.id == "azureai://built-in/evaluators/azure-openai/python_grader"