Class: LlmClassifier::Configuration
- Inherits:
-
Object
- Object
- LlmClassifier::Configuration
- Defined in:
- lib/llm_classifier/configuration.rb
Overview
Configuration object for LlmClassifier settings
Instance Attribute Summary collapse
-
#adapter ⇒ Object
Returns the value of attribute adapter.
-
#anthropic_api_key ⇒ Object
Returns the value of attribute anthropic_api_key.
-
#default_model ⇒ Object
Returns the value of attribute default_model.
-
#default_queue ⇒ Object
Returns the value of attribute default_queue.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#openai_api_key ⇒ Object
Returns the value of attribute openai_api_key.
-
#web_fetch_timeout ⇒ Object
Returns the value of attribute web_fetch_timeout.
-
#web_fetch_user_agent ⇒ Object
Returns the value of attribute web_fetch_user_agent.
Instance Method Summary collapse
- #adapter_class ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/llm_classifier/configuration.rb', line 12 def initialize @adapter = :ruby_llm @default_model = "gpt-4o-mini" @openai_api_key = ENV.fetch("OPENAI_API_KEY", nil) @anthropic_api_key = ENV.fetch("ANTHROPIC_API_KEY", nil) @web_fetch_timeout = 10 @web_fetch_user_agent = "LlmClassifier/#{VERSION}" @default_queue = :classification @logger = defined?(::Rails) ? ::Rails.logger : Logger.new($stdout) end |
Instance Attribute Details
#adapter ⇒ Object
Returns the value of attribute adapter.
8 9 10 |
# File 'lib/llm_classifier/configuration.rb', line 8 def adapter @adapter end |
#anthropic_api_key ⇒ Object
Returns the value of attribute anthropic_api_key.
8 9 10 |
# File 'lib/llm_classifier/configuration.rb', line 8 def anthropic_api_key @anthropic_api_key end |
#default_model ⇒ Object
Returns the value of attribute default_model.
8 9 10 |
# File 'lib/llm_classifier/configuration.rb', line 8 def default_model @default_model end |
#default_queue ⇒ Object
Returns the value of attribute default_queue.
8 9 10 |
# File 'lib/llm_classifier/configuration.rb', line 8 def default_queue @default_queue end |
#logger ⇒ Object
Returns the value of attribute logger.
8 9 10 |
# File 'lib/llm_classifier/configuration.rb', line 8 def logger @logger end |
#openai_api_key ⇒ Object
Returns the value of attribute openai_api_key.
8 9 10 |
# File 'lib/llm_classifier/configuration.rb', line 8 def openai_api_key @openai_api_key end |
#web_fetch_timeout ⇒ Object
Returns the value of attribute web_fetch_timeout.
8 9 10 |
# File 'lib/llm_classifier/configuration.rb', line 8 def web_fetch_timeout @web_fetch_timeout end |
#web_fetch_user_agent ⇒ Object
Returns the value of attribute web_fetch_user_agent.
8 9 10 |
# File 'lib/llm_classifier/configuration.rb', line 8 def web_fetch_user_agent @web_fetch_user_agent end |
Instance Method Details
#adapter_class ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/llm_classifier/configuration.rb', line 23 def adapter_class case adapter when :ruby_llm Adapters::RubyLlm when :openai Adapters::OpenAI when :anthropic Adapters::Anthropic when Class adapter else raise ConfigurationError, "Unknown adapter: #{adapter}" end end |