VetiverAPI

VetiverAPI(self, model, show_prototype=True, check_prototype=True, app_factory=FastAPI, **kwargs)

Create model aware API

Parameters

Name Type Description Default
model VetiverModel Model to be deployed in API required
show_prototype bool True
check_prototype bool Determine if data prototype should be enforced True
app_factory Type of API to be deployed FastAPI
**kwargs Deprecated parameters. {}

Examples

>>> import vetiver as vt
>>> X, y = vt.get_mock_data()
>>> model = vt.get_mock_model().fit(X, y)
>>> v = vt.VetiverModel(model = model, model_name = "my_model", prototype_data = X)
>>> v_api = vt.VetiverAPI(model = v, check_prototype = True)

Notes

This generates an API with either 3 or 4 GET endpoints and 1 POST endpoint.

├──/ping (GET)
├──/metadata (GET)
├──/prototype (GET)
├──/pin-url (GET, if VetiverModel metadata `url` field is not None)
└──/predict (POST)

Parameter check_ptype was changed to check_prototype. Handling of check_ptype will be removed in a future version.

Methods

Name Description
vetiver.VetiverAPI.run Start API
vetiver.VetiverAPI.vetiver_post Create new POST endpoint that is aware of model input data