Class: OpenAI::Resources::Audio::Speech
- Inherits:
-
Object
- Object
- OpenAI::Resources::Audio::Speech
- Defined in:
- lib/openai/resources/audio/speech.rb
Overview
Turn audio into text or text into audio.
Instance Method Summary collapse
-
#create(input:, model:, voice:, instructions: nil, response_format: nil, speed: nil, stream_format: nil, request_options: {}) ⇒ StringIO
Some parameter documentations has been truncated, see Models::Audio::SpeechCreateParams for more details.
-
#initialize(client:) ⇒ Speech
constructor
private
A new instance of Speech.
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.
51 52 53 |
# File 'lib/openai/resources/audio/speech.rb', line 51 def initialize(client:) @client = client end |
Instance Method Details
#create(input:, model:, voice:, instructions: nil, response_format: nil, speed: nil, stream_format: nil, request_options: {}) ⇒ StringIO
Some parameter documentations has been truncated, see Models::Audio::SpeechCreateParams for more details.
Generates audio from the input text.
Returns the audio file content, or a stream of audio events.
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/openai/resources/audio/speech.rb', line 36 def create(params) parsed, = OpenAI::Audio::SpeechCreateParams.dump_request(params) @client.request( method: :post, path: "audio/speech", headers: {"accept" => "application/octet-stream"}, body: parsed, model: StringIO, options: ) end |