OpenAI.completions

You're seeing just the function completions, go back to OpenAI module for more information.
Link to this function

completions(config, params)

View Source

It returns one or more predicted completions given a prompt. The function accepts as arguments the "engine_id" and the set of parameters used by the Completions OpenAI api

Example request

OpenAI.completions(
  model: "finetuned-model",
  prompt: "once upon a time",
  max_tokens: 5,
  temperature: 1,
  ...
)

Example response

{:ok, %{
  choices: [
    %{
      "finish_reason" => "length",
      "index" => 0,
      "logprobs" => nil,
      "text" => "" thing we are given"
    }
  ],
  created: 1617147958,
  id: "...",
  model: "...",
  object: "text_completion"
  }
}

See: https://platform.openai.com/docs/api-reference/completions/create

Link to this function

completions(config, engine_id, params)

View Source

It returns one or more predicted completions given a prompt. The function accepts as arguments the "engine_id" and the set of parameters used by the Completions OpenAI api

Example request

OpenAI.completions(
  "davinci", # engine_id
  prompt: "once upon a time",
  max_tokens: 5,
  temperature: 1,
  ...
)

Example response

{:ok, %{
  choices: [
    %{
      "finish_reason" => "length",
      "index" => 0,
      "logprobs" => nil,
      "text" => "" thing we are given"
    }
  ],
  created: 1617147958,
  id: "...",
  model: "...",
  object: "text_completion"
  }
}

See: https://beta.openai.com/docs/api-reference/completions/create for the complete list of parameters you can pass to the completions function