Class: LlmGateway::Adapters::Anthropic::InputMapper

Inherits:
Object
  • Object
show all
Defined in:
lib/llm_gateway/adapters/anthropic/input_mapper.rb

Class Method Summary collapse

Class Method Details

.map(data) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/llm_gateway/adapters/anthropic/input_mapper.rb', line 7

def self.map(data)
  {
    messages: map_messages(data[:messages]),
    tools: data[:tools],
    system: map_system(data[:system])
  }
end

.map_content(content) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/llm_gateway/adapters/anthropic/input_mapper.rb', line 15

def self.map_content(content)
  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