Conversation
…val output Surfaces overall precision/recall/f1/accuracy (not just per-entity) and the PIIRemover config (entity types, threshold, NLP engine, model, on_fail) used for the run, so metrics.json is self-describing for external readers.
Clarifies that this is PII's overall detection-level score alongside entity_metrics, distinct from the shared compute_binary_metrics() helper used as the sole metric in other eval scripts.
…s output Mirrors the pii_remover eval script, which already records the config used (entity types, threshold, etc.) alongside the metrics for reproducibility. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…valuations Introduces build_validator_config() in common/helper.py, which reads on_fail from validator.on_fail_descriptor (set by every guardrails Validator base class) and normalizes any extra constructor params passed in (enums -> their .value). PII and gender_assumption_bias now use it instead of hand-rolled dicts, and ban_list, lexical_slur, topic_relevance, and toxicity gain a config block in their metrics.json for the first time.
Adds LexicalSlur alongside the existing toxicity validators with --validators/--sources filtering and a combined (OR) metric per source (computed from already-produced predictions, no re-running), now against a single standardized dataset (text/label/language/dataset) instead of three separate files. Also lazily imports nsfw_text/profanity_free from their new guardrails_ai.* packages and llamaguard_7b from guardrails.hub, so selecting a subset of validators doesn't require llamaguard_7b's still-unmigrated hub path to be importable at all. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository: ProjectTech4DevAI/kaapi-guardrails/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…icity eval The toxicity eval runs uli_slur_match over a superset of the rows the standalone script used, producing identical metrics and config for that subset (--validators lexical_slur --sources lexical reproduces it exactly), so the separate script and its dataset are redundant. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LexicalSluras a fourth validator in the toxicity eval--validators/--sourcesflags to run a subset of validators or source datasetscombined_predcolumn and acombinedmetrics entry — a logical OR across whichever validators ran, derived from the already-produced*_predcolumns (nothing is re-run) — plus asource_metricsbreakdown per origin dataset for every validatortoxicity_test_combined.csv(text,label,language,dataset), with onepredictions.csv/metrics.jsonoutput pair instead of a file per datasetnsfw_text/profanity_freelazily from theirguardrails_ai.*packages andllamaguard_7blazily fromguardrails.hub, so selecting a subset of validators no longer requires llamaguard_7b's still-unmigrated hub path to be importable (a top-level import currently fails outright, since.guardrails/hub_registry.jsonstill points at the defunctguardrails_grhub_llamaguard_7bpackage)Results from a local run
--validators lexical_slur profanity_freeacross all 1801 rows:Note the
lexicalsource is the lexical-slur eval's own curated set, so its near-perfect recall is expected and inflates the overall figure; hasoc + sharechat alone give precision 0.78 / recall 0.48 / F1 0.59.Test plan
python3 -m app.evaluation.toxicity.run --validators lexical_slur profanity_freemetrics.jsonhas a per-validator entry pluscombined, each with asource_metricsbreakdownpredictions.csvhascombined_predequal to the row-wise OR of the individual*_predcolumns🤖 Generated with Claude Code