Skip to contents

Creates an embedding vector that represents the provided input. See this page for details.

Usage

create_embedding(
  engine_id = deprecated(),
  model,
  input,
  user = NULL,
  openai_api_key = Sys.getenv("OPENAI_API_KEY"),
  openai_organization = NULL
)

Arguments

engine_id

[Deprecated]

model

required; a length one character vector.

input

required; an arbitrary length character vector.

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.

Value

Returns a list, an element of which contains embedding vector(s) for a given input.

Details

For arguments description please refer to the official documentation.

Examples

if (FALSE) { # \dontrun{
create_embedding(
    model = "text-embedding-ada-002",
    input = c(
        "Ah, it is so boring to write documentation",
        "But examples are really crucial"
    )
)
} # }