Class: OmniAI::OpenAI::Config
- Inherits:
-
Config
- Object
- Config
- OmniAI::OpenAI::Config
- Defined in:
- lib/omniai/openai/config.rb
Overview
Configuration for OpenAI.
Constant Summary collapse
- DEFAULT_HOST =
'https://api.openai.com'
Instance Attribute Summary collapse
-
#organization ⇒ String?
Passed as ‘OpenAI-Organization` if specified.
-
#project ⇒ String?
Passed as ‘OpenAI-Organization` if specified.
Instance Method Summary collapse
-
#initialize(api_key: ENV.fetch('OPENAI_API_KEY', nil), host: ENV.fetch('OPENAI_HOST', DEFAULT_HOST), organization: ENV.fetch('OPENAI_ORGANIZATION', nil), project: ENV.fetch('OPENAI_PROJECT', nil), logger: nil, timeout: nil) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(api_key: ENV.fetch('OPENAI_API_KEY', nil), host: ENV.fetch('OPENAI_HOST', DEFAULT_HOST), organization: ENV.fetch('OPENAI_ORGANIZATION', nil), project: ENV.fetch('OPENAI_PROJECT', nil), logger: nil, timeout: nil) ⇒ Config
Returns a new instance of Config.
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/omniai/openai/config.rb', line 23 def initialize( api_key: ENV.fetch('OPENAI_API_KEY', nil), host: ENV.fetch('OPENAI_HOST', DEFAULT_HOST), organization: ENV.fetch('OPENAI_ORGANIZATION', nil), project: ENV.fetch('OPENAI_PROJECT', nil), logger: nil, timeout: nil ) super(api_key:, host:, logger:, timeout:) @organization = organization @project = project end |
Instance Attribute Details
#organization ⇒ String?
Returns passed as ‘OpenAI-Organization` if specified.
11 12 13 |
# File 'lib/omniai/openai/config.rb', line 11 def organization @organization end |
#project ⇒ String?
Returns passed as ‘OpenAI-Organization` if specified.
15 16 17 |
# File 'lib/omniai/openai/config.rb', line 15 def project @project end |