Method Signature
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
prompt_id | str | Yes | The unique identifier of the prompt |
version_id | str | Yes | The unique identifier of the version |
Examples
Basic Usage
Access Version Details
Asynchronous Usage
Error Handling
Overview
Theget_version
method allows you to retrieve a specific version of a prompt by its version ID or version number. This is useful for accessing historical versions, comparing changes, or rolling back to previous versions.
Method Signature
Synchronous
Asynchronous
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
prompt_id | str | Yes | The unique identifier of the prompt |
version_id | str | No* | The unique identifier of the version |
version_number | int | No* | The version number to retrieve |
version_id
or version_number
must be provided.
Returns
Returns a dictionary containing the complete version information.Examples
Get Version by Number
Get Version by ID
Detailed Version Information
Asynchronous Usage
Compare Versions
Get Latest Version
Get Active Version
Batch Version Retrieval
Asynchronous Batch Retrieval
Version Content Analysis
Export Version
Error Handling
Version Structure
A retrieved version contains:version_id
: Unique identifier for this versionprompt_id
: ID of the parent promptversion_number
: Sequential version numbercontent
: The version content with variablesdescription
: Optional description of changesvariables
: List of variables used in contentmetadata
: Version-specific metadatais_active
: Whether this version is currently activecreated_at
: Creation timestampcreated_by
: User who created the versionupdated_at
: Last modification timestamp (if applicable)
Best Practices
- Use version numbers for sequential access
- Use version IDs when you have the specific identifier
- Always handle cases where versions might not exist
- Cache frequently accessed versions
- Validate version content before using in production
- Compare versions to understand evolution
Common Use Cases
- Retrieving specific versions for rollback
- Comparing different versions for analysis
- Loading historical versions for audit
- Accessing A/B test versions
- Reviewing version evolution
- Preparing versions for deployment