Module: OmniAI::OpenAI::Chat::FileSerializer
- Defined in:
- lib/omniai/openai/chat/file_serializer.rb
Overview
Overrides file serialize / deserialize.
Class Method Summary collapse
Class Method Details
.serialize(file, direction:) ⇒ Hash
12 13 14 15 16 17 18 19 20 |
# File 'lib/omniai/openai/chat/file_serializer.rb', line 12 def self.serialize(file, direction:, **) type = file.image? ? "image" : "file" { type: "#{direction}_#{type}", "#{type}_data": file.data, filename: file.filename, } end |