aip_sdk.register_sdg_adapter
aip_sdk.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
namestr: Adapter name.pipelineAny | None: Pipeline class — must implement the SDGPipeline interface (runandvalidate_chainmethods). UsesissubclassagainstSDGPipelinewhenaip_sdg_coreis installed, otherwise falls back to duck-typing.job_configAny | None:aip_sdg_core.JobConfiginstance.versionstr: Version string (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.InterfaceValidationError: Ifpipelinedoes not satisfy the SDGPipeline interface.DuplicateAdapterError: If an adapter with this name already exists in the target workspace.AuthError: If no credentials are configured.
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)