Skip to main content

VariableModality

Enumeration of the supported modality types for prompt variables.

Import

import type { VariableModality } from '@adaline/api';

Definition

enum VariableModality {
  Text = 'text',
  Image = 'image',
  Pdf = 'pdf',
  Api = 'api',
  Prompt = 'prompt',
}

Values

ValueStringDescription
Text'text'Plain text content. The most common modality — used for names, instructions, or any string value.
Image'image'Image content, provided as a URL or base64-encoded data.
Pdf'pdf'PDF document content, provided as a URL or base64-encoded data.
Api'api'External API data source. The variable value is fetched from a configured API endpoint at runtime.
Prompt'prompt'Nested prompt reference. Allows composing prompts by embedding one prompt inside another.

Usage

import type { PromptVariable, VariableModality } from '@adaline/api';

const variables: PromptVariable[] = [
  { name: 'user_name', modality: 'text' },
  { name: 'profile_picture', modality: 'image' },
  { name: 'resume', modality: 'pdf' },
  { name: 'live_weather', modality: 'api' },
  { name: 'system_instructions', modality: 'prompt' },
];

function isTextVariable(v: PromptVariable): boolean {
  return v.modality === ('text' satisfies VariableModality);
}

Inspecting deployment variables

import { Adaline } from '@adaline/client';

const adaline = new Adaline();

const deployment = await adaline.getLatestDeployment({
  promptId: 'prompt_abc123',
  deploymentEnvironmentId: 'environment_abc123',
});

for (const variable of deployment.prompt.variables) {
  console.log(`${variable.name} (${variable.modality})`);
}

See Also