Exception: DSPy::ConfigurationError

Inherits:
Error
  • Object
show all
Defined in:
lib/dspy/errors.rb

Class Method Summary collapse

Class Method Details

.missing_lm(module_name) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/dspy/errors.rb', line 11

def self.missing_lm(module_name)
  new(<<~MESSAGE)
    No language model configured for #{module_name} module.

    To fix this, configure a language model either globally:

      DSPy.configure do |config|
        config.lm = DSPy::LM.new("openai/gpt-4", api_key: ENV["OPENAI_API_KEY"])
      end

    Or on the module instance:

      module_instance.configure do |config|
        config.lm = DSPy::LM.new("anthropic/claude-3", api_key: ENV["ANTHROPIC_API_KEY"])
      end
  MESSAGE
end