class

Smith::LLM::ContentBlock

Inherits JSON::Serializable < Reference < Object

Content block can represent text, tool calls, or tool results

Constructors

document(media_type : String, data : String, source : String | Nil = nil) : ContentBlock
Source
image(media_type : String, data : String, source : String | Nil = nil) : ContentBlock
Source
new(pull : JSON::PullParser)
Source
new(type : BlockType, text : String | Nil = nil, tool_call_id : String | Nil = nil, tool_name : String | Nil = nil, tool_args : JSON::Any | Nil = nil, is_error : Bool | Nil = nil, signature : String | Nil = nil, media_type : String | Nil = nil, data : String | Nil = nil, source : String | Nil = nil, media_ref : String | Nil = nil)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source
redacted_thinking(data : String) : ContentBlock

The content is encrypted, so it is carried through untouched and never shown.

Source
text(content : String) : ContentBlock
Source
thinking(content : String, signature : String | Nil = nil) : ContentBlock
Source
tool_result(id : String, result : String, is_error : Bool = false) : ContentBlock
Source
tool_use(id : String, name : String, args : JSON::Any) : ContentBlock
Source

Instance methods

data

The base64 payload, and the one field that must never be written anywhere. It is resent in full on every turn of the session, so a copy in session.json and a second copy in the raw transcript log would grow with each resume and be read by nobody. The session store puts the bytes in a file of their own and leaves media_ref behind to find them again; everything else that serializes a message gets the metadata and no blob.

Source
data=(data : String | Nil)

The base64 payload, and the one field that must never be written anywhere. It is resent in full on every turn of the session, so a copy in session.json and a second copy in the raw transcript log would grow with each resume and be read by nobody. The session store puts the bytes in a file of their own and leaves media_ref behind to find them again; everything else that serializes a message gets the metadata and no blob.

Source
is_error
Source
media?
Source
media_label

What to call it in a message meant for a human or for the model. The path if there was one, otherwise the media type — never nothing, because "an attachment was removed" without saying which is not information.

Source
media_ref
Source
media_ref=(media_ref : String | Nil)
Source
media_type

An attached image or PDF. media_type is what the bytes actually are, never what the file was called, and source is the name only so a renderer has something to print.

Source
signature

Anthropic's cryptographic signature over a thinking block. It must go back exactly as it came: never truncated, normalised or regenerated, or the next request is rejected. Defaulted in the declaration so sessions saved before thinking existed still deserialize.

Source
source
Source
text
Source
thinking?
Source
tool_args
Source
tool_call_id
Source
tool_name
Source
type
Source

Nested types