Class: OpenAI::Configuration

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

Constant Summary collapse

DEFAULT_API_VERSION =
"v1".freeze
DEFAULT_URI_BASE =
"https://api.openai.com/".freeze
DEFAULT_REQUEST_TIMEOUT =
120

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



47
48
49
50
51
52
53
54
55
# File 'lib/openai.rb', line 47

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

Instance Attribute Details

#access_tokenObject

Raises:



57
58
59
60
61
62
# File 'lib/openai.rb', line 57

def access_token
  return @access_token if @access_token

  error_text = "OpenAI access token missing! See https://github.com/alexrudall/ruby-openai#usage"
  raise ConfigurationError, error_text
end

#api_typeObject

Returns the value of attribute api_type.



40
41
42
# File 'lib/openai.rb', line 40

def api_type
  @api_type
end

#api_versionObject

Returns the value of attribute api_version.



40
41
42
# File 'lib/openai.rb', line 40

def api_version
  @api_version
end

#extra_headersObject

Returns the value of attribute extra_headers.



40
41
42
# File 'lib/openai.rb', line 40

def extra_headers
  @extra_headers
end

#organization_idObject

Returns the value of attribute organization_id.



40
41
42
# File 'lib/openai.rb', line 40

def organization_id
  @organization_id
end

#request_timeoutObject

Returns the value of attribute request_timeout.



40
41
42
# File 'lib/openai.rb', line 40

def request_timeout
  @request_timeout
end

#uri_baseObject

Returns the value of attribute uri_base.



40
41
42
# File 'lib/openai.rb', line 40

def uri_base
  @uri_base
end