llm_meta_widget 0.15.1 → 0.15.2

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: 5b7d8d8ce878a102002639b418702b741535fb67a23002ed74a6bb8382b4791f
4
- data.tar.gz: 9f2482cef0da260962f8fa2ff5d78952d6bdf6d6ae9bdbab2b3abe9348d8b2b9
3
+ metadata.gz: 863b128096d9e0813388bb13a03d96a8f2b0f202f2aa5c33a27bdd0a48416c7b
4
+ data.tar.gz: e14113a514e1fa7ffb09e067cc44150e32e90a61fb5dd80946b9d7cfb34c6ad6
5
5
  SHA512:
6
- metadata.gz: dc3ad442ac618dd9f8fa74af526a2d6e5a4d042a318af9492da7a5482dcb92f7fdcc1b22e004cdb5c6ce8d1b226ae81d9d425535d714ccac188fed1e6a6522e5
7
- data.tar.gz: aa0875cbba4e0af9d92588db27718bf846143b019510418209c5146972a245223e6f92e7e5927cdd9f8a0de2a884b14f76db8fb885b276c4873b1c01b35f5956
6
+ metadata.gz: c1c3f21142b8de93b5a8216472aa700ac7fd72c589ca810f95eb8e3d368a60045974cec8f56a8e6fd64803da7b6a90a18be296312b7f3dc6f42c3c252ccf0f62
7
+ data.tar.gz: 5ee508999c3a2fe61e26f258b4362e4fac981097d7a3c5a375d6dcfe129e75f0d415d0a26d1404c3d2bc99e7f140347851b55609ca157f25bdb0b889b3fe1703
data/CHANGELOG.md CHANGED
@@ -3,6 +3,31 @@
3
3
  This file starts at 0.8.0, the first release with a breaking change worth
4
4
  calling out. Earlier releases are in the git history (`git log --oneline v0.7.6`).
5
5
 
6
+ ## 0.15.2
7
+
8
+ ### A page that hides the model picker now learns the context window too
9
+
10
+ Both requests for the hub's model list sat inside the branches that fill the
11
+ model picker. A page that pins one model and hides the picker therefore never
12
+ learned that model's context window — and hiding the picker is a reasonable
13
+ choice when the host has already chosen the model.
14
+
15
+ Without a window the resource budget falls back to its 8 KB floor, so a page's
16
+ reference data is reported as skipped even when it would have fitted, and
17
+ oversized tool results are neither trimmed nor evicted, because each of those
18
+ steps returns its input unchanged when it has no window to spend. Release
19
+ 0.15.1 could not even warn about it: the warning there fires when a request
20
+ comes back unusable, and here no request was made.
21
+
22
+ The model list is now fetched whenever the hub is the provider, and only
23
+ filling the picker remains conditional. A page configured to talk straight to
24
+ Ollama is left alone, since there is no such endpoint to ask.
25
+
26
+ The widget also says so once, in the browser console, if a turn starts with no
27
+ known window — naming the model and what is lost. Three different causes have
28
+ produced an unknown window so far, and each was reported only where it
29
+ happened, if at all.
30
+
6
31
  ## 0.15.1
7
32
 
8
33
  ### A repeat visit no longer loses the model's context window or the hub tools
data/README.md CHANGED
@@ -61,7 +61,7 @@ Option 3 if it does not.
61
61
 
62
62
  ```ruby
63
63
  # Gemfile
64
- gem "llm_meta_widget", "~> 0.15.1"
64
+ gem "llm_meta_widget", "~> 0.15.2"
65
65
  ```
66
66
 
67
67
  ```bash
@@ -502,7 +502,18 @@ function boot(cfg) {
502
502
  });
503
503
  if (flat.length > 1) modelPicker.style.display = "";
504
504
  }));
505
- } else if (ENABLE_MODEL_PICKER && modelPicker) {
505
+ }
506
+ // The hub answers with each model's context window, and every budget below
507
+ // is derived from it, so ASK REGARDLESS OF THE PICKER. This used to sit
508
+ // inside the picker branches: a page that pinned a model and hid the
509
+ // picker — which is a sensible thing to do, and what the standalone E2E
510
+ // fixture does — never learned the window at all. The resource budget then
511
+ // fell to its 8 KB floor and both tool-result truncation and eviction stood
512
+ // down, each returning its input unchanged without a window. No warning was
513
+ // possible either, because no request was made to fail.
514
+ //
515
+ // Skipped only when talking straight to Ollama, which has no /api/llms.
516
+ if (LLM_PROVIDER !== "ollama") {
506
517
  // cache: "no-store" so the browser never sends a conditional request. The
507
518
  // hub answers /api/llms with an ETag and must-revalidate, so a REPEAT visit
508
519
  // got 304 Not Modified — and Response.ok is false for a 304, which became
@@ -528,6 +539,13 @@ function boot(cfg) {
528
539
  // configured model is often hosted while the picker shows local ones.
529
540
  llmsPayload = payload;
530
541
  modelWindow = modelWindowFrom(payload, MODEL);
542
+
543
+ // The window is the part every page needs; filling the picker is only for
544
+ // pages that show one, and the code below would dereference a null picker.
545
+ // Without this the TypeError only skips the rest of boot, whose
546
+ // remaining job is the picker's change handler — so nothing a
547
+ // no-picker page needs. Kept for intent, not for a visible bug.
548
+ if (!(ENABLE_MODEL_PICKER && modelPicker)) return;
531
549
  var flat = [];
532
550
  (payload.llms || []).forEach(function(llm) {
533
551
  if (llm.family !== "ollama") return;
@@ -723,6 +741,7 @@ function boot(cfg) {
723
741
  // call answers, and null forever if the hub is older than the field — in
724
742
  // which case the loop budgets nothing, exactly as it always did.
725
743
  var modelWindow = null;
744
+ var warnedNoWindow = false;
726
745
  // The /api/llms answer, kept so switching model in the picker can resolve
727
746
  // that model's window. Without it a visitor who switches from a 262k model
728
747
  // to a 32k one keeps the big window — no eviction, and a resource budget
@@ -1372,6 +1391,18 @@ function boot(cfg) {
1372
1391
  inputEl.value = "";
1373
1392
  appendTurn("user", userText, pendingTurnLabel);
1374
1393
 
1394
+ // An unknown window is not a small window: every budget below then uses a
1395
+ // floor, and oversized tool results are neither trimmed nor evicted. Say so
1396
+ // once, at the moment it affects an answer. Three separate causes have led
1397
+ // here — a 304 read as empty, a page that hid the model picker, and a model
1398
+ // the hub does not list — and the first two were silent for days.
1399
+ if (!modelWindow && !warnedNoWindow) {
1400
+ warnedNoWindow = true;
1401
+ console.warn("[llm-meta-widget] no context window known for " + MODEL +
1402
+ "; reference data is budgeted at the floor and oversized tool" +
1403
+ " results are not trimmed");
1404
+ }
1405
+
1375
1406
  // Reference data that did not fit, reported once per budget, at the moment
1376
1407
  // it affects an answer rather than at boot.
1377
1408
  // Plan the page's resources first: the refusals are recorded while planning,
@@ -4269,7 +4269,8 @@ function boot(cfg) {
4269
4269
  });
4270
4270
  if (flat.length > 1) modelPicker.style.display = "";
4271
4271
  }));
4272
- } else if (ENABLE_MODEL_PICKER && modelPicker) {
4272
+ }
4273
+ if (LLM_PROVIDER !== "ollama") {
4273
4274
  tasks.push(fetch(LLM_BASE + "/api/llms", { headers: { "Accept": "application/json" }, cache: "no-store" }).then(function(r) {
4274
4275
  if (r.ok) return r.json();
4275
4276
  console.warn("[llm-meta-widget] /api/llms answered " + r.status + "; the model context window is unknown, so reference data is budgeted at the floor and oversized tool results are not trimmed");
@@ -4277,6 +4278,7 @@ function boot(cfg) {
4277
4278
  }).then(function(payload) {
4278
4279
  llmsPayload = payload;
4279
4280
  modelWindow = modelWindowFrom(payload, MODEL);
4281
+ if (!(ENABLE_MODEL_PICKER && modelPicker)) return;
4280
4282
  var flat = [];
4281
4283
  (payload.llms || []).forEach(function(llm) {
4282
4284
  if (llm.family !== "ollama") return;
@@ -4425,6 +4427,7 @@ function boot(cfg) {
4425
4427
  return Object.assign({}, p, { source: "page" });
4426
4428
  });
4427
4429
  var modelWindow = null;
4430
+ var warnedNoWindow = false;
4428
4431
  var llmsPayload = null;
4429
4432
  var resourceContext = null;
4430
4433
  var resourcePlan = null;
@@ -4868,6 +4871,10 @@ function boot(cfg) {
4868
4871
  if (!userText) return;
4869
4872
  inputEl.value = "";
4870
4873
  appendTurn("user", userText, pendingTurnLabel);
4874
+ if (!modelWindow && !warnedNoWindow) {
4875
+ warnedNoWindow = true;
4876
+ console.warn("[llm-meta-widget] no context window known for " + MODEL + "; reference data is budgeted at the floor and oversized tool results are not trimmed");
4877
+ }
4871
4878
  pageResourcePlansNow();
4872
4879
  if (skippedResources.length && !announcedSkips) {
4873
4880
  announcedSkips = true;
@@ -1,3 +1,3 @@
1
1
  module LlmMetaWidget
2
- VERSION = "0.15.1"
2
+ VERSION = "0.15.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: llm_meta_widget
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.1
4
+ version: 0.15.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - jdkim