Skip to content

Commit 957696b

Browse files
authored
Address API View feedback for RedTeam (Azure#40257)
* Address API View feedback * move red team to top level namespace * fix test errors * attempting compatibility with python 39 * fix mindependency hopefully * revert dev_requirements
1 parent 86fe1d2 commit 957696b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+230
-269
lines changed

sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/__init__.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,33 @@
4141
OpenAIModelConfiguration,
4242
)
4343

44+
_patch_all = []
45+
4446
# The converter from the AI service to the evaluator schema requires a dependency on
4547
# ai.projects, but we also don't want to force users installing ai.evaluations to pull
4648
# in ai.projects. So we only import it if it's available and the user has ai.projects.
4749
try:
4850
from ._converters._ai_services import AIAgentConverter
49-
_patch_all = ["AIAgentConverter"]
51+
_patch_all.append("AIAgentConverter")
5052
except ImportError:
5153
print("Could not import AIAgentConverter. Please install the dependency with `pip install azure-ai-projects`.")
52-
_patch_all = []
54+
55+
# RedTeam requires a dependency on pyrit, but python 3.9 is not supported by pyrit.
56+
# So we only import it if it's available and the user has pyrit.
57+
try:
58+
from ._red_team._red_team import RedTeam
59+
from ._red_team._attack_strategy import AttackStrategy
60+
from ._red_team._attack_objective_generator import RiskCategory
61+
from ._red_team._red_team_result import RedTeamOutput
62+
_patch_all.extend([
63+
"RedTeam",
64+
"RedTeamOutput",
65+
"AttackStrategy",
66+
"RiskCategory",
67+
])
68+
except ImportError:
69+
print("Could not import RedTeam. Please install the dependency with `pip install azure-ai-evaluation[redteam]`.")
70+
5371

5472
__all__ = [
5573
"evaluate",

0 commit comments

Comments
 (0)