Overview
Use thecustom_function task type to run your own Python scoring logic on each evaluation item, giving you full control over scoring beyond the built-in metrics. The function source code is extracted, sent to the API, and executed server-side in a sandboxed environment.
The
scale-gp-beta SDK provides a CustomFunction helper that handles source extraction and serialization for you.SDK Helper
TheCustomFunction class wraps a Python callable and provides methods to serialize it for the API and test it with a dry run.
Allowed Imports
Custom functions run in a restricted environment. Only these standard library modules are available:math, json, re, collections, itertools, functools, statistics, decimal, fractions, datetime, copy, textwrap, difflib, unicodedata
Return Type
Functions must return anint or float. Returning other types (including bool) will produce an error.
Using arg_mapping
By default, function parameter names are matched to dataset column names. Use arg_mapping when your function parameters don’t match the column names in your data:
item. are passed through unchanged, which lets you reference nested fields:
Dry Run
Test your function against sample data before creating a full evaluation. The dry run endpoint is synchronous — it executes your function inline and returns per-row results immediately.Discovering Columns
If you already have an evaluation and want to see which columns are available forarg_mapping:

