Class: OpenAI::Resources::Models

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Models

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 Models.

Parameters:



71
72
73
# File 'lib/openai/resources/models.rb', line 71

def initialize(client:)
  @client = client
end

Instance Method Details

#delete(model, request_options: {}) ⇒ OpenAI::Models::ModelDeleted

Delete a fine-tuned model. You must have the Owner role in your organization to delete a model.

Parameters:

Returns:

See Also:



59
60
61
62
63
64
65
66
# File 'lib/openai/resources/models.rb', line 59

def delete(model, params = {})
  @client.request(
    method: :delete,
    path: ["models/%1$s", model],
    model: OpenAI::ModelDeleted,
    options: params[:request_options]
  )
end

#list(request_options: {}) ⇒ OpenAI::Internal::Page<OpenAI::Models::Model>

Lists the currently available models, and provides basic information about each one such as the owner and availability.

Parameters:

Returns:

See Also:



37
38
39
40
41
42
43
44
45
# File 'lib/openai/resources/models.rb', line 37

def list(params = {})
  @client.request(
    method: :get,
    path: "models",
    page: OpenAI::Internal::Page,
    model: OpenAI::Model,
    options: params[:request_options]
  )
end

#retrieve(model, request_options: {}) ⇒ OpenAI::Models::Model

Retrieves a model instance, providing basic information about the model such as the owner and permissioning.

Parameters:

  • model (String)

    The ID of the model to use for this request

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

Returns:

See Also:



18
19
20
21
22
23
24
25
# File 'lib/openai/resources/models.rb', line 18

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