Class: OpenAI::Finetunes

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

Instance Method Summary collapse

Constructor Details

#initialize(access_token: nil, organization_id: nil) ⇒ Finetunes

Returns a new instance of Finetunes.



3
4
5
6
# File 'lib/openai/finetunes.rb', line 3

def initialize(access_token: nil, organization_id: nil)
  OpenAI.configuration.access_token = access_token if access_token
  OpenAI.configuration.organization_id = organization_id if organization_id
end

Instance Method Details

#cancel(id:) ⇒ Object



20
21
22
# File 'lib/openai/finetunes.rb', line 20

def cancel(id:)
  OpenAI::Client.multipart_post(path: "/fine-tunes/#{id}/cancel")
end

#create(parameters: {}) ⇒ Object



12
13
14
# File 'lib/openai/finetunes.rb', line 12

def create(parameters: {})
  OpenAI::Client.json_post(path: "/fine-tunes", parameters: parameters)
end

#delete(fine_tuned_model:) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/openai/finetunes.rb', line 28

def delete(fine_tuned_model:)
  if fine_tuned_model.start_with?("ft-")
    raise ArgumentError, "Please give a fine_tuned_model name, not a fine-tune ID"
  end

  OpenAI::Client.delete(path: "/models/#{fine_tuned_model}")
end

#events(id:) ⇒ Object



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

def events(id:)
  OpenAI::Client.get(path: "/fine-tunes/#{id}/events")
end

#listObject



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

def list
  OpenAI::Client.get(path: "/fine-tunes")
end

#retrieve(id:) ⇒ Object



16
17
18
# File 'lib/openai/finetunes.rb', line 16

def retrieve(id:)
  OpenAI::Client.get(path: "/fine-tunes/#{id}")
end