Class: OpenAI::Models::FileObject

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/openai/models/file_object.rb,
sig/openai/models/file_object.rbs

Overview

See Also:

  • OpenAI::Resources::Files#create

Defined Under Namespace

Modules: Purpose, Status

Instance Attribute Summary collapse

Attributes inherited from Internal::Type::BaseModel

#last_response

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], #_request_id, #_set_last_response, coerce, #deconstruct_keys, #deep_to_h, dump, #encode_with, fields, hash, #hash, inherited, #inspect, inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, coerce_cached, coerce_with_error, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, resolve_type, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(id:, bytes:, created_at:, filename:, purpose:, status:, expires_at: nil, status_details: nil, object: :file) ⇒ FileObject

Returns a new instance of FileObject.

Parameters:

  • id —

    The file identifier, which can be referenced in the API endpoints.

  • bytes —

    The size of the file, in bytes.

  • created_at —

    The Unix timestamp (in seconds) for when the file was created.

  • filename —

    The name of the file.

  • purpose —

    The intended purpose of the file. Supported values are assistants, assistants_output, batch, batch_output, fine-tune, fine-tune-results, vision, and user_data.

  • status —

    Deprecated. The current status of the file, which can be either uploaded, processed, or error.

  • expires_at (defaults to: nil) —

    The Unix timestamp (in seconds) for when the file will expire.

  • status_details (defaults to: nil) —

    Deprecated. For details on why a fine-tuning training file failed validation, see the error field on fine_tuning.job.

  • object (defaults to: :file) —

    The object type, which is always file.

  • id: (String)
  • bytes: (Integer)
  • created_at: (Integer)
  • filename: (String)
  • purpose: (OpenAI::Models::FileObject::purpose)
  • status: (OpenAI::Models::FileObject::status)
  • expires_at: (Integer) (defaults to: nil)
  • status_details: (String) (defaults to: nil)
  • object: (:file) (defaults to: :file)


# File 'lib/openai/models/file_object.rb', line 69

Instance Attribute Details

#bytes ⇒ Integer

The size of the file, in bytes.

Returns:

  • (Integer)


17
# File 'lib/openai/models/file_object.rb', line 17

required :bytes, Integer

#created_at ⇒ Integer

The Unix timestamp (in seconds) for when the file was created.

Returns:

  • (Integer)


23
# File 'lib/openai/models/file_object.rb', line 23

required :created_at, Integer

#expires_at ⇒ Integer?

The Unix timestamp (in seconds) for when the file will expire.

Returns:

  • (Integer, nil)


58
# File 'lib/openai/models/file_object.rb', line 58

optional :expires_at, Integer

#filename ⇒ String

The name of the file.

Returns:

  • (String)


29
# File 'lib/openai/models/file_object.rb', line 29

required :filename, String

#id ⇒ String

The file identifier, which can be referenced in the API endpoints.

Returns:

  • (String)


11
# File 'lib/openai/models/file_object.rb', line 11

required :id, String

#object ⇒ :file

The object type, which is always file.

Returns:

  • (:file)


35
# File 'lib/openai/models/file_object.rb', line 35

required :object, const: :file

#purpose ⇒ OpenAI::Models::FileObject::purpose

The intended purpose of the file. Supported values are assistants, assistants_output, batch, batch_output, fine-tune, fine-tune-results, vision, and user_data.

Returns:

  • (OpenAI::Models::FileObject::purpose)


43
# File 'lib/openai/models/file_object.rb', line 43

required :purpose, enum: -> { OpenAI::FileObject::Purpose }

#status ⇒ OpenAI::Models::FileObject::status

Deprecated. The current status of the file, which can be either uploaded, processed, or error.

Returns:

  • (OpenAI::Models::FileObject::status)


52
# File 'lib/openai/models/file_object.rb', line 52

required :status, enum: -> { OpenAI::FileObject::Status }

#status_details ⇒ String?

Deprecated. For details on why a fine-tuning training file failed validation, see the error field on fine_tuning.job.

Returns:

  • (String, nil)


67
# File 'lib/openai/models/file_object.rb', line 67

optional :status_details, String

Class Method Details

.values ⇒ Array<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/openai/models/file_object.rb', line 120

Instance Method Details

#to_hash ⇒ { id: String, bytes: Integer, created_at: Integer, filename: String, ?object: :file, purpose: OpenAI::Models::FileObject::purpose, status: OpenAI::Models::FileObject::status, ?expires_at: Integer, ?status_details: String }

Returns:

  • ({ id: String, bytes: Integer, created_at: Integer, filename: String, ?object: :file, purpose: OpenAI::Models::FileObject::purpose, status: OpenAI::Models::FileObject::status, ?expires_at: Integer, ?status_details: String })


89
90
91
92
93
94
95
96
97
98
99
# File 'sig/openai/models/file_object.rbs', line 89

def to_hash: -> {
  id: String,
  bytes: Integer,
  created_at: Integer,
  filename: String,
  ?object: :file,
  purpose: OpenAI::Models::FileObject::purpose,
  status: OpenAI::Models::FileObject::status,
  ?expires_at: Integer,
  ?status_details: String
}