Class: Asimov::ApiV1::Finetunes

Inherits:
Base
  • Object
show all
Defined in:
lib/asimov/api_v1/finetunes.rb

Overview

Class interface for API methods in the “/fine-tunes” URI subspace.

Instance Method Summary collapse

Methods inherited from Base

#http_delete, #http_get, #http_streamed_download, #initialize, #json_post, #multipart_post

Constructor Details

This class inherits a constructor from Asimov::ApiV1::Base

Instance Method Details

#cancel(fine_tune_id:) ⇒ Object

Cancels the details of a fine-tuning job with the specified id.

Parameters:

  • fine_tune_id (String)

    the id of fine tuning job



43
44
45
# File 'lib/asimov/api_v1/finetunes.rb', line 43

def cancel(fine_tune_id:)
  multipart_post(path: "#{URI_PREFIX}/#{fine_tune_id}/cancel")
end

#create(training_file:, parameters: {}) ⇒ Object

Creates a new fine-tuning job with the specified parameters.

Parameters:

  • training_file (String)

    the id of the training file to use for fine tuning

  • parameters (Hash) (defaults to: {})

    the parameters passed with the fine tuning job

Raises:



23
24
25
26
27
# File 'lib/asimov/api_v1/finetunes.rb', line 23

def create(training_file:, parameters: {})
  raise MissingRequiredParameterError.new(:training_file) unless training_file

  json_post(path: URI_PREFIX, parameters: parameters.merge(training_file: training_file))
end

#listObject

Lists the set of fine-tuning jobs for this API key and (optionally) organization.



13
14
15
# File 'lib/asimov/api_v1/finetunes.rb', line 13

def list
  http_get(path: URI_PREFIX)
end

#list_events(fine_tune_id:) ⇒ Object

Lists the events associated with a fine-tuning job with the specified id.

Parameters:

  • fine_tune_id (String)

    the id of fine tuning job



52
53
54
# File 'lib/asimov/api_v1/finetunes.rb', line 52

def list_events(fine_tune_id:)
  http_get(path: "#{URI_PREFIX}/#{fine_tune_id}/events")
end

#retrieve(fine_tune_id:) ⇒ Object

Retrieves the details of a fine-tuning job with the specified id.

Parameters:

  • fine_tune_id (String)

    the id of fine tuning job



34
35
36
# File 'lib/asimov/api_v1/finetunes.rb', line 34

def retrieve(fine_tune_id:)
  http_get(path: "#{URI_PREFIX}/#{fine_tune_id}")
end