Class: Anthropic::Configuration

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

Constant Summary collapse

DEFAULT_API_VERSION =
"v1".freeze
DEFAULT_ANTHROPIC_VERSION =
"2023-06-01".freeze
DEFAULT_URI_BASE =
"https://api.anthropic.com/".freeze
DEFAULT_REQUEST_TIMEOUT =
120

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



38
39
40
41
42
43
44
45
# File 'lib/anthropic.rb', line 38

def initialize
  @access_token = nil
  @api_version = DEFAULT_API_VERSION
  @anthropic_version = DEFAULT_ANTHROPIC_VERSION
  @uri_base = DEFAULT_URI_BASE
  @request_timeout = DEFAULT_REQUEST_TIMEOUT
  @extra_headers = {}
end

Instance Attribute Details

#access_tokenObject

Raises:



47
48
49
50
51
52
# File 'lib/anthropic.rb', line 47

def access_token
  return @access_token if @access_token

  error_text = "Anthropic access token missing! See https://github.com/alexrudall/anthropic#usage"
  raise ConfigurationError, error_text
end

#anthropic_versionObject

Returns the value of attribute anthropic_version.



30
31
32
# File 'lib/anthropic.rb', line 30

def anthropic_version
  @anthropic_version
end

#api_versionObject

Returns the value of attribute api_version.



30
31
32
# File 'lib/anthropic.rb', line 30

def api_version
  @api_version
end

#extra_headersObject

Returns the value of attribute extra_headers.



30
31
32
# File 'lib/anthropic.rb', line 30

def extra_headers
  @extra_headers
end

#request_timeoutObject

Returns the value of attribute request_timeout.



30
31
32
# File 'lib/anthropic.rb', line 30

def request_timeout
  @request_timeout
end

#uri_baseObject

Returns the value of attribute uri_base.



30
31
32
# File 'lib/anthropic.rb', line 30

def uri_base
  @uri_base
end