18
18
from azure .ai .evaluation .simulator import Simulator , AdversarialSimulator , AdversarialScenario , AdversarialScenarioJailbreak , IndirectAttackSimulator , DirectAttackSimulator
19
19
from azure .ai .evaluation .simulator ._utils import JsonLineList
20
20
from azure .ai .evaluation ._common .utils import validate_azure_ai_project
21
- from pyrit .prompt_target import PromptChatTarget #TODO: Remove this once eval logic for red team agent is moved to red team agent
22
21
from azure .ai .evaluation ._model_configurations import AzureOpenAIModelConfiguration , OpenAIModelConfiguration
23
22
from azure .core .credentials import TokenCredential
24
23
import json
@@ -460,7 +459,7 @@ def _check_target_is_callback(target:Callable) -> bool:
460
459
def _validate_inputs (
461
460
self ,
462
461
evaluators : List [_SafetyEvaluator ],
463
- target : Union [Callable , AzureOpenAIModelConfiguration , OpenAIModelConfiguration , PromptChatTarget ], #TODO: Remove this once eval logic for red team agent is moved to red team agent
462
+ target : Union [Callable , AzureOpenAIModelConfiguration , OpenAIModelConfiguration ],
464
463
num_turns : int = 1 ,
465
464
scenario : Optional [Union [AdversarialScenario , AdversarialScenarioJailbreak ]] = None ,
466
465
source_text : Optional [str ] = None ,
@@ -478,10 +477,10 @@ def _validate_inputs(
478
477
:param source_text: The source text to use as grounding document in the evaluation.
479
478
:type source_text: Optional[str]
480
479
'''
481
- if not callable (target ) and not isinstance ( target , PromptChatTarget ): #TODO: Remove this once eval logic for red team agent is moved to red team agent
480
+ if not callable (target ):
482
481
self ._validate_model_config (target )
483
482
#TODO: Remove self._check_target_is_callback(target)) once eval logic for red team agent is moved to red team agent
484
- elif not isinstance ( target , PromptChatTarget ) and not ( self ._check_target_returns_str (target ) or self . _check_target_is_callback ( target ) ):
483
+ elif self ._check_target_returns_str (target ):
485
484
self .logger .error (f"Target function { target } does not return a string." )
486
485
msg = f"Target function { target } does not return a string."
487
486
raise EvaluationException (
@@ -574,7 +573,7 @@ def _calculate_defect_rate(self, evaluation_result_dict) -> EvaluationResult:
574
573
575
574
async def __call__ (
576
575
self ,
577
- target : Union [Callable , AzureOpenAIModelConfiguration , OpenAIModelConfiguration , PromptChatTarget ],
576
+ target : Union [Callable , AzureOpenAIModelConfiguration , OpenAIModelConfiguration ],
578
577
evaluators : List [_SafetyEvaluator ] = [],
579
578
evaluation_name : Optional [str ] = None ,
580
579
num_turns : int = 1 ,
0 commit comments