Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"