Arcanum.Response.Normalizer (arcanum v0.1.0)

Copy Markdown View Source

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

normalize(response, profile)

Normalizes a complete (non-streaming) response based on the model profile.

normalize_delta(delta, profile)

Normalizes a streaming delta based on the model profile. Only applies content fallback (tool calls are extracted from the final merged response).