City-of-Helsinki / mlops-template

Generic repository template for small scale MLOps
Apache License 2.0
25 stars 8 forks source link

Add API template #21

Closed nakytoe closed 1 year ago

nakytoe commented 2 years ago

Problem Currently the definition of the API is left open and has no instructions. This can lead to unsecure, bad and trivial solutions.

Solution It would be best to have a concrete template of an API that is easy to fill / complete for any algorithm. Or, at least link to general API instructions of the city.

nakytoe commented 2 years ago

API for ML model client. A client sends feature vectors to the ML model and in return receives predicted label for each feature vector. Additional information may also be provided to the client, such as confidence estimates for the predictions. There must be option to secure the API so that use can be limited securely.

manujoha commented 2 years ago

At the moment api requires pickled schema objects in order to generate proper API documentation using openapi tools together with swagger. Schema is obtained using pandera library, and that brings extra step to ml template. However, I will research if we could collect similar information from model class itself in order to generate api classes. My goal is to build such api module that does not require any configuration by ML template user.

API POC: https://github.com/Datahel/mlops_fast_api_poc