Compare two versions of a Prompt template, or a version and the draft
GET /v1/prompt-templates/{prompt_template_id}/diff
| Property | Value |
|---|---|
| Operation | get_prompt_template_diff |
| Group | Prompt templates |
| Scope | prompts:read |
| Route class | read |
| Idempotency | No Idempotency-Key |
| Audit | Not audited: A configuration read; a Prompt template is not Call content. |
| Released in | 1.55.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
Answers a line diff per variant, the changed declarations, constants and allowed terms, and the lint findings added and resolved (1.55.0; prompt-manager.md section 7). to omitted compares from with the draft.
Request
Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the prompts:read scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.
curl "$VOCAL_API/v1/prompt-templates/ptpl_.../diff?from=1" \
-H "Authorization: Bearer $VOCAL_API_KEY"const response = await fetch(`${process.env.VOCAL_API}/v1/prompt-templates/ptpl_.../diff?from=1`, {
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
},
});
console.log(response.status, await response.text());import os
import requests
response = requests.get(
f"{os.environ['VOCAL_API']}/v1/prompt-templates/ptpl_.../diff",
params={
"from": "1",
},
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
},
)
print(response.status_code, response.text)Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
prompt_template_id | path | PromptTemplateId | yes | The id of a Prompt template: ptpl_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log. |
from | query | integer | yes | The version compared from. |
to | query | integer | no | The version compared to; the draft when omitted. |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
200 | application/json | PromptTemplateDiff | |
400 | application/json | ErrorEnvelope | invalid_request |
401 | application/json | ErrorEnvelope | unauthenticated |
403 | application/json | ErrorEnvelope | forbidden |
404 | application/json | ErrorEnvelope | not_found |
429 | application/json | ErrorEnvelope | rate_limited |
500 | application/json | ErrorEnvelope | internal_error |
Fields of the 200 answer
The shape is PromptTemplateDiff.
| Field | Type | Required | Description |
|---|---|---|---|
declarations | array of PromptDeclarationDiff | yes | The declarations, constants and allowed terms that differ. |
from_version | integer | yes | |
lint_added | array of PromptLintFinding | yes | The findings the to side has and the from side lacks, by code and path. |
lint_resolved | array of PromptLintFinding | yes | The findings the from side has and the to side lacks, by code and path. |
object | "prompt_template_diff" | yes | |
prompt_template_id | PromptTemplateId | yes | |
to_revision | integer or null | yes | The draft revision compared to when to_version is null; null otherwise. |
to_version | integer or null | yes | The version compared to, or null for the draft. |
variants | array of PromptVariantDiff | yes | Every variant key of either side, default first. |