Class: ChatgptAssistant::AudioSynthesis

Inherits:
Object
  • Object
show all
Defined in:
lib/chatgpt_assistant/audio_synthesis.rb

Overview

This class is responsible for synthesize text to speech This class can work with IBM Cloud or AWS Polly for synthesize text into speech

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ AudioSynthesis

Returns a new instance of AudioSynthesis.



7
8
9
10
11
12
13
# File 'lib/chatgpt_assistant/audio_synthesis.rb', line 7

def initialize(config)
  @config = config
  @openai_api_key = config.openai_api_key
  @language = config.language
  @conn = faraday_instance
  classify_mode
end

Instance Method Details

#synthesize_text(text) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/chatgpt_assistant/audio_synthesis.rb', line 15

def synthesize_text(text)
  if ibm_mode?
    synthesize_text_ibm(text)
  elsif aws_mode?
    synthesize_text_aws(text)
  end
end