Skip to main content

LogSpanContent

Types used for log span content, traces, and spans in the Python SDK.

TraceStatus

Valid status values for traces.

SpanStatus

Valid status values for spans.

LogSpanContent

All span content is wrapped in LogSpanContent using the actual_instance parameter. This is the discriminated union wrapper used by the Python SDK.
The actual_instance must be one of the 8 content types documented below.

Content Types

LogSpanModelContent

See the dedicated LogSpanModelContent page for full documentation. Standard LLM inference calls.

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. See input and output constraints.
output
str | None
The output payload as a JSON string. See input and output constraints.
variables
LogSpanVariable | None
Variables associated with this span.
cost
float | None
The cost of the operation. Minimum: 0.

input and output constraints

Both input and output must be valid, parseable JSON strings (i.e. the result of json.dumps()). Passing a plain string that isn’t valid JSON will cause the span to be rejected. For Model spans specifically, you get the most out of Adaline when you pass the exact request payload you send to your provider as input, and the full provider response object as output. When you do this with a supported provider (OpenAI, Anthropic, Google, etc.), Adaline automatically:
  • Calculates cost from token counts and the model’s pricing
  • Extracts token usage (prompt, completion, and total tokens)
  • Surfaces model metadata such as stop reason, tool calls, and function invocations
  • Powers continuous evaluations with structured input/output pairs
The recommended pattern is to build your request params as a dict, pass that dict to the provider SDK, and json.dumps() the same dict as input. For output, call json.dumps() on the full response (using .model_dump() for Pydantic-based SDKs). You can also set input and output to use Adaline’s own content schema, although this is more advanced and requires maintaining custom transformations to convert provider payloads into the Adaline format.
For a deeper walkthrough of this pattern and how it applies across providers, see Span content: input and output.

Examples

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.

LogSpanModelStreamContent

See the dedicated LogSpanModelStreamContent page for full documentation. Streaming LLM inference calls.

Fields

type
str
required
Must be "ModelStream".
provider
str
required
The provider name. 1–512 characters.
model
str
required
The model identifier. 1–512 characters.
input
str
required
The input payload as a JSON string.
output
str
required
Raw streamed output chunks.
aggregate_output
str
required
The aggregated final output as a JSON string.
cost
float | None
The cost of the operation. Minimum: 0.

Example


LogSpanEmbeddingsContent

See the dedicated LogSpanEmbeddingsContent page for full documentation. Embedding generation calls.

Fields

type
str
required
Must be "Embeddings".
input
str
required
The input payload as a JSON string.
output
str
required
The output payload as a JSON string.

Example


LogSpanFunctionContent

See the dedicated LogSpanFunctionContent page for full documentation. Custom application logic and function calls.

Fields

type
str
required
Must be "Function".
input
str
required
The input payload as a JSON string.
output
str
required
The output payload as a JSON string.

Example


LogSpanToolContent

See the dedicated LogSpanToolContent page for full documentation. Tool and API invocations.

Fields

type
str
required
Must be "Tool".
input
str
required
The input payload as a JSON string.
output
str
required
The output payload as a JSON string.

Example


LogSpanGuardrailContent

See the dedicated LogSpanGuardrailContent page for full documentation. Safety and compliance checks.

Fields

type
str
required
Must be "Guardrail".
input
str
required
The input payload as a JSON string.
output
str
required
The output payload as a JSON string.

Example


LogSpanRetrievalContent

See the dedicated LogSpanRetrievalContent page for full documentation. RAG and vector database queries.

Fields

type
str
required
Must be "Retrieval".
input
str
required
The input payload as a JSON string.
output
str
required
The output payload as a JSON string.

Example


LogSpanOtherContent

See the dedicated LogSpanOtherContent page for full documentation. Catch-all for any other operation type.

Fields

type
str
required
Must be "Other".
input
str
required
The input payload as a JSON string.
output
str
required
The output payload as a JSON string.

Example

Supporting Types

LogSpanVariable

See the dedicated LogSpanVariable page for full documentation. Variable attached to a Model or ModelStream span for evaluation tracking.

LogSpanVariableValue

Content value for a span variable. A discriminated union on modality — can be TextContent, ImageContent, PdfContent, ReasoningContent, ToolCallContent, or ToolResponseContent.

LogAttributesValue

See the dedicated LogAttributesValue page for full documentation. The allowed value types for trace/span attributes: str, int, float, or bool.
Used in Dict[str, LogAttributesValue] for the attributes parameter on traces and spans.

TraceStatus

See the dedicated TraceStatus page for full documentation. Allowed status values for a trace: "success", "failure", "aborted", "cancelled", "pending", "unknown".

SpanStatus

See the dedicated SpanStatus page for full documentation. Allowed status values for a span: "success", "failure", "aborted", "cancelled", "unknown".
Span status does not include "pending" — that value is only available for traces.