Module: L::ClassMethods

Defined in:
lib/lammy.rb

Overview

Wrap generative methods with handlers

Instance Method Summary collapse

Instance Method Details

#llm(**kwargs) ⇒ Object



43
44
45
# File 'lib/lammy.rb', line 43

def llm(**kwargs)
  @next_llm_settings = kwargs
end

#method_added(method_name) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/lammy.rb', line 51

def method_added(method_name)
  if @next_llm_settings
    next_llm_settings = @next_llm_settings
    @next_llm_settings = nil

    Lammy::Chat.handle(self, method_name, next_llm_settings)
  end

  if @next_v_settings
    next_v_settings = @next_v_settings
    @next_v_settings = nil

    Lammy::Embeddings.handle(self, method_name, next_v_settings)
  end

  super
end

#v(**kwargs) ⇒ Object



47
48
49
# File 'lib/lammy.rb', line 47

def v(**kwargs)
  @next_v_settings = kwargs
end