vetiver.VetiverAPI.vetiver_post#

VetiverAPI.vetiver_post(endpoint_fx: Callable, endpoint_name: str = 'custom_endpoint')#

Create new POST endpoint that is aware of model input data

Parameters
  • endpoint_fx (Callable) – Custom function to be run at endpoint

  • endpoint_name (str) – Name of endpoint

Example

>>> import vetiver
>>> X, y = vetiver.get_mock_data()
>>> model = vetiver.get_mock_model().fit(X, y)
>>> v = vetiver.VetiverModel(model = model, model_name = "model", ptype_data = X)
>>> v_api = vetiver.VetiverAPI(model = v, check_ptype = True)
>>> def sum_values(x):
...     return x.sum()
>>> v_api.vetiver_post(sum_values, "sums")