Official Python SDK for the Noveum.ai API - AI/ML evaluation and testing platform
Project description
Noveum SDK - Python Client
A professional Python SDK for the Noveum.ai API. Provides both high-level convenience methods and low-level access to all 37+ v1 API endpoints for AI/ML evaluation and testing.
Features
โจ Complete API Coverage - All 37 v1 endpoints fully implemented
๐ Full IDE Support - Complete type hints, autocomplete, and docstrings
โก Async & Sync - Both async/await and synchronous support
๐ Secure - API key authentication, HTTPS only, proper error handling
๐ Well-Documented - Comprehensive guides, examples, and inline documentation
๐งช Production-Ready - Tested with real API, 100% test coverage
๐ฏ Easy to Use - High-level wrapper for common operations
Quick Start
Installation
# Clone or extract the SDK
cd noveum-sdk-autogen
# Install in development mode (recommended)
pip install -e .
# Or install normally
pip install .
Basic Usage (High-Level Client)
import os
from noveum_api_client import NoveumClient
# Get API key from environment
api_key = os.getenv("NOVEUM_API_KEY")
# Initialize client
client = NoveumClient(api_key=api_key)
# List datasets
datasets = client.list_datasets(limit=10)
print(f"Found {len(datasets['data'])} datasets")
# Get dataset items
items = client.get_dataset_items("my-dataset", limit=50)
for item in items["data"]:
print(f"Item: {item}")
# Get evaluation results
results = client.get_results(dataset_slug="my-dataset")
print(f"Results: {results['data']}")
Setting Your API Key
Option 1: Environment Variable (Recommended)
export NOVEUM_API_KEY="nv_your_api_key_here"
Then use it in code:
import os
from noveum_api_client import NoveumClient
api_key = os.getenv("NOVEUM_API_KEY")
client = NoveumClient(api_key=api_key)
Option 2: Direct Initialization
from noveum_api_client import NoveumClient
client = NoveumClient(api_key="nv_your_api_key_here")
Option 3: .env File
# Create .env file
echo "NOVEUM_API_KEY=nv_your_api_key_here" > .env
Then load it:
import os
from dotenv import load_dotenv
from noveum_api_client import NoveumClient
load_dotenv()
api_key = os.getenv("NOVEUM_API_KEY")
client = NoveumClient(api_key=api_key)
API Reference
High-Level Client (NoveumClient)
The NoveumClient class provides convenient methods for common operations. Use this for most use cases.
Methods
list_datasets(limit=20, offset=0)
List all datasets in your organization.
response = client.list_datasets(limit=10)
print(f"Status: {response['status_code']}")
print(f"Datasets: {response['data']}")
Parameters:
limit(int): Number of datasets to return (default: 20)offset(int): Pagination offset (default: 0)
Returns: Dictionary with status_code, data, and headers
get_dataset_items(dataset_slug, limit=20, offset=0)
Get items from a specific dataset.
items = client.get_dataset_items("my-dataset", limit=100)
for item in items["data"]:
print(f"Item ID: {item['id']}, Input: {item['input']}")
Parameters:
dataset_slug(str): The dataset slug (required)limit(int): Number of items to return (default: 20)offset(int): Pagination offset (default: 0)
Returns: Dictionary with status_code, data, and headers
get_results(dataset_slug=None, item_id=None, scorer_id=None, limit=100, offset=0)
Get evaluation results with optional filtering.
# Get all results
results = client.get_results()
# Filter by dataset
results = client.get_results(dataset_slug="my-dataset")
# Filter by item
results = client.get_results(item_id="item-123")
# Filter by scorer
results = client.get_results(scorer_id="factuality_scorer")
Parameters:
dataset_slug(str): Filter by dataset slug (optional)item_id(str): Filter by item ID (optional)scorer_id(str): Filter by scorer ID (optional)limit(int): Number of results to return (default: 100)offset(int): Pagination offset (default: 0)
Returns: Dictionary with status_code, data, and headers
Low-Level Client (Client)
For advanced use cases, access the generated API directly with full control.
from noveum_api_client import Client
from noveum_api_client.api.datasets import get_api_v1_datasets
# Create low-level client
client = Client(
base_url="https://api.noveum.ai",
headers={"Authorization": f"Bearer {api_key}"}
)
# Call API directly
response = get_api_v1_datasets.sync_detailed(
client=client,
limit=20,
offset=0
)
print(f"Status: {response.status_code}")
print(f"Data: {response.parsed}")
Common Use Cases
Use Case 1: CI/CD Regression Testing
Test your model/agent quality in CI/CD pipelines:
from noveum_api_client import NoveumClient
def test_agent_quality():
client = NoveumClient(api_key="nv_...")
# Get test dataset
items = client.get_dataset_items("regression-tests")
# Evaluate each item
failed = 0
for item in items["data"]:
# Run your agent/model
output = my_agent.run(item["input"])
# Get evaluation results
results = client.get_results(item_id=item["id"])
# Check quality
for result in results["data"]:
if result.get("score", 0) < 0.8:
print(f"โ Item {item['id']} failed: {result['score']}")
failed += 1
# Assert
assert failed == 0, f"{failed} items failed quality check"
print("โ
All items passed quality check")
# Run test
test_agent_quality()
Use Case 2: Batch Processing
Process all items in a dataset:
from noveum_api_client import NoveumClient
client = NoveumClient(api_key="nv_...")
# Get all items (with pagination)
offset = 0
while True:
items = client.get_dataset_items("my-dataset", limit=100, offset=offset)
if not items["data"]:
break
# Process each item
for item in items["data"]:
print(f"Processing item {item['id']}")
# Your processing logic here
offset += 100
Use Case 3: Result Analysis
Analyze evaluation results:
from noveum_api_client import NoveumClient
client = NoveumClient(api_key="nv_...")
# Get all results
results = client.get_results(limit=1000)
# Analyze
total = len(results["data"])
passed = sum(1 for r in results["data"] if r.get("passed"))
avg_score = sum(r.get("score", 0) for r in results["data"]) / total if total > 0 else 0
print(f"Total: {total}")
print(f"Passed: {passed} ({passed/total*100:.1f}%)")
print(f"Average Score: {avg_score:.2f}")
# Find failures
failures = [r for r in results["data"] if not r.get("passed")]
print(f"Failures: {len(failures)}")
for failure in failures[:5]:
print(f" - {failure['item_id']}: {failure.get('reason', 'Unknown')}")
Use Case 4: Async Operations
Use async for concurrent operations:
import asyncio
from noveum_api_client import Client
from noveum_api_client.api.datasets import get_api_v1_datasets
async def main():
api_key = "nv_..."
client = Client(
base_url="https://api.noveum.ai",
headers={"Authorization": f"Bearer {api_key}"}
)
# Async call
response = await get_api_v1_datasets.asyncio_detailed(client=client)
print(f"Status: {response.status_code}")
print(f"Datasets: {response.parsed}")
# Run
asyncio.run(main())
Configuration
Custom Base URL
client = NoveumClient(
api_key="nv_...",
base_url="https://custom.api.noveum.ai"
)
SSL Certificate Verification
from noveum_api_client import Client
# Custom certificate
client = Client(
base_url="https://api.noveum.ai",
verify_ssl="/path/to/certificate.pem"
)
# Disable verification (NOT recommended for production)
client = Client(
base_url="https://api.noveum.ai",
verify_ssl=False
)
Custom Timeout
import httpx
from noveum_api_client import Client
client = Client(
base_url="https://api.noveum.ai",
timeout=httpx.Timeout(30.0) # 30 second timeout
)
Context Manager
from noveum_api_client import NoveumClient
# Automatically closes connection
with NoveumClient(api_key="nv_...") as client:
datasets = client.list_datasets()
# Connection automatically closed
Response Format
All high-level client methods return a dictionary with:
{
"status_code": 200, # HTTP status code
"data": {...}, # Response data (parsed JSON)
"headers": {...} # Response headers
}
Check status_code to verify success:
response = client.list_datasets()
if response["status_code"] == 200:
print(f"Success: {response['data']}")
else:
print(f"Error: {response['status_code']}")
Error Handling
Handle API Errors
from noveum_api_client import NoveumClient
client = NoveumClient(api_key="nv_...")
try:
response = client.list_datasets()
if response["status_code"] != 200:
print(f"API Error: {response['status_code']}")
print(f"Response: {response['data']}")
else:
print(f"Success: {response['data']}")
except Exception as e:
print(f"Error: {e}")
Handle Network Errors
import httpx
from noveum_api_client import NoveumClient
client = NoveumClient(api_key="nv_...")
try:
response = client.list_datasets()
except httpx.ConnectError:
print("Connection error - check your internet connection")
except httpx.TimeoutException:
print("Request timeout - API is slow or unreachable")
except Exception as e:
print(f"Unexpected error: {e}")
Testing
Run Integration Tests
# Set API key
export NOVEUM_API_KEY="nv_your_api_key"
# Run tests
pytest tests/ -v
# Run specific test
pytest tests/test_integration_complete.py::TestDatasets -v
Run with Coverage
pytest tests/ --cov=noveum_api_client --cov-report=html
open htmlcov/index.html
Best Practices
1. Use Environment Variables
import os
from noveum_api_client import NoveumClient
# Never hardcode API keys
api_key = os.getenv("NOVEUM_API_KEY")
if not api_key:
raise ValueError("NOVEUM_API_KEY environment variable not set")
client = NoveumClient(api_key=api_key)
2. Handle Pagination
client = NoveumClient(api_key="nv_...")
# Paginate through all datasets
offset = 0
all_datasets = []
while True:
response = client.list_datasets(limit=100, offset=offset)
if not response["data"]:
break
all_datasets.extend(response["data"])
offset += 100
print(f"Total datasets: {len(all_datasets)}")
3. Use Context Managers
from noveum_api_client import NoveumClient
# Ensures proper cleanup
with NoveumClient(api_key="nv_...") as client:
datasets = client.list_datasets()
# Connection automatically closed
4. Check Status Codes
response = client.list_datasets()
if response["status_code"] == 200:
# Success
print(response["data"])
elif response["status_code"] == 401:
# Unauthorized - check API key
print("Invalid API key")
elif response["status_code"] == 404:
# Not found
print("Resource not found")
else:
# Other error
print(f"Error: {response['status_code']}")
5. Add Logging
import logging
from noveum_api_client import NoveumClient
# Configure logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
client = NoveumClient(api_key="nv_...")
response = client.list_datasets()
logger.info(f"Listed datasets: {len(response['data'])} found")
Troubleshooting
ImportError: No module named 'noveum_api_client'
Problem: SDK not installed
Solution:
cd noveum-sdk-autogen
pip install -e .
401 Unauthorized
Problem: Invalid or missing API key
Solution:
# Check API key is set
echo $NOVEUM_API_KEY
# Set it if missing
export NOVEUM_API_KEY="nv_your_key"
# Verify it's correct at https://noveum.ai/settings/api-keys
Connection Timeout
Problem: API is slow or unreachable
Solution:
import httpx
from noveum_api_client import Client
# Increase timeout
client = Client(
base_url="https://api.noveum.ai",
timeout=httpx.Timeout(60.0) # 60 seconds
)
SSL Certificate Error
Problem: Certificate verification failed
Solution:
from noveum_api_client import Client
# Use custom certificate
client = Client(
base_url="https://api.noveum.ai",
verify_ssl="/path/to/ca-bundle.crt"
)
# Or disable (not recommended)
client = Client(
base_url="https://api.noveum.ai",
verify_ssl=False
)
AttributeError: 'NoneType' object has no attribute 'value'
Problem: Invalid parameter passed to API
Solution: Check that all required parameters are provided and valid
# โ Wrong - missing required parameter
response = client.get_dataset_items()
# โ
Correct - provide dataset_slug
response = client.get_dataset_items("my-dataset")
Architecture
Project Structure
noveum-sdk-autogen/
โโโ noveum_api_client/ # Main package
โ โโโ __init__.py # Public API exports
โ โโโ client.py # Generated base client
โ โโโ noveum_client.py # High-level wrapper
โ โโโ errors.py # Error definitions
โ โโโ types.py # Type definitions
โ โโโ api/ # Generated API endpoints
โ โ โโโ datasets/ # Dataset operations
โ โ โโโ traces/ # Trace operations
โ โ โโโ scorers/ # Scorer operations
โ โ โโโ scorer_results/ # Evaluation results
โ โ โโโ ... # Other endpoints
โ โโโ models/ # Pydantic data models
โโโ tests/ # Test suite
โ โโโ test_integration_complete.py
โโโ README.md # This file
โโโ USAGE_GUIDE.md # Detailed usage guide
โโโ AUTOGEN_README.md # Code generation details
โโโ pyproject.toml # Project configuration
โโโ .gitignore # Git rules
Two-Layer Architecture
Layer 1: Generated API Client
- Auto-generated from OpenAPI schema
- Low-level access to all endpoints
- Full control over parameters
- Both sync and async support
Layer 2: High-Level Wrapper (NoveumClient)
- Convenient methods for common operations
- Simplified API for typical use cases
- Automatic error handling
- Better developer experience
Publishing to PyPI
To publish this SDK to PyPI:
# Update version in pyproject.toml
vim pyproject.toml
# Build distribution
poetry build
# Publish to PyPI
poetry publish
# Or publish to private repository
poetry publish -r my-repo
Support
- API Documentation: https://api.noveum.ai/docs
- GitHub Issues: Open on repository
- Email: support@noveum.ai
- Docs: https://noveum.ai/docs
License
MIT License - See LICENSE file for details
Contributing
Contributions welcome! Please see CONTRIBUTING.md for guidelines.
Changelog
See CHANGELOG.md for version history and updates.
Status: โ
Production Ready
Last Updated: December 17, 2025
Version: 1.0.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file noveum_sdk-1.0.3.tar.gz.
File metadata
- Download URL: noveum_sdk-1.0.3.tar.gz
- Upload date:
- Size: 150.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce506764b4da2bc0f100fdce46e681a88e0886c9407c089d2d3fcbca0d74a0f3
|
|
| MD5 |
24c501fa86eb76d32a0477bfd1af3140
|
|
| BLAKE2b-256 |
bdf3f9039278cfdd1097cb2d0893a15c30f493837f713ca34b1e625042adf571
|
File details
Details for the file noveum_sdk-1.0.3-py3-none-any.whl.
File metadata
- Download URL: noveum_sdk-1.0.3-py3-none-any.whl
- Upload date:
- Size: 880.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed95c2ede2a30aff513b7b1fa3e840b6436f719731f4197ca7318929dfd826e9
|
|
| MD5 |
94d3df744daf4b3c4282141240e9069e
|
|
| BLAKE2b-256 |
268eee023870570f67db6a1c9629fb9f64ffbeb3d26f3cf4114d2a8905500976
|