Class: Raix::Configuration
- Inherits:
-
Object
- Object
- Raix::Configuration
- Defined in:
- lib/raix/configuration.rb
Overview
The Configuration class holds the configuration options for the Raix gem.
Constant Summary collapse
- DEFAULT_MAX_TOKENS =
1000
- DEFAULT_MAX_COMPLETION_TOKENS =
16_384
- DEFAULT_MODEL =
"meta-llama/llama-3.3-8b-instruct:free"
- DEFAULT_TEMPERATURE =
0.0
- DEFAULT_MAX_TOOL_CALLS =
25
Class Method Summary collapse
Instance Method Summary collapse
- #client? ⇒ Boolean
-
#initialize(fallback: nil) ⇒ Configuration
constructor
Initializes a new instance of the Configuration class with default values.
Constructor Details
#initialize(fallback: nil) ⇒ Configuration
Initializes a new instance of the Configuration class with default values.
50 51 52 53 54 55 56 57 |
# File 'lib/raix/configuration.rb', line 50 def initialize(fallback: nil) self.temperature = DEFAULT_TEMPERATURE self.max_completion_tokens = DEFAULT_MAX_COMPLETION_TOKENS self.max_tokens = DEFAULT_MAX_TOKENS self.model = DEFAULT_MODEL self.max_tool_calls = DEFAULT_MAX_TOOL_CALLS self.fallback = fallback end |
Class Method Details
.attr_accessor_with_fallback(method_name) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/raix/configuration.rb', line 6 def self.attr_accessor_with_fallback(method_name) define_method(method_name) do value = instance_variable_get("@#{method_name}") return value if value return unless fallback fallback.public_send(method_name) end define_method("#{method_name}=") do |value| instance_variable_set("@#{method_name}", value) end end |
Instance Method Details
#client? ⇒ Boolean
59 60 61 |
# File 'lib/raix/configuration.rb', line 59 def client? !!(openrouter_client || openai_client) end |