Class: Durable::Llm::Providers::Anthropic::AnthropicResponse
- Inherits:
-
Object
- Object
- Durable::Llm::Providers::Anthropic::AnthropicResponse
- Defined in:
- lib/durable/llm/providers/anthropic.rb
Overview
Response object for Anthropic messages API responses.
This class wraps the raw response from Anthropic’s messages endpoint and provides a consistent interface for accessing content and metadata.
Instance Attribute Summary collapse
-
#raw_response ⇒ Object
readonly
Returns the value of attribute raw_response.
Instance Method Summary collapse
- #choices ⇒ Object
-
#initialize(response) ⇒ AnthropicResponse
constructor
A new instance of AnthropicResponse.
- #to_s ⇒ Object
- #usage ⇒ Object
Constructor Details
#initialize(response) ⇒ AnthropicResponse
270 271 272 |
# File 'lib/durable/llm/providers/anthropic.rb', line 270 def initialize(response) @raw_response = response end |
Instance Attribute Details
#raw_response ⇒ Object (readonly)
Returns the value of attribute raw_response.
268 269 270 |
# File 'lib/durable/llm/providers/anthropic.rb', line 268 def raw_response @raw_response end |
Instance Method Details
#choices ⇒ Object
274 275 276 |
# File 'lib/durable/llm/providers/anthropic.rb', line 274 def choices [AnthropicChoice.new(@raw_response)] end |
#to_s ⇒ Object
282 283 284 |
# File 'lib/durable/llm/providers/anthropic.rb', line 282 def to_s choices.map(&:to_s).join(' ') end |
#usage ⇒ Object
278 279 280 |
# File 'lib/durable/llm/providers/anthropic.rb', line 278 def usage @raw_response['usage'] end |