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

#initialize, #rest_create_w_json_params, #rest_create_w_multipart_params, #rest_delete, #rest_get, #rest_get_streamed_download, #rest_index

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



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

def cancel(fine_tune_id:)
  rest_create_w_multipart_params(resource: [RESOURCE, 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
28
# File 'lib/asimov/api_v1/finetunes.rb', line 23

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

  rest_create_w_json_params(resource: RESOURCE,
                            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
  rest_index(resource: RESOURCE)
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



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

def list_events(fine_tune_id:)
  rest_index(resource: [RESOURCE, 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



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

def retrieve(fine_tune_id:)
  rest_get(resource: RESOURCE, id: fine_tune_id)
end