Skip to main content

Averian AI Validator SDK User Guide

Welcome to the Averian AI Validator Python SDK. This guide provides a comprehensive overview of how to integrate automated anomaly detection into your workflows.


1. Introduction

The SDK allows you to interact with the Averian AI Validator platform programmatically. You can manage projects, upload training data, trigger model retraining, and most importantly, run real-time inference to detect anomalies in images.

2. Setup

Installation

The SDK is available via pip:

pip install averian-ai-validator-sdk

Authentication

Authentication is handled via API Keys.

  • API Keys are generated in the "Organization Settings" page of the web platform.
  • Each API Key is bound to a specific Organization.
  • The key carries specific permissions (Inference, Admin, etc.). Ensure your key has Inference permissions for production use.

3. Core Concepts

Note on Configuration: While this SDK provides methods to create and configure projects, input sources, and processors, it is highly recommended to use the AI Validator webapp for initial setup. The webapp provides essential visual tools for defining regions of interest, masking, and processor sequencing that are difficult to replicate via code.

  • Organization: Your top-level container. An API key gives you access to one organization.
  • Project: A specific use-case or product line (e.g., "PCBA Inspection").
  • Input Source: A specific camera, station, or data stream within a project.
  • Model Ensemble: A trained AI model hosted on the platform. Each Input Source typically has a "Default Ensemble" used for inference.

4. Basic Workflow

Connecting

from averian_ai_validator_sdk import APIClient

api = APIClient()
# Note: api_host is the base URL of your instance (e.g., https://validator.yourcompany.com)
api.connect("https://validator_address", "YOUR_API_KEY")

Navigating Projects and Sources

To run inference, you need a project_id and an input_id.

# List all projects in your organization
projects = api.get_projects()['projects']
for p in projects:
    print(f"Project: {p['name']} (ID: {p['id']})")

# List input sources for a specific project
project_id = "your-project-uuid"
sources = api.get_input_sources(project_id)
for s in sources:
    print(f"Source: {s['name']} (ID: {s['id']})")

Running Inference

Inference requires an image (as a blob), the project ID, input ID, and a model ID.

project_id = "..."
input_id = "..."
image_path = "sample.jpg"

# 1. Get the model (using the default ensemble for the source)
source = api.get_input_source_by_id(project_id, input_id)
model_id = source.get('defaultEnsemble')

# 2. Prepare the image
img_blob = api.read_file_as_blob(image_path)

# 3. Run Inference
result = api.infer(
    project_id=project_id, 
    input_id=input_id, 
    model_id=model_id, 
    img_name="sample", 
    img_ext="jpg", 
    img_blob=img_blob
)

print(f"Is Anomalous: {result['isAnomalous']}")

Retrieving Heatmaps

If an anomaly is detected, you can download a visual heatmap showing the localized area of concern.

heatmap_bytes = api.fetch_result_image_with_heatmap(project_id, result['id'])
with open("result_heatmap.jpg", "wb") as f:
    f.write(heatmap_bytes)

5. Advanced Usage

Data Management

You can programmatically manage your training and testing datasets.

  • move_from_train_to_test(project_id, image_id)
  • set_image_anomality(project_id, image_id, is_anomaly, coordinates): Re-label data from the SDK.

Retraining

Trigger a new training session for a specific input source:

from averian_ai_validator_sdk import ModelType
api.train_new_model(project_id, input_id, ModelType.PATCHCORE)

Step 6 — Clean Up (Optional)

api.del_result(project_id, result['id'])

For the full API reference, visit the Averian AI Validator documentation.

Metadata

Release files for averian-ai-validator-sdk 1.0.1214

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for averian-ai-validator-sdk 1.0.1214
File Size Uploaded Provenance
averian_ai_validator_sdk-1.0.1214.tar.gz 14.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for averian-ai-validator-sdk 1.0.1214
File Interpreter ABI Platform
averian_ai_validator_sdk-1.0.1214-py3-none-any.whl Python 3 none any Details

Total release size: 26.9 kB

Release files / averian_ai_validator_sdk-1.0.1214.tar.gz

Download URL averian_ai_validator_sdk-1.0.1214.tar.gz
Size 14.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e315679e5d16a6bc97b87a9ce40d9f8761441f2fb04da13682b16fc37fe72e15
BLAKE2b-256 checksum
How to use checksums
6b73e3b4419cec805ca9eceec816069d32fb647875bf492334bd33cd52970a41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / averian_ai_validator_sdk-1.0.1214-py3-none-any.whl

Download URL averian_ai_validator_sdk-1.0.1214-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a7d1085d827d90a69dbd8421f5fd193af3bb9cba55bd6fa7cb9dc80c51c771f
BLAKE2b-256 checksum
How to use checksums
715e419f3b193da5361f8372b318d4fa7ab1f12c579a7d917568848390481db0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for averian-ai-validator-sdk 1.0.1214

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page