Module: L::ClassMethods

Defined in:
lib/lammy.rb

Overview

Wrap generative methods with handlers

Instance Method Summary collapse

Instance Method Details

#llm(**kwargs) ⇒ Object



20
21
22
# File 'lib/lammy.rb', line 20

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

#method_added(method_name) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/lammy.rb', line 28

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



24
25
26
# File 'lib/lammy.rb', line 24

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