You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TrustyAI Garak (trustyai_garak): Out-of-Tree Llama Stack Eval Provider for Garak Red Teaming
About
This repository implements Garak as a Llama Stack out-of-tree provider for security testing and red teaming of Large Language Models with optional Shield Integration for enhanced security testing.
# Test with input shieldclient.benchmarks.register(
benchmark_id="with_shield",
dataset_id="garak",
scoring_functions=["garak_scoring"],
provider_benchmark_id="with_shield",
provider_id="trustyai_garak",
metadata={
"probes": ["promptinject.HijackHateHumans"],
"shield_ids": ["Prompt-Guard-86M"] # Input shield only
}
)
# Test with input/output shieldsmetadata={
"probes": ["promptinject.HijackHateHumans"],
"shield_config": {
"input": ["Prompt-Guard-86M"],
"output": ["Llama-Guard-3-8B"]
}
}
Accessing Reports
# Get report file IDs from job statusscan_report_id=status.metadata["scan.report.jsonl"]
scan_html_id=status.metadata["scan.report.html"]
# Download via Files APIcontent=client.files.content(scan_report_id)
# Or via HTTPimportrequestsreport=requests.get(f"http://localhost:8321/v1/openai/v1/files/{scan_html_id}/content")
Remote Execution (Kubernetes/KFP)
Setup
# KFP Configurationexport KUBEFLOW_PIPELINES_ENDPOINT="https://your-kfp-endpoint"export KUBEFLOW_NAMESPACE="your-namespace"export KUBEFLOW_EXPERIMENT_NAME="trustyai-garak-scans"export KUBEFLOW_BASE_IMAGE="quay.io/rh-ee-spandraj/trustyai-garak-provider-dsp:cpu"# for gpu - "quay.io/rh-ee-spandraj/trustyai-garak-provider-dsp:gpu"# S3 Configuration (for artifacts)export AWS_ACCESS_KEY_ID="your-key"export AWS_SECRET_ACCESS_KEY="your-secret"export AWS_S3_ENDPOINT="https://your-s3-endpoint"export AWS_S3_BUCKET="pipeline-artifacts"export AWS_DEFAULT_REGION="us-east-1"# Start server
llama stack run run-remote.yaml --image-type venv
Note: If you're running Llama Stack server locally, make sure BASE_URL in run-remote*.yaml is accessible from KFP pods (you can use ngrok to create an accessible endpoint for your local Llama stack service).
Usage
# Same API, runs as KFP pipelinejob=client.eval.run_eval(benchmark_id="trustyai_garak::owasp_llm_top10", ...)
# Monitor pipelinestatus=client.eval.jobs.status(job_id=job.job_id, benchmark_id="trustyai_garak::owasp_llm_top10")
print(f"KFP Run ID: {status.metadata['kfp_run_id']}")