struct

Smith::LLM::Message

Inherits JSON::Serializable < Struct < Value < Object

Constructors

assistant(text : String) : Message
Source
assistant_with_blocks(blocks : Array(ContentBlock)) : Message
Source
new(role : Role, content : Array(ContentBlock), synthetic : Bool = false, id : String = Message.new_id)
Source
new(pull : JSON::PullParser)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source
tool_results(results : Array(ContentBlock)) : Message
Source
user(text : String, synthetic : Bool = false) : Message
Source

Class methods

new_id
Source

Instance methods

content
Source
id

Identity, so anything that wants to point at a message can survive compaction moving it. A position cannot: replacing a prefix with a summary shifts every index behind it, and whoever stored one has to be told. Nothing outside smith ever sees this — every provider builds its request from the role and the blocks.

Random per message rather than a counter: a fork copies a transcript, and two sessions handing out the same numbers would collide. Defaulted so messages saved before ids existed load and get one.

Source
role
Source
synthetic?

True for a user message the agent wrote, not the user: the stop-hook continuation and the output-limit continuation. Anything reasoning about turn boundaries has to skip these — three of them can sit inside a single real turn. Defaulted so sessions saved before the flag existed load.

Source