> ## Documentation Index
> Fetch the complete documentation index at: https://www.adaline.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# VariableValue

> Discriminated union of variable content types, keyed by modality.

# VariableValue

Discriminated union representing the value supplied for a [PromptVariable](/docs/reference/sdk/v2/typescript/types/PromptVariable). The `modality` field determines the concrete type.

## Import

```typescript theme={null}
import type { VariableValue } from '@adaline/api';
```

## Type Definition

```typescript theme={null}
type VariableValue =
  | TextContent
  | ImageContent
  | PdfContent
  | ApiContent
  | PromptContent;
```

## Variants

| `modality` | Type                                                            | Description              |
| ---------- | --------------------------------------------------------------- | ------------------------ |
| `"text"`   | [TextContent](/docs/reference/sdk/v2/typescript/types/TextContent)   | Plain text value         |
| `"image"`  | [ImageContent](/docs/reference/sdk/v2/typescript/types/ImageContent) | Image (URL or base64)    |
| `"pdf"`    | [PdfContent](/docs/reference/sdk/v2/typescript/types/PdfContent)     | PDF document             |
| `"api"`    | `ApiContent`                                                    | External API data source |
| `"prompt"` | `PromptContent`                                                 | Nested prompt reference  |

***

## Example

```typescript theme={null}
import type { VariableValue } from '@adaline/api';

const textVar: VariableValue = {
  modality: 'text',
  value: 'John Doe'
};

const imageVar: VariableValue = {
  modality: 'image',
  detail: 'auto',
  value: { type: 'url', url: 'https://example.com/logo.png' }
};

const pdfVar: VariableValue = {
  modality: 'pdf',
  value: { type: 'url', url: 'https://example.com/report.pdf' },
  file: { name: 'report.pdf', id: 'file_123' }
};
```

### Type narrowing

```typescript theme={null}
function processVariable(v: VariableValue) {
  switch (v.modality) {
    case 'text':
      console.log('Text:', v.value);
      break;
    case 'image':
      console.log('Image:', v.value.type);
      break;
    case 'pdf':
      console.log('PDF:', v.file.name);
      break;
  }
}
```

***

## Related

* [PromptVariable](/docs/reference/sdk/v2/typescript/types/PromptVariable) — variable definition that this value satisfies
* [TextContent](/docs/reference/sdk/v2/typescript/types/TextContent) — text variant
* [ImageContent](/docs/reference/sdk/v2/typescript/types/ImageContent) — image variant
* [PdfContent](/docs/reference/sdk/v2/typescript/types/PdfContent) — PDF variant
