create_translation {openai}R Documentation

Create translation

Description

Translates audio into into English. See this page for details.

Usage

create_translation(
  file,
  model,
  prompt = NULL,
  response_format = "json",
  temperature = 0,
  openai_api_key = Sys.getenv("OPENAI_API_KEY"),
  openai_organization = NULL
)

Arguments

file

required; a length one character vector.

model

required; a length one character vector.

prompt

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

response_format

required; defaults to "json"; length one character vector equals to "json". Currently only "json" is implemented.

temperature

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

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.

Value

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

See Also

Other audio functions: create_transcription()

Examples

## Not run: 
voice_sample_ua <- system.file(
    "extdata", "sample-ua.m4a", package = "openai"
)
create_translation(file = voice_sample_ua, model = "whisper-1")

## End(Not run)

[Package openai version 0.4.1 Index]