Skip to main content

aip_sdk.sdg

SDG (Synthetic Data Generation) Adapter Registry SDK.

aip_sdk.sdg.SdgAdapter​

aip_sdk.sdg.SdgAdapter

SDG Adapter Registry top-level access.

Examples

>>> import aip_sdk as aip
>>> from mypackage import MyPipeline # subclass of SDGPipeline
>>> aip.init(base_url, api_key=api_key)
>>> adapter = aip.SdgAdapter.register(
... name="adversarial-gen",
... pipeline=MyPipeline,
... version="1.0",
... )
>>> print(adapter.id, adapter.name)
>>> adapters = aip.SdgAdapter.list()
>>> for a in adapters:
... print(a.name, a.version)

aip_sdk.sdg.SdgAdapter.aget​

async aip_sdk.sdg.SdgAdapter.aget(adapter_id: str, client: AsyncAPIClient | None = None) -> SdgAdapterInstance

Async variant of get().

Parameters

  • adapter_id str: Adapter registration ID.
  • client AsyncAPIClient | None: Optional async API client.

Returns

Raises

aip_sdk.sdg.SdgAdapter.alist​

async aip_sdk.sdg.SdgAdapter.alist(page: int = 1, per_page: int = 100, *, workspace_id: str | None = None, client: AsyncAPIClient | None = None, all_workspaces: bool = False) -> list[SdgAdapterInstance]

Async variant of list().

Reads your session's workspace unless you name one, and raises if none is set. Pass all_workspaces=True to read across every workspace you can access.

Parameters

  • page int: Page number (1-indexed).
  • per_page int: Results per page.
  • workspace_id str | None: Filter to adapters registered in this workspace.
  • client AsyncAPIClient | None: Optional async API client.
  • all_workspaces bool: Read across every workspace you can access.

Returns

  • list[SdgAdapterInstance]: List of SdgAdapterInstance objects.

Raises

aip_sdk.sdg.SdgAdapter.aregister​

async aip_sdk.sdg.SdgAdapter.aregister(name: str, pipeline: Any | None = None, job_config: Any | None = None, version: str = '1.0', owner: str | None = None, *, workspace_id: str | None = None, client: AsyncAPIClient | None = None) -> SdgAdapterInstance

Async variant of register().

Exactly one of pipeline and job_config must be provided.

Parameters

  • name str: Adapter name.
  • pipeline Any | None: Pipeline class — legacy dotted-path registration. Must implement the SDGPipeline interface (run, validate_chain). Uses issubclass when aip_sdg_core is installed, otherwise falls back to duck-typing. Adapters registered this way are not runnable via run_sdg() — they only round-trip metadata.
  • job_config Any | None: aip_sdg_core.JobConfig instance — the runnable path. Adapters registered this way can be run via run_sdg().
  • version str: Version identifier (default: "1.0").
  • owner str | None: Owner/team identifier.
  • workspace_id str | None: Workspace to register the adapter in. Falls back to client.config.workspace_id (set via init() or AIP_WORKSPACE_ID) when not provided. With neither, the registration is refused rather than landing somewhere you did not choose.
  • client AsyncAPIClient | None: Optional async API client.

Returns

Raises

aip_sdk.sdg.SdgAdapter.get​

aip_sdk.sdg.SdgAdapter.get(adapter_id: str, client: APIClient | None = None) -> SdgAdapterInstance

Fetch a registered SDG adapter by ID.

Parameters

  • adapter_id str: Adapter registration ID.
  • client APIClient | None: Optional pre-configured API client.

Returns

Raises

aip_sdk.sdg.SdgAdapter.list​

aip_sdk.sdg.SdgAdapter.list(page: int = 1, per_page: int = 100, *, workspace_id: str | None = None, client: APIClient | None = None, all_workspaces: bool = False) -> list[SdgAdapterInstance]

List registered SDG adapters.

Reads your session's workspace unless you name one, and raises if none is set. Pass all_workspaces=True to read across every workspace you can access.

Parameters

  • page int: Page number (1-indexed).
  • per_page int: Results per page.
  • workspace_id str | None: Filter to adapters registered in this workspace.
  • client APIClient | None: Optional pre-configured API client.
  • all_workspaces bool: Read across every workspace you can access.

Returns

  • list[SdgAdapterInstance]: List of SdgAdapterInstance objects.

Raises

aip_sdk.sdg.SdgAdapter.register​

aip_sdk.sdg.SdgAdapter.register(name: str, pipeline: Any | None = None, job_config: Any | None = None, version: str = '1.0', owner: str | None = None, *, workspace_id: str | None = None, client: APIClient | None = None) -> SdgAdapterInstance

Register a custom SDG adapter.

Exactly one of pipeline and job_config must be provided.

Parameters

  • name str: Adapter name.
  • pipeline Any | None: Pipeline class — legacy dotted-path registration. Must implement the SDGPipeline interface (run, validate_chain). Uses issubclass when aip_sdg_core is installed, otherwise falls back to duck-typing. Adapters registered this way are not runnable via run_sdg() — they only round-trip metadata.
  • job_config Any | None: aip_sdg_core.JobConfig instance — the runnable path. Adapters registered this way can be run via run_sdg().
  • version str: Version identifier (default: "1.0").
  • owner str | None: Owner/team identifier.
  • workspace_id str | None: Workspace to register the adapter in. Falls back to client.config.workspace_id (set via init() or AIP_WORKSPACE_ID) when not provided. With neither, the registration is refused rather than landing somewhere you did not choose.
  • client APIClient | None: Optional pre-configured API client.

Returns

Raises

aip_sdk.sdg.SdgAdapterInstance​

aip_sdk.sdg.SdgAdapterInstance(id: str, name: str, version: str, owner: str | None, workspace_id: str, created_at: datetime | None, updated_at: datetime | None)

A registered SDG adapter.

Attributes

  • id str: Adapter registration ID
  • name str: Adapter name
  • version str: Version string
  • owner str | None: Owner/team identifier
  • workspace_id str: Workspace the adapter is registered in
  • created_at datetime | None: When this adapter was registered
  • updated_at datetime | None: Last update timestamp

aip_sdk.sdg.SdgAdapterInstance.created_at​

aip_sdk.sdg.SdgAdapterInstance.created_at: datetime | None

No docstring is defined in the source.

aip_sdk.sdg.SdgAdapterInstance.id​

aip_sdk.sdg.SdgAdapterInstance.id: str

No docstring is defined in the source.

aip_sdk.sdg.SdgAdapterInstance.name​

aip_sdk.sdg.SdgAdapterInstance.name: str

No docstring is defined in the source.

aip_sdk.sdg.SdgAdapterInstance.owner​

aip_sdk.sdg.SdgAdapterInstance.owner: str | None

No docstring is defined in the source.

aip_sdk.sdg.SdgAdapterInstance.updated_at​

aip_sdk.sdg.SdgAdapterInstance.updated_at: datetime | None

No docstring is defined in the source.

aip_sdk.sdg.SdgAdapterInstance.version​

aip_sdk.sdg.SdgAdapterInstance.version: str

No docstring is defined in the source.

aip_sdk.sdg.SdgAdapterInstance.workspace_id​

aip_sdk.sdg.SdgAdapterInstance.workspace_id: str

No docstring is defined in the source.

aip_sdk.sdg.SdgRun​

aip_sdk.sdg.SdgRun(id: str, adapter_id: str, pipeline: str, status: str, created_at: datetime | None)

A triggered SDG run.

Returned by run_sdg(). Carries enough state to poll status via refresh() against GET /runs/{id}.

aip_sdk.sdg.SdgRun.adapter_id​

aip_sdk.sdg.SdgRun.adapter_id: str

No docstring is defined in the source.

aip_sdk.sdg.SdgRun.created_at​

aip_sdk.sdg.SdgRun.created_at: datetime | None

No docstring is defined in the source.

aip_sdk.sdg.SdgRun.id​

aip_sdk.sdg.SdgRun.id: str

No docstring is defined in the source.

aip_sdk.sdg.SdgRun.pipeline​

aip_sdk.sdg.SdgRun.pipeline: str

No docstring is defined in the source.

aip_sdk.sdg.SdgRun.refresh​

aip_sdk.sdg.SdgRun.refresh(client: APIClient | None = None) -> SdgRun

Re-fetch this run's status from the API and return an updated instance.

aip_sdk.sdg.SdgRun.status​

aip_sdk.sdg.SdgRun.status: str

No docstring is defined in the source.

aip_sdk.sdg.alist_sdg_adapters​

async aip_sdk.sdg.alist_sdg_adapters(page: int = 1, per_page: int = 100, *, workspace_id: str | None = None, client: AsyncAPIClient | None = None, all_workspaces: bool = False) -> list[SdgAdapterInstance]

Async variant of list_sdg_adapters().

Reads your session's workspace unless you name one, and raises if none is set. Pass all_workspaces=True to read across every workspace you can access.

Parameters

  • page int: Page number (1-indexed).
  • per_page int: Results per page.
  • workspace_id str | None: Filter to adapters registered in this workspace.
  • client AsyncAPIClient | None: Optional pre-configured async API client.
  • all_workspaces bool: Read across every workspace you can access.

Returns

  • list[SdgAdapterInstance]: List of SdgAdapterInstance objects.

Raises

aip_sdk.sdg.aregister_sdg_adapter​

async aip_sdk.sdg.aregister_sdg_adapter(name: str, pipeline: Any | None = None, job_config: Any | None = None, version: str = '1.0', owner: str | None = None, *, workspace_id: str | None = None, client: AsyncAPIClient | None = None) -> SdgAdapterInstance

Async variant of register_sdg_adapter().

Parameters

  • name str: Adapter name.
  • pipeline Any | None: Pipeline class — must implement the SDGPipeline interface (run and validate_chain methods). Uses issubclass against SDGPipeline when aip_sdg_core is installed, otherwise falls back to duck-typing.
  • job_config Any | None: aip_sdg_core.JobConfig instance.
  • version str: Version string.
  • owner str | None: Owner/team identifier.
  • workspace_id str | None: Workspace to register the adapter in. Falls back to client.config.workspace_id when not provided — see register_sdg_adapter() for why to pass this explicitly on multi-workspace accounts.
  • client AsyncAPIClient | None: Optional pre-configured async API client.

Returns

Raises

Example:

adapter = await aip.aregister_sdg_adapter(
name="adversarial-gen",
pipeline=MyPipeline,
)

aip_sdk.sdg.arun_sdg​

async aip_sdk.sdg.arun_sdg(adapter_id: str, project_id: str | None = None, client: AsyncAPIClient | None = None) -> SdgRun

Async variant of run_sdg().

aip_sdk.sdg.list_sdg_adapters​

aip_sdk.sdg.list_sdg_adapters(page: int = 1, per_page: int = 100, *, workspace_id: str | None = None, client: APIClient | None = None, all_workspaces: bool = False) -> list[SdgAdapterInstance]

List registered SDG adapters.

Reads your session's workspace unless you name one, and raises if none is set. Pass all_workspaces=True to read across every workspace you can access.

Parameters

  • page int: Page number (1-indexed).
  • per_page int: Results per page.
  • workspace_id str | None: Filter to adapters registered in this workspace.
  • client APIClient | None: Optional pre-configured API client.
  • all_workspaces bool: Read across every workspace you can access.

Returns

  • list[SdgAdapterInstance]: List of SdgAdapterInstance objects.

Raises

Example:

adapters = aip.list_sdg_adapters()
for a in adapters:
print(a.name, a.version)

aip_sdk.sdg.register_sdg_adapter​

aip_sdk.sdg.register_sdg_adapter(name: str, pipeline: Any | None = None, job_config: Any | None = None, version: str = '1.0', owner: str | None = None, *, workspace_id: str | None = None, client: APIClient | None = None) -> SdgAdapterInstance

Register a custom SDG adapter in a single call.

Validates the pipeline class locally against the SDGPipeline interface before calling the registration API.

Parameters

  • name str: Adapter name.
  • pipeline Any | None: Pipeline class — must implement the SDGPipeline interface (run and validate_chain methods). Uses issubclass against SDGPipeline when aip_sdg_core is installed, otherwise falls back to duck-typing.
  • job_config Any | None: aip_sdg_core.JobConfig instance.
  • version str: Version string (default: "1.0").
  • owner str | None: Owner/team identifier.
  • workspace_id str | None: Workspace to register the adapter in. Falls back to client.config.workspace_id (set via init() or AIP_WORKSPACE_ID) when not provided. With neither, the registration is refused rather than landing somewhere you did not choose.
  • client APIClient | None: Optional pre-configured API client.

Returns

Raises

Example:

import aip_sdk as aip
from mypackage import MyPipeline # subclass of SDGPipeline

aip.init("https://aip.example.com", api_key="...")
project = aip.Project.get("my-project-id")
adapter = aip.register_sdg_adapter(
name="adversarial-gen",
pipeline=MyPipeline,
version="1.0",
workspace_id=project.workspace_id,
)
print(adapter.id, adapter.name)

aip_sdk.sdg.run_sdg​

aip_sdk.sdg.run_sdg(adapter_id: str, project_id: str | None = None, *, target_dataset_id: str | None = None, source_dataset_version_id: str | None = None, client: APIClient | None = None) -> SdgRun

Trigger an SDG run against a previously registered adapter.

The adapter must have been registered with pipeline_config; adapters registered with the legacy pipeline_class dotted-path slot are not runnable and are rejected with 400.

The call returns immediately (HTTP 202 Accepted) once the run has been enqueued; processing happens asynchronously. Use SdgRun.refresh() to poll status, or aip.get_run() to attach a full Run handle.

Parameters

  • adapter_id str: ID of the registered SDG adapter to run.
  • project_id str | None: Optional project to attach the resulting run to. Must belong to the adapter's workspace. Strongly recommended: without it non-admin callers cannot fetch the run back via GET /runs/{id} and the run is invisible to project-scoped run lists.
  • target_dataset_id str | None: Optional dataset to write the generated samples into.
  • source_dataset_version_id str | None: Optional dataset version to read seed samples from.
  • client APIClient | None: Optional pre-configured API client.

Returns

  • SdgRun: SdgRun with id, status, created_at.

Raises

  • AdapterNotFoundError: If the adapter doesn't exist.
  • APIError: If the adapter was registered without pipeline_config, or if project_id is unknown / not in the adapter's workspace.
  • AuthError: If no credentials are configured.

Example:

# Authoring a JobConfig requires the SDG extra: pip install 'aip-sdk[sdg]'
import aip_sdk as aip
from aip_sdg_core import JobConfig
from aip_sdg_core.schemas.object_detection.augmentation.brightness_contrast import (
BrightnessContrastConfig,
)

aip.init("https://aip.example.com", api_key="...")
job_config = JobConfig(storage_root="/tmp/sdg")
job_config.add_node("seed", ...)
job_config.add_node("augmented", BrightnessContrastConfig(...), upstream="seed")
adapter = aip.register_sdg_adapter(name="brightness-tune", job_config=job_config)
run = aip.run_sdg(adapter_id=adapter.id, project_id="proj_…")
print(run.id, run.status)