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
refstr: The plan whose history to read — its name, or theidof any of its versions.workspace_idstr | None: Workspace the plan belongs to. Falls back to the client's configured workspace.before_versionint | None: Read the versions below this one, between 1 andMAX_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_pageint: Rows per page (1-100).clientAPIClient | None: Explicit API client. Uses the default client when omitted.
Returns
TestPlanVersionPage: ATestPlanVersionPage— this page's versions only, newest first, withTestPlanVersionPage:next_before_versionthe cursor for the page below orNoneat the end. A cursorTestPlanVersionPage: 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:refis empty or contains/, orbefore_version/per_pageis out of range.TestPlanNotFoundError: Nothing in this workspace answers toref. 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)