Decorator
@predicate
Convert a comparison function into a full predicate with automatic result wrapping. Signature:
Returns:
Predicate - A wrapped callable that returns PredicateResult
Example:
Result Classes
PredicateResult
Result of a predicate evaluation with metadata and confidence. Attributes:
Methods:
Example:
Built-in Semantic Predicates
All built-in predicates are async functions that returnPredicateResult.
has_conflicting_facts
Check if actual text contradicts facts in reference text. Signature:
Returns:
PredicateResult - value is True if contradictions found
Example:
has_unsupported_facts
Check if actual text contains facts not found in reference text (hallucinations). Signature:
Returns:
PredicateResult - value is True if unsupported facts found
Example:
has_facts
Check if actual text contains all facts from reference text. Signature:
Returns:
PredicateResult - value is True if all required facts present
Example:
matches_facts
Check if actual and reference texts convey the same set of facts (bidirectional). Signature:
Returns:
PredicateResult - value is True if texts are factually equivalent
Example:
has_topics
Check if actual text covers all topics from reference text. Signature:
Returns:
PredicateResult - value is True if all topics covered
Example:
follows_policy
Check if actual text adheres to rules/policies in reference text. Signature:
Returns:
PredicateResult - value is True if compliant with policy
Example:
matches_writing_style
Check if actual text has the same writing style as reference text. Signature:
Returns:
PredicateResult - value is True if style matches
Example:
matches_writing_layout
Check if actual text follows the same structure as reference template. Signature:
Returns:
PredicateResult - value is True if layout matches
Example: