aip_sdk.get_test_plan
aip_sdk.get_test_plan(ref: str, version: int, *, workspace_id: str | None = None, client: APIClient | None = None) -> TestPlanDetail
Read one published version of a test plan, with the columns its metrics need now.
The version's stored methodology never changes, but required_columns and
unresolved_metrics are resolved against the workspace's catalogue as it is at this
read — not the one the plan published against. A metric redeployed with a new required
column lengthens the list; one deregistered since publish is named in
unresolved_metrics rather than quietly dropped from it. Two reads of one immutable
version can therefore differ, and that is the point: the field says what a dataset must
carry to score today.
Parameters
refstr: The plan to read — its name, or theidof any of its versions. Surrounding whitespace is trimmed; a literal/is refused, since a plan name can never contain one and a version id never does either.versionint: Which published version to read. Whenrefis a versionid, it already pins one version — so pass that one; any other raisesTestPlanNotFoundError.workspace_idstr | None: Workspace the plan belongs to. Falls back to the client's configured workspace.clientAPIClient | None: Explicit API client. Uses the default client when omitted.
Returns
TestPlanDetail: TheTestPlanDetailfor that version, carrying the plan body, its liveTestPlanDetail:required_columnsand everything the workspace's catalogue no longer answers for —TestPlanDetail:unresolved_metrics,metric_driftandunresolved_metric_configs.
Raises
NoWorkspaceSelectedError: No workspace was given and the client has none configured.InvalidArgumentError:refis empty or contains/, orversionis not a valid version number.TestPlanNotFoundError: Nothing in this workspace answers torefatversion, orrefis a version id paired with a version other than the one it belongs to. A plan published only in another workspace reads as absent here rather than as a permissions failure, so this never means the caller lacks access to it.AuthError: Credentials are missing, invalid, or expired.ForbiddenError: The caller is not a member of the workspace.ResponseParseError: A platform response did not match the shape this SDK version expects. Usually means the platform is running a newer release; upgrading resolves it.APIError: Any other error from the platform.
Examples
import aip_sdk as aip
record = aip.get_test_plan("toxicity-baseline", 2, workspace_id="ws_001")
print(record.required_columns)
if record.unresolved_metrics:
print("no longer resolvable:", record.unresolved_metrics)