Model playground
When defining a Verta Standard Model class, additional methods can be provided to populate the web UI's model playground.
The playground can be found on the endpoint page, after the registered model version is deployed.
describe()
describe()
This method should return a dict
describing the model:
The following items must be provided—keys and values all being str
s:
"method"
– The name of the model method that will be used to serve requests. For almost all models, this will be"predict"
; for models that support batch prediction, this may be"batch_predict"
."args"
– The names of the arguments to the model's predict method. This doesn't need to match the actual signature of the method (which would just be a single variable), but instead can be a more symbolic representation of the argument; this guide's example uses the column names of the source DataFrame."returns"
– The names of the values returned by the model's predict method. As withargs
, this doesn't need to match the actual signature of the method."description"
– A plain text description of the model's behavior, background, and/or purpose."input_description"
– A plain text description of the model's predict method's input."output_description"
– A plain text description of the model's predict method's output.
description
, input_description
, and output_description
do not currently support formatting (such as newlines or indentation), but otherwise there are no constraints on their contents; this guide's example includes type information, but details can be freely included or omitted as desired.
example()
example()
This method should return a sample input for the model that could be passed directly to its predict()
function:
This return value—just like predict()
's input value—must be a fully-JSON-serializable object such as a basic Python list
or dict
.
Troubleshooting
The endpoint just finished deploying, but none of the playground fields are being populated.
It may take a few minutes after an endpoint is deployed for the playground fields to be populated in the web UI.
Even after waiting, certain playground fields are not being populated.
Please ensure that describe()
and example()
do not contain any errors, and that the value being returned by example()
is fully JSON-serializable (i.e. can be passed to Python's json.dumps()
without issue). Additionally, one can check the endpoint's running logs for any raised exceptions from GET /describe
and/or GET /example
.
Last updated