Class: Boxcars::Configuration

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

Overview

Configuration contains gem settings

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



33
34
35
36
37
38
# File 'lib/boxcars.rb', line 33

def initialize
  @organization_id = nil
  @logger = Rails.logger if defined?(Rails)
  @log_prompts = ENV.fetch("LOG_PROMPTS", false)
  @log_generated = ENV.fetch("LOG_GEN", false)
end

Instance Attribute Details

#default_engineObject

Returns the value of attribute default_engine.



31
32
33
# File 'lib/boxcars.rb', line 31

def default_engine
  @default_engine
end

#default_trainObject

Returns the value of attribute default_train.



31
32
33
# File 'lib/boxcars.rb', line 31

def default_train
  @default_train
end

#groq_api_key(**kwargs) ⇒ String

Returns The Groq API key either from arg or env.

Returns:

  • (String)

    The Groq API key either from arg or env.



61
62
63
# File 'lib/boxcars.rb', line 61

def groq_api_key(**kwargs)
  key_lookup(:groq_api_key, kwargs)
end

#log_generatedObject

Returns the value of attribute log_generated.



31
32
33
# File 'lib/boxcars.rb', line 31

def log_generated
  @log_generated
end

#log_promptsObject

Returns the value of attribute log_prompts.



31
32
33
# File 'lib/boxcars.rb', line 31

def log_prompts
  @log_prompts
end

#loggerObject

Returns the value of attribute logger.



31
32
33
# File 'lib/boxcars.rb', line 31

def logger
  @logger
end

#openai_access_token(**kwargs) ⇒ String

Returns The OpenAI Access Token either from arg or env.

Returns:

  • (String)

    The OpenAI Access Token either from arg or env.



41
42
43
# File 'lib/boxcars.rb', line 41

def openai_access_token(**kwargs)
  key_lookup(:openai_access_token, kwargs)
end

#organization_idObject

Returns the value of attribute organization_id.



31
32
33
# File 'lib/boxcars.rb', line 31

def organization_id
  @organization_id
end

#serpapi_api_key(**kwargs) ⇒ String

Returns The SerpAPI API key either from arg or env.

Returns:

  • (String)

    The SerpAPI API key either from arg or env.



46
47
48
# File 'lib/boxcars.rb', line 46

def serpapi_api_key(**kwargs)
  key_lookup(:serpapi_api_key, kwargs)
end

Instance Method Details

#anthropic_api_key(**kwargs) ⇒ String

Returns The Anthropic API key either from arg or env.

Returns:

  • (String)

    The Anthropic API key either from arg or env.



51
52
53
# File 'lib/boxcars.rb', line 51

def anthropic_api_key(**kwargs)
  key_lookup(:anthropic_api_key, kwargs)
end

#cohere_api_key(**kwargs) ⇒ String

Returns The Cohere API key either from arg or env.

Returns:

  • (String)

    The Cohere API key either from arg or env.



56
57
58
# File 'lib/boxcars.rb', line 56

def cohere_api_key(**kwargs)
  key_lookup(:cohere_api_key, kwargs)
end