NAME

LLM::API::Content

DESCRIPTION

Wraps the content array from an Anthropic Messages API response. A response can contain multiple content blocks of different types (for example a thinking block followed by a text block, when adaptive thinking is enabled) - this class does not assume the first block is the one you want.

METHODS

text

Returns the concatenated text of all text-type blocks. Empty string if there are none.

thinking

Returns the concatenated thinking content of all thinking-type blocks, joined by newlines. Empty string if there are none.

tool_uses

Returns an arrayref of all tool_use-type blocks, unmodified.

blocks

Returns the raw, unfiltered arrayref of content blocks as received from the API.

AUTHOR

Rob Lauer - <rlauer@treasurersbriefcase.com>