Registry / llm-agents / rubric

rubric

JSON →
library2.2.0pypypi✓ verified 85d ago

Rubric is an open-source Python library designed to define and manage data quality rules for Large Language Model (LLM) datasets. It provides a structured way to validate LLM inputs and outputs against predefined criteria, helping ensure data consistency and reliability. The current version is 2.2.0, and it follows a minor release cadence based on feature additions and bug fixes.

pip install rubric
INSTALL
IMPORT
SIG · RUBRIC
R
rubric
llm-agentspythonv2.2.0
Install
6.3s avg
Import
Disk
69MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.93.13
musl
3.93.13
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
musl
glibc
py 3.10
✓ —
✓ 7.55s
py 3.11
✓ —
✓ 6.4s
py 3.12
✓ —
✓ 5.45s
py 3.13
✓ —
✓ 5.6s
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.']
Debug
Known issues
gotchaWhen using the `IS_LANGUAGE` operator, you must manually download the required spaCy language models. For English, this is `en_core_web_sm`.
fix
Run `python -m spacy download en_core_web_sm` in your environment for English. Adjust model name as needed for other languages.
affects: >=1.0.0
breakingThe `DataQualityRule` class introduced a mandatory `column` field in version 1.1.0, specifying which column the rule applies to. Older code that did not specify a column will break.
fix
Ensure all `DataQualityRule` instances explicitly set the `column` argument, e.g., `column="your_data_column_name"`.
affects: >=1.1.0
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.
Agent activity
17 hits · last 30 days
node
16
OpenAI (training)
1
Resources
rubric — pip install rubric · libregistry