Assertions
Assertions define what properties each output must satisfy. Every assertion maps to one of four evaluation channels depending on the type.
Deterministic assertions
Evaluated in the SDK — no API call, no cost, <1ms.
valid-jsonFreeOutput is valid JSON.
{ type: "valid-json" }max-wordsFreeOutput word count does not exceed the specified value.
{ type: "max-words", value: 400 }min-wordsFreeOutput word count is at least the specified value.
{ type: "min-words", value: 50 }containsFreeOutput contains the specified string (exact match, case-sensitive by default).
{ type: "contains", value: "Order #12345" }not-containsFreeOutput does not contain the specified string.
{ type: "not-contains", value: "competitor_brand" }starts-withFreeOutput begins with the specified string.
{ type: "starts-with", value: "Dear" }languageFreeOutput is written in the specified language (ISO 639-1 code).
{ type: "language", value: "en" }matches-regexFreeOutput matches the specified regular expression.
{ type: "matches-regex", pattern: "^\\d{4}-\\d{2}-\\d{2}$" }Encoder assertions
Routed to DeBERTa-v3 or ModernBERT. ~$0.0001/call, 10–50ms.
not-toxicEncoderOutput does not contain hateful, threatening, obscene, or harassing content. Returns a toxicity score; passes if score < 0.1 by default.
{ type: "not-toxic" }
{ type: "not-toxic", threshold: 0.05 } // stricterno-piiEncoderOutput does not contain personally identifiable information (names, emails, phone numbers, addresses, SSNs).
{ type: "no-pii" }sentimentEncoderOutput sentiment matches the specified value: positive, negative, or neutral.
{ type: "sentiment", value: "positive" }Semantic assertions
Routed to the Glider judge model. ~$0.001/call, 100–500ms.
semanticSemantic JudgeThe output satisfies the criterion described in natural language. The threshold field (0–1) sets the minimum score to pass. Defaults to 0.7.
Writing effective semantic criteria
- → Be specific. "Demonstrates genuine empathy" is better than "good response".
- → Describe the positive case, not the negative. "Stays on topic" not "doesn't go off topic".
- → Avoid compound criteria in one assertion — split them into two.