Skip to main content

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

  • ref str: The plan to read — its name, or the id of 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.
  • version int: Which published version to read. When ref is a version id, it already pins one version — so pass that one; any other raises TestPlanNotFoundError.
  • workspace_id str | None: Workspace the plan belongs to. Falls back to the client's configured workspace.
  • client APIClient | None: Explicit API client. Uses the default client when omitted.

Returns

  • TestPlanDetail: The TestPlanDetail for that version, carrying the plan body, its live
  • TestPlanDetail: required_columns and everything the workspace's catalogue no longer answers for —
  • TestPlanDetail: unresolved_metrics, metric_drift and unresolved_metric_configs.

Raises

  • NoWorkspaceSelectedError: No workspace was given and the client has none configured.
  • InvalidArgumentError: ref is empty or contains /, or version is not a valid version number.
  • TestPlanNotFoundError: Nothing in this workspace answers to ref at version, or ref is 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)