@@ -543,8 +543,17 @@ def test_groundedness_pro_evaluator(self, project_scope, azure_cred, simple_conv
543543 convo_result ["evaluation_per_turn" ]["groundedness_pro_reason" ]
544544 ), "groundedness_pro_reason must not be None or empty."
545545
546- def test_multimodal_evaluator_content_safety_json_image_urls_text_image_input_only (self , project_scope , azure_cred ):
547- evaluator = ContentSafetyMultimodalEvaluator (credential = azure_cred , azure_ai_project = project_scope )
546+ @pytest .mark .parametrize (
547+ "evaluator_class" ,
548+ [
549+ (ContentSafetyMultimodalEvaluator ),
550+ (ContentSafetyEvaluator ),
551+ ],
552+ )
553+ def test_multimodal_evaluator_content_safety_json_image_urls_text_image_input_only (
554+ self , project_scope , azure_cred , evaluator_class
555+ ):
556+ evaluator = evaluator_class (credential = azure_cred , azure_ai_project = project_scope )
548557 conversation = {
549558 "messages" : [
550559 {
@@ -591,10 +600,17 @@ def test_multimodal_evaluator_content_safety_json_image_urls_text_image_input_on
591600 assert score ["hate_unfairness_score" ] < 1.0
592601 assert score ["hate_unfairness_reason" ], "hate_unfairness_reason must not be None or empty."
593602
603+ @pytest .mark .parametrize (
604+ "evaluator_class" ,
605+ [
606+ (ContentSafetyMultimodalEvaluator ),
607+ (ContentSafetyEvaluator ),
608+ ],
609+ )
594610 def test_multimodal_evaluator_content_safety_json_image_urls_text_image_input_only_with_text_content (
595- self , project_scope , azure_cred
611+ self , project_scope , azure_cred , evaluator_class
596612 ):
597- evaluator = ContentSafetyMultimodalEvaluator (credential = azure_cred , azure_ai_project = project_scope )
613+ evaluator = evaluator_class (credential = azure_cred , azure_ai_project = project_scope )
598614 conversation = {
599615 "messages" : [
600616 {
@@ -603,10 +619,10 @@ def test_multimodal_evaluator_content_safety_json_image_urls_text_image_input_on
603619 {"type" : "text" , "text" : "This is a nature boardwalk at the University of Wisconsin-Madison." }
604620 ],
605621 },
606- {"role" : "user" , "content" : "What is in this picture?" },
607622 {
608623 "role" : "user" ,
609624 "content" : [
625+ {"type" : "text" , "text" : "What is in this picture?" },
610626 {
611627 "type" : "image_url" ,
612628 "image_url" : {
@@ -642,8 +658,17 @@ def test_multimodal_evaluator_content_safety_json_image_urls_text_image_input_on
642658 assert score ["hate_unfairness_score" ] < 1.0
643659 assert score ["hate_unfairness_reason" ], "hate_unfairness_reason must not be None or empty."
644660
645- def test_multimodal_evaluator_content_safety_json_image_urls_with_image_output (self , project_scope , azure_cred ):
646- evaluator = ContentSafetyMultimodalEvaluator (credential = azure_cred , azure_ai_project = project_scope )
661+ @pytest .mark .parametrize (
662+ "evaluator_class" ,
663+ [
664+ (ContentSafetyMultimodalEvaluator ),
665+ (ContentSafetyEvaluator ),
666+ ],
667+ )
668+ def test_multimodal_evaluator_content_safety_json_image_urls_with_image_output (
669+ self , project_scope , azure_cred , evaluator_class
670+ ):
671+ evaluator = evaluator_class (credential = azure_cred , azure_ai_project = project_scope )
647672 conversation = {
648673 "messages" : [
649674 {
@@ -683,15 +708,22 @@ def test_multimodal_evaluator_content_safety_json_image_urls_with_image_output(s
683708 assert score ["hate_unfairness_score" ] < 1.0
684709 assert score ["hate_unfairness_reason" ], "hate_unfairness_reason must not be None or empty."
685710
686- def test_multimodal_evaluator_content_safety_json_b64_image (self , project_scope , azure_cred ):
711+ @pytest .mark .parametrize (
712+ "evaluator_class" ,
713+ [
714+ (ContentSafetyMultimodalEvaluator ),
715+ (ContentSafetyEvaluator ),
716+ ],
717+ )
718+ def test_multimodal_evaluator_content_safety_json_b64_image (self , project_scope , azure_cred , evaluator_class ):
687719 parent = pathlib .Path (__file__ ).parent .resolve ()
688720 path = os .path .join (parent , "data" )
689721 image_path = os .path .join (path , "image1.jpg" )
690722
691723 with pathlib .Path (image_path ).open ("rb" ) as image_file :
692724 encoded_image = base64 .b64encode (image_file .read ()).decode ("utf-8" )
693725
694- evaluator = ContentSafetyMultimodalEvaluator (credential = azure_cred , azure_ai_project = project_scope )
726+ evaluator = evaluator_class (credential = azure_cred , azure_ai_project = project_scope )
695727 conversation = {
696728 "messages" : [
697729 {
@@ -734,8 +766,15 @@ def test_multimodal_evaluator_content_safety_json_b64_image(self, project_scope,
734766 assert score ["hate_unfairness_score" ] < 1.0
735767 assert score ["hate_unfairness_reason" ], "hate_unfairness_reason must not be None or empty."
736768
737- def test_multimodal_evaluator_content_safety_inference (self , project_scope , azure_cred ):
738- evaluator = ContentSafetyMultimodalEvaluator (credential = azure_cred , azure_ai_project = project_scope )
769+ @pytest .mark .parametrize (
770+ "evaluator_class" ,
771+ [
772+ (ContentSafetyMultimodalEvaluator ),
773+ (ContentSafetyEvaluator ),
774+ ],
775+ )
776+ def test_multimodal_evaluator_content_safety_inference (self , project_scope , azure_cred , evaluator_class ):
777+ evaluator = evaluator_class (credential = azure_cred , azure_ai_project = project_scope )
739778 conversation = Conversation (
740779 messages = [
741780 SystemMessage (
@@ -776,8 +815,15 @@ def test_multimodal_evaluator_content_safety_inference(self, project_scope, azur
776815 assert score ["hate_unfairness_score" ] < 1.0
777816 assert score ["hate_unfairness_reason" ], "hate_unfairness_reason must not be None or empty."
778817
779- def test_multimodal_evaluator_violence_json (self , project_scope , azure_cred ):
780- evaluator = ViolenceMultimodalEvaluator (credential = azure_cred , azure_ai_project = project_scope )
818+ @pytest .mark .parametrize (
819+ "evaluator_class" ,
820+ [
821+ (ViolenceMultimodalEvaluator ),
822+ (ViolenceEvaluator ),
823+ ],
824+ )
825+ def test_multimodal_evaluator_violence_json (self , project_scope , azure_cred , evaluator_class ):
826+ evaluator = evaluator_class (credential = azure_cred , azure_ai_project = project_scope )
781827 conversation = {
782828 "messages" : [
783829 {
@@ -816,8 +862,15 @@ def test_multimodal_evaluator_violence_json(self, project_scope, azure_cred):
816862 assert score ["violence_score" ] < 1.0
817863 assert score ["violence_reason" ], "violence_reason must not be None or empty."
818864
819- def test_multimodal_evaluator_sexual_json (self , project_scope , azure_cred ):
820- evaluator = SexualMultimodalEvaluator (credential = azure_cred , azure_ai_project = project_scope )
865+ @pytest .mark .parametrize (
866+ "evaluator_class" ,
867+ [
868+ (SexualMultimodalEvaluator ),
869+ (SexualEvaluator ),
870+ ],
871+ )
872+ def test_multimodal_evaluator_sexual_json (self , project_scope , azure_cred , evaluator_class ):
873+ evaluator = evaluator_class (credential = azure_cred , azure_ai_project = project_scope )
821874 conversation = {
822875 "messages" : [
823876 {
@@ -856,8 +909,15 @@ def test_multimodal_evaluator_sexual_json(self, project_scope, azure_cred):
856909 assert score ["sexual_score" ] < 1.0
857910 assert score ["sexual_reason" ], "sexual_reason must not be None or empty."
858911
859- def test_multimodal_evaluator_hate_unfairness_json (self , project_scope , azure_cred ):
860- evaluator = HateUnfairnessMultimodalEvaluator (credential = azure_cred , azure_ai_project = project_scope )
912+ @pytest .mark .parametrize (
913+ "evaluator_class" ,
914+ [
915+ (HateUnfairnessMultimodalEvaluator ),
916+ (HateUnfairnessEvaluator ),
917+ ],
918+ )
919+ def test_multimodal_evaluator_hate_unfairness_json (self , project_scope , azure_cred , evaluator_class ):
920+ evaluator = evaluator_class (credential = azure_cred , azure_ai_project = project_scope )
861921 conversation = {
862922 "messages" : [
863923 {
@@ -896,8 +956,15 @@ def test_multimodal_evaluator_hate_unfairness_json(self, project_scope, azure_cr
896956 assert score ["hate_unfairness_score" ] < 1.0
897957 assert score ["hate_unfairness_reason" ], "hate_unfairness_reason must not be None or empty."
898958
899- def test_multimodal_evaluator_self_harm_json (self , project_scope , azure_cred ):
900- evaluator = SelfHarmMultimodalEvaluator (credential = azure_cred , azure_ai_project = project_scope )
959+ @pytest .mark .parametrize (
960+ "evaluator_class" ,
961+ [
962+ (SelfHarmMultimodalEvaluator ),
963+ (SelfHarmEvaluator ),
964+ ],
965+ )
966+ def test_multimodal_evaluator_self_harm_json (self , project_scope , azure_cred , evaluator_class ):
967+ evaluator = evaluator_class (credential = azure_cred , azure_ai_project = project_scope )
901968 conversation = {
902969 "messages" : [
903970 {
@@ -936,8 +1003,15 @@ def test_multimodal_evaluator_self_harm_json(self, project_scope, azure_cred):
9361003 assert score ["self_harm_score" ] < 1.0
9371004 assert score ["self_harm_reason" ], "self_harm_reason must not be None or empty."
9381005
939- def test_multimodal_evaluator_protected_material_json (self , project_scope , azure_cred ):
940- evaluator = ProtectedMaterialMultimodalEvaluator (credential = azure_cred , azure_ai_project = project_scope )
1006+ @pytest .mark .parametrize (
1007+ "evaluator_class" ,
1008+ [
1009+ (ProtectedMaterialMultimodalEvaluator ),
1010+ (ProtectedMaterialEvaluator ),
1011+ ],
1012+ )
1013+ def test_multimodal_evaluator_protected_material_json (self , project_scope , azure_cred , evaluator_class ):
1014+ evaluator = evaluator_class (credential = azure_cred , azure_ai_project = project_scope )
9411015 conversation = {
9421016 "messages" : [
9431017 {
0 commit comments