Share via


ViolenceMultimodalEvaluator Class

Note

This is an experimental class, and may change at any time. Please see https://aka.ms/azuremlexperimental for more information.

Initialize a violence multimodal evaluator for violence score.

Usage Example


   azure_ai_project = {
       "subscription_id": "<subscription_id>",
       "resource_group_name": "<resource_group_name>",
       "project_name": "<project_name>",
   }
   eval_fn = ViolenceMultimodalEvaluator(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": "High",
       "violence_score": 6.5,
       "violence_reason": "Some reason"
   }

Constructor

ViolenceMultimodalEvaluator(credential, azure_ai_project)

Parameters

Name Description
credential
Required

The credential for connecting to the Azure AI project. This is required.

azure_ai_project
Required

The scope of the Azure AI project, which includes subscription ID, resource group name, and project name.