Module: Rllama

Defined in:
lib/rllama.rb,
lib/rllama/cli.rb,
lib/rllama/cpp.rb,
lib/rllama/model.rb,
lib/rllama/loader.rb,
lib/rllama/context.rb,
lib/rllama/version.rb

Defined Under Namespace

Modules: Cpp, Loader Classes: Cli, Context, Model, Result

Constant Summary collapse

Error =
Class.new(StandardError)
VERSION =
'1.0.3'

Class Method Summary collapse

Class Method Details

.load_model(path_or_name, dir: nil) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/rllama.rb', line 16

def load_model(path_or_name, dir: nil)
  model = Model.new(path_or_name, dir:)

  if block_given?
    begin
      yield model
    ensure
      model.close
    end
  else
    model
  end
end

.set_log(io = $stdout) ⇒ Object



34
35
36
# File 'lib/rllama.rb', line 34

def set_log(io = $stdout)
  Cpp.set_log(io)
end

.silence_log!Object



30
31
32
# File 'lib/rllama.rb', line 30

def silence_log!
  Cpp.silence_log!
end