kind="code" flag on the scores.
This page covers programmatic code evaluators — functions you write in Python or TypeScript and run via the
arize-phoenix-evals SDK. If you want deterministic checks that run automatically in the Phoenix UI without any code, see Server Evals.For the full catalog of return shapes accepted by Phoenix UI code evaluators (categorical, continuous, multi-output routing, and the explanation field), see Code Evaluator Output Shapes.Using create_evaluator
For convenience, a simple (sync or async) function can be converted into an Evaluator using the create_evaluator decorator. This function can either directly return a Score object or a value that can be converted into a score.
In the following examples, our decorated evaluation function and coroutine return a boolean, which when used as an Evaluator, is converted into a Score with a score value of 1 or 0 and a corresponding label of True or False.
- Python
- TypeScript
- Python
- TypeScript
Returning Score objects directly
- Python
- TypeScript
Other Score conversions
The create_evaluator / createEvaluator function will convert many different function outputs into scores automatically:
- Python
- TypeScript
- A Score object (no conversion needed)
- A number (converted to Score.score)
- A boolean (converted to integer Score.score and string Score.label)
- A short string (≤3 words, converted to Score.label)
- A long string (≥4 words, converted to Score.explanation)
- A dictionary with keys “score”, “label”, or “explanation”
- A tuple of values (only bool, number, str types allowed)

