struct

Grafito::AI::Response

Inherits JSON::Serializable < Struct < Value < Object

Normalized AI response from any provider. Contains the generated content plus metadata.

Constructors

new(content : String, model : String, provider : String, usage : Usage | Nil = nil, raw : String | Nil = nil)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

content

The generated text content

Source
empty?

Check if this response contains meaningful content

Source
model

Model that generated this response

Source
provider

Provider identifier (e.g., "anthropic", "openai_compatible")

Source
raw

Optional raw response for debugging (not serialized by default)

Source
usage

Optional token usage statistics

Source