Skip to content

types

diapason.core.types

Canonical data types shared across all Diapason primitives.

Conversation dataclass

Ordered list of messages with an optional sliding-window cap.

add(message)

Append a message, trimming oldest if max_messages is set.

window(n)

Return the last n messages.

Message dataclass

A single chat message (OpenAI-compatible structure).

text property

Return message content as text, treating None as empty.

ModelSpec dataclass

Metadata describing a language model.

Quantization

Bases: str, Enum

Model quantization formats.

Role

Bases: str, Enum

Chat message roles (OpenAI-compatible).

RoutingContext dataclass

Context describing a query for model routing decisions.

StepType

Bases: str, Enum

Types of steps within an agent trace.

TelemetryRecord dataclass

Single telemetry observation recorded after an inference call.

ToolCall dataclass

A single tool invocation request embedded in an assistant message.

ToolResult dataclass

Result returned by a tool invocation.

Trace dataclass

Complete trace of an agent handling a query.

A trace captures the full sequence of steps an agent took to handle a query — which model was selected, what memory was retrieved, which tools were called, and the final response. Traces are the primary input to the learning system: by analyzing which decisions led to good outcomes, the system can improve routing, tool selection, and memory strategies.

add_step(step)

Append a step and update running totals.

TraceStep dataclass

A single step within an agent trace.

Each step records what the agent did (route, retrieve, generate, tool_call, respond), its inputs and outputs, and timing.