Skip to main content

PromptVariable

Types for prompt variables with modality definitions.

Overview

Variable types define dynamic content that can be injected into prompts, with support for multiple modalities.

PromptVariable

Prompt variable with name and modality.

Fields

name
str
required
The variable name as it appears in the prompt template (used as {{variable_name}} in prompts).
modality
VariableModality
required
The variable modality type. See VariableModality.

Example

JSON:

VariableModality

See the dedicated VariableModality page for full documentation. Variable modality type enumeration.
VariableModality is a str enum with the following values:

Example


Using with Deployments


Replacing variables at runtime

The SDK returns deployments with {{variable_name}} placeholders intact — substitute them yourself before sending the prompt to your AI provider.

Text variables

Image and PDF variables

For non-text variables, replace a text content item whose entire value is {{variable_name}} with the corresponding ImageContent or PdfContent:
Image and PDF variables can only replace a text content item whose entire value is {{variable_name}}. A placeholder embedded in larger text (e.g., "See: {{pic}}") cannot be swapped for a binary modality.