Client Libraries & SDKs
Client Libraries & SDKs
To simplify your integration with the Supervised AI platform, we provide official client libraries for several popular programming languages. These libraries handle authentication, retries, and data parsing, allowing you to focus on building your application.
Official Libraries
Python
The Python SDK is the recommended way to interact with the testing API for data science and backend automation workflows.
Installation
pip install supervised-testing-sdk
Usage
from supervised_testing import TestingClient
# Initialize the client with your API Key
client = TestingClient(api_key="your_api_key_here")
# Run a test suite
response = client.suites.run(
suite_id="ts_12345",
parameters={
"threshold": 0.85,
"environment": "production"
}
)
print(f"Test Status: {response['status']}")
Node.js / TypeScript
Ideal for web applications and server-side integrations using JavaScript or TypeScript.
Installation
npm install @supervised-ai/testing-api
Usage
import { TestingAPI } from '@supervised-ai/testing-api';
const api = new TestingAPI({
apiKey: 'your_api_key_here'
});
async function checkTestStatus(testId: string) {
try {
const result = await api.tests.retrieve(testId);
console.log('Results:', result.metrics);
} catch (error) {
console.error('Error fetching test:', error.message);
}
}
Community Libraries
The following libraries are maintained by the community. Please note that these may not always support the latest features of the Testing API.
| Language | Repository | Maintainer |
| :--- | :--- | :--- |
| Go | github.com/community/testing-api-go | @dev-user |
| Ruby | rubygems.org/gems/supervised-testing | @oss-contrib |
Note: If you have developed a client library in a language not listed above, please submit a Pull Request to include it in this documentation.
SDK Configuration Reference
All official SDKs support the following configuration options during initialization:
| Parameter | Type | Description | Default |
| :--- | :--- | :--- | :--- |
| api_key | string | Required. Your Supervised AI secret key. | None |
| base_url | string | The API endpoint URL. | https://api.supervised.ai/v1 |
| timeout | integer | Request timeout in milliseconds. | 30000 |
| max_retries | integer | Number of times to retry failed requests. | 2 |
Error Handling
The SDKs raise specific exceptions to help you handle errors gracefully.
- AuthenticationError: Invalid or expired API key.
- ValidationError: The request body or parameters are malformed.
- RateLimitError: You have exceeded your current plan's request limit.
- APIError: An internal server error occurred within the Supervised AI platform.
Example (Python):
try:
client.suites.run(suite_id="invalid_id")
except TestingClient.ValidationError as e:
print(f"Check your parameters: {e}")
except TestingClient.RateLimitError:
print("Backing off... rate limit hit.")