Method: WordSmith::Services::OpenAI#initialize
- Defined in:
- lib/services/open_a_i.rb
#initialize ⇒ OpenAI
Returns a new instance of OpenAI.
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/services/open_a_i.rb', line 51 def initialize raise OpenAIKeyNotSetError if OpenAI.api_key.nil? raise OpenAIOrgIDNotSetError if OpenAI.org_id.nil? ::OpenAI.configure do |config| config.access_token = OpenAI.api_key config.organization_id = OpenAI.org_id config.log_errors = Config::DEBUG_MODE end @client = ::OpenAI::Client.new end |