Class: OpenAI::Resources::FineTuning::Jobs

Inherits:
Object
  • Object
show all
Defined in:
lib/openai/resources/fine_tuning/jobs.rb,
lib/openai/resources/fine_tuning/jobs/checkpoints.rb

Overview

Manage fine-tuning jobs to tailor a model to your specific training data.

Defined Under Namespace

Classes: Checkpoints

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Jobs

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Jobs.

Parameters:



218
219
220
221
# File 'lib/openai/resources/fine_tuning/jobs.rb', line 218

def initialize(client:)
  @client = client
  @checkpoints = OpenAI::Resources::FineTuning::Jobs::Checkpoints.new(client: client)
end

Instance Attribute Details

#checkpointsOpenAI::Resources::FineTuning::Jobs::Checkpoints (readonly)

Manage fine-tuning jobs to tailor a model to your specific training data.



10
11
12
# File 'lib/openai/resources/fine_tuning/jobs.rb', line 10

def checkpoints
  @checkpoints
end

Instance Method Details

#cancel(fine_tuning_job_id, request_options: {}) ⇒ OpenAI::Models::FineTuning::FineTuningJob

Some parameter documentations has been truncated, see Models::FineTuning::JobCancelParams for more details.

Immediately cancel a fine-tune job.

Parameters:

  • fine_tuning_job_id (String)

    The ID of the fine-tuning job to cancel.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



129
130
131
132
133
134
135
136
# File 'lib/openai/resources/fine_tuning/jobs.rb', line 129

def cancel(fine_tuning_job_id, params = {})
  @client.request(
    method: :post,
    path: ["fine_tuning/jobs/%1$s/cancel", fine_tuning_job_id],
    model: OpenAI::FineTuning::FineTuningJob,
    options: params[:request_options]
  )
end

#create(model:, training_file:, hyperparameters: nil, integrations: nil, metadata: nil, method_: nil, seed: nil, suffix: nil, validation_file: nil, request_options: {}) ⇒ OpenAI::Models::FineTuning::FineTuningJob

Some parameter documentations has been truncated, see Models::FineTuning::JobCreateParams for more details.

Creates a fine-tuning job which begins the process of creating a new model from a given dataset.

Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete.

[Learn more about fine-tuning](platform.openai.com/docs/guides/model-optimization)

Parameters:

Returns:

See Also:



48
49
50
51
52
53
54
55
56
57
# File 'lib/openai/resources/fine_tuning/jobs.rb', line 48

def create(params)
  parsed, options = OpenAI::FineTuning::JobCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "fine_tuning/jobs",
    body: parsed,
    model: OpenAI::FineTuning::FineTuningJob,
    options: options
  )
end

#list(after: nil, limit: nil, metadata: nil, request_options: {}) ⇒ OpenAI::Internal::CursorPage<OpenAI::Models::FineTuning::FineTuningJob>

Some parameter documentations has been truncated, see Models::FineTuning::JobListParams for more details.

List your organization’s fine-tuning jobs

Parameters:

  • after (String)

    Identifier for the last job from the previous pagination request.

  • limit (Integer)

    Number of fine-tuning jobs to retrieve.

  • metadata (Hash{Symbol=>String}, nil)

    Optional metadata filter. To filter, use the syntax ‘metadata=v`. Alternative

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/openai/resources/fine_tuning/jobs.rb', line 102

def list(params = {})
  parsed, options = OpenAI::FineTuning::JobListParams.dump_request(params)
  query = OpenAI::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "fine_tuning/jobs",
    query: query,
    page: OpenAI::Internal::CursorPage,
    model: OpenAI::FineTuning::FineTuningJob,
    options: options
  )
end

#list_events(fine_tuning_job_id, after: nil, limit: nil, request_options: {}) ⇒ OpenAI::Internal::CursorPage<OpenAI::Models::FineTuning::FineTuningJobEvent>

Some parameter documentations has been truncated, see Models::FineTuning::JobListEventsParams for more details.

Get status updates for a fine-tuning job.

Parameters:

  • fine_tuning_job_id (String)

    The ID of the fine-tuning job to get events for.

  • after (String)

    Identifier for the last event from the previous pagination request.

  • limit (Integer)

    Number of events to retrieve.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/openai/resources/fine_tuning/jobs.rb', line 156

def list_events(fine_tuning_job_id, params = {})
  parsed, options = OpenAI::FineTuning::JobListEventsParams.dump_request(params)
  query = OpenAI::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["fine_tuning/jobs/%1$s/events", fine_tuning_job_id],
    query: query,
    page: OpenAI::Internal::CursorPage,
    model: OpenAI::FineTuning::FineTuningJobEvent,
    options: options
  )
end

#pause(fine_tuning_job_id, request_options: {}) ⇒ OpenAI::Models::FineTuning::FineTuningJob

Some parameter documentations has been truncated, see Models::FineTuning::JobPauseParams for more details.

Pause a fine-tune job.

Parameters:

  • fine_tuning_job_id (String)

    The ID of the fine-tuning job to pause.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



183
184
185
186
187
188
189
190
# File 'lib/openai/resources/fine_tuning/jobs.rb', line 183

def pause(fine_tuning_job_id, params = {})
  @client.request(
    method: :post,
    path: ["fine_tuning/jobs/%1$s/pause", fine_tuning_job_id],
    model: OpenAI::FineTuning::FineTuningJob,
    options: params[:request_options]
  )
end

#resume(fine_tuning_job_id, request_options: {}) ⇒ OpenAI::Models::FineTuning::FineTuningJob

Some parameter documentations has been truncated, see Models::FineTuning::JobResumeParams for more details.

Resume a fine-tune job.

Parameters:

  • fine_tuning_job_id (String)

    The ID of the fine-tuning job to resume.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



206
207
208
209
210
211
212
213
# File 'lib/openai/resources/fine_tuning/jobs.rb', line 206

def resume(fine_tuning_job_id, params = {})
  @client.request(
    method: :post,
    path: ["fine_tuning/jobs/%1$s/resume", fine_tuning_job_id],
    model: OpenAI::FineTuning::FineTuningJob,
    options: params[:request_options]
  )
end

#retrieve(fine_tuning_job_id, request_options: {}) ⇒ OpenAI::Models::FineTuning::FineTuningJob

Some parameter documentations has been truncated, see Models::FineTuning::JobRetrieveParams for more details.

Get info about a fine-tuning job.

[Learn more about fine-tuning](platform.openai.com/docs/guides/model-optimization)

Parameters:

  • fine_tuning_job_id (String)

    The ID of the fine-tuning job.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



75
76
77
78
79
80
81
82
# File 'lib/openai/resources/fine_tuning/jobs.rb', line 75

def retrieve(fine_tuning_job_id, params = {})
  @client.request(
    method: :get,
    path: ["fine_tuning/jobs/%1$s", fine_tuning_job_id],
    model: OpenAI::FineTuning::FineTuningJob,
    options: params[:request_options]
  )
end