This is an interactive notebook. You can run it locally or use the links below:
Scorers as guardrails
Weave Scorers are classes with ascore method that evaluates the performance of a call. They can range from basic rules to LLMs as judges.
This notebook is for Weave users who want to apply Scorers at runtime to block or filter unwanted model outputs. By following along, you build a content safety guardrail that intercepts an LLM response, evaluates it with a Scorer, and returns a fallback message when the Scorer flags the response as unsafe. Using Scorers this way lets you reuse the same evaluation logic that powers offline experiments to enforce safety policies in production.
By the end of this notebook, you have a working ContentSafetyScorer that wraps an LLM call and returns either the original response or a safe fallback, depending on the Scorer’s verdict.