@melaya/runner 1.0.45 → 1.0.47

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.
@@ -147,6 +147,46 @@ async def _ingest(args) -> int:
147
147
  dimensions=768,
148
148
  base_url="http://localhost:1234/v1",
149
149
  )
150
+ # Diagnostic: surface the URLs the httpx client will actually
151
+ # hit. Prior runs were failing with `[Errno 8] nodename nor
152
+ # servname provided` — the high-level `.base_url` attribute
153
+ # was being set but the underlying httpx client kept the
154
+ # default `api.openai.com` from construction. With the kwarg
155
+ # path these should both be `localhost:1234/v1`.
156
+ try:
157
+ _cb = getattr(embedder.client, "base_url", "?")
158
+ _hb = getattr(getattr(embedder.client, "_client", None), "base_url", "?")
159
+ _emit("lmstudio_init", client_base_url=str(_cb), httpx_base_url=str(_hb))
160
+ except Exception as _exc:
161
+ _emit("lmstudio_init", error=f"{type(_exc).__name__}: {_exc}")
162
+ # Probe the LM Studio HTTP server BEFORE the first embed call
163
+ # so a misconfigured/off server surfaces as one clear error
164
+ # rather than 240 cryptic per-file failures.
165
+ try:
166
+ import urllib.request, json as _json
167
+ with urllib.request.urlopen(
168
+ "http://localhost:1234/v1/models", timeout=3
169
+ ) as _r:
170
+ _models = _json.loads(_r.read().decode("utf-8"))
171
+ _names = [m.get("id") for m in _models.get("data", [])]
172
+ _emit("lmstudio_probe", ok=True, models=_names)
173
+ if args.embedder_model not in _names:
174
+ _emit("warning", reason=(
175
+ f"LM Studio is reachable but model "
176
+ f"'{args.embedder_model}' is not loaded. "
177
+ f"Loaded: {_names}"
178
+ ))
179
+ except Exception as _exc:
180
+ _emit("lmstudio_probe", ok=False,
181
+ error=f"{type(_exc).__name__}: {_exc}")
182
+ _emit("error", reason=(
183
+ f"Cannot reach LM Studio at http://localhost:1234. "
184
+ f"Make sure the LM Studio app's local server is started "
185
+ f"(Developer → Start Server) and the model "
186
+ f"'{args.embedder_model}' is loaded. Underlying error: "
187
+ f"{type(_exc).__name__}: {_exc}"
188
+ ))
189
+ return 6
150
190
  # LM Studio's /v1/embeddings rejects the OpenAI-specific
151
191
  # `dimensions` kwarg (only OpenAI text-embedding-3 supports
152
192
  # output-dim reduction). Strip it before each call so the
@@ -166,6 +206,25 @@ async def _ingest(args) -> int:
166
206
  from agentscope.rag import QdrantStore, SimpleKnowledge
167
207
  store_path = _resolve_store_path(args.pipeline_name)
168
208
  store_path.mkdir(parents=True, exist_ok=True)
209
+ # ── Fix qdrant-client's location-vs-path ambiguity ───────────────
210
+ # agentscope's QdrantStore only exposes `location=` and forwards
211
+ # it verbatim to `AsyncQdrantClient(location=...)`. When `location`
212
+ # is a filesystem path (not `:memory:` and not a URL), qdrant-client
213
+ # tries to parse it as a host:port → getaddrinfo → fails with
214
+ # `[Errno 8] nodename nor servname provided` on Mac / `[Errno
215
+ # 11001] getaddrinfo failed` on Windows. Per-file embedding then
216
+ # crashes 240 times in a row. Reroute `location=<path>` into the
217
+ # dedicated `path=` kwarg the embedded-mode wants.
218
+ import qdrant_client as _qc
219
+ _orig_qcinit = _qc.AsyncQdrantClient.__init__
220
+ def _patched_qcinit(self, location=None, **_kw):
221
+ if (location and location != ":memory:"
222
+ and "://" not in str(location)
223
+ and not _kw.get("path")):
224
+ _kw["path"] = location
225
+ location = None
226
+ _orig_qcinit(self, location=location, **_kw)
227
+ _qc.AsyncQdrantClient.__init__ = _patched_qcinit
169
228
  store = QdrantStore(
170
229
  location=str(store_path),
171
230
  collection_name=args.pipeline_name,
package/localRagIngest.py CHANGED
@@ -147,6 +147,46 @@ async def _ingest(args) -> int:
147
147
  dimensions=768,
148
148
  base_url="http://localhost:1234/v1",
149
149
  )
150
+ # Diagnostic: surface the URLs the httpx client will actually
151
+ # hit. Prior runs were failing with `[Errno 8] nodename nor
152
+ # servname provided` — the high-level `.base_url` attribute
153
+ # was being set but the underlying httpx client kept the
154
+ # default `api.openai.com` from construction. With the kwarg
155
+ # path these should both be `localhost:1234/v1`.
156
+ try:
157
+ _cb = getattr(embedder.client, "base_url", "?")
158
+ _hb = getattr(getattr(embedder.client, "_client", None), "base_url", "?")
159
+ _emit("lmstudio_init", client_base_url=str(_cb), httpx_base_url=str(_hb))
160
+ except Exception as _exc:
161
+ _emit("lmstudio_init", error=f"{type(_exc).__name__}: {_exc}")
162
+ # Probe the LM Studio HTTP server BEFORE the first embed call
163
+ # so a misconfigured/off server surfaces as one clear error
164
+ # rather than 240 cryptic per-file failures.
165
+ try:
166
+ import urllib.request, json as _json
167
+ with urllib.request.urlopen(
168
+ "http://localhost:1234/v1/models", timeout=3
169
+ ) as _r:
170
+ _models = _json.loads(_r.read().decode("utf-8"))
171
+ _names = [m.get("id") for m in _models.get("data", [])]
172
+ _emit("lmstudio_probe", ok=True, models=_names)
173
+ if args.embedder_model not in _names:
174
+ _emit("warning", reason=(
175
+ f"LM Studio is reachable but model "
176
+ f"'{args.embedder_model}' is not loaded. "
177
+ f"Loaded: {_names}"
178
+ ))
179
+ except Exception as _exc:
180
+ _emit("lmstudio_probe", ok=False,
181
+ error=f"{type(_exc).__name__}: {_exc}")
182
+ _emit("error", reason=(
183
+ f"Cannot reach LM Studio at http://localhost:1234. "
184
+ f"Make sure the LM Studio app's local server is started "
185
+ f"(Developer → Start Server) and the model "
186
+ f"'{args.embedder_model}' is loaded. Underlying error: "
187
+ f"{type(_exc).__name__}: {_exc}"
188
+ ))
189
+ return 6
150
190
  # LM Studio's /v1/embeddings rejects the OpenAI-specific
151
191
  # `dimensions` kwarg (only OpenAI text-embedding-3 supports
152
192
  # output-dim reduction). Strip it before each call so the
@@ -166,6 +206,25 @@ async def _ingest(args) -> int:
166
206
  from agentscope.rag import QdrantStore, SimpleKnowledge
167
207
  store_path = _resolve_store_path(args.pipeline_name)
168
208
  store_path.mkdir(parents=True, exist_ok=True)
209
+ # ── Fix qdrant-client's location-vs-path ambiguity ───────────────
210
+ # agentscope's QdrantStore only exposes `location=` and forwards
211
+ # it verbatim to `AsyncQdrantClient(location=...)`. When `location`
212
+ # is a filesystem path (not `:memory:` and not a URL), qdrant-client
213
+ # tries to parse it as a host:port → getaddrinfo → fails with
214
+ # `[Errno 8] nodename nor servname provided` on Mac / `[Errno
215
+ # 11001] getaddrinfo failed` on Windows. Per-file embedding then
216
+ # crashes 240 times in a row. Reroute `location=<path>` into the
217
+ # dedicated `path=` kwarg the embedded-mode wants.
218
+ import qdrant_client as _qc
219
+ _orig_qcinit = _qc.AsyncQdrantClient.__init__
220
+ def _patched_qcinit(self, location=None, **_kw):
221
+ if (location and location != ":memory:"
222
+ and "://" not in str(location)
223
+ and not _kw.get("path")):
224
+ _kw["path"] = location
225
+ location = None
226
+ _orig_qcinit(self, location=location, **_kw)
227
+ _qc.AsyncQdrantClient.__init__ = _patched_qcinit
169
228
  store = QdrantStore(
170
229
  location=str(store_path),
171
230
  collection_name=args.pipeline_name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@melaya/runner",
3
- "version": "1.0.45",
3
+ "version": "1.0.47",
4
4
  "description": "Run Melaya AI pipelines locally with your own LM Studio or Ollama models",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,