Class: OpenAI::Resources::Audio::Speech

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Speech

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 Speech.

Parameters:



46
47
48
# File 'lib/openai/resources/audio/speech.rb', line 46

def initialize(client:)
  @client = client
end

Instance Method Details

#create(input: , model: , voice: , instructions: nil, response_format: nil, speed: nil, request_options: {}) ⇒ StringIO

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

Generates audio from the input text.

Parameters:

Returns:

  • (StringIO)

See Also:



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/openai/resources/audio/speech.rb', line 31

def create(params)
  parsed, options = OpenAI::Audio::SpeechCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "audio/speech",
    headers: {"accept" => "application/octet-stream"},
    body: parsed,
    model: StringIO,
    options: options
  )
end