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 or LogSpanModelStreamContent span, the variable is available for continuous evaluations in Adaline.
from adaline_api.models.log_span_variable import LogSpanVariable
Fields
The variable name. 1–200 characters.
value
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.
LogSpanVariableValue
The value field accepts any content type supported by the Adaline message schema, wrapped in a LogSpanVariableValue union via actual_instance.
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
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
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
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
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
{
"name": "user_question",
"value": {
"modality": "text",
"value": "What is quantum computing?"
}
}