Skip to main content
POST
Create evaluator
Creates a new evaluator for your organization. You must specify type and score_value_type. The eval_class field is optional and only used for pre-built templates.

Authentication

All endpoints require API key authentication:

Evaluator Types and Score Value Types

Evaluator Types (Required)

Important: The evaluator type field now represents the primary interface/use case, but automation can be added independently via llm_config or code_config. This decouples the annotation method from the evaluator type.
  • llm: Primarily LLM-based evaluators (can also have code automation)
  • human: Primarily human annotation-based (can have LLM or code automation for assistance)
  • code: Primarily code-based evaluators (can also have LLM automation as fallback)

Score Value Types (Required)

  • numerical: Numeric scores (e.g., 1-5, 0.0-1.0)
  • boolean: True/false or pass/fail evaluations
  • percentage: 0-100 percentage scores (use decimals; 0.0–100.0)
  • single_select: Choose exactly one option from predefined choices
  • multi_select: Choose one or more options from predefined choices
  • json: Structured JSON data for complex evaluations
  • text: Text-based feedback and comments
  • (Legacy) categorical and comment remain readable for older evaluators

Pre-built Templates (Optional)

You can optionally use pre-built templates by specifying eval_class:
  • keywordsai_custom_llm: LLM-based evaluator with standard configuration
  • custom_code: Code-based evaluator template

Unified Evaluator Inputs

All evaluator runs now receive a single unified inputs object. This applies to all evaluator types (llm, human, code). Structure:
  • input (any JSON): The request/input to be evaluated.
  • output (any JSON): The response/output being evaluated.
  • metrics (object, optional): System-captured metrics (e.g., tokens, latency, cost).
  • metadata (object, optional): Context and custom properties you pass; also logged.
  • llm_input and llm_output (string, optional): Legacy convenience aliases.

Required Fields

  • name (string): Display name for the evaluator
  • type (string): Evaluator type - "llm", "human", or "code"
  • score_value_type (string): Score format - "numerical", "boolean", "categorical", or "comment"

Optional Fields

  • evaluator_slug (string): Unique identifier (auto-generated if not provided)
  • description (string): Description of the evaluator
  • eval_class (string): Pre-built template to use (optional)
  • configurations (object): Custom configuration based on evaluator type
  • categorical_choices (array): Required when score_value_type is "categorical"
The new evaluator format uses clean, flat configuration fields instead of nested configurations. This format allows you to add both LLM and code automation to any evaluator type, decoupling the annotation method from the evaluator type.

New Top-Level Fields (All Optional)

Score Config Shapes

Numerical/Percentage:
Single/Multi Select:

LLM Config

Available LLM config fields (all optional except model and evaluator_definition):
  • Core: model, stream
  • Sampling: temperature, top_p, max_tokens, max_completion_tokens
  • Penalties: frequency_penalty, presence_penalty, stop
  • Formatting: response_format, verbosity
  • Tools: tools, tool_choice, parallel_tool_calls

Code Config

Passing Conditions

Uses the universal filter format. Example:
For complete details, see the Filters API Reference.

Legacy Format (Still Supported)

The legacy configurations format remains fully functional for backward compatibility.

Configuration Fields by Type

For type: "llm" evaluators:
  • evaluator_definition (string): The evaluation prompt/instruction. Must include {{input}} and {{output}} template variables. Legacy {{llm_input}} and {{llm_output}} are also supported for backward compatibility.
  • scoring_rubric (string): Description of the scoring criteria
  • llm_engine (string): LLM model to use (e.g., “gpt-4o-mini”, “gpt-4o”)
  • model_options (object, optional): LLM parameters like temperature, max_tokens
  • min_score (number, optional): Minimum possible score
  • max_score (number, optional): Maximum possible score
  • passing_score (number, optional): Score threshold for passing
For type: "code" evaluators:
  • eval_code_snippet (string): Python code with main(eval_inputs) function that returns the score
For type: "human" evaluators:
  • No specific configuration fields required
  • Use categorical_choices field when score_value_type is "single_select" or "multi_select"
For score_value_type: "single_select" | "multi_select":
  • categorical_choices (array): List of choice objects with name and value properties

Examples

New Format Examples

LLM Evaluator with Automation (Numerical)

Human Evaluator with LLM Assistance

This shows how a human evaluator can have LLM automation for suggested scoring, decoupling annotation method from evaluator type.

Code Evaluator (Boolean)

Single Select Evaluator with LLM

Legacy Format Examples

Custom LLM Evaluator (Numerical)

Human Categorical Evaluator

Code-based Boolean Evaluator

LLM Boolean Evaluator

Using Pre-built Template

Response

Status: 201 Created

Error Responses

400 Bad Request

401 Unauthorized