Class: LlmGateway::Adapters::Anthropic::BidirectionalMessageMapper
- Inherits:
-
Object
- Object
- LlmGateway::Adapters::Anthropic::BidirectionalMessageMapper
- Defined in:
- lib/llm_gateway/adapters/anthropic/bidirectional_message_mapper.rb
Instance Attribute Summary collapse
-
#direction ⇒ Object
readonly
Returns the value of attribute direction.
Instance Method Summary collapse
-
#initialize(direction) ⇒ BidirectionalMessageMapper
constructor
A new instance of BidirectionalMessageMapper.
- #map_content(content) ⇒ Object
Constructor Details
#initialize(direction) ⇒ BidirectionalMessageMapper
Returns a new instance of BidirectionalMessageMapper.
9 10 11 |
# File 'lib/llm_gateway/adapters/anthropic/bidirectional_message_mapper.rb', line 9 def initialize(direction) @direction = direction end |
Instance Attribute Details
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
7 8 9 |
# File 'lib/llm_gateway/adapters/anthropic/bidirectional_message_mapper.rb', line 7 def direction @direction end |
Instance Method Details
#map_content(content) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/llm_gateway/adapters/anthropic/bidirectional_message_mapper.rb', line 13 def map_content(content) # Convert string content to text format content = { type: "text", text: content } unless content.is_a?(Hash) case content[:type] when "text" map_text_content(content) when "file" map_file_content(content) when "image" map_image_content(content) when "tool_use" map_tool_use_content(content) when "tool_result" map_tool_result_content(content) when "thinking", "reasoning" map_reasoning_content(content) else content end end |