whylabs-client

WhyLabs API that enables end-to-end AI observability


License
Apache-2.0
Install
conda install -c anaconda whylabs-client

Documentation

whylabs-client

WhyLabs API that enables end-to-end AI observability

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 0.1
  • Package version: 0.4.4
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit https://whylabs.ai

Requirements.

Python >= 3.6

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

import whylabs_client

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import whylabs_client

Getting Started

Please follow the installation procedure and then run the following:

import time
import whylabs_client
from pprint import pprint
from whylabs_client.api import alerts_api
from whylabs_client.model.get_alerts_paths_response import GetAlertsPathsResponse
from whylabs_client.model.segment_tag import SegmentTag
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = whylabs_client.Configuration(
    host = "http://localhost"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: ApiKeyAuth
configuration.api_key['ApiKeyAuth'] = 'YOUR_API_KEY'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKeyAuth'] = 'Bearer'


# Enter a context with an instance of the API client
with whylabs_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = alerts_api.AlertsApi(api_client)
    org_id = "org-123" # str | Your company's unique organization ID
model_id = "model-123" # str | The unique model ID in your company. The model is created if it doesn't exist already.
start_timestamp = 1577836800000 # int | Start time exclusive
end_timestamp = 1893456000000 # int | 
segment_tags = [
        SegmentTag(
            key="key_example",
            value="value_example",
        ),
    ] # [SegmentTag], none_type | List of (key, value) pair tags for a segment. Must not contain duplicate values (optional)
version = "" # str, none_type | the version of the alert in case we have multiple schemas (optional)

    try:
        # Get the alerts for a given time period.
        api_response = api_instance.get_alerts_paths(org_id, model_id, start_timestamp, end_timestamp, segment_tags=segment_tags, version=version)
        pprint(api_response)
    except whylabs_client.ApiException as e:
        print("Exception when calling AlertsApi->get_alerts_paths: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to http://localhost

Class Method HTTP request Description
AlertsApi get_alerts_paths GET /v0/organizations/{org_id}/alerts/models/{model_id}/paths Get the alerts for a given time period.
ApiKeyApi create_api_key POST /v0/organizations/{org_id}/api-key Generate an API key for a user.
ApiKeyApi get_api_key GET /v0/organizations/{org_id}/api-key/{key_id} Get an api key by its id
ApiKeyApi list_api_keys GET /v0/organizations/{org_id}/api-key List API key metadata for a given organization and user
ApiKeyApi revoke_api_key DELETE /v0/organizations/{org_id}/api-key Revoke the given API Key, removing its ability to access WhyLabs systems
DatasetProfileApi delete_analyzer_results DELETE /v0/organizations/{org_id}/dataset-profiles/models/{dataset_id}/analyzer-results Deletes a set of analyzer results
DatasetProfileApi delete_dataset_profiles DELETE /v0/organizations/{org_id}/dataset-profiles/models/{dataset_id} Deletes a set of dataset profiles
EventsApi get_events_data GET /v0/organizations/{org_id}/events/models/{model_id}/data Get the event data as multi-line JSON for a given time period.
FeatureWeightsApi get_column_weights GET /v0/organizations/{org_id}/dataset/{dataset_id}/weights Get column weights for the specified dataset
FeatureWeightsApi put_column_weights PUT /v0/organizations/{org_id}/dataset/{dataset_id}/weights Put column weights for the specified dataset
LogApi log POST /v0/organizations/{org_id}/log Log a dataset profile entry to the backend
LogApi log_async POST /v0/organizations/{org_id}/log/async/{dataset_id} Like /log, except this api doesn't take the actual profile content. It returns an upload link that can be used to upload the profile to.
LogApi log_reference POST /v0/organizations/{org_id}/log/reference/{model_id} Returns a presigned URL for uploading the reference profile to.
MembershipApi create_membership POST /v0/membership Create a membership for a user, making them apart of an organization. Uses the user's current email address.
MembershipApi create_organization_membership POST /v0/organizations/{org_id}/membership Create a membership for a user, making them apart of an organization. Uses the user's current email address.
MembershipApi get_default_membership_for_email GET /v0/membership/default Get the default membership for a user.
MembershipApi get_memberships GET /v0/membership/user/{user_id} Get memberships for a user.
MembershipApi get_memberships_by_email GET /v0/membership/user Get memberships for a user given that user's email address.
MembershipApi get_memberships_by_org GET /v0/membership/org/{org_id} Get memberships for an org.
MembershipApi list_organization_memberships GET /v0/organizations/{org_id}/membership List organization memberships
MembershipApi remove_membership_by_email DELETE /v0/membership Removes membership in a given org from a user, using the user's email address.
MembershipApi remove_organization_membership DELETE /v0/organizations/{org_id}/membership Removes membership in a given org from a user, using the user's email address.
MembershipApi set_default_membership POST /v0/membership/default Sets the organization that should be used when logging a user in
MembershipApi update_membership_by_email PUT /v0/membership Updates the role in an membership
MembershipApi update_organization_membership PUT /v0/organizations/{org_id}/membership Updates the role in an membership
ModelsApi create_model POST /v0/organizations/{org_id}/models Create a model with a given name and a time period
ModelsApi deactivate_model DELETE /v0/organizations/{org_id}/models/{model_id} Mark a model as inactive
ModelsApi delete_analyzer DELETE /v0/organizations/{org_id}/models/{dataset_id}/monitor-config/analyzer/{analyzer_id} Delete the analyzer config for a given dataset.
ModelsApi delete_entity_schema_column DELETE /v0/organizations/{org_id}/models/{dataset_id}/schema/column/{column_id} Delete the entity schema of a single column for a given dataset.
ModelsApi delete_monitor DELETE /v0/organizations/{org_id}/models/{dataset_id}/monitor-config/monitor/{monitor_id} Delete the monitor for a given dataset.
ModelsApi get_analyzer GET /v0/organizations/{org_id}/models/{dataset_id}/monitor-config/analyzer/{analyzer_id} Get the analyzer config for a given dataset.
ModelsApi get_entity_schema GET /v0/organizations/{org_id}/models/{dataset_id}/schema Get the entity schema config for a given dataset.
ModelsApi get_entity_schema_column GET /v0/organizations/{org_id}/models/{dataset_id}/schema/column/{column_id} Get the entity schema of a single column for a given dataset.
ModelsApi get_model GET /v0/organizations/{org_id}/models/{model_id} Get a model metadata
ModelsApi get_monitor GET /v0/organizations/{org_id}/models/{dataset_id}/monitor-config/monitor/{monitor_id} Get the monitor config for a given dataset.
ModelsApi get_monitor_config_v2 GET /v0/organizations/{org_id}/models/{model_id}/monitor-config/v2 Get the monitor config for a given model or segment. The return of this api will include default values that we apply over any config that omits portions of the monitor config schema.
ModelsApi get_monitor_config_v3 GET /v0/organizations/{org_id}/models/{dataset_id}/monitor-config/v3 Get the monitor config document for a given dataset.
ModelsApi get_monitor_config_v3_version GET /v0/organizations/{org_id}/models/{dataset_id}/monitor-config/v3/versions/{version_id} Get the monitor config document version for a given dataset.
ModelsApi list_models GET /v0/organizations/{org_id}/models Get a list of all of the model ids for an organization.
ModelsApi list_monitor_config_v3_versions GET /v0/organizations/{org_id}/models/{dataset_id}/monitor-config/v3/versions List the monitor config document versions for a given dataset.
ModelsApi list_segments GET /v0/organizations/{org_id}/models/{model_id}/segments Get a model metadata
ModelsApi put_analyzer PUT /v0/organizations/{org_id}/models/{dataset_id}/monitor-config/analyzer/{analyzer_id} Save the analyzer config for a given dataset.
ModelsApi put_entity_schema PUT /v0/organizations/{org_id}/models/{dataset_id}/schema Save the entity schema config for a given dataset.
ModelsApi put_entity_schema_column PUT /v0/organizations/{org_id}/models/{dataset_id}/schema/column/{column_id} Save the entity schema of a single column for a given dataset.
ModelsApi put_monitor PUT /v0/organizations/{org_id}/models/{dataset_id}/monitor-config/monitor/{monitor_id} Save the monitor for a given dataset.
ModelsApi put_monitor_config_v2 PUT /v0/organizations/{org_id}/models/{model_id}/monitor-config/v2 Save the monitor config for a given model or segment
ModelsApi put_monitor_config_v3 PUT /v0/organizations/{org_id}/models/{dataset_id}/monitor-config/v3 Save the monitor config document for a given dataset.
ModelsApi put_request_monitor_run_config PUT /v0/organizations/{org_id}/models/{dataset_id}/request-monitor-run Put the RequestMonitorRun config into S3.
ModelsApi put_segments PUT /v0/organizations/{org_id}/models/{model_id}/segments Add a segment to the dataset
ModelsApi update_model PUT /v0/organizations/{org_id}/models/{model_id} Update a model's metadata
ModelsApi validate_monitor_config_v3 PUT /v0/organizations/{org_id}/models/{dataset_id}/monitor-config/v3/validate Validate the monitor config document for a given dataset.
NotificationSettingsApi delete_notification_action DELETE /v0/notification-settings/{org_id}/actions/{action_id} Delete notification action
NotificationSettingsApi get_email_notification_action_payload GET /v0/notification-settings/actions/email/payload Get dummy notification action payload
NotificationSettingsApi get_notification_action GET /v0/notification-settings/{org_id}/actions/{action_id} Get notification action for id
NotificationSettingsApi get_notification_settings GET /v0/notification-settings/{org_id} Get notification settings for an org
NotificationSettingsApi get_pager_duty_notification_action_payload GET /v0/notification-settings/actions/pagerduty/payload Get dummy notification action payload
NotificationSettingsApi get_slack_notification_action_payload GET /v0/notification-settings/actions/slack/payload Get dummy notification action payload
NotificationSettingsApi list_notification_actions GET /v0/notification-settings/{org_id}/actions List notification actions for an org
NotificationSettingsApi put_notification_action PUT /v0/notification-settings/{org_id}/actions/{type}/{action_id} Add new notification action
NotificationSettingsApi update_notification_action PATCH /v0/notification-settings/{org_id}/actions/{type}/{action_id} Update notification action
NotificationSettingsApi update_notification_settings POST /v0/notification-settings/{org_id} Update notification settings for an org
SessionsApi close_session POST /v0/sessions/{session_token}/close naddeo Close a session, triggering its display in whylabs and making it no longer accept any additional data.
SessionsApi create_dataset_profile_upload POST /v0/sessions/{session_token}/upload Create an upload for a given session.
SessionsApi create_session POST /v0/sessions Create a new session that can be used to upload dataset profiles from whylogs for display in whylabs.
SessionsApi get_session GET /v0/sessions/{session_token} Get information about a session.

Documentation For Models

Documentation For Authorization

ApiKeyAuth

  • Type: API key
  • API key parameter name: X-API-Key
  • Location: HTTP header

Author

support@whylabs.ai

Notes for Large OpenAPI documents

If the OpenAPI document is large, imports in whylabs_client.apis and whylabs_client.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1: Use specific imports for apis and models like:

  • from whylabs_client.api.default_api import DefaultApi
  • from whylabs_client.model.pet import Pet

Solution 2: Before importing the package, adjust the maximum recursion limit as shown below:

import sys
sys.setrecursionlimit(1500)
import whylabs_client
from whylabs_client.apis import *
from whylabs_client.models import *