Class: LlmGateway::Adapters::OpenAI::Responses::BidirectionalMessageMapper

Inherits:
ChatCompletions::BidirectionalMessageMapper show all
Defined in:
lib/llm_gateway/adapters/openai/responses/bidirectional_message_mapper.rb

Instance Attribute Summary

Attributes inherited from ChatCompletions::BidirectionalMessageMapper

#direction

Instance Method Summary collapse

Methods inherited from ChatCompletions::BidirectionalMessageMapper

#initialize

Constructor Details

This class inherits a constructor from LlmGateway::Adapters::OpenAI::ChatCompletions::BidirectionalMessageMapper

Instance Method Details

#map_content(content) ⇒ Object



10
11
12
13
14
15
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/responses/bidirectional_message_mapper.rb', line 10

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 "image"
    map_image_content(content)
  when "message"
    map_messages(content)
  when "output_text"
    map_output_text_content(content)
  when "tool_use"
    map_tool_use_content(content)
  when "function_call"
    map_tool_use_content(content)
  when "tool_result"
    map_tool_result_content(content)
  when "reasoning"
    map_reasoning_content(content)
  else
    content
  end
end