from vetiver import mock, VetiverModel, VetiverAPI
= mock.get_mock_data()
X, y = mock.get_mock_model().fit(X, y)
model
= VetiverModel(model = model, model_name = "my_model", prototype_data = X)
v = VetiverAPI(model = v, check_prototype = True) api
VetiverAPI
VetiverAPI(self,
model: VetiverModel,bool = True,
show_prototype: bool = True,
check_prototype:
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 |