veritail includes a set of built-in deterministic checks (zero results, price outliers, near-duplicates, etc.). When you need domain-specific quality checks, you can add your own without modifying veritail itself by providing a custom check module.
Note: Custom check modules are loaded and executed as Python code at runtime. Only use check files from sources you trust.
A check module is a Python file containing one or more functions whose names start with check_. Each function must accept a QueryEntry and a list[SearchResult], and return a list[CheckResult]:
def check_<name>(query: QueryEntry, results: list[SearchResult]) -> list[CheckResult]:
...All three types are importable from veritail.types:
from veritail.types import CheckResult, QueryEntry, SearchResult# my_checks.py
from veritail.types import CheckResult, QueryEntry, SearchResult
def check_species_mismatch(
query: QueryEntry, results: list[SearchResult]
) -> list[CheckResult]:
"""Flag cross-species results in pet supply searches."""
checks = []
for r in results:
species = r.attributes.get("species")
if species and species.lower() not in query.query.lower():
checks.append(
CheckResult(
check_name="species_mismatch",
query=query.query,
product_id=r.product_id,
passed=False,
detail=f"Query mentions no '{species}' but result is for {species}",
)
)
return checkscheck_*callable functions are discovered and run automatically.- Non-callable names starting with
check_(e.g.,check_threshold = 0.5) are silently skipped. This lets you define constants alongside your check functions without triggering errors. - Helper functions without the
check_prefix are ignored by the loader. Use any prefix other thancheck_for utility functions.
If a module contains no callable check_* functions, veritail raises an error at startup.
Pass one or more --checks flags to veritail run. Each flag points to a Python file:
veritail run \
--queries queries.csv \
--adapter my_adapter.py \
--checks my_checks.py \
--checks more_checks.py \
--llm-model gpt-4oCustom check results appear alongside built-in checks in both the terminal output and the HTML report.
See the CLI Reference for the full list of veritail run options.