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.



34
35
36
37
38
39
40
41
42
43
# 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)
  @default_model_options = {}
  @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.

Returns:

  • (String)

    The Cerebras API key either from arg or env.



99
100
101
# File 'lib/boxcars.rb', line 99

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

#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_modelObject

Returns the value of attribute default_model.



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

def default_model
  @default_model
end

#default_model_optionsObject

Returns the value of attribute default_model_options.



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

def default_model_options
  @default_model_options
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.



94
95
96
# File 'lib/boxcars.rb', line 94

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

#observability_backendObject

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.

Returns:

  • (String)

    The OpenAI Access Token either from arg or env.



74
75
76
# File 'lib/boxcars.rb', line 74

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

#perplexity_api_key(**kwargs) ⇒ String

Returns The Perplexity API key either from arg or env.

Returns:

  • (String)

    The Perplexity API key either from arg or env.



114
115
116
# File 'lib/boxcars.rb', line 114

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.

Returns:

  • (String)

    The SerpAPI API key either from arg or env.



79
80
81
# File 'lib/boxcars.rb', line 79

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

#strict_deprecated_model_aliasesObject

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.

Returns:

  • (String)

    The Anthropic API key either from arg or env.



84
85
86
# File 'lib/boxcars.rb', line 84

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.



89
90
91
# File 'lib/boxcars.rb', line 89

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

#emit_deprecation_warningsObject



65
66
67
# File 'lib/boxcars.rb', line 65

def emit_deprecation_warnings
  !!@emit_deprecation_warnings
end

#emit_deprecation_warnings=(value) ⇒ Object



69
70
71
# File 'lib/boxcars.rb', line 69

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.

Returns:

  • (String)

    The Google AI API key either from arg or env.



104
105
106
# File 'lib/boxcars.rb', line 104

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

#openai_official_client_builderObject



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

def openai_official_client_builder
  @openai_official_client_builder
end

#openai_official_client_builder=(builder) ⇒ Object



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

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_nativeObject



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

def openai_official_require_native
  !!@openai_official_require_native
end

#openai_official_require_native=(value) ⇒ Object



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

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.

Returns:

  • (String)

    The Together AI API key either from arg or env.



109
110
111
# File 'lib/boxcars.rb', line 109

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