Profile-driven post-processing of inference responses.
The adapter translates the wire format faithfully. This module applies model-specific normalization based on the profile:
- Content fallback from thinking (reasoning models with empty content)
- Malformed tool-call filtering (models that emit incomplete tool calls)
- XML text tool-call extraction (models that emit tool calls as text)
- Streaming delta normalization
All model-specific behavior lives here — not in the adapter.
Summary
Functions
Normalizes a complete (non-streaming) response based on the model profile.
Normalizes a streaming delta based on the model profile. Only applies content fallback (tool calls are extracted from the final merged response).
Functions
@spec normalize(Arcanum.Response.t(), Arcanum.ModelProfile.t()) :: Arcanum.Response.t()
Normalizes a complete (non-streaming) response based on the model profile.
@spec normalize_delta(Arcanum.Response.t(), Arcanum.ModelProfile.t()) :: Arcanum.Response.t()
Normalizes a streaming delta based on the model profile. Only applies content fallback (tool calls are extracted from the final merged response).