Normandy.Components.ContentBlock.Document
(normandy v0.6.0)
View Source
Represents a document content block inside a multimodal message.
Currently supports documents referenced by a Files-API file_id. Base64
and URL sources can be added later — the library's raw-list fallback in
the adapter already handles arbitrary pre-shaped block maps.
Cache control
An optional cache_control field carries an Anthropic prompt-cache
breakpoint annotation that the adapter ships verbatim on the wire.
Use with_cache/1 for the default ephemeral type, or with_cache/2
for a custom map (e.g. %{"type" => "ephemeral", "ttl" => "1h"}).
Atom keys are accepted and stringified at serialization time.
Summary
Functions
Builds a document block referencing a file uploaded via Anthropic's Files API.
Converts the block into the Anthropic/Claudio content-block map shape
(string keys). Includes cache_control only when set.
Annotates this block with an ephemeral cache breakpoint.
Annotates this block with a caller-supplied cache_control map.
Types
Functions
Builds a document block referencing a file uploaded via Anthropic's Files API.
Converts the block into the Anthropic/Claudio content-block map shape
(string keys). Includes cache_control only when set.
Raises ArgumentError on an incomplete struct (e.g. source: :file_id
with nil file_id). The constructor (new_file/1) enforces valid
state, so this only fires when a caller bypasses it.
Annotates this block with an ephemeral cache breakpoint.
Annotates this block with a caller-supplied cache_control map.
Atom keys are accepted; they are stringified when serialized.