Class: BddOpenai::Mapper::File
- Inherits:
-
Object
- Object
- BddOpenai::Mapper::File
- Defined in:
- lib/bdd_openai/mappers/file.rb
Overview
The File object Ref: platform.openai.com/docs/api-reference/files/object
Instance Attribute Summary collapse
-
#bytes ⇒ Integer
The size of the file, in bytes.
-
#created_at ⇒ Integer
The Unix timestamp (in seconds) for when the file was created.
-
#filename ⇒ String
The name of the file.
-
#id ⇒ String
The file identifier, which can be referenced in the API endpoints.
-
#object ⇒ String
The object type, which is always “file”.
-
#purpose ⇒ String
The intended purpose of the file.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(**args) ⇒ File
constructor
A new instance of File.
Constructor Details
#initialize(**args) ⇒ File
Returns a new instance of File.
36 37 38 39 40 |
# File 'lib/bdd_openai/mappers/file.rb', line 36 def initialize(**args) args.each do |k, v| instance_variable_set("@#{k}", v) unless v.nil? end end |
Instance Attribute Details
#bytes ⇒ Integer
Returns The size of the file, in bytes.
13 14 15 |
# File 'lib/bdd_openai/mappers/file.rb', line 13 def bytes @bytes end |
#created_at ⇒ Integer
Returns The Unix timestamp (in seconds) for when the file was created.
15 16 17 |
# File 'lib/bdd_openai/mappers/file.rb', line 15 def created_at @created_at end |
#filename ⇒ String
Returns The name of the file.
17 18 19 |
# File 'lib/bdd_openai/mappers/file.rb', line 17 def filename @filename end |
#id ⇒ String
Returns The file identifier, which can be referenced in the API endpoints.
11 12 13 |
# File 'lib/bdd_openai/mappers/file.rb', line 11 def id @id end |
#object ⇒ String
Returns The object type, which is always “file”.
19 20 21 |
# File 'lib/bdd_openai/mappers/file.rb', line 19 def object @object end |
#purpose ⇒ String
Returns The intended purpose of the file. Supported values are \ “fine-tune”, “fine-tune-results”, “assistants”, and “assistants_output”.
22 23 24 |
# File 'lib/bdd_openai/mappers/file.rb', line 22 def purpose @purpose end |
Class Method Details
.from_json(json_string) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/bdd_openai/mappers/file.rb', line 24 def self.from_json(json_string) data = JSON.parse(json_string) new( id: data['id'], bytes: data['bytes'], created_at: data['created_at'], filename: data['filename'], object: data['object'], purpose: data['purpose'] ) end |