Learn R Programming

openai (version 0.2.0)

create_classification: Create classification

Description

[Deprecated]

Note: This endpoint is deprecated and will be removed on December 3, 2022. Please see Classifications Transition Guide for details.

Classifies the query based on the provided examples. See this page for details.

Usage

create_classification(
  model = c("ada", "babbage", "curie", "davinci"),
  query,
  examples = NULL,
  file = NULL,
  labels = NULL,
  search_model = c("ada", "babbage", "curie", "davinci"),
  temperature = 0,
  logprobs = NULL,
  max_examples = 200,
  logit_bias = NULL,
  return_prompt = FALSE,
  return_metadata = FALSE,
  expand = NULL,
  user = NULL,
  openai_api_key = Sys.getenv("OPENAI_API_KEY"),
  openai_organization = NULL
)

Value

Returns a list, elements of which contain label and other supplementary information.

Arguments

model

required; defaults to "ada"; a length one character vector, one among "ada", "babbage", "curie", and "davinci".

query

required; a length one character vector.

examples

optional; defaults to NULL; a list. A list of examples with labels, in the following format: list(c("The movie is so interesting.", "Positive"), c("It is quite boring.", "Negative"), ...).

file

optional; defaults to NULL; a length one character vector.

labels

optional; defaults to NULL; an arbitrary length character vector.

search_model

required; defaults to ada; a length one character vector, one among "ada", "babbage", "curie", and "davinci".

temperature

required; defaults to 0; a length one numeric vector with the value between 0 and 2.

logprobs

optional; defaults to NULL; a length one numeric vector with the integer value between 0 and 5.

max_examples

required; defaults to 200; a length one numeric vector with the integer value greater than 0.

logit_bias

optional; defaults to NULL; a named list.

return_prompt

required; defaults to FALSE; a length one logical vector.

return_metadata

required; defaults to FALSE; a length one logical vector.

expand

optional; defaults to NULL; a list elements of which are among completion and file.

user

optional; defaults to NULL; a length one character vector.

openai_api_key

required; defaults to Sys.getenv("OPENAI_API_KEY") (i.e., the value is retrieved from the .Renviron file); a length one character vector. Specifies OpenAI API key.

openai_organization

optional; defaults to NULL; a length one character vector. Specifies OpenAI organization.

Details

For arguments description please refer to the official documentation.

Examples

Run this code
if (FALSE) {
create_classification(
    search_model = "ada",
    model = "curie",
    examples = list(
        c("A happy moment", "Positive"),
        c("I am sad.", "Negative"),
        c("I am feeling awesome", "Positive")
    ),
    query = "I'm ok",
    labels = c("Positive", "Negative", "Neutral")
)
}

Run the code above in your browser using DataLab