Translates SkillKit.Types message structs to Anthropic Messages API format.
Summary
Functions
Builds an ephemeral cache_control map for the given TTL.
Tags the last content block of the last encoded message with cache_control.
Wraps a system prompt string in a cached text-block list.
Encodes a list of native message structs into Anthropic API message format.
Encodes Tool structs into Anthropic tool format.
Functions
Builds an ephemeral cache_control map for the given TTL.
Tags the last content block of the last encoded message with cache_control.
Wraps a system prompt string in a cached text-block list.
@spec encode_messages([SkillKit.LLM.message()]) :: [map()]
Encodes a list of native message structs into Anthropic API message format.
Consecutive ToolResult messages are grouped into a single user message with tool_result content blocks, as required by the Anthropic API.
Encodes Tool structs into Anthropic tool format.