Class: RubricLLM::Config
- Inherits:
-
Object
- Object
- RubricLLM::Config
- Defined in:
- lib/rubric_llm/config.rb
Instance Attribute Summary collapse
-
#concurrency ⇒ Object
Returns the value of attribute concurrency.
-
#custom_prompt ⇒ Object
Returns the value of attribute custom_prompt.
-
#judge_model ⇒ Object
Returns the value of attribute judge_model.
-
#judge_provider ⇒ Object
Returns the value of attribute judge_provider.
-
#max_retries ⇒ Object
Returns the value of attribute max_retries.
-
#max_tokens ⇒ Object
Returns the value of attribute max_tokens.
-
#retry_base_delay ⇒ Object
Returns the value of attribute retry_base_delay.
-
#temperature ⇒ Object
Returns the value of attribute temperature.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(judge_model: nil, judge_provider: nil, temperature: nil, max_tokens: nil, custom_prompt: nil, max_retries: nil, retry_base_delay: nil, concurrency: nil, validate: false) ⇒ Config
constructor
rubocop:disable Metrics/ParameterLists.
- #to_h ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(judge_model: nil, judge_provider: nil, temperature: nil, max_tokens: nil, custom_prompt: nil, max_retries: nil, retry_base_delay: nil, concurrency: nil, validate: false) ⇒ Config
rubocop:disable Metrics/ParameterLists
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rubric_llm/config.rb', line 8 def initialize(judge_model: nil, judge_provider: nil, temperature: nil, max_tokens: nil, # rubocop:disable Metrics/ParameterLists custom_prompt: nil, max_retries: nil, retry_base_delay: nil, concurrency: nil, validate: false) @judge_model = judge_model || ENV.fetch("RUBRIC_JUDGE_MODEL", "gpt-4o") @judge_provider = (judge_provider || ENV.fetch("RUBRIC_JUDGE_PROVIDER", "openai")).to_sym @temperature = temperature || Float(ENV.fetch("RUBRIC_TEMPERATURE", "0.0")) @max_tokens = max_tokens || Integer(ENV.fetch("RUBRIC_MAX_TOKENS", "4096")) @custom_prompt = custom_prompt @max_retries = max_retries || Integer(ENV.fetch("RUBRIC_MAX_RETRIES", "2")) @retry_base_delay = retry_base_delay || Float(ENV.fetch("RUBRIC_RETRY_BASE_DELAY", "1.0")) @concurrency = concurrency || Integer(ENV.fetch("RUBRIC_CONCURRENCY", "1")) validate! if validate end |
Instance Attribute Details
#concurrency ⇒ Object
Returns the value of attribute concurrency.
5 6 7 |
# File 'lib/rubric_llm/config.rb', line 5 def concurrency @concurrency end |
#custom_prompt ⇒ Object
Returns the value of attribute custom_prompt.
5 6 7 |
# File 'lib/rubric_llm/config.rb', line 5 def custom_prompt @custom_prompt end |
#judge_model ⇒ Object
Returns the value of attribute judge_model.
5 6 7 |
# File 'lib/rubric_llm/config.rb', line 5 def judge_model @judge_model end |
#judge_provider ⇒ Object
Returns the value of attribute judge_provider.
5 6 7 |
# File 'lib/rubric_llm/config.rb', line 5 def judge_provider @judge_provider end |
#max_retries ⇒ Object
Returns the value of attribute max_retries.
5 6 7 |
# File 'lib/rubric_llm/config.rb', line 5 def max_retries @max_retries end |
#max_tokens ⇒ Object
Returns the value of attribute max_tokens.
5 6 7 |
# File 'lib/rubric_llm/config.rb', line 5 def max_tokens @max_tokens end |
#retry_base_delay ⇒ Object
Returns the value of attribute retry_base_delay.
5 6 7 |
# File 'lib/rubric_llm/config.rb', line 5 def retry_base_delay @retry_base_delay end |
#temperature ⇒ Object
Returns the value of attribute temperature.
5 6 7 |
# File 'lib/rubric_llm/config.rb', line 5 def temperature @temperature end |
Class Method Details
.from_env ⇒ Object
21 22 23 |
# File 'lib/rubric_llm/config.rb', line 21 def self.from_env new end |
Instance Method Details
#to_h ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/rubric_llm/config.rb', line 36 def to_h { judge_model:, judge_provider:, temperature:, max_tokens:, custom_prompt:, max_retries:, retry_base_delay:, concurrency: } end |
#validate! ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rubric_llm/config.rb', line 25 def validate! validate_judge_model validate_judge_provider validate_temperature validate_max_tokens validate_max_retries validate_retry_base_delay validate_concurrency self end |