Skip to content

Commit

Permalink
add: test for eval classification
Browse files Browse the repository at this point in the history
  • Loading branch information
soumik12345 committed Jan 2, 2025
1 parent 0e6261e commit e705646
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,17 @@ jobs:
pip install -e ".[dev]"
huggingface-cli login --token ${{ secrets.HF_TOKEN }}
python -m pytest -s tests/test_prompt_injection_classifier.py
test-evaluation-classification:
name: test evaluation classification
runs-on: ubuntu-latest
env:
WANDB_API_KEY: ${{ secrets.WANDB_API_KEY }}
steps:
- uses: actions/checkout@v4
- run: |
pip install -U pip
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install -e ".[dev]"
wandb login --relogin
python -m pytest -s tests/test_evaluation_classification.py
12 changes: 12 additions & 0 deletions tests/test_evaluation_classification.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from safeguards.meta_evaluation import EvaluationClassifier


def test_evaluation_classification():
parser = EvaluationClassifier(
project="geekyrakshit/guardrails-genie",
call_id="0193bc3f-cb02-7271-89bd-e7fdccfc4edc",
)
parser.register_predict_and_score_calls(
max_predict_and_score_calls=2, save_filepath="evaluation.json"
)
assert len(parser.predict_and_score_calls) == 2

0 comments on commit e705646

Please sign in to comment.