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

# LogSpanVariable

Variable attached to a Model or ModelStream span for evaluation tracking.

## Overview

`LogSpanVariable` pairs a variable name with a content value. When attached to a [LogSpanModelContent](/docs/reference/sdk/v2/python/types/LogSpanModelContent) or `LogSpanModelStreamContent` span, the variable is available for continuous evaluations in Adaline.

```python theme={null}
from adaline_api.models.log_span_variable import LogSpanVariable
```

***

## Fields

<ParamField body="name" type="str" required>
  The variable name. 1–200 characters.
</ParamField>

<ParamField body="value" type="LogSpanVariableValue" required>
  The variable's content value. `LogSpanVariableValue` is a discriminated union (on `modality`) that wraps one of: `TextContent`, `ImageContent`, `PdfContent`, `ReasoningContent`, `ToolCallContent`, or `ToolResponseContent`.
</ParamField>

***

## LogSpanVariableValue

The `value` field accepts any content type supported by the Adaline message schema, wrapped in a `LogSpanVariableValue` union via `actual_instance`.

```python theme={null}
from adaline_api.models.log_span_variable_value import LogSpanVariableValue
```

| Content Type          | Modality          | Description                      |
| --------------------- | ----------------- | -------------------------------- |
| `TextContent`         | `"text"`          | Plain text content               |
| `ImageContent`        | `"image"`         | Image content (URL or base64)    |
| `PdfContent`          | `"pdf"`           | PDF document content             |
| `ReasoningContent`    | `"reasoning"`     | Model reasoning/chain-of-thought |
| `ToolCallContent`     | `"tool-call"`     | Tool invocation request          |
| `ToolResponseContent` | `"tool-response"` | Tool execution result            |

***

## Examples

### Text Variable

```python theme={null}
from adaline_api.models.log_span_variable import LogSpanVariable
from adaline_api.models.text_content import TextContent

variable = LogSpanVariable(
    name="user_question",
    value=TextContent(modality="text", value="What is quantum computing?")
)
```

### Image Variable

```python theme={null}
from adaline_api.models.log_span_variable import LogSpanVariable
from adaline_api.models.image_content import ImageContent
from adaline_api.models.image_content_value import ImageContentValue

variable = LogSpanVariable(
    name="uploaded_image",
    value=ImageContent(
        modality="image",
        detail="high",
        value=ImageContentValue.from_dict({
            "type": "url",
            "url": "https://example.com/image.jpg"
        })
    )
)
```

### Attaching to a Model Span

```python theme={null}
import json
from adaline_api.models.log_span_content import LogSpanContent
from adaline_api.models.log_span_model_content import LogSpanModelContent
from adaline_api.models.log_span_variable import LogSpanVariable
from adaline_api.models.text_content import TextContent

span.update({
    "status": "success",
    "content": LogSpanContent(
        actual_instance=LogSpanModelContent(
            type="Model",
            provider="openai",
            model="gpt-4o",
            input=json.dumps(params),
            output=json.dumps(response.model_dump()),
            variables=LogSpanVariable(
                name="user_question",
                value=TextContent(
                    modality="text",
                    value="Explain quantum computing simply."
                )
            ),
        )
    ),
})
```

***

## Serialization

```python theme={null}
from adaline_api.models.log_span_variable import LogSpanVariable
from adaline_api.models.text_content import TextContent

variable = LogSpanVariable(
    name="user_question",
    value=TextContent(modality="text", value="Hello")
)

d = variable.to_dict()
j = variable.to_json()

restored = LogSpanVariable.from_dict(d)
restored = LogSpanVariable.from_json(j)
```

***

## JSON Example

```json theme={null}
{
  "name": "user_question",
  "value": {
    "modality": "text",
    "value": "What is quantum computing?"
  }
}
```
