Class: Durable::Llm::Providers::Anthropic::AnthropicChoice

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

Overview

Represents a single choice in an Anthropic messages response.

Anthropic typically returns only one choice, containing the assistant’s message.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ AnthropicChoice

Returns a new instance of AnthropicChoice.



293
294
295
296
# File 'lib/durable/llm/providers/anthropic.rb', line 293

def initialize(response)
  @message = AnthropicMessage.new(response)
  @stop_reason = response['stop_reason']
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



291
292
293
# File 'lib/durable/llm/providers/anthropic.rb', line 291

def message
  @message
end

#stop_reasonObject (readonly)

Returns the value of attribute stop_reason.



291
292
293
# File 'lib/durable/llm/providers/anthropic.rb', line 291

def stop_reason
  @stop_reason
end

Instance Method Details

#to_sObject



298
299
300
# File 'lib/durable/llm/providers/anthropic.rb', line 298

def to_s
  @message.to_s
end