Skip to main content

Interfaces

Interfaces to MLOps platforms

TangoModelServerProxy

Proxies a custom Model Server, decoupling its specific implementation to a standardized behaviour.


get_model_server_url(self) -> str

Returns: the model server url.


invoke(self, request_type: RequestType, payload: bytes) -> dict

Invokes an operation on a specified model server component.

Parameters:

  • request_type: the type of request to be called on the model; at the moment, the value is not used, but it could be useful in the future when more models are implemented;
  • payload: the payload of the invocation, containing invocation data, working session, etc.: the method map_request available in the instance of Tango model could be useful in converting from a TangoRequest to the custom input format for invoked Model Server.

Returns: a custom output format from invoked Model Server: the method map_response available in the instance of TANGO model could be useful in converting from the custom output format to a TangoResponse.

Interfaces to models

TangoModel

Defines functional interface a model must adhere to in order to be part of the TANGO platform.


map_request(self, tango_request: TangoRequest, session: WorkingSession = None) -> object

Converts a TANGO request to the input needed by the model server publishing the model.


map_response(self, response: object) -> TangoResponse

Converts a custom response (output from the model server publishing the model) to a TANGO response.

ExplainableTangoModel

Defines functional interface an explainable model must adhere to in order to be part of the TANGO platform. Inherits from TangoModel.


get_explainer(self, **kwargs) -> TangoModel

Returns a model responding to 'predict' method providing explanation. To decouple MLOps specifications on different implementations, we are better assume that an artifact responds only to a 'predict' invocation (as is on MLFlow implementation).

TangoModelRegistryConnector

Proxies a custom Model Registry, decoupling its specific implementation to a standardized behaviour. This interface provides basic implementation of registry connection defined by url; more detailed implementations could be necessary to manage username/password or other authentication methods.


get_native_metadata(self, model_key: ModelKey) -> dict

Retrieves model metadata by model identifier.

Parameters:

  • model_key: the unique identifier of the model.

Returns: the native metadata from specific MLOps.


get_model(self, model_key: ModelKey, download_folder: str) -> TangoModel

Retrieves model by model identifier.

Parameters:

  • model_key: the unique identifier of the model;
  • download_folder: the folder where the model is downloaded.

Returns: the model artifact as exposed by model server.


get_resource(self, model_key: ModelKey, download_folder: str, resource_path: str) -> str

Retrieves resource from the model artifact by model identifier.

Parameters:

  • model_key: the unique identifier of the model;
  • download_folder: the folder where the model is downloaded;
  • resource_path: the path to the resource in the model artifact

Returns: the model requirements as string.

Create a TANGO Model

TODO: How to use the for creating a tango model implementation