openlit.evals module provides four classes:
Hallucination
Detects factual inaccuracies and contradictions against context
BiasDetector
Identifies prejudiced or discriminatory language
ToxicityDetector
Flags harmful or offensive content
All
Runs all three evaluations in a single call
Export configuration
By default, evaluation results are emitted as OTel Log Records, which works well with backends like Grafana Loki. To use OTel Events instead:Both modes carry the same fields — only the transport differs (log body vs. event attributes).
Hallucination detection
Compares the generated text against a set of context sentences and identifies factual inaccuracies, contradictions, and nonsensical responses.Hallucination class parameters
measure() parameters
Hallucination categories
Bias detection
Identifies prejudiced or discriminatory language across categories including gender, age, ethnicity, and religion.BiasDetector class parameters
Bias categories
Toxicity detection
Evaluates text for harmful, offensive, or threatening language.ToxicityDetector class parameters
Toxicity categories
All evaluations
Combines hallucination, bias, and toxicity detection in a single call. Returns the highest-risk evaluation result.All class parameters
Output format
All evaluators return a dict with the same structure:Supported providers
Guardrails
Real-time input safety checks before LLM calls
Tracing
Distributed tracing for LLM calls and agent workflows
Destinations
Send evaluation results to any OTel-compatible backend
