struct

Anthropic::Messages::Response

Inherits Struct < Value < Object

Constructors

new(id : String, type : String, role : String, content : Array(ResponseContentBlock), model : String, stop_reason : StopReason | Nil, stop_sequence : String | Nil, usage : Usage)
Source
new(pull : JSON::PullParser) : Response
Source

Instance methods

content
Source
model
Source
request_id

Request ID extracted from HTTP response headers (not part of JSON body). Set by Messages::API after parsing the response.

Source
request_id=(request_id : String | Nil)

Request ID extracted from HTTP response headers (not part of JSON body). Set by Messages::API after parsing the response.

Source
role
Source
role_enum

Returns a typed enum for the role if it's a known value. Returns nil for unknown/future role values (forward compatibility). Case-insensitive: handles "assistant", "Assistant", etc.

Source
stop_reason
Source
stop_sequence
Source
text
Source
to_json(json : JSON::Builder) : Nil
Source
tool_use_blocks
Source
type
Source
usage
Source

Nested types