{"id":8779,"library":"whylabs-client","title":"WhyLabs API Client","description":"The `whylabs-client` is a Python client library that provides a convenient way to interact with the WhyLabs API for end-to-end AI observability. It enables users to manage models, datasets, and monitors on the WhyLabs Platform. The library is automatically generated by the OpenAPI Generator project. Current version is 0.6.16.","status":"maintenance","version":"0.6.16","language":"en","source_language":"en","source_url":"https://github.com/whylabs/whylabs-client-python","tags":["AI Observability","MLOps","Data Quality","API Client","OpenAPI","WhyLabs"],"install":[{"cmd":"pip install whylabs-client","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Often used in conjunction to generate statistical profiles for upload to WhyLabs Platform.","package":"whylogs","optional":true},{"reason":"A higher-level client library built on `whylabs-client` for simplified interactions.","package":"whylabs-toolkit","optional":true}],"imports":[{"symbol":"Configuration","correct":"from whylabs_client import Configuration"},{"symbol":"ApiClient","correct":"from whylabs_client import ApiClient"},{"note":"Directly importing specific API modules is preferred to avoid recursion depth issues with large OpenAPI specifications.","wrong":"import whylabs_client.api","symbol":"ApiClass","correct":"from whylabs_client.api import some_api"}],"quickstart":{"code":"import os\nimport whylabs_client\nfrom whylabs_client.api import api_key_api\n\n# Configure API key authorization\nconfiguration = whylabs_client.Configuration(\n    host=\"https://api.whylabsapp.com\"\n)\nconfiguration.api_key['ApiKeyAuth'] = os.environ.get('WHYLABS_API_KEY', '')\n\n# It's good practice to set discard_unknown_keys to True if you encounter parsing issues\n# configuration.discard_unknown_keys = True\n\ntry:\n    with whylabs_client.ApiClient(configuration) as api_client:\n        # Create an instance of the API class\n        api_instance = api_key_api.ApiKeyApi(api_client)\n\n        # Example: List user API keys (requires appropriate permissions)\n        # This call might not be available or might require specific permissions/parameters\n        # depending on your API key scope. This is illustrative.\n        # response = api_instance.list_user_api_keys()\n        # print(response)\n        print(\"Successfully configured WhyLabs API client.\")\n        print(\"Ensure WHYLABS_API_KEY environment variable is set for actual API calls.\")\n\nexcept whylabs_client.ApiException as e:\n    print(f\"Exception when calling WhyLabs API: {e}\")\nexcept Exception as e:\n    print(f\"An unexpected error occurred: {e}\")\n","lang":"python","description":"This quickstart demonstrates how to initialize the WhyLabs API client with an API key. It uses environment variables for secure credential management and sets up the basic `Configuration` and `ApiClient` objects. Replace `api_key_api` with the specific API module you intend to use (e.g., `dataset_profile_api`, `data_api`). Ensure your `WHYLABS_API_KEY` is set as an environment variable."},"warnings":[{"fix":"Users should be aware that the library and platform are now community-driven. Consider exploring the open-source platform directly or `whylogs` for profiling, which remains actively maintained.","message":"WhyLabs, Inc. officially discontinued operations. While the platform has been open-sourced, future commercial support and active development from the original company are no longer available.","severity":"breaking","affected_versions":"All versions"},{"fix":"Instead of `import whylabs_client.api` or `from whylabs_client import api`, use specific imports like `from whylabs_client.api.your_api_module import YourApiClass` and `from whylabs_client.model.your_model import YourModel`.","message":"Importing the entire `whylabs_client.api` or `whylabs_client.model` modules directly can lead to a `RecursionError: maximum recursion depth exceeded` if the generated OpenAPI specification is very large.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Review WhyLabs' API limits documentation. Implement exponential backoff and retry logic in your application. Optimize profile uploads to stay within daily/hourly limits, e.g., by merging profiles before uploading if possible.","message":"WhyLabs API enforces profile and rate limits. Exceeding these quotas will result in a `TooManyRequests` error.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Refactor imports to be more specific, e.g., `from whylabs_client.api.your_api_module import YourApiClass` and `from whylabs_client.model.your_model import YourModel`. Alternatively, increase Python's recursion limit with `sys.setrecursionlimit(new_limit)` (use with caution).","cause":"Attempting to import large portions of the auto-generated client (`whylabs_client.api` or `whylabs_client.model`) at once, which can hit Python's default recursion limit due to the complexity of the OpenAPI spec.","error":"RecursionError: maximum recursion depth exceeded"},{"fix":"Implement retry mechanisms with exponential backoff. Review your data ingestion strategy to ensure it adheres to WhyLabs' profile and rate limits. Consider aggregating data locally before uploading or adjusting your upload frequency.","cause":"Your application has exceeded the API rate limits or profile limits set by the WhyLabs platform.","error":"whylabs_client.ApiException: (429) Too Many Requests"},{"fix":"If duplicate profiles are not desired, ensure your logging mechanism only uploads a unique profile for a given time granularity. To remove existing duplicates, a new model might need to be created and backfilled with correct data, or contact support for options if still available.","cause":"This typically occurs when the same dataset is logged multiple times. WhyLabs merges profiles uploaded for the same day (or hour), rather than overwriting previous ones.","error":"Seeing more rows in WhyLabs than I had in my dataset"}]}