prompts.resolve()
ts
client.prompts.resolve(
promptIdSpec: string,
options?: {
vars?: Record<string, string>;
signal?: AbortSignal;
},
): Promise<{
prompt: string;
promptVersionId: string;
version: string;
}>Resolves a prompt's production version and substitutes its variables, server side. It performs no inference.
Parameters
| Name | Type | Description |
|---|---|---|
promptIdSpec | string | The prompt id, optionally pinned to a version with @vN. |
options.vars | Record<string, string> | Values for the {{variables}} in the prompt body. |
options.signal | AbortSignal | Cancels the in-flight request. |
Returns
| Field | Type | Description |
|---|---|---|
prompt | string | The substituted, ready-to-run prompt text. No {{...}} remain. |
promptVersionId | string | Id of the exact version that was resolved — worth logging next to the model's output. |
version | string | The resolved label, e.g. "v7". |
Version pinning
ts
// Always whatever is promoted to production right now.
await client.prompts.resolve("intent-classifier", { vars });
// Pinned. Promoting a new version does not move this caller.
await client.prompts.resolve("intent-classifier@v7", { vars });Unpinned callers follow production, which is the point: one promotion changes every caller that did not ask to stay put. A prompt with no production version and no pin fails with 404.
Calls in parallel
Each call is one HTTP request and holds no client-side state, so batches are just Promise.all:
ts
const resolved = await Promise.all(
customers.map((c) =>
client.prompts.resolve("welcome-email", {
vars: { name: c.name, plan: c.plan },
}),
),
);Cancellation
ts
const controller = new AbortController();
const promise = client.prompts.resolve("slow-prompt", {
vars: {},
signal: controller.signal,
});
setTimeout(() => controller.abort(), 5_000);