@melaya/runner 1.0.40 → 1.0.41

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.
@@ -37,6 +37,35 @@ except ImportError as exc:
37
37
  print(f"ImportError: agentscope.rag not reachable on PYTHONPATH={os.environ.get('PYTHONPATH')!r}: {exc}", file=sys.stderr)
38
38
  sys.exit(2)
39
39
 
40
+ # Ensure NLTK's sentence tokenizer data is on disk. agentscope's readers
41
+ # do `nltk.download(..., quiet=True)` inside the chunking call but with
42
+ # quiet=True a network failure surfaces only as "Resource 'punkt_tab' not
43
+ # found" at sent_tokenize time. We force the download once up-front,
44
+ # loudly, so the user sees a clear network-error if it fails — beats
45
+ # 240 per-file failures with the same opaque message.
46
+ def _ensure_nltk_data() -> None:
47
+ try:
48
+ import nltk # type: ignore
49
+ except ImportError:
50
+ print("nltk missing — runner venv needs `pip install nltk`", file=sys.stderr)
51
+ return
52
+ needed = ["punkt", "punkt_tab"]
53
+ for pkg in needed:
54
+ try:
55
+ nltk.data.find(f"tokenizers/{pkg}")
56
+ except LookupError:
57
+ try:
58
+ ok = nltk.download(pkg, quiet=True)
59
+ if not ok:
60
+ print(f"nltk.download({pkg!r}) returned False — likely offline. "
61
+ f"Run `python -m nltk.downloader {pkg}` once with network.",
62
+ file=sys.stderr)
63
+ except Exception as exc: # noqa: BLE001
64
+ print(f"nltk.download({pkg!r}) failed: {type(exc).__name__}: {exc}",
65
+ file=sys.stderr)
66
+
67
+ _ensure_nltk_data()
68
+
40
69
 
41
70
  def _emit(kind: str, **fields):
42
71
  """Stream a progress event to the runner subprocess parent which
package/localRagIngest.py CHANGED
@@ -37,6 +37,35 @@ except ImportError as exc:
37
37
  print(f"ImportError: agentscope.rag not reachable on PYTHONPATH={os.environ.get('PYTHONPATH')!r}: {exc}", file=sys.stderr)
38
38
  sys.exit(2)
39
39
 
40
+ # Ensure NLTK's sentence tokenizer data is on disk. agentscope's readers
41
+ # do `nltk.download(..., quiet=True)` inside the chunking call but with
42
+ # quiet=True a network failure surfaces only as "Resource 'punkt_tab' not
43
+ # found" at sent_tokenize time. We force the download once up-front,
44
+ # loudly, so the user sees a clear network-error if it fails — beats
45
+ # 240 per-file failures with the same opaque message.
46
+ def _ensure_nltk_data() -> None:
47
+ try:
48
+ import nltk # type: ignore
49
+ except ImportError:
50
+ print("nltk missing — runner venv needs `pip install nltk`", file=sys.stderr)
51
+ return
52
+ needed = ["punkt", "punkt_tab"]
53
+ for pkg in needed:
54
+ try:
55
+ nltk.data.find(f"tokenizers/{pkg}")
56
+ except LookupError:
57
+ try:
58
+ ok = nltk.download(pkg, quiet=True)
59
+ if not ok:
60
+ print(f"nltk.download({pkg!r}) returned False — likely offline. "
61
+ f"Run `python -m nltk.downloader {pkg}` once with network.",
62
+ file=sys.stderr)
63
+ except Exception as exc: # noqa: BLE001
64
+ print(f"nltk.download({pkg!r}) failed: {type(exc).__name__}: {exc}",
65
+ file=sys.stderr)
66
+
67
+ _ensure_nltk_data()
68
+
40
69
 
41
70
  def _emit(kind: str, **fields):
42
71
  """Stream a progress event to the runner subprocess parent which
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@melaya/runner",
3
- "version": "1.0.40",
3
+ "version": "1.0.41",
4
4
  "description": "Run Melaya AI pipelines locally with your own LM Studio or Ollama models",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,