Arcanum.Adapters.OpenAI (arcanum v0.1.10)

Copy Markdown View Source

Inference adapter for OpenAI-compatible APIs.

Handles wire protocol translation:

  • Request serialization (messages, tools, provider routing, multimodal content)
  • System role demotion at serialization time (profile-driven)
  • Response parsing (faithful field mapping)
  • Image generation via /images/generations
  • Retry on transient HTTP errors (429, 502, 503, 529)

Model-specific normalization (content fallback, XML tool-call extraction) is handled by Response.Normalizer in the Gateway layer.

Summary

Functions

Serializes content blocks to OpenAI wire format.

Functions

serialize_content(blocks)

Serializes content blocks to OpenAI wire format.

Text-only messages are sent as a plain string (single text block optimization). Mixed content is sent as an array of typed objects.