Class: OpenAI::Resources::Audio::Translations

Inherits:
Object
  • Object
show all
Defined in:
lib/openai/resources/audio/translations.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Translations

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Translations.

Parameters:



44
45
46
# File 'lib/openai/resources/audio/translations.rb', line 44

def initialize(client:)
  @client = client
end

Instance Method Details

#create(file: , model: , prompt: nil, response_format: nil, temperature: nil, request_options: {}) ⇒ OpenAI::Models::Audio::Translation, OpenAI::Models::Audio::TranslationVerbose

Some parameter documentations has been truncated, see Models::Audio::TranslationCreateParams for more details.

Translates audio into English.

Parameters:

  • file (Pathname, StringIO, IO, String, OpenAI::FilePart)

    The audio file object (not file name) translate, in one of these formats: flac,

  • model (String, Symbol, OpenAI::Models::AudioModel)

    ID of the model to use. Only ‘whisper-1` (which is powered by our open source Wh

  • prompt (String)

    An optional text to guide the model’s style or continue a previous audio segment

  • response_format (Symbol, OpenAI::Models::Audio::TranslationCreateParams::ResponseFormat)

    The format of the output, in one of these options: ‘json`, `text`, `srt`, `verbo

  • temperature (Float)

    The sampling temperature, between 0 and 1. Higher values like 0.8 will make the

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/openai/resources/audio/translations.rb', line 29

def create(params)
  parsed, options = OpenAI::Audio::TranslationCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "audio/translations",
    headers: {"content-type" => "multipart/form-data"},
    body: parsed,
    model: OpenAI::Models::Audio::TranslationCreateResponse,
    options: options
  )
end