Documentation

SDK Reference

Complete API reference for the Aionvision Python SDK

Reference Documentation

This section provides a comprehensive reference of all classes, methods, and types in the SDK. For tutorials and guides, see the SDK Guide.

Quick Reference

SectionDescription
ClientMain AionVision client class and convenience methods
ResourcesSub-client resources (uploads, files, chats, etc.)
TypesAll dataclasses and response types
ExceptionsException hierarchy and error types

class AionVision

Main async client for the Aionvision Vision AI API

Constructor

AionVision(
api_key: str,
*,
base_url: str = "https://api.aionvision.tech/api/v2",
timeout: float = 300.0,
max_retries: int = 3,
retry_delay: float = 1.0,
polling_interval: float = 2.0,
polling_timeout: float = 360.0,
tenant_id: Optional[str] = None,
proxy_url: Optional[str] = None,
enable_tracing: bool = False,
)

Parameters

NameTypeDefaultDescription
api_keystrrequiredYour Aionvision API key (starts with aion_)
base_urlstrproduction URLAPI base URL
timeoutfloat300.0Request timeout in seconds
max_retriesint3Maximum retry attempts for transient failures
retry_delayfloat1.0Initial delay between retries (exponential backoff)
polling_intervalfloat2.0Interval for polling operations (auto-describe)
polling_timeoutfloat360.0Maximum time to wait for polling operations
tenant_idOptional[str]NoneTenant ID for multi-tenant deployments
proxy_urlOptional[str]NoneProxy URL (http, https, or socks5)
enable_tracingboolFalseEnable OpenTelemetry tracing

Context Manager Usage

The client must be used as an async context manager

async with AionVision(api_key="aion_...") as client:
result = await client.upload_one("photo.jpg")
print(result.description)

Factory Methods

from_env()

Create a client from environment variables

@classmethod
def from_env(**overrides) -> AionVision

Reads configuration from AIONVISION_* environment variables. See Environment Variables for details.

Convenience Methods

High-level methods that handle common operations

upload_one()

Upload a single file with automatic AI description

async def upload_one(
file: Union[str, Path, bytes],
*,
filename: Optional[str] = None,
wait_for_descriptions: bool = True,
raise_on_failure: bool = True,
description_timeout: Optional[float] = None,
storage_target: Union[StorageTarget, str] = StorageTarget.DEFAULT,
) -> UploadResult

upload()

Upload one or more files with automatic AI description

async def upload(
files: Union[str, Path, bytes, list[Union[str, Path, bytes]]],
*,
filename: Optional[str] = None,
filenames: Optional[list[str]] = None,
recursive: bool = True,
include_hidden: bool = False,
wait_for_descriptions: bool = True,
raise_on_failure: bool = True,
on_progress: Optional[Callable[[UploadProgressEvent], None]] = None,
on_file_complete: Optional[Callable[[FileCompleteEvent], None]] = None,
on_description_progress: Optional[Callable[[DescriptionProgressEvent], None]] = None,
on_description_failed: Optional[Callable[[DescriptionFailedEvent], None]] = None,
description_timeout: Optional[float] = None,
storage_target: Union[StorageTarget, str] = StorageTarget.DEFAULT,
) -> BatchUploadResults

chat_session()

Create a chat session context manager

def chat_session(
*,
title: Optional[str] = None,
image_ids: Optional[list[str]] = None,
use_all_images: bool = True,
auto_close: bool = True,
) -> ChatSessionContext

chat()

Send a message to an existing session and get a complete response

async def chat(
message: str,
*,
session_id: str,
force_detailed_analysis: bool = False,
) -> ChatResponse

chat_stream()

Send a message and stream response tokens as they arrive

async def chat_stream(
message: str,
*,
session_id: str,
force_detailed_analysis: bool = False,
) -> AsyncIterator[ChatToken]

pipeline()

Create a pipeline builder for multi-step agent workflows

def pipeline() -> Pipeline

Returns a Pipeline builder. Chain agent steps and call .run() to execute.

Resource Properties

Access to sub-client resources for advanced operations

PropertyTypeDescription
client.uploadsUploadResourceLow-level upload operations
client.chatsChatResourceChat session management
client.filesFilesResourceFile management operations
client.batchBatchResourceBatch operation management
client.colorsColorsResourceColor analysis and search (automatic on upload)
client.settingsSettingsResourceOrganization settings (custom S3)
client.tenantTenantResourceTenant management
client.auditAuditResourceAudit log operations
client.agent_searchAgentSearchResourceStandalone AI-powered search
client.agent_operationsAgentOperationsResourceAI-powered synthesis, analysis, and organization
client.documentsDocumentsResourceDocument upload, processing, and search
client.linksLinksResourceLink management and crawling
client.foldersFoldersResourceFolder management and organization
client.cloud_storageCloudStorageResourceCloud storage import/export (Google Drive)