Skip to main content

aip_sdk.list_test_plan_versions

aip_sdk.list_test_plan_versions(ref: str, *, workspace_id: str | None = None, before_version: int | None = None, per_page: int = 20, client: APIClient | None = None) -> TestPlanVersionPage

List the published versions of one test plan, newest first.

Pages by cursor, not page number: omit before_version for the newest page, then pass the previous page's next_before_version to walk down. See TestPlanVersionPage for why.

Returns TestPlanSummary rows, which carry neither required_columns nor unresolved_metrics; get_test_plan derives them for the version you choose.

Parameters

  • ref str: The plan whose history to read — its name, or the id of any of its versions.
  • workspace_id str | None: Workspace the plan belongs to. Falls back to the client's configured workspace.
  • before_version int | None: Read the versions below this one, between 1 and MAX_TEST_PLAN_VERSION. Omit for the newest page. Need not be a version that exists — a value above the newest simply starts at the newest.
  • per_page int: Rows per page (1-100).
  • client APIClient | None: Explicit API client. Uses the default client when omitted.

Returns

  • TestPlanVersionPage: A TestPlanVersionPage — this page's versions only, newest first, with
  • TestPlanVersionPage: next_before_version the cursor for the page below or None at the end. A cursor
  • TestPlanVersionPage: past the end of a plan that exists returns an empty page rather than raising.

Raises

  • NoWorkspaceSelectedError: No workspace was given and the client has none configured.
  • InvalidArgumentError: ref is empty or contains /, or before_version/ per_page is out of range.
  • TestPlanNotFoundError: Nothing in this workspace answers to ref. A plan published only in another workspace reads as absent here rather than as a permissions failure.
  • 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

history = aip.list_test_plan_versions("toxicity-baseline", workspace_id="ws_001")
print("latest is v", history[0].version, "of", history.total)