View Source ExOpenAI.Models (ex_openai.ex v1.5.1)

Modules for interacting with the models group of OpenAI APIs

API Reference: https://platform.openai.com/docs/api-reference/models

Summary

Functions

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

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

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

Functions

Link to this function

delete_model(model, opts \\ [])

View Source
@spec delete_model(String.t(),
  openai_organization_key: String.t(),
  openai_api_key: String.t()
) ::
  {:ok, ExOpenAI.Components.DeleteModelResponse.t()} | {:error, any()}

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

Endpoint: https://api.openai.com/v1/models/{model}

Method: DELETE

Docs: https://platform.openai.com/docs/api-reference/models


Required Arguments:

  • model

Example: ft:gpt-3.5-turbo:acemeco:suffix:abc123

Optional Arguments:

  • openai_api_key: OpenAI API key to pass directly. If this is specified, it will override the api_key config value.

  • openai_organization_key: OpenAI API key to pass directly. If this is specified, it will override the organization_key config value.

@spec list_models(openai_organization_key: String.t(), openai_api_key: String.t()) ::
  {:ok, ExOpenAI.Components.ListModelsResponse.t()} | {:error, any()}

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

Endpoint: https://api.openai.com/v1/models

Method: GET

Docs: https://platform.openai.com/docs/api-reference/models


Required Arguments:

Optional Arguments:

  • openai_api_key: OpenAI API key to pass directly. If this is specified, it will override the api_key config value.

  • openai_organization_key: OpenAI API key to pass directly. If this is specified, it will override the organization_key config value.

Link to this function

retrieve_model(model, opts \\ [])

View Source
@spec retrieve_model(String.t(),
  openai_organization_key: String.t(),
  openai_api_key: String.t()
) ::
  {:ok, ExOpenAI.Components.Model.t()} | {:error, any()}

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

Endpoint: https://api.openai.com/v1/models/{model}

Method: GET

Docs: https://platform.openai.com/docs/api-reference/models


Required Arguments:

  • model

Example: gpt-3.5-turbo

Optional Arguments:

  • openai_api_key: OpenAI API key to pass directly. If this is specified, it will override the api_key config value.

  • openai_organization_key: OpenAI API key to pass directly. If this is specified, it will override the organization_key config value.