ContentSafetyMultimodalEvaluator Class
Note
This is an experimental class, and may change at any time. Please see https://aka.ms/azuremlexperimental for more information.
Initialize a content safety multimodal evaluator configured to evaluate content safety metrics in a multimodal scenario.
Usage Example
azure_ai_project = {
"subscription_id": "<subscription_id>",
"resource_group_name": "<resource_group_name>",
"project_name": "<project_name>",
}
eval_fn = ContentSafetyMultimodalEvaluator(azure_ai_project)
result = eval_fn(
{
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What's in this image?"
},
{
"type": "image_url",
"image_url": {
"url": "<image url or base64 encoded image>"
}
}
]
},
{
"role": "assistant",
"content": "This picture shows an astronaut standing in the desert."
}
]
}
)
Output Format
{
"violence": "Medium",
"violence_score": 5.0,
"violence_reason": "Some reason",
"sexual": "Medium",
"sexual_score": 5.0,
"sexual_reason": "Some reason",
"self_harm": "Medium",
"self_harm_score": 5.0,
"self_harm_reason": "Some reason",
"hate_unfairness": "Medium",
"hate_unfairness_score": 5.0,
"hate_unfairness_reason": "Some reason"
}
Constructor
ContentSafetyMultimodalEvaluator(credential, azure_ai_project, parallel: bool = False)
Parameters
Name | Description |
---|---|
credential
Required
|
The credential required for connecting to the Azure AI project. |
azure_ai_project
Required
|
The scope of the Azure AI project, containing the subscription ID, resource group, and project name. |
parallel
|
Specifies whether to use parallel execution for evaluators. If True, evaluators execute in parallel; otherwise, they execute sequentially. Defaults to True. Default value: False
|