lex-llm-ollama 0.2.9 → 0.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90c9bd5b9b740637320d528012401d93d38e1d0b38396c3baa51ad45067547aa
4
- data.tar.gz: 1024e115de9bea52c58b3fb20bbbf1fc561bc6299f4bdfea4a95d2c7899618c8
3
+ metadata.gz: 367e593d0f98eed36e553e82356f0c86e37dd8e4a1324674c388f0383e59034d
4
+ data.tar.gz: f9d24ec554a9be7be90d33c76ddbb7d475a976c8158ceda71f596fcc8bfa42dd
5
5
  SHA512:
6
- metadata.gz: 7222b463dd74c7ba154d363dabaf451979562831313583ac2e6fc034ddda595c13b3c4b1ae6772906842a92aa83842bb9a37c2c99f198c5a4985c82a3f61174c
7
- data.tar.gz: 682b890f4c30d28d0786c6d3f7d03ac1d024fbec025119373346f9bcb87cad22391328b02238007ab9550cf6dd8ef07f565cc69628e26084fc2815a4b2d8e095
6
+ metadata.gz: 5be0235ede9a88b3b355cd2d6232c885332f6bcf8f5e0041922d496a76b5335c1533edd193b50c8ffe1f04953305b6527d7c60ac1a46b8d35d9cf28535902c36
7
+ data.tar.gz: cce2dd847b6fa13f1c8bf2c2a84df522315ed1d8af2f0e524e0564309a24494b4336432a57c60e3b2570402354923f1de805c7d721131d30939e633624f8aa4e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.10 - 2026-05-16
4
+
5
+ - Stop assuming every non-embedding Ollama model supports tools; fallback chat discovery now advertises completion, streaming, and vision only.
6
+ - Add canonical Ollama capability normalization so reported `tools`/function-calling metadata is preserved and streaming is inferred for chat/completion models.
7
+ - Include reported capability metadata from `/api/show` model detail responses.
8
+
3
9
  ## 0.2.9 - 2026-05-13
4
10
 
5
11
  - Add `fetch_model_detail` — calls POST `/api/show` to retrieve the real context window from Ollama.
@@ -90,7 +90,7 @@ module Legion
90
90
  def fetch_model_detail(model_name)
91
91
  raw = show_model(model_name)
92
92
  context_window = extract_context_window(raw)
93
- { context_window: context_window }.compact
93
+ { context_window: context_window, capabilities: extract_capabilities(raw) }.compact
94
94
  rescue StandardError => e
95
95
  handle_exception(e, level: :warn, handled: true, operation: 'ollama.fetch_model_detail',
96
96
  model: model_name)
@@ -372,15 +372,35 @@ module Legion
372
372
  end
373
373
 
374
374
  def infer_capabilities(name, family, api_caps)
375
- return api_caps.map(&:to_sym) unless api_caps.empty?
375
+ normalized = normalize_ollama_capabilities(api_caps)
376
+ return normalized unless normalized.empty?
376
377
 
377
378
  if embedding_model?(name, family)
378
379
  [:embedding]
379
380
  else
380
- %i[completion streaming tools vision]
381
+ %i[completion streaming vision]
381
382
  end
382
383
  end
383
384
 
385
+ def normalize_ollama_capabilities(capabilities)
386
+ Array(capabilities).compact.each_with_object([]) do |capability, result|
387
+ capability_sym = capability.to_s.downcase.strip.to_sym
388
+ next if capability_sym.to_s.empty?
389
+
390
+ result << capability_sym
391
+ result << :tools if %i[function_calling functions tool tool_use].include?(capability_sym)
392
+ result << :streaming if %i[chat completion].include?(capability_sym)
393
+ end.uniq
394
+ end
395
+
396
+ def extract_capabilities(raw)
397
+ return nil unless raw.is_a?(Hash)
398
+
399
+ caps = raw['capabilities'] || raw[:capabilities]
400
+ normalized = normalize_ollama_capabilities(caps)
401
+ normalized unless normalized.empty?
402
+ end
403
+
384
404
  def embedding_model?(name, family)
385
405
  name.to_s.match?(/embed|embedding/i) || family.to_s.match?(/bert|nomic/i)
386
406
  end
@@ -4,7 +4,7 @@ module Legion
4
4
  module Extensions
5
5
  module Llm
6
6
  module Ollama
7
- VERSION = '0.2.9'
7
+ VERSION = '0.2.10'
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-llm-ollama
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - LegionIO