Skip to content

Home > intention-kernel > renderModelPrompt

renderModelPrompt() function ​

Render bounded literal instructions with exact, one-pass substitution.

Signature:

typescript
export declare function renderModelPrompt(definition: ModelPromptDefinition, values: Readonly<Record<string, string>>, template?: string): string;

Parameters ​

Parameter

Type

Description

definition

ModelPromptDefinition

Valid unique ID, positive version, default template and up to 128 variable names.

values

Readonly<Record<string, string>>

Own string properties matching every declared variable, with no extra names.

template

string

(Optional) Optional pinned replacement; it may omit placeholders but cannot add names.

Returns:

string

Instructions of at most 1 MiB UTF-8; inserted values are never reparsed.

Exceptions ​

KernelConfigurationError with INVALID_MODEL_PROMPT for invalid definitions, malformed placeholders, missing/extra values, or any template/value/output above 1 MiB.

Example ​

ts
renderModelPrompt({ id: "greeting", contractVersion: 1, template: "Hello {{name}}", variables: ["name"] }, { name: "Ada" });