Class: Durable::Llm::Providers::Anthropic::AnthropicResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/durable/llm/providers/anthropic.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ AnthropicResponse

Returns a new instance of AnthropicResponse.



90
91
92
# File 'lib/durable/llm/providers/anthropic.rb', line 90

def initialize(response)
  @raw_response = response
end

Instance Attribute Details

#raw_responseObject (readonly)

Returns the value of attribute raw_response.



88
89
90
# File 'lib/durable/llm/providers/anthropic.rb', line 88

def raw_response
  @raw_response
end

Instance Method Details

#choicesObject



94
95
96
# File 'lib/durable/llm/providers/anthropic.rb', line 94

def choices
  [@raw_response['content']].map { |content| AnthropicChoice.new(content) }
end

#to_sObject



98
99
100
# File 'lib/durable/llm/providers/anthropic.rb', line 98

def to_s
  choices.map(&:to_s).join(' ')
end