Recipe: create a custom grader
Recipe — create a custom grader (LLM-backed). Pointer to the SDK grader-creation samples.
In LayerLens, custom graders are LLM-backed: a grader wraps a model + a prompt. The SDK shape:
scorer = client.scorers.create(
name="response-rubric",
description="Rate response on factual accuracy",
model_id=model.id,
prompt="Rate the response on a 1-5 scale...",
)CRUD covers create, get, get_many(page=, page_size=), update(id,...), delete(id). Returned Scorer includes model_id, model_name, model_company, prompt.
For a complete custom-grader-with-validation example, see samples/core/judge_creation_and_test.py — builds a custom PII detection grader and validates against known inputs.
For deterministic logic (regex, JSON-schema, exact match), encode the rule in the grader's prompt or give the grader rule-based goals.
See also
Last updated
Was this helpful?