Method: OllamaChat::ModelHandling#pull_model_unless_present

Defined in:
lib/ollama_chat/model_handling.rb

#pull_model_unless_present(model, options) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ollama_chat/model_handling.rb', line 13

def pull_model_unless_present(model, options)
  if system = model_present?(model)
    return system.full?
  else
    pull_model_from_remote(model)
    if system = model_present?(model)
      return system.full?
    else
      STDOUT.puts "Model #{bold{model}} not found remotely. => Exiting."
      exit 1
    end
  end
rescue Ollama::Errors::Error => e
  warn "Caught #{e.class} while pulling model: #{e} => Exiting."
  exit 1
end