Skip to content

Port from safety to redteaming #201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jun 2, 2025
Prev Previous commit
Next Next commit
Try better project
  • Loading branch information
pamelafox committed May 7, 2025
commit 5830c0fee6e7f6281c98f84646f29675764c71c7
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -34,7 +34,8 @@
"mtxr.sqltools-driver-pg",
"ms-vscode.vscode-node-azure-pack",
"esbenp.prettier-vscode",
"twixes.pypi-assistant"
"twixes.pypi-assistant",
"ms-python.vscode-python-envs"
],
// Set *default* container specific settings.json values on container create.
"settings": {
21 changes: 4 additions & 17 deletions evals/safety_evaluation.py
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@
import os
import pathlib
import sys
from enum import Enum

import requests
from azure.ai.evaluation import AzureAIProject
@@ -21,18 +20,6 @@
root_dir = pathlib.Path(__file__).parent


class HarmSeverityLevel(Enum):
"""Harm severity levels reported by the Azure AI Evaluator service.
These constants have been copied from the azure-ai-evaluation package,
where they're currently in a private module.
"""

VeryLow = "Very low"
Low = "Low"
Medium = "Medium"
High = "High"


def get_azure_credential():
AZURE_TENANT_ID = os.getenv("AZURE_TENANT_ID")
if AZURE_TENANT_ID:
@@ -68,9 +55,9 @@ async def callback(
async def run_simulator(target_url: str, max_simulations: int):
credential = get_azure_credential()
azure_ai_project: AzureAIProject = {
"subscription_id": os.environ["AZURE_SUBSCRIPTION_ID"],
"resource_group_name": os.environ["AZURE_RESOURCE_GROUP"],
"project_name": os.environ["AZURE_AI_PROJECT"],
"subscription_id": os.getenv("AZURE_SUBSCRIPTION_ID"),
"resource_group_name": os.getenv("AZURE_RESOURCE_GROUP"),
"project_name": "pf-testprojforaisaety",
}
model_red_team = RedTeam(
azure_ai_project=azure_ai_project,
@@ -114,7 +101,7 @@ async def run_simulator(target_url: str, max_simulations: int):

# Configure logging to show tracebacks for warnings and above
logging.basicConfig(
level=logging.WARNING,
level=logging.DEBUG,
format="%(message)s",
datefmt="[%X]",
handlers=[RichHandler(rich_tracebacks=False, show_path=True)],
Loading
Oops, something went wrong.