from vetiver import mock, VetiverModel, VetiverAPI
X, y = mock.get_mock_data()
model = mock.get_mock_model().fit(X, y)
v = VetiverModel(model = model, model_name = "my_model", prototype_data = X)
api = VetiverAPI(model = v, check_prototype = True)VetiverAPI
VetiverAPI(
self,
model: VetiverModel,
show_prototype: bool = True,
check_prototype: bool = True,
app_factory,
**kwargs,
)Create model aware API
Parameters
model : VetiverModel-
Model to be deployed in API
show_prototype : bool = True-
Whether or not to show the data prototype in the API
check_prototype : bool = True-
Determine if data prototype should be enforced
app_factory : = FastAPI-
Type of API to be deployed
****kwargs** : = {}-
Deprecated parameters.
Examples
Notes
This generates an API with 2-4 GET endpoints and 1 POST endpoint.
├──/ping (GET)
├──/metadata (GET)
├──/prototype (GET, if `show_prototype` is True)
├──/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 |
|---|---|
| run | Start API |
| vetiver_post | Create new POST endpoint that is aware of model input data |