Class: OmniAI::Config
- Inherits:
-
Object
- Object
- OmniAI::Config
- Defined in:
- lib/omniai/config.rb
Overview
A configuration for each agent w/ ‘api_key` / `host` / `logger`.
Usage:
OmniAI::OpenAI.config do |config|
config.api_key = '...'
config.host = 'http://localhost:8080'
config.logger = Logger.new(STDOUT)
config.timeout = 15
config.chat_options = { ... }
config.transcribe_options = { ... }
config.speak_options = { ... }
end
Instance Attribute Summary collapse
- #api_key ⇒ String?
- #chat_options ⇒ Hash
- #host ⇒ String?
- #logger ⇒ Logger?
- #speak_options ⇒ Hash
- #timeout ⇒ Integer, ...
- #transcribe_options ⇒ Hash
Instance Method Summary collapse
-
#initialize(api_key: nil, host: nil, logger: nil, timeout: nil) ⇒ Config
constructor
A new instance of Config.
- #inspect ⇒ String
Constructor Details
#initialize(api_key: nil, host: nil, logger: nil, timeout: nil) ⇒ Config
Returns a new instance of Config.
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/omniai/config.rb', line 46 def initialize(api_key: nil, host: nil, logger: nil, timeout: nil) @api_key = api_key @host = host @logger = logger @timeout = timeout @chat_options = {} @transcribe_options = {} @speak_options = {} end |
Instance Attribute Details
#api_key ⇒ String?
19 20 21 |
# File 'lib/omniai/config.rb', line 19 def api_key @api_key end |
#chat_options ⇒ Hash
34 35 36 |
# File 'lib/omniai/config.rb', line 34 def @chat_options end |
#host ⇒ String?
22 23 24 |
# File 'lib/omniai/config.rb', line 22 def host @host end |
#logger ⇒ Logger?
25 26 27 |
# File 'lib/omniai/config.rb', line 25 def logger @logger end |
#speak_options ⇒ Hash
40 41 42 |
# File 'lib/omniai/config.rb', line 40 def @speak_options end |
#timeout ⇒ Integer, ...
31 32 33 |
# File 'lib/omniai/config.rb', line 31 def timeout @timeout end |
#transcribe_options ⇒ Hash
37 38 39 |
# File 'lib/omniai/config.rb', line 37 def @transcribe_options end |
Instance Method Details
#inspect ⇒ String
58 59 60 61 |
# File 'lib/omniai/config.rb', line 58 def inspect masked_api_key = "#{api_key[..2]}***" if api_key "#<#{self.class.name} api_key=#{masked_api_key.inspect} host=#{host.inspect}>" end |