Model store APIs

Operations for creating and managing models, model tags, policies, segments, and model alerts. This data is maintained in the VIANOPS model store database.

vianops_client.api.modelstore.alerts

class AlertsV1API(config: Config | None = None)

Bases: ConfiguredBaseApiClass

create(data: V1AlertCreateModelList, output_type: str = 'object') V1AlertModelList

Create alerts

Parameters:

data (V1AlertCreateModelList) – An instance of V1AlertCreateModelList containing the data for the new alerts.

Returns:

An instance of V1AlertModelList containing information about the created alerts.

Return type:

V1AlertModelList

delete(delete_params: V1AlertSearchModel, deletetype: str = 'archive', output_type: str = 'object') VianaiSuccessResponse

Delete or archive alerts

Parameters:
  • delete_params (V1AlertSearchModel) – Instance containing the required data to select, and archive or delete selected alerts.

  • deletetype (str) – The deletion type. Supported values: archive, delete, force_delete. Default: archive

Returns:

Instance containing response from alert deletion.

Return type:

VianaiSuccessResponse

delete_url = '/v1/monitor-alerts/{deletetype}'
search(search_params: V1AlertSearchRequest, output_type: str = 'object') V1AlertPageModel

Search for alerts

Parameters:

search_params (V1AlertSearchRequest) – An instance of V1AlertSearchRequest containing the search parameters for alerts.

Returns:

An instance of V1AlertPageModel containing information about the searched alerts.

Return type:

V1AlertPageModel

search_url = '/v1/monitor-alerts/search'
update(update_params: V1AlertUpdateModelList, output_type: str = 'object') V1AlertUpdateResponseModel

Update existing alerts

Parameters:

update_params (V1AlertUpdateModelList) – An instance of V1AlertUpdateModelList containing the data for the alert updates.

Returns:

An instance of V1AlertUpdateResponseModel containing information about the alert updates.

Return type:

V1AlertUpdateResponseModel

url_suffix = '/v1/monitor-alerts'

vianops_client.api.modelstore.feature_importance_file_utils

check_absolute_percentage_and_sum(df)
check_and_convert_file_to_json(content, name, tag_name)

vianops_client.api.modelstore.model_tags

class ModelsTagsV1Api(config: Config | None = None)

Bases: ConfiguredBaseApiClass

create(data: V1BaseModelTagsModelList, output_type: str = 'object') V1ModelTagsModelList

Create model tags

Parameters:

data (V1BaseModelTagsModelList) – Instance containing data to create model tags.

Returns:

Instance containing a list of the created model tags.

Return type:

V1ModelTagsModelList

delete(data: V1ModelTagsFilters, deletetype: str = 'archive', output_type: str = 'object') V1ModelTagsModelList

Delete or archive model tags

Parameters:
  • data (V1ModelTagsFilters) – Instance containing the required data to select, and archive or delete selected model tags.

  • deletetype (str) – The deletion type. Supported values: archive, delete, force_delete. Default: archive.

Returns:

Instance containing response from model tag deletion.

Return type:

V1ModelTagsModelList

delete_url = '/v1/model-tags/{deletetype}'
search(data: V1ModelTagsSearch, output_type: str = 'object') V1ModelTagsModelPage

Search for model tags

Parameters:

data (V1ModelTagsSearch) – Instance containing data to be use to perform a paginated model tags search.

Returns:

Instance containing a list of model tags collected from search along with pagination details.

Return type:

V1ModelTagsModelPage

search_url = '/v1/model-tags/search'
update(data: V1ModelTagsUpdates, output_type: str = 'object') V1ModelTagsModelList

Update existing model tags

Parameters:

data (V1ModelTagsUpdates) – Instance containing the required data to select and update selected model tags.

Returns:

Instance containing information about the updated model tags.

Return type:

V1ModelTagsModelList

update_with_file_upload(uuid: str, file_path: str, name: str) V1ModelTagsModelList

Update model tags using file upload

Parameters:
  • uuid (str) – The UUID for the model tag.

  • file_path (str) – The file path containing model tag data.

  • name (str) – Unique name for the model tag within model.

Returns:

Instance containing information about the updated model tag.

Return type:

V1ModelTagsModelList

upload(model_uuid: str, name: str, file_path: str) V1ModelTagsModelList

Add model tags using file upload

Parameters:
  • model_uuid (str) – The UUID for the related model

  • name (str) – Unique name for the model tag within model.

  • file_path (str) – File path containing model tag data.

Returns:

Instance containing information about the uploaded model tag.

Return type:

V1ModelTagsModelList

url_suffix = '/v1/model-tags'

vianops_client.api.modelstore.models

class ModelsV1Api(config: Config | None = None)

Bases: ConfiguredBaseApiClass

create(data: V1ModelsModelList, output_type: str = 'object') V1ModelsModelList

Create models

Parameters:

data (V1ModelsModelList) – Instance containing the data to create models.

Returns:

Instance containing a list of the created models.

Return type:

V1ModelsModelList

delete(data: V1ModelsFilters, deletetype: str = 'archive', output_type: str = 'object') V1ModelsModelList

Delete or archive models

Parameters:
  • data (V1ModelsFilters) – Instance containing the required data to select, and archive or delete selected models.

  • deletetype (str) – The deletion type. Supported values: archive, delete, force_delete. Default: archive

Returns:

Instance containing response from model deletion.

Return type:

V1ModelsModelList

delete_url = '/v1/models/{deletetype}'
search(data: V1ModelSearch, output_type: str = 'object') V1ModelsModelPage

Search for models

Parameters:

data (V1ModelSearch) – Instance containing data to be use to perform a paginated model search.

Returns:

Instance containing a list of models collected from search along with pagination details.

Return type:

V1ModelsModelPage

search_url = '/v1/models/search'
update(data: V1ModelUpdates, output_type: str = 'object') V1ModelsModelList

Update existing models

Parameters:

data (V1ModelUpdates) – An instance of V1ModelUpdates containing the data for updating the model.

Returns:

Instance containing information about the updated models.

Return type:

V1ModelsModelList

url_suffix = '/v1/models'

vianops_client.api.modelstore.policies

class PoliciesV1Api(config: Config | None = None)

Bases: ConfiguredBaseApiClass

bulk_create(project_name: str = '', model_name: str = '', model_version: str | None = '1', model_stage: str | None = 'primary', window_type: List[str] | None = ['day', 'week', 'month', 'quarter'], window_method=None, features=None, name_prefix=None, hotspot_analysis: dict | None = None, segments=None, warning_level: float | None = 0.1, critical_level: float | None = 0.5, drift_measure: str | None = 'PSI', schedule: str | None = '0 0 6 ? * *', output_type: str = 'object', training_baseline=False)
create(data: V1PolicyRequestModelList, output_type: str = 'object') V1PolicyModelList

Create policies

Parameters:

data (V1PolicyRequestModelList) – Instance containing data to create policies.

Returns:

Instance containing a list of the created policies.

Return type:

V1PolicyModelList

delete(data: V1PolicyModelSearch, deletetype: str = 'archive', output_type: str = 'object') VianaiSuccessResponse

Delete or archive policies

Parameters:
  • data (V1PolicyModelSearch) – Instance containing the required data to select, and archive or delete the selected policies.

  • deletetype (str) – The deletion type. Supported values: archive, delete, force_delete. Default: archive.

Returns:

Instance containing response from policy deletion.

Return type:

VianaiSuccessResponse

delete_url = '/v1/policies/{deletetype}'
run_policies(deployments: List[str] = [], model_names: List[str] = [], model_versions: List[str] = ['1'], model_stages: List[str] = ['primary'], start_date: datetime | None = None, end_date: datetime | None = None, offset_target: List[int] = [1], offset_type: str = '', policy_names: List[str] | None = None, activate_policies: bool = True, num_threads: int = 15) List[dict]

Run policies

Parameters:
  • deployments (List[str]) – A list of deployment names to filter policies by.

  • model_names (List[str]) – A list of model names to filter policies by. Default: value of deployments.

  • model_versions (List[str]) – A list of model versions to filter policies by. Default: [“1”].

  • model_stages (List[str]) – A list of model stages to filter policies by. Default: [“primary”].

  • start_date (Optional[datetime]) – First date to start running polcicies from.

  • end_date (Optional[datetime]) – Last date to run policies to.

  • offset_target (List[int]) – A list of offsets to be applied to policy run date. If value not provided and start_date and end_date are not provided, default will be used and all policies will run with an offset of 1.

  • offset_type (Optional[str]) – Type of offset. Supported values: day, week, month, quarter.

  • policy_names (Optional[List[str]]) – A list of policy names to run to filter policies by.

  • activate_policies (bool) – Indicates whether to activate policies or not. If True, policies will run accordingly on their specified schedule; otherwise, policies will only run once. Default: True.

  • num_threads (int) – The number of threads to running the policies. Default: 15.

Returns:

A list of dictionaries containing the responses from each policy run.

Return type:

List[dict]

search(data: V1PolicySearchRequest, output_type: str = 'object') V1PolicyModelPage

Search for policies

Parameters:

data (V1PolicySearchRequest) – Instance containing data to be used to perform a paginated segment search.

Returns:

Instance containing a list of policies collected from search along with pagination details.

Return type:

V1PolicyModelPage

search_url = '/v1/policies/search'
update(data: V1PolicyUpdateModelList, output_type: str = 'object') V1PolicyModelList

Update policies

Parameters:

data (V1PolicyUpdateModelList) – Instance containing the required data to select and update selected policies.

Returns:

Instance containing information about the updated policies.

Return type:

V1PolicyModelList

url_suffix = '/v1/policies'

vianops_client.api.modelstore.segments

class SegmentsV1Api(config: Config | None = None)

Bases: ConfiguredBaseApiClass

create(data: V1SegmentBaseModelList, output_type: str = 'object') V1SegmentModelList

Create segments

Parameters:

data (V1SegmentBaseModelList) – Instance containing data to create segments.

Returns:

Instance containing a list of the created segments.

Return type:

V1SegmentModelList

delete(data: V1SegmentSearch, deletetype: str = 'archive', output_type: str = 'object') VianaiSuccessResponse

Delete or archive segments

Parameters:
  • data (V1SegmentSearch) – Instance containing the required data to select, and archive or delete the selected segments.

  • deletetype (str) – The deletion type. Supported values: archive, delete, force_delete. Default: archive.

Returns:

Instance containing response from segment deletion.

Return type:

VianaiSuccessResponse

delete_url = '/v1/segments/{deletetype}'
get_filter(data: dict, output_type: str = 'object') V1SegmentFilterCondition

Generate the conditions for a segment

Parameters:

data (dict) – A dictionary containing the segment id, database connection, and table name to generate filter condition. Sample dictionary object:` {“id”: 1, “connection”: “connection_string”, “table”: “table_name”}`

Returns:

Instance containing information about the condition.

Return type:

V1SegmentFilterCondition

get_preview(data: V1SegmentPreviewRequestModel, output_type: str = 'object') V1SegmentPreviewModel

Get a preview of the segment data

Parameters:

data (V1SegmentPreviewRequestModel) – Instance containing the required data to update segments.

Returns:

Instance containing segment preview data

Return type:

V1SegmentPreviewModel

preview_url = '/v1/segments/preview'
search(data: V1SegmentPageSearch, output_type: str = 'object') V1SegmentModelPage

Search for segments

Parameters:

data (V1SegmentPageSearch) – Instance containing data to be use to perform a paginated segment search.

Returns:

Instance containing a list of segments collected from search along with pagination details.

Return type:

V1SegmentModelPage

search_url = '/v1/segments/search'
update(data: V1SegmentUpdateRequestModelList, output_type: str = 'object') V1SegmentModelList

Update existing segments

Parameters:

data (V1SegmentUpdateRequestModelList) – Instance containing the required data to select and update selected segments.

Returns:

Instance containing information about the updated segments.

Return type:

V1SegmentModelList

url_id_filter = '/v1/segments/{id}/filter?connection={connection}&table={table}'
url_suffix = '/v1/segments'