Class: Groq::Configuration
- Inherits:
-
Object
- Object
- Groq::Configuration
- 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
- #api_key ⇒ Object
-
#api_url ⇒ Object
Returns the value of attribute api_url.
-
#extra_headers ⇒ Object
Returns the value of attribute extra_headers.
-
#max_tokens ⇒ Object
Returns the value of attribute max_tokens.
-
#model_id ⇒ Object
Returns the value of attribute model_id.
-
#request_timeout ⇒ Object
Returns the value of attribute request_timeout.
-
#temperature ⇒ Object
Returns the value of attribute temperature.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
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_key ⇒ Object
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_url ⇒ Object
Returns the value of attribute api_url.
4 5 6 |
# File 'lib/groq/configuration.rb', line 4 def api_url @api_url end |
#extra_headers ⇒ Object
Returns the value of attribute extra_headers.
4 5 6 |
# File 'lib/groq/configuration.rb', line 4 def extra_headers @extra_headers end |
#max_tokens ⇒ Object
Returns the value of attribute max_tokens.
3 4 5 |
# File 'lib/groq/configuration.rb', line 3 def max_tokens @max_tokens end |
#model_id ⇒ Object
Returns the value of attribute model_id.
3 4 5 |
# File 'lib/groq/configuration.rb', line 3 def model_id @model_id end |
#request_timeout ⇒ Object
Returns the value of attribute request_timeout.
4 5 6 |
# File 'lib/groq/configuration.rb', line 4 def request_timeout @request_timeout end |
#temperature ⇒ Object
Returns the value of attribute temperature.
3 4 5 |
# File 'lib/groq/configuration.rb', line 3 def temperature @temperature end |