Class: Deepseek::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/deepseek/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



5
6
7
8
9
10
# File 'lib/deepseek/configuration.rb', line 5

def initialize
  @api_key = ENV['DEEPSEEK_API_KEY']
  @api_base_url = ENV['DEEPSEEK_API_BASE_URL'] || 'https://api.deepseek.com'
  @timeout = ENV['DEEPSEEK_TIMEOUT']&.to_i || 30
  @max_retries = ENV['DEEPSEEK_MAX_RETRIES']&.to_i || 3
end

Instance Attribute Details

#api_base_urlObject

Returns the value of attribute api_base_url.



3
4
5
# File 'lib/deepseek/configuration.rb', line 3

def api_base_url
  @api_base_url
end

#api_keyObject

Returns the value of attribute api_key.



3
4
5
# File 'lib/deepseek/configuration.rb', line 3

def api_key
  @api_key
end

#max_retriesObject

Returns the value of attribute max_retries.



3
4
5
# File 'lib/deepseek/configuration.rb', line 3

def max_retries
  @max_retries
end

#timeoutObject

Returns the value of attribute timeout.



3
4
5
# File 'lib/deepseek/configuration.rb', line 3

def timeout
  @timeout
end

Instance Method Details

#validate!Object

Raises:



12
13
14
# File 'lib/deepseek/configuration.rb', line 12

def validate!
  raise ConfigurationError, 'API key must be set' if api_key.nil? || api_key.to_s.strip.empty?
end