aip_sdk.SdgAdapter
aip_sdk.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.SdgAdapter.aget
async aip_sdk.SdgAdapter.aget(adapter_id: str, client: AsyncAPIClient | None = None) -> SdgAdapterInstance
Async variant of get().
Parameters
adapter_idstr: Adapter registration ID.clientAsyncAPIClient | None: Optional async API client.
Returns
SdgAdapterInstance: SdgAdapterInstance.
Raises
AdapterNotFoundError: If the adapter doesn't exist.
aip_sdk.SdgAdapter.alist
async aip_sdk.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
pageint: Page number (1-indexed).per_pageint: Results per page.workspace_idstr | None: Filter to adapters registered in this workspace.clientAsyncAPIClient | None: Optional async API client.all_workspacesbool: Read across every workspace you can access.
Returns
list[SdgAdapterInstance]: List of SdgAdapterInstance objects.
Raises
ForbiddenError: Ifworkspace_idnames a workspace you cannot access.InvalidArgumentError: If bothworkspace_idandall_workspacesare given.NoWorkspaceSelectedError: No workspace was passed, none is configured for the session, andall_workspaceswas not set.
aip_sdk.SdgAdapter.aregister
async aip_sdk.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
namestr: Adapter name.pipelineAny | None: Pipeline class — legacy dotted-path registration. Must implement the SDGPipeline interface (run,validate_chain). Usesissubclasswhenaip_sdg_coreis installed, otherwise falls back to duck-typing. Adapters registered this way are not runnable viarun_sdg()— they only round-trip metadata.job_configAny | None:aip_sdg_core.JobConfiginstance — the runnable path. Adapters registered this way can be run viarun_sdg().versionstr: Version identifier (default:"1.0").ownerstr | None: Owner/team identifier.workspace_idstr | None: Workspace to register the adapter in. Falls back toclient.config.workspace_id(set viainit()orAIP_WORKSPACE_ID) when not provided. With neither, the registration is refused rather than landing somewhere you did not choose.clientAsyncAPIClient | None: Optional async API client.
Returns
SdgAdapterInstance: SdgAdapterInstance.
Raises
NoWorkspaceSelectedError: If no workspace is passed and none is configured for the session.InvalidArgumentError: If neither or both ofpipeline/job_configprovided.InterfaceValidationError: Ifpipelinedoes not subclassSDGPipelineor is missing required interface members.DuplicateAdapterError: If an adapter with this name already exists in the target workspace.AuthError: If no credentials are configured.
aip_sdk.SdgAdapter.get
aip_sdk.SdgAdapter.get(adapter_id: str, client: APIClient | None = None) -> SdgAdapterInstance
Fetch a registered SDG adapter by ID.
Parameters
adapter_idstr: Adapter registration ID.clientAPIClient | None: Optional pre-configured API client.
Returns
SdgAdapterInstance: SdgAdapterInstance.
Raises
AdapterNotFoundError: If the adapter doesn't exist.
aip_sdk.SdgAdapter.list
aip_sdk.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
pageint: Page number (1-indexed).per_pageint: Results per page.workspace_idstr | None: Filter to adapters registered in this workspace.clientAPIClient | None: Optional pre-configured API client.all_workspacesbool: Read across every workspace you can access.
Returns
list[SdgAdapterInstance]: List of SdgAdapterInstance objects.
Raises
ForbiddenError: Ifworkspace_idnames a workspace you cannot access.InvalidArgumentError: If bothworkspace_idandall_workspacesare given.NoWorkspaceSelectedError: No workspace was passed, none is configured for the session, andall_workspaceswas not set.
aip_sdk.SdgAdapter.register
aip_sdk.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
namestr: Adapter name.pipelineAny | None: Pipeline class — legacy dotted-path registration. Must implement the SDGPipeline interface (run,validate_chain). Usesissubclasswhenaip_sdg_coreis installed, otherwise falls back to duck-typing. Adapters registered this way are not runnable viarun_sdg()— they only round-trip metadata.job_configAny | None:aip_sdg_core.JobConfiginstance — the runnable path. Adapters registered this way can be run viarun_sdg().versionstr: Version identifier (default:"1.0").ownerstr | None: Owner/team identifier.workspace_idstr | None: Workspace to register the adapter in. Falls back toclient.config.workspace_id(set viainit()orAIP_WORKSPACE_ID) when not provided. With neither, the registration is refused rather than landing somewhere you did not choose.clientAPIClient | None: Optional pre-configured API client.
Returns
SdgAdapterInstance: SdgAdapterInstance.
Raises
NoWorkspaceSelectedError: If no workspace is passed and none is configured for the session.InvalidArgumentError: If neither or both ofpipeline/job_configprovided.InterfaceValidationError: Ifpipelinedoes not subclassSDGPipelineor is missing required interface members.DuplicateAdapterError: If an adapter with this name already exists in the target workspace.AuthError: If no credentials are configured.