@melaya/runner 1.0.45 → 1.0.46

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
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@melaya/runner",
3
- "version": "1.0.45",
3
+ "version": "1.0.46",
4
4
  "description": "Run Melaya AI pipelines locally with your own LM Studio or Ollama models",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,