Class: Durable::Llm::Providers::Anthropic::AnthropicMessage
- Inherits:
-
Object
- Object
- Durable::Llm::Providers::Anthropic::AnthropicMessage
- Defined in:
- lib/durable/llm/providers/anthropic.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
Instance Method Summary collapse
-
#initialize(content) ⇒ AnthropicMessage
constructor
A new instance of AnthropicMessage.
- #to_s ⇒ Object
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
#content ⇒ Object (readonly)
Returns the value of attribute content.
116 117 118 |
# File 'lib/durable/llm/providers/anthropic.rb', line 116 def content @content end |
#role ⇒ Object (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_s ⇒ Object
123 124 125 |
# File 'lib/durable/llm/providers/anthropic.rb', line 123 def to_s @content end |