Class: Strata::CLI::AI::Configuration
- Inherits:
-
Object
- Object
- Strata::CLI::AI::Configuration
- Defined in:
- lib/strata/cli/ai/configuration.rb
Constant Summary collapse
- PROVIDERS =
RubyLLM::Providers.constants.map { |c| c.to_s.downcase }.sort.freeze
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
Instance Method Summary collapse
- #default_model ⇒ Object
- #default_provider ⇒ Object
- #enabled? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #model_or_default ⇒ Object
Constructor Details
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
10 11 12 |
# File 'lib/strata/cli/ai/configuration.rb', line 10 def api_key @api_key end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
10 11 12 |
# File 'lib/strata/cli/ai/configuration.rb', line 10 def model @model end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
10 11 12 |
# File 'lib/strata/cli/ai/configuration.rb', line 10 def provider @provider end |
Instance Method Details
#default_model ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/strata/cli/ai/configuration.rb', line 26 def default_model case @provider when "gemini" then "gemini-2.0-flash" when "openai" then "gpt-4o-mini" when "anthropic" then "claude-sonnet-4-20250514" when "mistral" then "mistral-large-latest" when "deepseek" then "deepseek-chat" else # For other providers, we don't have a specific default. # The user should specify a model in .strata or via CLI if needed. # Returning nil here might cause issues if a default is expected, # so we'll return a safe fallback or let the provider helper handle it. nil end end |
#default_provider ⇒ Object
22 23 24 |
# File 'lib/strata/cli/ai/configuration.rb', line 22 def default_provider "gemini" end |
#enabled? ⇒ Boolean
18 19 20 |
# File 'lib/strata/cli/ai/configuration.rb', line 18 def enabled? CLI.config["ai_enabled"] != false && !@api_key.nil? && !@api_key.empty? end |
#model_or_default ⇒ Object
42 43 44 |
# File 'lib/strata/cli/ai/configuration.rb', line 42 def model_or_default @model || default_model end |