Skip to content

whylabs/whylabs-client-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.6.3
  • 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 api_key_api
from whylabs_client.model.user_api_key import UserApiKey
# Defining the host is optional and defaults to https://api.whylabsapp.com
# See configuration.py for a list of all supported configuration parameters.
configuration = whylabs_client.Configuration(
    host = "https://api.whylabsapp.com"
)

# 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 = api_key_api.ApiKeyApi(api_client)
    org_id = "org-123" # str | Your company's unique organization ID
user_id = "user-123" # str | The unique user ID in an organization.
expiration_time = 1577836800000 # int, none_type | Expiration time in epoch milliseconds (optional)
scopes = [
        ":user",
    ] # [str], none_type | Scopes of the token (optional)
alias = "MLApplicationName" # str, none_type | A human-friendly name for the API Key (optional)

    try:
        # Generate an API key for a user.
        api_response = api_instance.create_api_key(org_id, user_id, expiration_time=expiration_time, scopes=scopes, alias=alias)
        pprint(api_response)
    except whylabs_client.ApiException as e:
        print("Exception when calling ApiKeyApi->create_api_key: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://api.whylabsapp.com

Class Method HTTP request Description
ApiKeyApi create_api_key POST /v0/organizations/{org_id}/api-key Generate an API key for a user.
ApiKeyApi revoke_api_key DELETE /v0/organizations/{org_id}/api-key Revoke the given API Key, removing its ability to access WhyLabs systems
AssetsApi get_asset GET /v1/assets/{asset_id} Endpoint to retrieve assets
AssetsApi upload_asset POST /v1/assets/{asset_id}/upload Endpoint to upload an asset
ContainerDiagnosticsApi send_diagnostics POST /v1/container-diagnostics Send container diagnostics
DataApi analysis_results_data POST /v0/organizations/{org_id}/dataset/{dataset_id}/data/analysis-results Endpoint to query analysis results for a dataset
DataApi metric_timeseries_data POST /v0/organizations/{org_id}/dataset/{dataset_id}/data/metric-timeseries Endpoint to query a single metric timeseries for a dataset
DatasetProfileApi create_reference_profile POST /v0/organizations/{org_id}/dataset-profiles/models/{dataset_id}/reference-profile Returns data needed to uploading the reference profile
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
DatasetProfileApi delete_reference_profile DELETE /v0/organizations/{org_id}/dataset-profiles/models/{model_id}/reference-profiles/{reference_id} Delete a single reference profile
DatasetProfileApi get_profile_traces GET /v0/organizations/{org_id}/dataset-profiles/models/{dataset_id}/trace/{trace_id} Returns a list for profile traces matching a trace id
DatasetProfileApi get_reference_profile GET /v0/organizations/{org_id}/dataset-profiles/models/{model_id}/reference-profiles/{reference_id} Returns a single reference profile
DatasetProfileApi list_delete_analyzer_results_requests GET /v0/organizations/{org_id}/dataset-profiles/delete-requests/analyzer-results List requests to delete analyzer results
DatasetProfileApi list_delete_dataset_profiles_requests GET /v0/organizations/{org_id}/dataset-profiles/delete-requests/dataset-profiles List requests to delete dataset profiles
DatasetProfileApi list_profile_traces GET /v0/organizations/{org_id}/dataset-profiles/models/{dataset_id}/trace Returns a list for profile traces
DatasetProfileApi list_reference_profiles GET /v0/organizations/{org_id}/dataset-profiles/models/{model_id}/reference-profiles Returns a list for reference profiles between the given time range filtered on the upload timestamp
DatasetProfileApi list_segments GET /v0/organizations/{org_id}/dataset-profiles/models/{model_id}/segments Returns a list of segments
DatasetMetadataApi delete_dataset_metadata DELETE /v0/organizations/{org_id}/dataset/{dataset_id}/metadata Delete dataset metadata for the specified dataset
DatasetMetadataApi get_dataset_metadata GET /v0/organizations/{org_id}/dataset/{dataset_id}/metadata Get dataset metadata for the specified dataset
DatasetMetadataApi put_dataset_metadata PUT /v0/organizations/{org_id}/dataset/{dataset_id}/metadata Put dataset metadata for the specified dataset
DebugEventsApi log_debug_event POST /v0/organizations/{org_id}/debug-events/resources/{dataset_id}/debug-events/log Log a debug event
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 get_profile_observatory_link POST /v0/organizations/{org_id}/log/observatory-link/{dataset_id} Get observatory links for profiles in a given org/model. A max of 3 profiles can be viewed a a time.
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_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 list_organization_memberships GET /v0/organizations/{org_id}/membership List organization memberships
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 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_entity_schema DELETE /v0/organizations/{org_id}/models/{dataset_id}/schema Delete the entity schema 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_entity_schema_metric DELETE /v0/organizations/{org_id}/models/{dataset_id}/schema/metric/{metric_name} Delete the schema of a single metric 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_named_metric_schemas GET /v0/organizations/{org_id}/models/{dataset_id}/schema/metrics Get all of the named metrics 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 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_entity_schema_metric PUT /v0/organizations/{org_id}/models/{dataset_id}/schema/metric Save the schema of a single metric for a given dataset.
ModelsApi put_named_metric_schema PUT /v0/organizations/{org_id}/models/{dataset_id}/schema/metric/{metric_name} Save the schema of a single named metric for a given dataset.
ModelsApi update_model PUT /v0/organizations/{org_id}/models/{model_id} Update a model's metadata
MonitorApi delete_analyzer DELETE /v0/organizations/{org_id}/models/{dataset_id}/monitor-config/analyzer/{analyzer_id} Delete the analyzer config for a given dataset.
MonitorApi delete_monitor DELETE /v0/organizations/{org_id}/models/{dataset_id}/monitor-config/monitor/{monitor_id} Delete the monitor for a given dataset.
MonitorApi get_analyzer GET /v0/organizations/{org_id}/models/{dataset_id}/monitor-config/analyzer/{analyzer_id} Get the analyzer config for a given dataset.
MonitorApi get_monitor GET /v0/organizations/{org_id}/models/{dataset_id}/monitor-config/monitor/{monitor_id} Get the monitor config for a given dataset.
MonitorApi get_monitor_config_v3 GET /v0/organizations/{org_id}/models/{dataset_id}/monitor-config/v3 Get the monitor config document for a given dataset.
MonitorApi list_constraints GET /v0/organizations/{org_id}/models/{dataset_id}/constraints List the constraints for a given dataset.
MonitorApi patch_monitor_config_v3 PATCH /v0/organizations/{org_id}/models/{dataset_id}/monitor-config/v3 Patch an updated monitor config document for a given dataset.
MonitorApi put_analyzer PUT /v0/organizations/{org_id}/models/{dataset_id}/monitor-config/analyzer/{analyzer_id} Save the analyzer config for a given dataset.
MonitorApi put_monitor PUT /v0/organizations/{org_id}/models/{dataset_id}/monitor-config/monitor/{monitor_id} Save the monitor for a given dataset.
MonitorApi put_monitor_config_v3 PUT /v0/organizations/{org_id}/models/{dataset_id}/monitor-config/v3 Save the monitor config document for a given dataset.
MonitorApi 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.
MonitorDiagnosticsApi detect_noisy_analyzers POST /v0/organizations/{org_id}/diagnostics/monitor/analyzers Endpoint to detect noisy or failing analyzers
MonitorDiagnosticsApi detect_noisy_columns POST /v0/organizations/{org_id}/diagnostics/monitor/analyzer/segment/columns Endpoint to detect the noisiest columns for a specific analyzer and segment
MonitorDiagnosticsApi detect_noisy_segments POST /v0/organizations/{org_id}/diagnostics/monitor/analyzer/segments Endpoint to detect the noisiest segments for a specific analyzer
MonitorDiagnosticsApi diagnose_analyzer_async POST /v0/organizations/{org_id}/diagnostics/monitor/diagnose/analyzer/async Endpoint to request a diagnosis for a specific analyzer
MonitorDiagnosticsApi diagnose_analyzer_async_result GET /v0/organizations/{org_id}/diagnostics/monitor/diagnose/analyzer/async/result Endpoint to request the result of an async diagnosis
MonitorDiagnosticsApi diagnose_analyzer_sync POST /v0/organizations/{org_id}/diagnostics/monitor/diagnose/analyzer/sync Endpoint to diagnose a specific analyzer
MonitorDiagnosticsApi recommend_diagnostic_interval POST /v0/organizations/{org_id}/diagnostics/monitor/interval Endpoint to recommend a diagnostic interval
NotificationSettingsApi add_notification_action POST /v0/notification-settings/{org_id}/actions/{type}/{action_id} Add new notification action
NotificationSettingsApi delete_notification_action DELETE /v0/notification-settings/{org_id}/actions/{action_id} Delete notification action
NotificationSettingsApi disable_notification_action PUT /v0/notification-settings/{org_id}/actions/{action_id}/disable Disable notification action
NotificationSettingsApi enable_notification_action PUT /v0/notification-settings/{org_id}/actions/{action_id}/enable Enable 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_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 test_notification_action POST /v0/notification-settings/{org_id}/actions/{action_id}/test Test a notification action
NotificationSettingsApi update_notification_action PATCH /v0/notification-settings/{org_id}/actions/{type}/{action_id} Update notification action
PolicyApi get_policy GET /v1/policy Endpoint to get the policy configuration
SchemaApi get_monitor_config_schema GET /v0/organizations/{org_id}/schema/monitor-config Get the current supported schema of the monitor configuration
SessionsApi batch_create_reference_profile_upload POST /v0/sessions/{session_id}/references Create multiple reference profile uploads for a given session.
SessionsApi claim_guest_session POST /v0/sessions/{session_id}/claim Claim a guest session, copying its model data into another org and expiring the session.
SessionsApi create_dataset_profile_upload POST /v0/sessions/{session_id}/upload Create an upload for a given session.
SessionsApi create_reference_profile_upload POST /v0/sessions/{session_id}/reference Create a reference profile 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_id} Get information about a session.
SessionsApi get_session_profile_observatory_link POST /v0/sessions/observatory-link/{session_id} Get observatory links for profiles in a given session. A max of 3 profiles can be viewed a a time.
TracesApi export_traces POST /v1/traces Export traces into WhyLabs
TransactionsApi abort_transaction POST /v1/transaction/abort Abort a transaction which has not yet been committed
TransactionsApi commit_transaction POST /v1/transaction/commit Commit a log transaction
TransactionsApi log_transaction POST /v1/transaction/log Add to a log transaction
TransactionsApi start_transaction POST /v1/transaction Start a log transaction
TransactionsApi transaction_status GET /v1/transaction Get the status of a log transaction

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 *

About

Public Python client for WhyLabs API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages