Sha256: d4215f845a3cd1d1769e0d1703e6658eeeb491acfd07a01dbffcbe26374d884d

Contents?: true

Size: 966 Bytes

Versions: 13

Compression:

Stored size: 966 Bytes

Contents

module OpenAI
  class Finetunes
    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

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

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

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

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

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

    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
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
ruby-openai-4.3.2 lib/openai/finetunes.rb
ruby-openai-4.3.1 lib/openai/finetunes.rb
ruby-openai-4.3.0 lib/openai/finetunes.rb
ruby-openai-4.2.0 lib/openai/finetunes.rb
ruby-advanced-openai-4.1.1 lib/openai/finetunes.rb
ruby-advanced-openai-4.1.0 lib/openai/finetunes.rb
ruby-openai-4.1.0 lib/openai/finetunes.rb
ruby-openai-4.0.0 lib/openai/finetunes.rb
ruby-openai-3.7.0 lib/openai/finetunes.rb
ruby-openai-3.6.0 lib/openai/finetunes.rb
ruby-openai-3.5.0 lib/openai/finetunes.rb
ruby-openai-3.4.0 lib/openai/finetunes.rb
ruby-openai-3.3.0 lib/openai/finetunes.rb