Class: Groq::Configuration

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

Defined Under Namespace

Classes: Error

Constant Summary collapse

DEFAULT_API_URL =
"https://api.groq.com"
DEFAULT_REQUEST_TIMEOUT =
5
DEFAULT_MAX_TOKENS =
1024
DEFAULT_TEMPERATURE =
1

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



13
14
15
16
17
18
19
20
21
22
# File 'lib/groq/configuration.rb', line 13

def initialize
  @api_key = ENV["GROQ_API_KEY"]
  @api_url = DEFAULT_API_URL
  @request_timeout = DEFAULT_REQUEST_TIMEOUT
  @extra_headers = {}

  @model_id = Groq::Model.default_model_id
  @max_tokens = DEFAULT_MAX_TOKENS
  @temperature = DEFAULT_TEMPERATURE
end

Instance Attribute Details

#api_keyObject

Raises:



24
25
26
27
# File 'lib/groq/configuration.rb', line 24

def api_key
  return @api_key if @api_key
  raise Error, "No GROQ API key provided. Set via $GROQ_API_KEY or Groq.configuration.api_key"
end

#api_urlObject

Returns the value of attribute api_url.



4
5
6
# File 'lib/groq/configuration.rb', line 4

def api_url
  @api_url
end

#extra_headersObject

Returns the value of attribute extra_headers.



4
5
6
# File 'lib/groq/configuration.rb', line 4

def extra_headers
  @extra_headers
end

#max_tokensObject

Returns the value of attribute max_tokens.



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

def max_tokens
  @max_tokens
end

#model_idObject

Returns the value of attribute model_id.



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

def model_id
  @model_id
end

#request_timeoutObject

Returns the value of attribute request_timeout.



4
5
6
# File 'lib/groq/configuration.rb', line 4

def request_timeout
  @request_timeout
end

#temperatureObject

Returns the value of attribute temperature.



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

def temperature
  @temperature
end