Class: Durable::Llm::Providers::Anthropic::AnthropicMessage

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ AnthropicMessage

Returns a new instance of AnthropicMessage.



118
119
120
121
# File 'lib/durable/llm/providers/anthropic.rb', line 118

def initialize(content)
  @role = [content].flatten.map { |_| _['type'] }.join(' ')
  @content = [content].flatten.map { |_| _['text'] }.join(' ')
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



116
117
118
# File 'lib/durable/llm/providers/anthropic.rb', line 116

def content
  @content
end

#roleObject (readonly)

Returns the value of attribute role.



116
117
118
# File 'lib/durable/llm/providers/anthropic.rb', line 116

def role
  @role
end

Instance Method Details

#to_sObject



123
124
125
# File 'lib/durable/llm/providers/anthropic.rb', line 123

def to_s
  @content
end