One block of content in a message. A reply from Claude is a list of
these — usually just text, sometimes thinking or a tool call mixed in.
decode/1 reads a block's "type" field and returns the matching
struct.
Summary
Functions
Decodes one content block. Falls back to Claudex.ContentBlock.Unknown
for a block type not modeled yet, so a new block type from the API never
breaks decoding — it just arrives un-typed.
Turns a decoded block back into the map the API expects in a request, so a reply can be sent straight back as conversation history.
Types
Functions
Decodes one content block. Falls back to Claudex.ContentBlock.Unknown
for a block type not modeled yet, so a new block type from the API never
breaks decoding — it just arrives un-typed.
Turns a decoded block back into the map the API expects in a request, so a reply can be sent straight back as conversation history.
A map is passed through untouched, so hand-written blocks keep working.