Class: OpenAI::Resources::Audio::Transcriptions
- Inherits:
-
Object
- Object
- OpenAI::Resources::Audio::Transcriptions
- Defined in:
- lib/openai/resources/audio/transcriptions.rb
Instance Method Summary collapse
-
#create(file: , model: , chunking_strategy: nil, include: nil, language: nil, prompt: nil, response_format: nil, temperature: nil, timestamp_granularities: nil, request_options: {}) ⇒ OpenAI::Models::Audio::Transcription, OpenAI::Models::Audio::TranscriptionVerbose
See #create_streaming for streaming counterpart.
-
#create_streaming(file: , model: , chunking_strategy: nil, include: nil, language: nil, prompt: nil, response_format: nil, temperature: nil, timestamp_granularities: nil, request_options: {}) ⇒ OpenAI::Internal::Stream<OpenAI::Models::Audio::TranscriptionTextDeltaEvent, OpenAI::Models::Audio::TranscriptionTextDoneEvent>
See #create for non-streaming counterpart.
-
#initialize(client:) ⇒ Transcriptions
constructor
private
A new instance of Transcriptions.
Constructor Details
#initialize(client:) ⇒ Transcriptions
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 Transcriptions.
110 111 112 |
# File 'lib/openai/resources/audio/transcriptions.rb', line 110 def initialize(client:) @client = client end |
Instance Method Details
#create(file: , model: , chunking_strategy: nil, include: nil, language: nil, prompt: nil, response_format: nil, temperature: nil, timestamp_granularities: nil, request_options: {}) ⇒ OpenAI::Models::Audio::Transcription, OpenAI::Models::Audio::TranscriptionVerbose
See #create_streaming for streaming counterpart.
Some parameter documentations has been truncated, see Models::Audio::TranscriptionCreateParams for more details.
Transcribes audio into the input language.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/openai/resources/audio/transcriptions.rb', line 40 def create(params) parsed, = OpenAI::Audio::TranscriptionCreateParams.dump_request(params) if parsed[:stream] = "Please use `#create_streaming` for the streaming use case." raise ArgumentError.new() end @client.request( method: :post, path: "audio/transcriptions", headers: {"content-type" => "multipart/form-data"}, body: parsed, model: OpenAI::Models::Audio::TranscriptionCreateResponse, options: ) end |
#create_streaming(file: , model: , chunking_strategy: nil, include: nil, language: nil, prompt: nil, response_format: nil, temperature: nil, timestamp_granularities: nil, request_options: {}) ⇒ OpenAI::Internal::Stream<OpenAI::Models::Audio::TranscriptionTextDeltaEvent, OpenAI::Models::Audio::TranscriptionTextDoneEvent>
See #create for non-streaming counterpart.
Some parameter documentations has been truncated, see Models::Audio::TranscriptionCreateParams for more details.
Transcribes audio into the input language.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/openai/resources/audio/transcriptions.rb', line 89 def create_streaming(params) parsed, = OpenAI::Audio::TranscriptionCreateParams.dump_request(params) unless parsed.fetch(:stream, true) = "Please use `#create` for the non-streaming use case." raise ArgumentError.new() end parsed.store(:stream, true) @client.request( method: :post, path: "audio/transcriptions", headers: {"content-type" => "multipart/form-data", "accept" => "text/event-stream"}, body: parsed, stream: OpenAI::Internal::Stream, model: OpenAI::Audio::TranscriptionStreamEvent, options: ) end |