Learn R Programming

edgemodelr (version 0.2.0)

edge_find_ollama_models: Find and load Ollama models

Description

Utility functions to discover and work with locally stored Ollama models. Ollama stores models as SHA-256 named blobs which are GGUF files that can be used directly with edgemodelr.

Usage

edge_find_ollama_models(
  ollama_dir = NULL,
  test_compatibility = FALSE,
  max_size_gb = 10
)

Value

List with ollama_path and discovered models information

Arguments

ollama_dir

Optional path to Ollama models directory. If NULL, will auto-detect.

test_compatibility

If TRUE, test if each model can be loaded successfully

max_size_gb

Maximum model size in GB to consider (default: 10)

Examples

Run this code
if (FALSE) {
# Find Ollama models
ollama_info <- edge_find_ollama_models()

if (!is.null(ollama_info) && length(ollama_info$models) > 0) {
  # Use first compatible model
  model_path <- ollama_info$models[[1]]$path
  ctx <- edge_load_model(model_path)
  result <- edge_completion(ctx, "Hello", n_predict = 10)
  edge_free_model(ctx)
}
}

Run the code above in your browser using DataLab