Skip to content

Commit 8f2e930

Browse files
nagkumar91Nagkumar ArkalgudNagkumar ArkalgudNagkumar Arkalgud
authored
Api view fixes (#40376)
* Update task_query_response.prompty remove required keys * Update task_simulate.prompty * Update task_query_response.prompty * Update task_simulate.prompty * Fix the api_key needed * Update for release * Black fix for file * Add original text in global context * Update test * Update the indirect attack simulator * Black suggested fixes * Update simulator prompty * Update adversarial scenario enum to exclude XPIA * Update changelog * Black fixes * Remove duplicate import * Fix the mypy error * Mypy please be happy * Updates to non adv simulator * accept context from assistant messages, exclude them when using them for conversation * update changelog * pylint fixes * pylint fixes * remove redundant quotes * Fix typo * pylint fix * Update broken tests * Include the grounding json in the manifest * Fix typo * Come on package * Release 1.0.0b5 * Notice from Chang * Remove adv_conv template parameters from the outputs * Update chanagelog * Experimental tags on adv scenarios * Readme fix onbreaking change * Add the category and both user and assistant context to the response of qr_json_lines * Update changelog * Rename _kwargs to _options * _options as prefix * update troubleshooting for simulator * Rename according to suggestions * Clean up readme * more links * Bugfix: zip_longest created null parameters * Updated changelog * zip does the job * remove ununsed import * Fix changelog merge * Remove print statements * fixed * add experimental * Address feedback --------- Co-authored-by: Nagkumar Arkalgud <[email protected]> Co-authored-by: Nagkumar Arkalgud <[email protected]> Co-authored-by: Nagkumar Arkalgud <[email protected]>
1 parent 69ad59c commit 8f2e930

File tree

5 files changed

+24
-10
lines changed

5 files changed

+24
-10
lines changed

sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/_evaluators/_response_completeness/_response_completeness.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from azure.ai.evaluation._common._experimental import experimental
1616

1717

18+
@experimental
1819
class ResponseCompletenessEvaluator(PromptyEvaluatorBase[Union[str, float]]):
1920
"""
2021
Evaluates the extent to which a given response contains all necessary and relevant information with respect to the

sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/red_team/_attack_objective_generator.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
from enum import Enum
88
from typing import List, Optional, Dict, Any
99
from pathlib import Path
10+
from azure.ai.evaluation._common._experimental import experimental
1011

12+
13+
@experimental
1114
class RiskCategory(str, Enum):
1215
"""Risk categories for attack objectives."""
1316
HateUnfairness = "hate_unfairness"

sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/red_team/_attack_strategy.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
# ---------------------------------------------------------
44
from enum import Enum
55
from typing import List
6+
from azure.ai.evaluation._common._experimental import experimental
67

8+
9+
@experimental
710
class AttackStrategy(Enum):
811
"""Strategies for attacks."""
912
EASY = "easy"

sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/red_team/_red_team.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,17 @@ class RedTeam():
9090
:param max_parallel_tasks: Maximum number of parallel tasks to run when scanning (default: 5)
9191
:type max_parallel_tasks: int
9292
"""
93-
def __init__(self,
94-
azure_ai_project,
95-
credential,
96-
risk_categories: Optional[List[RiskCategory]] = None,
97-
num_objectives: int = 10,
98-
application_scenario: Optional[str] = None,
99-
custom_attack_seed_prompts: Optional[str] = None,
100-
output_dir=None):
93+
def __init__(
94+
self,
95+
azure_ai_project,
96+
credential,
97+
*,
98+
risk_categories: Optional[List[RiskCategory]] = None,
99+
num_objectives: int = 10,
100+
application_scenario: Optional[str] = None,
101+
custom_attack_seed_prompts: Optional[str] = None,
102+
output_dir=None
103+
):
101104

102105
self.azure_ai_project = validate_azure_ai_project(azure_ai_project)
103106
self.credential = credential
@@ -1430,8 +1433,9 @@ async def _process_attack(
14301433
return None
14311434

14321435
async def scan(
1433-
self,
1436+
self,
14341437
target: Union[Callable, AzureOpenAIModelConfiguration, OpenAIModelConfiguration, PromptChatTarget],
1438+
*,
14351439
scan_name: Optional[str] = None,
14361440
num_turns : int = 1,
14371441
attack_strategies: List[Union[AttackStrategy, List[AttackStrategy]]] = [],
@@ -1440,7 +1444,8 @@ async def scan(
14401444
application_scenario: Optional[str] = None,
14411445
parallel_execution: bool = True,
14421446
max_parallel_tasks: int = 5,
1443-
timeout: int = 120) -> RedTeamOutput:
1447+
timeout: int = 120
1448+
) -> RedTeamOutput:
14441449
"""Run a red team scan against the target using the specified strategies.
14451450
14461451
:param target: The target model or function to scan

sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/red_team/_red_team_result.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# ---------------------------------------------------------
44
from typing import Dict, List, Optional, TypedDict
55
import json
6+
from azure.ai.evaluation._common._experimental import experimental
67

78
class _RiskCategorySummary(TypedDict):
89
"""Summary of attack success rates across risk categories."""
@@ -118,6 +119,7 @@ class _RedTeamResult(TypedDict):
118119
redteaming_data: List[_Conversation]
119120
studio_url: Optional[str]
120121

122+
@experimental
121123
class RedTeamOutput():
122124
def __init__(self, red_team_result: Optional[_RedTeamResult] = None, redteaming_data: Optional[List[_Conversation]] = None):
123125
self.red_team_result = red_team_result

0 commit comments

Comments
 (0)