WhyLabs API
Getting Started
After your user account is set up, you can sign in to the WhyLabs Platform and start to onboard your data. To do this, you will need an access token (API key) in order to interact with the API endpoints.
Creating an API Token
To obtain your API key, you will need to navigate to the Access Tokens page. In the top left corner of the page, click on the menu icon and select Access Tokens from the list of options. From the Access Tokens page you will need provide a name for the token and optionally set an expiry date, then click the Create access token button.
Once the token has been generated you should see a notification and the API key will be shown on the page. Clicking the copy button will copy the key to your clipboard.
Publishing Log Data to the Platform
After your API key has been created you can use it to authenticate a new session and upload log data to the platform. See the Onboarding to the Platform page for a walkthrough on uploading profiles to WhyLabs models/datasets.
Using the WhyLabs Client
The WhyLabs python client is a wrapper around the WhyLabs API that provides a convenient way to interact with the platform.
The client is available on PyPI and can be installed using pip install whylabs-client
. See the
WhyLabs python client git repo for more information.
Using the WhyLabs Toolkit
The WhyLabs toolkit is a client library built using the WhyLabs python client. It helps you to automate
activities like creating and updating monitors. The client is available on PyPI and can be installed using
pip install whylabs-toolkit
. See the WhyLabs toolkit git
repo for more information and examples.
Limits
WhyLabs implements quotas that restrict the size and number of requests that you can make to the WhyLabs API from your organization/team.
The maximum number of requests varies by type and API operation. WhyLabs implements two types of API requests limitations:
- Profile limits: this type of quota limits the number of whylogs profiles that can be uploaded for a specific segments (which belongs to a dataset / model)
- Rate limits: this type of quota defines the maximum number of requests that you can make per second for a particular operation. It controls the rate of requests that are sent or received.
The following table list the profile limits for the WhyLabs API.
Operation | Use case | Daily Profile Granularity | Hourly Profile Granularity |
---|---|---|---|
LogAsync | Ingestion per segment | 24 profiles per day | 6 profiles per hour |
LogAsync | Backfill per segment | 60 daily profiles (to backfill 60 days) | 720 hourly profiles (to backfill 30 days) |
The following table list the rate limits for the WhyLabs API.
Operation | TPS |
---|---|
LogAsync | 5 |
CreateModel | 5 |
PutSegments | 5 |
PutMonitorConfigv2 | 5 |
CreateUser | 5 |
CreateMembership | 5 |
RemoveMembership | 5 |
If you exceed one of these quotas, WhyLabs throttles the request—that is, it rejects an otherwise valid request and returns a TooManyRequests error. Throttling is based on the total number of requests that you make from your organization for a specific operation.