> ## 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.

# LogSpanVariable

> Variable types for evaluation tracking on Model and ModelStream spans.

# LogSpanVariable

Variables attached to `Model` or `ModelStream` spans for evaluation tracking. A variable captures a named piece of content (text, image, PDF, etc.) that Adaline uses to power [continuous evaluations](/docs/monitor/setup-continuous-evaluations).

## Import

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

## Type Definitions

### LogSpanVariable

```typescript theme={null}
interface LogSpanVariable {
  name: string;                  // 1-200 chars
  value: LogSpanVariableValue;
}
```

**Properties**:

* `name` - Variable name, 1–200 characters. Should match a variable name defined in your prompt template.
* `value` - The variable content, a discriminated union on `modality` ([LogSpanVariableValue](#logspanvariablevalue))

***

### LogSpanVariableValue

```typescript theme={null}
type LogSpanVariableValue =
  | TextContent           // modality: 'text'
  | ImageContent          // modality: 'image'
  | PdfContent            // modality: 'pdf'
  | ReasoningContent      // modality: 'reasoning'
  | ToolCallContent       // modality: 'tool-call'
  | ToolResponseContent;  // modality: 'tool-response'
```

This is a subset of [MessageContent](/docs/reference/sdk/v2/typescript/types/MessageContent), supporting the modalities relevant for evaluation variables.

***

## Examples

### Text Variable

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

const variable: LogSpanVariable = {
  name: 'user_question',
  value: { modality: 'text', value: 'What is quantum computing?' }
};
```

### Image Variable

```typescript theme={null}
const imageVariable: LogSpanVariable = {
  name: 'uploaded_image',
  value: {
    modality: 'image',
    detail: 'high',
    value: { type: 'url', url: 'https://example.com/chart.png' }
  }
};
```

### PDF Variable

```typescript theme={null}
const pdfVariable: LogSpanVariable = {
  name: 'source_document',
  value: {
    modality: 'pdf',
    value: { type: 'url', url: 'https://example.com/report.pdf' },
    file: { name: 'report.pdf', id: 'file_123' }
  }
};
```

### Using with a Model Span

```typescript theme={null}
import OpenAI from 'openai';

const openai = new OpenAI();
const userQuestion = 'Explain quantum computing simply.';

const params = {
  model: 'gpt-4o',
  messages: [
    { role: 'system' as const, content: 'You are a helpful assistant.' },
    { role: 'user' as const, content: userQuestion },
  ],
};

const response = await openai.chat.completions.create(params);

span.update({
  content: {
    type: 'Model',
    provider: 'openai',
    model: 'gpt-4o',
    input: JSON.stringify(params),
    output: JSON.stringify(response),
    variables: {
      name: 'user_question',
      value: { modality: 'text', value: userQuestion }
    },
  },
});
```

***

## Related

* [LogSpanModelContent](/docs/reference/sdk/v2/typescript/types/LogSpanModelContent) — uses `LogSpanVariable` in its `variables` field
* [MessageContent](/docs/reference/sdk/v2/typescript/types/MessageContent) — full content union that `LogSpanVariableValue` is derived from
* [Span](/docs/reference/sdk/v2/typescript/classes/span) — class where span content with variables is set
