Interface: PromptsResource
Methods
resolve()
ts
resolve(promptIdSpec, options?): Promise<PromptResolveResult>;Resolves a prompt to ready-to-run text.
The production version is used unless the id carries a pin. Every {{variable}} in the body is substituted server-side from vars; a missing one is an error rather than an empty string, and keys the prompt does not use are ignored.
Parameters
promptIdSpec
string
The prompt id, optionally pinned as id@vN.
options?
PromptResolveOptions = {}
Variable values and an optional AbortSignal.
Returns
Promise<PromptResolveResult>
The substituted prompt text, and which version produced it.
Throws
400 when a variable is missing, 401 when the key is rejected or out of scope, 404 when the prompt is unknown or has no production version and no pin was given.
Example
ts
// Follows production.
await client.prompts.resolve("intent-classifier", { vars });
// Pinned: a promotion does not move this caller.
await client.prompts.resolve("intent-classifier@v7", { vars });