MLflow prediction requests API Specs

Methods

verify_prediction (response_json, expected_keywords_response,)

verifies if a prediction output is as expected

verify_prediction

get_requests (model_name, databricks_cluster_hostname, databricks_workspace_token, settings, keywords, stage_env, request_time_out)

makes post requests for model inference and verify that inference is within expectations

get_requests

verify_prediction

verify_prediction(response_json: dict, expected_keywords_response: str)
load an ML model from MLflow run, raises an exception if type_of_model is not in dictionary
Parameters:
  • response_json (dict) – json response of the post request from model endpoint

  • expected_keywords_response (str) – expected top parent seo name for keywords

Returns:

non exit response if response matches

Return type:

bool

get_requests

get_requests(model_name: str, databricks_cluster_hostname: str, databricks_workspace_token: str, settings: dict, keywords: str, stage_env: str = 'Production', request_time_out: int = 60)
load an artifact from MLflow run, accepts `joblib, pkl, dict and yaml` file types
Parameters:
  • model_name (str) – name of the registered model

  • databricks_cluster_hostname (str) – hostname of the databricks cluster

  • databricks_workspace_token (str) – token of the databricks workspace

  • settings (dict) – repo settings and configuration

  • keywords (str) – keywords to be used for prediction

  • stage_env (str) – stage of the registered model (e.g. Staging or Production)

  • request_time_out (int) – time out for the request

Returns:

returns a callable python object; dictionary, pandas dataframe, list

Return type:

int