Class: OpenAI::Models::Upload

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

Overview

See Also:

  • OpenAI::Resources::Uploads#create

Defined Under Namespace

Modules: Status

Instance Attribute Summary collapse

Attributes inherited from Internal::Type::BaseModel

#last_response

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:, expires_at:, filename:, purpose:, status:, file: nil, object: :upload) ⇒ Upload

Returns a new instance of Upload.

Parameters:

  • id —

    The Upload unique identifier, which can be referenced in API endpoints.

  • bytes —

    The intended number of bytes to be uploaded.

  • created_at —

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

  • expires_at —

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

  • filename —

    The name of the file to be uploaded.

  • purpose —

    The intended purpose of the file. Please refer here for acceptable values.

  • status —

    The status of the Upload.

  • file (defaults to: nil) —

    The File object represents a document that has been uploaded to OpenAI.

  • object (defaults to: :upload) —

    The object type, which is always "upload".

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


# File 'lib/openai/models/upload.rb', line 63

Instance Attribute Details

#bytes ⇒ Integer

The intended number of bytes to be uploaded.

Returns:

  • (Integer)


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

required :bytes, Integer

#created_at ⇒ Integer

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

Returns:

  • (Integer)


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

required :created_at, Integer

#expires_at ⇒ Integer

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

Returns:

  • (Integer)


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

required :expires_at, Integer

#file ⇒ OpenAI::FileObject?

The File object represents a document that has been uploaded to OpenAI.

Returns:



61
# File 'lib/openai/models/upload.rb', line 61

optional :file, -> { OpenAI::FileObject }, nil?: true

#filename ⇒ String

The name of the file to be uploaded.

Returns:

  • (String)


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

required :filename, String

#id ⇒ String

The Upload unique identifier, which can be referenced in API endpoints.

Returns:

  • (String)


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

required :id, String

#object ⇒ :upload

The object type, which is always "upload".

Returns:

  • (:upload)


41
# File 'lib/openai/models/upload.rb', line 41

required :object, const: :upload

#purpose ⇒ String

The intended purpose of the file. Please refer here for acceptable values.

Returns:

  • (String)


49
# File 'lib/openai/models/upload.rb', line 49

required :purpose, String

#status ⇒ OpenAI::Models::Upload::status

The status of the Upload.

Returns:

  • (OpenAI::Models::Upload::status)


55
# File 'lib/openai/models/upload.rb', line 55

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

Instance Method Details

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

Returns:

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


78
79
80
81
82
83
84
85
86
87
88
# File 'sig/openai/models/upload.rbs', line 78

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