Class: Boxcars::Configuration
- Inherits:
-
Object
- Object
- Boxcars::Configuration
- Defined in:
- lib/boxcars.rb
Overview
Configuration contains gem settings
Instance Attribute Summary collapse
-
#cerebras_api_key(**kwargs) ⇒ String
The Cerebras API key either from arg or env.
-
#default_engine ⇒ Object
Returns the value of attribute default_engine.
-
#default_model ⇒ Object
Returns the value of attribute default_model.
-
#default_train ⇒ Object
Returns the value of attribute default_train.
-
#groq_api_key(**kwargs) ⇒ String
The Groq API key either from arg or env.
-
#log_generated ⇒ Object
Returns the value of attribute log_generated.
-
#log_prompts ⇒ Object
Returns the value of attribute log_prompts.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#observability_backend ⇒ Object
Returns the value of attribute observability_backend.
-
#openai_access_token(**kwargs) ⇒ String
The OpenAI Access Token either from arg or env.
-
#organization_id ⇒ Object
Returns the value of attribute organization_id.
-
#perplexity_api_key(**kwargs) ⇒ String
The Perplexity API key either from arg or env.
-
#serpapi_api_key(**kwargs) ⇒ String
The SerpAPI API key either from arg or env.
-
#strict_deprecated_model_aliases ⇒ Object
Returns the value of attribute strict_deprecated_model_aliases.
Instance Method Summary collapse
-
#anthropic_api_key(**kwargs) ⇒ String
The Anthropic API key either from arg or env.
-
#cohere_api_key(**kwargs) ⇒ String
The Cohere API key either from arg or env.
- #emit_deprecation_warnings ⇒ Object
- #emit_deprecation_warnings=(value) ⇒ Object
-
#gemini_api_key(**kwargs) ⇒ String
The Google AI API key either from arg or env.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #openai_official_client_builder ⇒ Object
- #openai_official_client_builder=(builder) ⇒ Object
- #openai_official_require_native ⇒ Object
- #openai_official_require_native=(value) ⇒ Object
-
#together_api_key(**kwargs) ⇒ String
The Together AI API key either from arg or env.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
34 35 36 37 38 39 40 41 42 |
# File 'lib/boxcars.rb', line 34 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) @strict_deprecated_model_aliases = false self.emit_deprecation_warnings = true self.openai_official_require_native = ENV.fetch("OPENAI_OFFICIAL_REQUIRE_NATIVE", false) end |
Instance Attribute Details
#cerebras_api_key(**kwargs) ⇒ String
Returns The Cerebras API key either from arg or env.
98 99 100 |
# File 'lib/boxcars.rb', line 98 def cerebras_api_key(**kwargs) key_lookup(:cerebras_api_key, kwargs) end |
#default_engine ⇒ Object
Returns the value of attribute default_engine.
31 32 33 |
# File 'lib/boxcars.rb', line 31 def default_engine @default_engine end |
#default_model ⇒ Object
Returns the value of attribute default_model.
31 32 33 |
# File 'lib/boxcars.rb', line 31 def default_model @default_model end |
#default_train ⇒ Object
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.
93 94 95 |
# File 'lib/boxcars.rb', line 93 def groq_api_key(**kwargs) key_lookup(:groq_api_key, kwargs) end |
#log_generated ⇒ Object
Returns the value of attribute log_generated.
31 32 33 |
# File 'lib/boxcars.rb', line 31 def log_generated @log_generated end |
#log_prompts ⇒ Object
Returns the value of attribute log_prompts.
31 32 33 |
# File 'lib/boxcars.rb', line 31 def log_prompts @log_prompts end |
#logger ⇒ Object
Returns the value of attribute logger.
31 32 33 |
# File 'lib/boxcars.rb', line 31 def logger @logger end |
#observability_backend ⇒ Object
Returns the value of attribute observability_backend.
31 32 33 |
# File 'lib/boxcars.rb', line 31 def observability_backend @observability_backend end |
#openai_access_token(**kwargs) ⇒ String
Returns The OpenAI Access Token either from arg or env.
73 74 75 |
# File 'lib/boxcars.rb', line 73 def openai_access_token(**kwargs) key_lookup(:openai_access_token, kwargs) end |
#organization_id ⇒ Object
Returns the value of attribute organization_id.
31 32 33 |
# File 'lib/boxcars.rb', line 31 def organization_id @organization_id end |
#perplexity_api_key(**kwargs) ⇒ String
Returns The Perplexity API key either from arg or env.
113 114 115 |
# File 'lib/boxcars.rb', line 113 def perplexity_api_key(**kwargs) key_lookup(:perplexity_api_key, kwargs) end |
#serpapi_api_key(**kwargs) ⇒ String
Returns The SerpAPI API key either from arg or env.
78 79 80 |
# File 'lib/boxcars.rb', line 78 def serpapi_api_key(**kwargs) key_lookup(:serpapi_api_key, kwargs) end |
#strict_deprecated_model_aliases ⇒ Object
Returns the value of attribute strict_deprecated_model_aliases.
31 32 33 |
# File 'lib/boxcars.rb', line 31 def strict_deprecated_model_aliases @strict_deprecated_model_aliases end |
Instance Method Details
#anthropic_api_key(**kwargs) ⇒ String
Returns The Anthropic API key either from arg or env.
83 84 85 |
# File 'lib/boxcars.rb', line 83 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.
88 89 90 |
# File 'lib/boxcars.rb', line 88 def cohere_api_key(**kwargs) key_lookup(:cohere_api_key, kwargs) end |
#emit_deprecation_warnings ⇒ Object
64 65 66 |
# File 'lib/boxcars.rb', line 64 def emit_deprecation_warnings !!@emit_deprecation_warnings end |
#emit_deprecation_warnings=(value) ⇒ Object
68 69 70 |
# File 'lib/boxcars.rb', line 68 def emit_deprecation_warnings=(value) @emit_deprecation_warnings = normalize_boolean(value, attr_name: :emit_deprecation_warnings) end |
#gemini_api_key(**kwargs) ⇒ String
Returns The Google AI API key either from arg or env.
103 104 105 |
# File 'lib/boxcars.rb', line 103 def gemini_api_key(**kwargs) key_lookup(:gemini_api_key, kwargs) end |
#openai_official_client_builder ⇒ Object
44 45 46 |
# File 'lib/boxcars.rb', line 44 def openai_official_client_builder @openai_official_client_builder end |
#openai_official_client_builder=(builder) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/boxcars.rb', line 48 def openai_official_client_builder=(builder) unless builder.nil? || builder.respond_to?(:call) raise ConfigurationError, "openai_official_client_builder must be callable (Proc/lambda) or nil" end @openai_official_client_builder = builder end |
#openai_official_require_native ⇒ Object
56 57 58 |
# File 'lib/boxcars.rb', line 56 def openai_official_require_native !!@openai_official_require_native end |
#openai_official_require_native=(value) ⇒ Object
60 61 62 |
# File 'lib/boxcars.rb', line 60 def openai_official_require_native=(value) @openai_official_require_native = normalize_boolean(value, attr_name: :openai_official_require_native) end |
#together_api_key(**kwargs) ⇒ String
Returns The Together AI API key either from arg or env.
108 109 110 |
# File 'lib/boxcars.rb', line 108 def together_api_key(**kwargs) key_lookup(:together_api_key, kwargs) end |