Class: LlmGateway::Adapters::OpenAI::FileOutputMapper

Inherits:
Object
  • Object
show all
Defined in:
lib/llm_gateway/adapters/openai/file_output_mapper.rb

Class Method Summary collapse

Class Method Details

.map(data) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/llm_gateway/adapters/openai/file_output_mapper.rb', line 7

def self.map(data)
  bytes = data.delete(:bytes)
  data.delete(:object) # Didnt see much value in this only option is "file"
  data.delete(:status) # Deprecated so no need to pull through
  data.delete(:status_details)  # Deprecated so no need to pull through
  created_at = data.delete(:created_at)
  time = Time.at(created_at, in: "UTC")
  iso_format = time.iso8601(6)
  data.merge(
    size_bytes: bytes,
    downloadable: data[:purpose] != "user_data",
    mime_type: nil,
    created_at: iso_format # Claude api format, easier for human reading so kept it this way
  )
end