Module: Smith::Doctor::Checks::Live
- Defined in:
- lib/smith/doctor/checks/live.rb
Class Method Summary collapse
- .attempt_model_call(report) ⇒ Object
- .check_model_call(report) ⇒ Object
- .check_provider_config(report) ⇒ Object
- .present?(value) ⇒ Boolean
- .ruby_llm_configured? ⇒ Boolean
- .run(report) ⇒ Object
Class Method Details
.attempt_model_call(report) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/smith/doctor/checks/live.rb', line 26 def self.attempt_model_call(report) response = ::RubyLLM.chat.ask("Respond with exactly: ok") has_content = response.respond_to?(:content) && !response.content.nil? report.add( name: "live.model_call", status: has_content ? :pass : :fail, message: has_content ? "Live model call succeeded" : "Live model call returned no content" ) rescue StandardError => e report.add(name: "live.model_call", status: :fail, message: "Live model call failed", detail: e.) end |
.check_model_call(report) ⇒ Object
22 23 24 |
# File 'lib/smith/doctor/checks/live.rb', line 22 def self.check_model_call(report) attempt_model_call(report) end |
.check_provider_config(report) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/smith/doctor/checks/live.rb', line 12 def self.check_provider_config(report) configured = ruby_llm_configured? report.add( name: "live.provider_config", status: configured ? :pass : :warn, message: configured ? "RubyLLM provider configured" : "No RubyLLM provider credentials detected", detail: configured ? nil : "Configure RubyLLM or set a provider API key env var" ) end |
.present?(value) ⇒ Boolean
49 50 51 |
# File 'lib/smith/doctor/checks/live.rb', line 49 def self.present?(value) value.is_a?(String) && !value.empty? end |
.ruby_llm_configured? ⇒ Boolean
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/smith/doctor/checks/live.rb', line 38 def self.ruby_llm_configured? config = ::RubyLLM.config return true if present?(config.openai_api_key) return true if present?(config.anthropic_api_key) return true if present?(config.gemini_api_key) false rescue StandardError false end |
.run(report) ⇒ Object
7 8 9 10 |
# File 'lib/smith/doctor/checks/live.rb', line 7 def self.run(report) check_provider_config(report) check_model_call(report) end |