Class: LlmGateway::Adapters::OpenAI::ChatCompletions::BidirectionalMessageMapper
- Inherits:
-
Object
- Object
- LlmGateway::Adapters::OpenAI::ChatCompletions::BidirectionalMessageMapper
- Defined in:
- lib/llm_gateway/adapters/openai/chat_completions/bidirectional_message_mapper.rb
Direct Known Subclasses
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.
12 13 14 |
# File 'lib/llm_gateway/adapters/openai/chat_completions/bidirectional_message_mapper.rb', line 12 def initialize(direction) @direction = direction end |
Instance Attribute Details
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
10 11 12 |
# File 'lib/llm_gateway/adapters/openai/chat_completions/bidirectional_message_mapper.rb', line 10 def direction @direction end |
Instance Method Details
#map_content(content) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/llm_gateway/adapters/openai/chat_completions/bidirectional_message_mapper.rb', line 16 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 "function" map_tool_use_content(content) when "tool_result" map_tool_result_content(content) else content end end |