Skip to main content
POST
Create a custom scorer for domain-specific evaluation criteria. Playgent provides 27 built-in metrics (RAG, safety, agentic, multi-turn), but use this endpoint when you need evaluation logic specific to your use case.
Already have 27 metrics? Check out the built-in scorers before creating custom ones. Most use cases are covered by playval, faithfulness, answer_relevancy, bias, toxicity, and other out-of-the-box metrics.

When to Create Custom Scorers

  • Domain-specific quality: e.g., “Does the response follow medical compliance rules?”
  • Business logic: e.g., “Did the agent offer the correct discount tier?”
  • Custom rubrics: Your own evaluation criteria not covered by built-ins
  • Code-based evaluation: Regex, exact matching, or programmatic checks

Scorer Types

Use an LLM to evaluate based on your custom rubric. Most flexible option. Best for: Subjective quality assessment, custom criteria
Execute Python code to evaluate the response programmatically. Best for: Exact matching, calculations, format validation
Use regex patterns to validate response format or content. Best for: Format checking, required keyword presence

Parameters

string
required
Scorer name (e.g., policy_compliance, discount_accuracy)
string
Human-readable description of what this scorer evaluates
string
required
Scorer type: llm_judge, code, or regex
object
required
Scorer configuration
object
Custom variables to inject into the rubric template (e.g., company policies, reference data)
string
required
Unique scorer identifier (use in evaluate requests)
string
required
Scorer name

Example: Code-Based Scorer

For programmatic evaluation:

Example: Regex Scorer

For format validation:

Using Custom Scorers

Once created, use your custom scorer in evaluation requests:

Tips

  • Start with built-ins: Try playval with a custom expected_behavior or use safety metrics like bias/toxicity before creating a full scorer
  • Template variables: Use {{output}}, {{input}}, {{context}} to reference evaluation data
  • Combine with built-ins: Mix custom scorers with RAG/safety/agentic metrics for comprehensive evaluation
  • Version control: Create new scorers for significant rubric changes rather than modifying existing ones