Module: Ollama::Capabilities

Defined in:
lib/ollama/capabilities.rb

Overview

Automatically infers model capabilities (tools, thinking, vision, embeddings) based on the model’s native ‘family`, `families`, and `name`.

Constant Summary collapse

TOOLS_FAMILIES =
%w[llama qwen2 qwen3 qwen3vl command-r mistral gemma2 gemma4].freeze
THINKING_MODELS =
[/deepseek-r1/i, /-r1/i, /qwq/i, /qwen3/i, /gemma[_-]?4/i].freeze
VISION_FAMILIES =
%w[llava clip qwen3vl mllama].freeze
VISION_MODELS =
[/vision/i, /vl/i].freeze
EMBEDDING_FAMILIES =
%w[nomic-bert bert mxbai-embed-large].freeze
EMBEDDING_MODELS =
[/embed/i, /minilm/i].freeze

Class Method Summary collapse

Class Method Details

.for(model_info) ⇒ Hash

Returns a hash of boolean capabilities.

Parameters:

  • model_info (Hash)

    A model entry from ‘/api/tags` or `/api/show`

Returns:

  • (Hash)

    { “tools” => true, “thinking” => false, … }



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ollama/capabilities.rb', line 11

def for(model_info)
  name = model_info["name"] || ""

  # Details may be nested under 'details' in list/tags, or at top level in show
  details = model_info["details"] || model_info || {}

  family = details["family"] || ""
  families = details["families"] || [family]

  {
    "tools" => tools_supported?(families, name),
    "thinking" => thinking_supported?(families, name),
    "vision" => vision_supported?(families, name),
    "embeddings" => embeddings_supported?(families, name)
  }
end