Class: OmniAI::OpenAI::Files

Inherits:
Object
  • Object
show all
Defined in:
lib/omniai/openai/files.rb

Overview

An OpenAI scope for establishing files.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Files

Returns a new instance of Files.

Parameters:



8
9
10
# File 'lib/omniai/openai/files.rb', line 8

def initialize(client:)
  @client = client
end

Instance Method Details

#allArray<OmniAI::OpenAI::File>

Returns:

Raises:

  • (OmniAI::Error)


24
25
26
# File 'lib/omniai/openai/files.rb', line 24

def all
  File.all(client: @client)
end

#build(io: nil, purpose: File::Purpose::ASSISTANTS) ⇒ OmniAI::OpenAI::File

Parameters:

  • io (IO) (defaults to: nil)

    optional

  • purpose (String) (defaults to: File::Purpose::ASSISTANTS)

    optional

Returns:



39
40
41
# File 'lib/omniai/openai/files.rb', line 39

def build(io: nil, purpose: File::Purpose::ASSISTANTS)
  File.new(io:, purpose:, client: @client)
end

#destroy!(id:) ⇒ Object

Parameters:

  • id (String)

    required

Raises:

  • (OmniAI::Error)


31
32
33
# File 'lib/omniai/openai/files.rb', line 31

def destroy!(id:)
  File.destroy!(id:, client: @client)
end

#find(id:) ⇒ OmniAI::OpenAI::File

Parameters:

  • id (String)

    required

Returns:

Raises:

  • (OmniAI::Error)


17
18
19
# File 'lib/omniai/openai/files.rb', line 17

def find(id:)
  File.find(id:, client: @client)
end