Skip to main content

LogSpanModelContent

Content type for standard LLM inference spans. All fields are optional.

Overview

LogSpanModelContent captures the input, output, and metadata of an LLM model call. It is wrapped in a LogSpanContent union via the actual_instance pattern. For the best observability experience, pass the raw provider request as input and the full provider response as output — Adaline will automatically extract cost, token usage, and model metadata.

Fields

type
str | None
Must be "Model" when provided.
provider
str | None
The provider name (e.g., "openai", "anthropic"). 1–512 characters.
model
str | None
The model identifier (e.g., "gpt-4o", "claude-sonnet-4-20250514"). 1–512 characters.
input
str | None
The input payload as a JSON string. Must be valid, parseable JSON (the result of json.dumps()).
output
str | None
The output payload as a JSON string. Must be valid, parseable JSON (the result of json.dumps()).
variables
LogSpanVariable | None
Variable associated with this span for evaluation tracking. See LogSpanVariable.
cost
float | None
Cost of inference in USD. Overrides the automatic cost calculated by Adaline. Minimum: 0.

Construction Pattern

All span content is wrapped in LogSpanContent using the actual_instance parameter:

input and output Best Practices

Both input and output must be valid JSON strings. For Model spans, you get the most out of Adaline when you pass the exact request payload as input and the full provider response as output. This enables Adaline to automatically:
  • Calculate cost from token counts and model pricing
  • Extract token usage (prompt, completion, and total tokens)
  • Surface metadata such as stop reason and tool calls
  • Power continuous evaluations with structured I/O
For a deeper walkthrough of this pattern across providers, see Span content: input and output.

Examples

With Variables

With Explicit Cost

Avoid cherry-picking or reshaping the request/response before serializing. Pass the raw objects — Adaline’s automatic parsing depends on seeing the provider’s native schema.

Serialization