Class: ActiveIntelligence::ASR::OpenAIAdapter

Inherits:
Adapter show all
Includes:
Concerns::OpenAI
Defined in:
lib/active_intelligence/asr/openai_adapter.rb

Instance Attribute Summary

Attributes inherited from ActiveIntelligence::Adapter

#settings

Instance Method Summary collapse

Methods inherited from Adapter

#logger

Methods inherited from ActiveIntelligence::Adapter

#initialize

Constructor Details

This class inherits a constructor from ActiveIntelligence::Adapter

Instance Method Details

#transcribe(path, options = {}) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/active_intelligence/asr/openai_adapter.rb', line 10

def transcribe(path, options = {})
  parameters = default_parameters.merge(options)
  parameters[:file] = File.open(path, 'rb')

  response = client.audio.transcribe(parameters:)
  return response['text']
end