Install & Compatibility
Where this runs
tested against v2.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
py 3.9
✕ build_error
✕ build_error
69MB installed
● package 69MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Rubric
✓ from rubric import Rubric
✗ from rubric.engine import RubricEngine
Criterion
✓ from rubric import Criterion
EvaluationReport
✓ from rubric import EvaluationReport
This example demonstrates how to define a dataset schema with data quality rules for response length and language, then use the RubricEngine to validate a list of sample data entries. It showcases the use of `DataQualityRule` with various operators and severity levels.
from rubric.schemas import Dataset, DataQualityRule, Severity, Operator
from rubric.engine import RubricEngine
# Define your dataset schema
rules = [
DataQualityRule(
rule_id="length_check",
description="Responses should be between 10 and 100 characters.",
column="response",
operator=Operator.LENGTH_BETWEEN,
value=[10, 100],
severity=Severity.HIGH,
error_message="Response length out of range."
),
DataQualityRule(
rule_id="language_is_english",
description="Responses should be in English.",
column="response",
operator=Operator.IS_LANGUAGE,
value="en",
severity=Severity.MEDIUM,
error_message="Response is not in English."
)
]
dataset_schema = Dataset(rules=rules)
# Initialize RubricEngine with the schema
rubric_engine = RubricEngine(dataset=dataset_schema)
# Sample data to validate
data = [
{"id": 1, "prompt": "Hello", "response": "This is a short test."}, # Valid
{"id": 2, "prompt": "Another", "response": "Too short"}, # Invalid (length)
{"id": 3, "prompt": "Translate", "response": "Ceci n'est pas anglais."}, # Invalid (language)
{"id": 4, "prompt": "Long response", "response": "a" * 150} # Invalid (length)
]
# Validate the data
validation_results = rubric_engine.validate(data)
for result in validation_results:
print(f"ID: {result.id}, Valid: {result.is_valid}, Errors: {result.errors}")
# Expected Output:
# ID: 1, Valid: True, Errors: []
# ID: 2, Valid: False, Errors: ['Response length out of range.']
# ID: 3, Valid: False, Errors: ['Response is not in English.']
# ID: 4, Valid: False, Errors: ['Response length out of range.']
Upgrade
Version history
2.2.0latest on PyPI · released Jan 21, 2026
Audit
Dependencies
pydanticrequiredUsed for defining data schemas and validation models.
langdetectrequiredUsed for language detection in 'IS_LANGUAGE' rules.
spacyrequiredUsed for advanced language processing, specifically with 'IS_LANGUAGE' rules. Requires manual model download.
numpyrequiredNumerical operations, likely underlying data structures.
scipyrequiredScientific computing, likely for statistical or advanced data processing.