hugpy-engine 0.3.13__tar.gz → 0.3.15__tar.gz
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.
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/PKG-INFO +3 -25
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/README.md +2 -24
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/pyproject.toml +1 -1
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/__init__.py +3 -3
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/config/main.py +2 -2
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/config/models/models_config.py +22 -3
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/config/models/models_default.py +3 -3
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/dispatch/__init__.py +1 -1
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/dispatch/dispatch.py +22 -20
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/llama/runners/fitevict_runner.py +4 -4
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/resolvers/__init__.py +1 -1
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/resolvers/assure_model_key.py +6 -6
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/resolvers/categories/__init__.py +2 -2
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/resolvers/categories/builders.py +3 -3
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/resolvers/categories/frameworks.py +4 -4
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/resolvers/model_resolver.py +33 -23
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/resolvers/task_resolution.py +1 -1
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/schemas/chat_schemas.py +1 -1
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/schemas/model_schemas.py +1 -1
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/schemas/runner_schemas.py +2 -2
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/task_endpoints.py +5 -5
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/utils/no_think.py +2 -2
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine.egg-info/PKG-INFO +3 -25
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/setup.cfg +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/categories.py +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/config/__init__.py +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/config/models/__init__.py +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/core_auth.py +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/fit/__init__.py +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/fit/types.py +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/imports/__init__.py +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/imports/classes.py +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/imports/constants.py +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/imports/functions.py +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/imports/init_imports.py +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/llama/__init__.py +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/llama/runners/__init__.py +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/name_match.py +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/placement.py +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/py.typed +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/schemas/__init__.py +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/schemas/event_schemas.py +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/schemas/metadata_schemas.py +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/schemas/task_schemas.py +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/task_deps.py +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/tasks.py +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/utils/__init__.py +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/utils/json_scavenge.py +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/utils/model_marker.py +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine.egg-info/SOURCES.txt +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine.egg-info/dependency_links.txt +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine.egg-info/requires.txt +0 -0
- {hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hugpy-engine
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.15
|
|
4
4
|
Summary: Hugpy engine: model discovery and classification, allocation and eviction, native llama.cpp and GGUF runners, and the prompt-to-reply inference path with task and placement seams
|
|
5
5
|
Author-email: putkoff <support@hugpy.ai>
|
|
6
6
|
License-Expression: LicenseRef-Proprietary
|
|
@@ -27,28 +27,6 @@ and the call log. The engine itself does not load models in fleet mode.
|
|
|
27
27
|
Distribution `hugpy-engine`, import `hugpy_engine`. Dependencies:
|
|
28
28
|
`hugpy-platform`, `abstract-essentials`, `pydantic>=2`.
|
|
29
29
|
|
|
30
|
-
**Status: LIVE.** It is a library only: no service, no console script.
|
|
31
|
-
|
|
32
|
-
- Installed in `/opt/hugpy-media/venv` (0.3.7) and `/opt/hugpy-video/venv`
|
|
33
|
-
(0.3.8).
|
|
34
|
-
- Imported by `hugpy_media`, `hugpy_video` and `hugpy_oracle`.
|
|
35
|
-
- Core's live basic mode does not use it. Only core's legacy
|
|
36
|
-
`config/prompt.py` does, and that code is not live.
|
|
37
|
-
|
|
38
|
-
On 2026-10-15 the engine's last ties to `hugpy-storage` and `hugpy-control`
|
|
39
|
-
are being removed, targeting 0.3.9 and later:
|
|
40
|
-
|
|
41
|
-
- `vl_gguf_tasks` is ported in from `hugpy_storage.hugpy_marker`.
|
|
42
|
-
- The `hugpy_storage.model_paths.route_destination` call is dropped; it was
|
|
43
|
-
dead in fleet mode.
|
|
44
|
-
- `hugpy_storage.console.downloader.model_status` is replaced by registry
|
|
45
|
-
availability from `/v1/models`.
|
|
46
|
-
- The guarded imports of the retired `hugpy_control.settings.settings_store`
|
|
47
|
-
are deleted.
|
|
48
|
-
|
|
49
|
-
Check `pyproject.toml` for the current version. See
|
|
50
|
-
[docs/packages.md](../../docs/packages.md#versions-in-flight).
|
|
51
|
-
|
|
52
30
|
## Public API
|
|
53
31
|
|
|
54
32
|
```python
|
|
@@ -200,5 +178,5 @@ hugpy_engine/
|
|
|
200
178
|
See also:
|
|
201
179
|
|
|
202
180
|
- [docs/execute_prompt.md](../../docs/execute_prompt.md)
|
|
203
|
-
- [docs/arms.md](../../docs/
|
|
204
|
-
- [docs/packages.md](../../
|
|
181
|
+
- [docs/arms.md](../../hugpy-core/package/docs/ROUTES-CONVENTION.md)
|
|
182
|
+
- [docs/packages.md](../../README.md)
|
|
@@ -8,28 +8,6 @@ and the call log. The engine itself does not load models in fleet mode.
|
|
|
8
8
|
Distribution `hugpy-engine`, import `hugpy_engine`. Dependencies:
|
|
9
9
|
`hugpy-platform`, `abstract-essentials`, `pydantic>=2`.
|
|
10
10
|
|
|
11
|
-
**Status: LIVE.** It is a library only: no service, no console script.
|
|
12
|
-
|
|
13
|
-
- Installed in `/opt/hugpy-media/venv` (0.3.7) and `/opt/hugpy-video/venv`
|
|
14
|
-
(0.3.8).
|
|
15
|
-
- Imported by `hugpy_media`, `hugpy_video` and `hugpy_oracle`.
|
|
16
|
-
- Core's live basic mode does not use it. Only core's legacy
|
|
17
|
-
`config/prompt.py` does, and that code is not live.
|
|
18
|
-
|
|
19
|
-
On 2026-10-15 the engine's last ties to `hugpy-storage` and `hugpy-control`
|
|
20
|
-
are being removed, targeting 0.3.9 and later:
|
|
21
|
-
|
|
22
|
-
- `vl_gguf_tasks` is ported in from `hugpy_storage.hugpy_marker`.
|
|
23
|
-
- The `hugpy_storage.model_paths.route_destination` call is dropped; it was
|
|
24
|
-
dead in fleet mode.
|
|
25
|
-
- `hugpy_storage.console.downloader.model_status` is replaced by registry
|
|
26
|
-
availability from `/v1/models`.
|
|
27
|
-
- The guarded imports of the retired `hugpy_control.settings.settings_store`
|
|
28
|
-
are deleted.
|
|
29
|
-
|
|
30
|
-
Check `pyproject.toml` for the current version. See
|
|
31
|
-
[docs/packages.md](../../docs/packages.md#versions-in-flight).
|
|
32
|
-
|
|
33
11
|
## Public API
|
|
34
12
|
|
|
35
13
|
```python
|
|
@@ -181,5 +159,5 @@ hugpy_engine/
|
|
|
181
159
|
See also:
|
|
182
160
|
|
|
183
161
|
- [docs/execute_prompt.md](../../docs/execute_prompt.md)
|
|
184
|
-
- [docs/arms.md](../../docs/
|
|
185
|
-
- [docs/packages.md](../../
|
|
162
|
+
- [docs/arms.md](../../hugpy-core/package/docs/ROUTES-CONVENTION.md)
|
|
163
|
+
- [docs/packages.md](../../README.md)
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "hugpy-engine"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.15"
|
|
8
8
|
description = "Hugpy engine: model discovery and classification, allocation and eviction, native llama.cpp and GGUF runners, and the prompt-to-reply inference path with task and placement seams"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -19,7 +19,7 @@ try:
|
|
|
19
19
|
except Exception: # pragma: no cover - source tree without metadata
|
|
20
20
|
__version__ = "0.0.0+unknown"
|
|
21
21
|
|
|
22
|
-
from
|
|
22
|
+
from .dispatch.dispatch import (
|
|
23
23
|
execute_chat_stream,
|
|
24
24
|
execute_prompt,
|
|
25
25
|
execute_prompt_stream,
|
|
@@ -27,8 +27,8 @@ from hugpy_engine.dispatch.dispatch import (
|
|
|
27
27
|
normalize_prompt_kwargs,
|
|
28
28
|
runner_for,
|
|
29
29
|
)
|
|
30
|
-
from
|
|
31
|
-
from
|
|
30
|
+
from .resolvers import resolve, resolve_model_key
|
|
31
|
+
from .config.models.models_config import (
|
|
32
32
|
MODEL_REGISTRY,
|
|
33
33
|
get_model_registry,
|
|
34
34
|
refresh_registry,
|
|
@@ -9,7 +9,7 @@ from __future__ import annotations
|
|
|
9
9
|
|
|
10
10
|
from typing import Optional
|
|
11
11
|
|
|
12
|
-
from
|
|
12
|
+
from .models.models_config import (
|
|
13
13
|
MODEL_REGISTRY,
|
|
14
14
|
get_model_registry,
|
|
15
15
|
refresh_registry,
|
|
@@ -33,7 +33,7 @@ def _resolve_model_key(model_key, registry, prefer=None):
|
|
|
33
33
|
candidates = sorted(k for k in registry if _bare(k) == model_key)
|
|
34
34
|
if not candidates:
|
|
35
35
|
try:
|
|
36
|
-
from
|
|
36
|
+
from ..fit.types import key_equivalent
|
|
37
37
|
candidates = sorted(k for k in registry if key_equivalent(_bare(k), model_key))
|
|
38
38
|
except Exception: # noqa: BLE001
|
|
39
39
|
candidates = []
|
|
@@ -30,7 +30,7 @@ import time
|
|
|
30
30
|
import urllib.request
|
|
31
31
|
from typing import Dict, Optional, Tuple
|
|
32
32
|
|
|
33
|
-
from
|
|
33
|
+
from ...schemas.model_schemas import ModelConfig
|
|
34
34
|
|
|
35
35
|
logger = logging.getLogger(__name__)
|
|
36
36
|
|
|
@@ -145,6 +145,17 @@ def derive_model_config_row(name, row) -> "Tuple[Optional[dict], Optional[str]]"
|
|
|
145
145
|
}, None
|
|
146
146
|
|
|
147
147
|
|
|
148
|
+
_catalog_source = None
|
|
149
|
+
_bindings_source = None
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def set_core_sources(*, catalog, bindings):
|
|
153
|
+
"""Use Core's own facts when hosted; never fall back to self-HTTP."""
|
|
154
|
+
global _catalog_source, _bindings_source, _last_fetch, _bindings_at
|
|
155
|
+
_catalog_source, _bindings_source = catalog, bindings
|
|
156
|
+
_last_fetch = _bindings_at = 0.0
|
|
157
|
+
|
|
158
|
+
|
|
148
159
|
def _fetch_catalog() -> "Optional[list]":
|
|
149
160
|
"""The live catalog as raw rows. None on total failure (fail-open).
|
|
150
161
|
|
|
@@ -155,7 +166,11 @@ def _fetch_catalog() -> "Optional[list]":
|
|
|
155
166
|
EIO models disk). Stores the rows in ``_LAST_CATALOG`` so the ranked resolver
|
|
156
167
|
reads the same fetch."""
|
|
157
168
|
global _LAST_CATALOG
|
|
158
|
-
|
|
169
|
+
if _catalog_source is not None:
|
|
170
|
+
rows = list(_catalog_source())
|
|
171
|
+
_LAST_CATALOG = rows
|
|
172
|
+
return rows
|
|
173
|
+
from ...resolvers import task_resolution as _tr
|
|
159
174
|
|
|
160
175
|
def _log(msg):
|
|
161
176
|
logger.warning("registry: %s; keeping the last known model set (%d models)",
|
|
@@ -265,10 +280,14 @@ def task_bindings(force: bool = False) -> dict:
|
|
|
265
280
|
unreachable read keeps the last-known map. Bindings are now ONE input to the
|
|
266
281
|
ranked resolver, not the sole authority."""
|
|
267
282
|
global _bindings, _bindings_at
|
|
283
|
+
if _bindings_source is not None:
|
|
284
|
+
_bindings = dict(_bindings_source())
|
|
285
|
+
_bindings_at = time.time()
|
|
286
|
+
return dict(_bindings)
|
|
268
287
|
now = time.time()
|
|
269
288
|
if not force and _bindings and (now - _bindings_at) < _TTL_S:
|
|
270
289
|
return dict(_bindings)
|
|
271
|
-
from
|
|
290
|
+
from ...resolvers import task_resolution as _tr
|
|
272
291
|
_unreachable = []
|
|
273
292
|
fresh = _tr.load_bindings(_CORE_URL, timeout=_TIMEOUT_S,
|
|
274
293
|
on_log=lambda m: _unreachable.append(m))
|
{hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/config/models/models_default.py
RENAMED
|
@@ -15,9 +15,9 @@ the current model set on every request.
|
|
|
15
15
|
from typing import Dict
|
|
16
16
|
|
|
17
17
|
from abstract_essentials import make_list
|
|
18
|
-
from
|
|
19
|
-
from
|
|
20
|
-
from
|
|
18
|
+
from ...categories import MEDIA_DEFAULTS, TASK_DEFAULTS
|
|
19
|
+
from .models_config import MODEL_REGISTRY
|
|
20
|
+
from ...schemas.model_schemas import ModelConfig
|
|
21
21
|
from hugpy_platform.constants import (
|
|
22
22
|
DEFAULT_AGENT_BRAIN,
|
|
23
23
|
DEFAULT_CHAT_MODEL,
|
|
@@ -34,11 +34,11 @@ import os
|
|
|
34
34
|
import threading
|
|
35
35
|
import time
|
|
36
36
|
from typing import Any, Dict, List, Optional, Tuple
|
|
37
|
-
from
|
|
37
|
+
from ..resolvers import resolve
|
|
38
38
|
import re
|
|
39
|
-
from
|
|
40
|
-
from
|
|
41
|
-
from
|
|
39
|
+
from ..schemas.event_schemas import DoneEvent, ErrorEvent, TokenEvent
|
|
40
|
+
from ..schemas.runner_schemas import Runner
|
|
41
|
+
from ..schemas.task_schemas import Resolution, TaskResult
|
|
42
42
|
|
|
43
43
|
logger = logging.getLogger(__name__)
|
|
44
44
|
|
|
@@ -179,7 +179,7 @@ _CONTENTION_LOCK = threading.Lock()
|
|
|
179
179
|
# dispatch importable on bare central and in tests exactly as before; if the
|
|
180
180
|
# import fails for any reason, _emit degrades to a no-op and the eviction path
|
|
181
181
|
# is byte-identical to its pre-telemetry self.
|
|
182
|
-
from
|
|
182
|
+
from ..placement import get_eviction_ledger as _ledger # noqa: E402
|
|
183
183
|
|
|
184
184
|
STAGE_CANDIDATE_SKIP = "candidate.skip"
|
|
185
185
|
|
|
@@ -399,7 +399,7 @@ def _headroom_pass(model_key: str, trigger: str, run_id: str) -> List[str]:
|
|
|
399
399
|
# capacity-class refusal it can walk its brain ladder on, never a wedged
|
|
400
400
|
# cold load. A warm model never reaches this pass (its runner is cached).
|
|
401
401
|
try:
|
|
402
|
-
from
|
|
402
|
+
from ..spill import no_evict_env
|
|
403
403
|
_polite = no_evict_env()
|
|
404
404
|
except Exception: # noqa: BLE001 — an unreadable flag is not a policy
|
|
405
405
|
_polite = False
|
|
@@ -550,7 +550,7 @@ def infer_arg_name(arg: Any) -> Optional[str]:
|
|
|
550
550
|
existing paths, prompts with whitespace, single-token model ids); this adds
|
|
551
551
|
the live-registry check so core ids like ``AtomicChat~Qwen3.8-27B-GGUF`` /
|
|
552
552
|
``Echo-Mini`` are recognised by membership (operator 2026-10-04), fail-open."""
|
|
553
|
-
from
|
|
553
|
+
from ..resolvers.task_resolution import classify_arg
|
|
554
554
|
return classify_arg(arg, is_model_key=_is_registry_key)
|
|
555
555
|
|
|
556
556
|
|
|
@@ -558,11 +558,11 @@ def _is_registry_key(arg: str) -> bool:
|
|
|
558
558
|
"""True when ``arg`` names a model the registry holds (exact or resolvable).
|
|
559
559
|
Fail-open to False so a registry/import hiccup never misclassifies a prompt."""
|
|
560
560
|
try:
|
|
561
|
-
from
|
|
561
|
+
from ..config.models.models_config import MODEL_REGISTRY, refresh_registry
|
|
562
562
|
refresh_registry()
|
|
563
563
|
if arg in MODEL_REGISTRY:
|
|
564
564
|
return True
|
|
565
|
-
from
|
|
565
|
+
from ..resolvers.assure_model_key import assure_model_key
|
|
566
566
|
return assure_model_key(arg, fuzzy=False) is not None
|
|
567
567
|
except Exception: # noqa: BLE001
|
|
568
568
|
return False
|
|
@@ -720,7 +720,7 @@ def execute_prompt(*args: Any, **kwargs: Any):
|
|
|
720
720
|
# for byte-parity with the monolith's file classification.
|
|
721
721
|
if not prompt_kwargs.get("task") and not prompt_kwargs.get("model_key"):
|
|
722
722
|
try:
|
|
723
|
-
from
|
|
723
|
+
from ..resolvers.task_resolution import infer
|
|
724
724
|
from abstract_essentials import derive_media_type
|
|
725
725
|
_info = infer((), prompt_kwargs, media_type_fn=derive_media_type)
|
|
726
726
|
if _info.get("task"):
|
|
@@ -752,9 +752,11 @@ def execute_prompt(*args: Any, **kwargs: Any):
|
|
|
752
752
|
# A build failure is the SAME for every candidate (bad kwargs) —
|
|
753
753
|
# it is a caller error, so surface it rather than cascading.
|
|
754
754
|
raise
|
|
755
|
-
|
|
756
|
-
touch_model(res_i.model_key) # residency idle clock
|
|
755
|
+
phase = "runner"
|
|
757
756
|
try:
|
|
757
|
+
runner = _get_or_build_runner(res_i)
|
|
758
|
+
touch_model(res_i.model_key) # residency idle clock
|
|
759
|
+
phase = "run"
|
|
758
760
|
out = runner.run(req=req)
|
|
759
761
|
if inspect.isawaitable(out):
|
|
760
762
|
out = _run_coro_sync(out)
|
|
@@ -762,7 +764,7 @@ def execute_prompt(*args: Any, **kwargs: Any):
|
|
|
762
764
|
if _is_caller_error(str(exc)):
|
|
763
765
|
raise # 4xx: bad request, never cascade
|
|
764
766
|
attempts.append({"model_key": mk, "source": source, "ok": False,
|
|
765
|
-
"phase":
|
|
767
|
+
"phase": phase, "error": str(exc)})
|
|
766
768
|
last_exc = exc
|
|
767
769
|
continue
|
|
768
770
|
# Result-as-data failure (the runner caught it): cascade unless 4xx.
|
|
@@ -942,7 +944,7 @@ async def execute_prompt_stream(*args, cancel_event=None, **kwargs):
|
|
|
942
944
|
# stays single-pass, a remote relay sees a *completed* response (finish=stop)
|
|
943
945
|
# and this loop terminates after one pass — no double-continuation.
|
|
944
946
|
# ---------------------------------------------------------------------------
|
|
945
|
-
from
|
|
947
|
+
from ..schemas.event_schemas import StatusEvent
|
|
946
948
|
|
|
947
949
|
# How many continuation passes before giving up (runaway guard). Env-overridable;
|
|
948
950
|
# the WORKER_* names are honored too so existing worker deployments keep tuning.
|
|
@@ -1229,7 +1231,7 @@ def _dir_size_detail(path: str, model_key: Optional[str] = None,
|
|
|
1229
1231
|
framework = str(getattr(cfg, "framework", "") or "").lower()
|
|
1230
1232
|
if model_key and framework in ("gguf", "llama_cpp"):
|
|
1231
1233
|
try:
|
|
1232
|
-
from
|
|
1234
|
+
from ..serve.overrides import effective_load_requirement
|
|
1233
1235
|
req = effective_load_requirement(model_key, path, cfg) or {}
|
|
1234
1236
|
chosen = req.get("chosen_gguf")
|
|
1235
1237
|
eff_weight = req.get("weights_bytes")
|
|
@@ -1304,7 +1306,7 @@ def evict(model_key: str, task: Optional[str] = None) -> bool:
|
|
|
1304
1306
|
_INSTANCES.pop(k, None)
|
|
1305
1307
|
dropped = bool(to_drop)
|
|
1306
1308
|
try:
|
|
1307
|
-
from
|
|
1309
|
+
from ..llama.runners.get import evict_llama_runner
|
|
1308
1310
|
heavy = evict_llama_runner(model_key)
|
|
1309
1311
|
except Exception:
|
|
1310
1312
|
heavy = False
|
|
@@ -1314,7 +1316,7 @@ def evict(model_key: str, task: Optional[str] = None) -> bool:
|
|
|
1314
1316
|
# a 17 GB model and stranded the rest on the card).
|
|
1315
1317
|
tf = 0
|
|
1316
1318
|
try:
|
|
1317
|
-
from
|
|
1319
|
+
from ..generate.coder import REGISTRY as _TF_REGISTRY
|
|
1318
1320
|
tf = _TF_REGISTRY.evict_model(model_key)
|
|
1319
1321
|
except Exception:
|
|
1320
1322
|
tf = 0
|
|
@@ -1335,12 +1337,12 @@ def clear() -> None:
|
|
|
1335
1337
|
with _INSTANCES_LOCK:
|
|
1336
1338
|
_INSTANCES.clear()
|
|
1337
1339
|
try:
|
|
1338
|
-
from
|
|
1340
|
+
from ..llama.runners.get import clear_llama_runners
|
|
1339
1341
|
clear_llama_runners()
|
|
1340
1342
|
except Exception:
|
|
1341
1343
|
pass
|
|
1342
1344
|
try:
|
|
1343
|
-
from
|
|
1345
|
+
from ..generate.coder import REGISTRY as _TF_REGISTRY
|
|
1344
1346
|
for _k in {getattr(getattr(i, "cfg", None), "model_key", None) for i in list(_TF_REGISTRY._instances.values())}:
|
|
1345
1347
|
if _k:
|
|
1346
1348
|
_TF_REGISTRY.evict_model(_k)
|
|
@@ -1352,5 +1354,5 @@ def clear() -> None:
|
|
|
1352
1354
|
def supported_task_keys() -> List[Tuple[str, str]]:
|
|
1353
1355
|
# (framework, task) pairs a runner is registered for — engine chat runners
|
|
1354
1356
|
# plus whatever media/video plugged in (hugpy_engine.tasks).
|
|
1355
|
-
from
|
|
1357
|
+
from ..resolvers.categories import FRAMEWORK_RUNNERS
|
|
1356
1358
|
return sorted(FRAMEWORK_RUNNERS)
|
{hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/llama/runners/fitevict_runner.py
RENAMED
|
@@ -31,9 +31,9 @@ import urllib.error
|
|
|
31
31
|
import urllib.request
|
|
32
32
|
from typing import AsyncIterator, Optional
|
|
33
33
|
|
|
34
|
-
from
|
|
35
|
-
from
|
|
36
|
-
from
|
|
34
|
+
from ...schemas.chat_schemas import ChatRequest, ChatResult
|
|
35
|
+
from ...schemas.event_schemas import DoneEvent, ErrorEvent, TokenEvent
|
|
36
|
+
from ...schemas.runner_schemas import StreamEvent
|
|
37
37
|
|
|
38
38
|
logger = logging.getLogger(__name__)
|
|
39
39
|
|
|
@@ -121,7 +121,7 @@ class FitevictChatRunner:
|
|
|
121
121
|
return body
|
|
122
122
|
|
|
123
123
|
def _post(self, body: dict) -> "tuple[int, dict]":
|
|
124
|
-
from
|
|
124
|
+
from ...core_auth import core_headers
|
|
125
125
|
req = urllib.request.Request(FRONT_DOOR + "/v1/chat/completions",
|
|
126
126
|
data=json.dumps(body).encode("utf-8"),
|
|
127
127
|
headers=core_headers(FRONT_DOOR + "/v1/chat/completions", {"Content-Type": "application/json"}),
|
|
@@ -5,7 +5,7 @@ through the box's fitevict front door via hugpy_core's relay. The legacy
|
|
|
5
5
|
remote.py (DelegatingRunner / PeerRunner / placement.json peers) is DROPPED;
|
|
6
6
|
there is no in-process GPU runner and no peer/worker-provider seam here.
|
|
7
7
|
"""
|
|
8
|
-
from
|
|
8
|
+
from .model_resolver import (
|
|
9
9
|
EXTERNAL_TASK_RUNNERS,
|
|
10
10
|
external_runner_for,
|
|
11
11
|
resolve,
|
|
@@ -6,14 +6,14 @@ import threading
|
|
|
6
6
|
from pathlib import PurePosixPath
|
|
7
7
|
from typing import Optional
|
|
8
8
|
|
|
9
|
-
from
|
|
9
|
+
from ..config.models.models_config import MODEL_REGISTRY
|
|
10
10
|
# THE single model-key identity rule (operator, board 2026-09-29): ``-GGUF`` vs
|
|
11
11
|
# no suffix is one key; any other differing token is a different model. Defined
|
|
12
12
|
# once in the pure fit core and re-exported here for every resolver caller.
|
|
13
|
-
from
|
|
14
|
-
from
|
|
15
|
-
from
|
|
16
|
-
from
|
|
13
|
+
from ..fit.types import canonical_key, key_equivalent # noqa: F401
|
|
14
|
+
from ..name_match import Candidate, _distance, resolve_name
|
|
15
|
+
from ..name_match import _tokens as _nm_tokens
|
|
16
|
+
from ..placement import get_blocklist, get_model_metrics, get_worker_registry
|
|
17
17
|
|
|
18
18
|
_log = logging.getLogger(__name__)
|
|
19
19
|
|
|
@@ -198,7 +198,7 @@ def _is_classified(key: str) -> bool:
|
|
|
198
198
|
Fail-open to True (let a later refusal speak) only on import error.
|
|
199
199
|
"""
|
|
200
200
|
try:
|
|
201
|
-
from
|
|
201
|
+
from ..model_classifier import ADAPTER_TASK, NEEDS_CLASSIFICATION_TASK
|
|
202
202
|
cfg = MODEL_REGISTRY.get(key)
|
|
203
203
|
tasks = list(getattr(cfg, "tasks", None) or [])
|
|
204
204
|
if not tasks or tasks == [NEEDS_CLASSIFICATION_TASK] or tasks == [ADAPTER_TASK]:
|
{hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/resolvers/categories/__init__.py
RENAMED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
Both are live views over :mod:`hugpy_engine.tasks`; importing this package
|
|
4
4
|
registers the engine's own chat runners (lazily imported) and nothing else.
|
|
5
5
|
"""
|
|
6
|
-
from
|
|
6
|
+
from .builders import (
|
|
7
7
|
LEGACY_BUILDERS,
|
|
8
8
|
MODEL_REQUEST_BUILDERS,
|
|
9
9
|
)
|
|
10
|
-
from
|
|
10
|
+
from .frameworks import (
|
|
11
11
|
FRAMEWORK_RUNNERS,
|
|
12
12
|
KNOWN_TASKS_REGISTRY,
|
|
13
13
|
register_builtin_tasks,
|
{hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/resolvers/categories/builders.py
RENAMED
|
@@ -12,8 +12,8 @@ import os
|
|
|
12
12
|
from typing import Any, Callable, Dict, Tuple
|
|
13
13
|
from abstract_essentials import derive_media_type, read_from_file
|
|
14
14
|
from pydantic import BaseModel
|
|
15
|
-
from
|
|
16
|
-
from
|
|
15
|
+
from ...schemas.chat_schemas import ChatRequest
|
|
16
|
+
from ...tasks import ANY_FRAMEWORK, BuilderTable
|
|
17
17
|
from hugpy_platform.constants import DEFAULT_ROOT, UPLOADS_HOME
|
|
18
18
|
from hugpy_platform.utils import make_request_id
|
|
19
19
|
|
|
@@ -108,7 +108,7 @@ def _build_chat_request(kwargs: Dict[str, Any], model_key: str) -> ChatRequest:
|
|
|
108
108
|
# pass. Fail-open twice over: the guard itself returns the request
|
|
109
109
|
# untouched on any internal error, and an import failure changes nothing.
|
|
110
110
|
try:
|
|
111
|
-
from
|
|
111
|
+
from ...chat_context.chat_context import ctx_fit_chat_request
|
|
112
112
|
req = ctx_fit_chat_request(req)
|
|
113
113
|
except Exception: # noqa: BLE001
|
|
114
114
|
pass
|
{hugpy_engine-0.3.13 → hugpy_engine-0.3.15}/src/hugpy_engine/resolvers/categories/frameworks.py
RENAMED
|
@@ -11,7 +11,7 @@ keep their dict/set semantics for every existing caller.
|
|
|
11
11
|
"""
|
|
12
12
|
from __future__ import annotations
|
|
13
13
|
|
|
14
|
-
from
|
|
14
|
+
from ...tasks import RunnerTable, TaskNames, register_task
|
|
15
15
|
|
|
16
16
|
SOURCE = "hugpy_engine"
|
|
17
17
|
|
|
@@ -20,13 +20,13 @@ def _llama_chat_runner():
|
|
|
20
20
|
# hugpy_next: GGUF and transformers chat are served by the box's fitevict front door
|
|
21
21
|
# (evict-to-fit + llama-server + call log), not the slot pool.
|
|
22
22
|
# LlamaCppChatRunner stays: ProfileChildChatRunner (transformers) subclasses it.
|
|
23
|
-
from
|
|
23
|
+
from ...llama.runners.fitevict_runner import FitevictChatRunner
|
|
24
24
|
|
|
25
25
|
return FitevictChatRunner
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def _deepcoder_chat_runner():
|
|
29
|
-
from
|
|
29
|
+
from ...generate.generate_runner import DeepCoderChatRunner
|
|
30
30
|
|
|
31
31
|
return DeepCoderChatRunner
|
|
32
32
|
|
|
@@ -43,7 +43,7 @@ def register_builtin_tasks(*, replace: bool = False) -> None:
|
|
|
43
43
|
Request builders come from :mod:`.builders` (the chat-specific ones are
|
|
44
44
|
engine-owned; ``("transformers", "image-text-to-text")`` belongs to media).
|
|
45
45
|
"""
|
|
46
|
-
from
|
|
46
|
+
from .builders import (
|
|
47
47
|
_build_chat_request,
|
|
48
48
|
_build_vision_chat_request,
|
|
49
49
|
)
|
|
@@ -26,15 +26,15 @@ from abstract_essentials import derive_media_type, safe_load_from_json
|
|
|
26
26
|
from pydantic import BaseModel
|
|
27
27
|
import logging
|
|
28
28
|
logger = logging.getLogger(__name__)
|
|
29
|
-
from
|
|
30
|
-
from
|
|
29
|
+
from ..categories import MEDIA_DEFAULTS
|
|
30
|
+
from ..config.models.models_config import (
|
|
31
31
|
MODELS, MODEL_REGISTRY, refresh_registry, task_bindings)
|
|
32
|
-
from
|
|
33
|
-
from
|
|
34
|
-
from
|
|
35
|
-
from
|
|
36
|
-
from
|
|
37
|
-
from
|
|
32
|
+
from ..config.models.models_default import DEFAULT_CHAT_MODEL
|
|
33
|
+
from ..schemas.task_schemas import Resolution
|
|
34
|
+
from .categories.builders import MODEL_REQUEST_BUILDERS
|
|
35
|
+
from .categories.frameworks import FRAMEWORK_RUNNERS, KNOWN_TASKS_REGISTRY
|
|
36
|
+
from .assure_model_key import assure_model_key
|
|
37
|
+
from ..task_endpoints import (
|
|
38
38
|
TASK_ROUTES, TaskEndpointRunner, build_endpoint_request)
|
|
39
39
|
|
|
40
40
|
# ---------------------------------------------------------------------------
|
|
@@ -65,6 +65,15 @@ def _refuse_if_unclassified(model_key, cfg) -> None:
|
|
|
65
65
|
# resolve_model_key — picks the model. Default-resolution chain only.
|
|
66
66
|
# Does NOT pick task; that's resolve()'s job.
|
|
67
67
|
# ---------------------------------------------------------------------------
|
|
68
|
+
def _vl_answers_text(cfg, task) -> bool:
|
|
69
|
+
"""A vision-language chat model answers a text-only chat (operator 2026-10-24:
|
|
70
|
+
the producer plan's role default Surogate-3.5-2B, registered image-text-to-text
|
|
71
|
+
only, refused every `text-generation` call). Its chat endpoint takes image parts
|
|
72
|
+
as optional content, so a `text-generation` request rides the ordinary chat
|
|
73
|
+
builder to the same model — no image, no other change."""
|
|
74
|
+
return task == "text-generation" and "image-text-to-text" in (getattr(cfg, "tasks", None) or [])
|
|
75
|
+
|
|
76
|
+
|
|
68
77
|
def _adopt_vl_tasks_from_disk(model_key, cfg, task):
|
|
69
78
|
"""A stale registry row refusing ``image-text-to-text`` for a GGUF: re-apply
|
|
70
79
|
the vision-GGUF rule (hugpy_marker.vl_gguf_tasks — the rule the marker
|
|
@@ -83,13 +92,13 @@ def _adopt_vl_tasks_from_disk(model_key, cfg, task):
|
|
|
83
92
|
return None
|
|
84
93
|
dirs = []
|
|
85
94
|
try:
|
|
86
|
-
from
|
|
95
|
+
from ..config.main import get_model_path
|
|
87
96
|
dirs.append(get_model_path(model_key))
|
|
88
97
|
except Exception: # noqa: BLE001 — unresolvable local path: try the row's dir
|
|
89
98
|
pass
|
|
90
99
|
dirs.append(getattr(cfg, "dir", None))
|
|
91
100
|
try:
|
|
92
|
-
from
|
|
101
|
+
from ..utils.model_marker import vl_gguf_tasks
|
|
93
102
|
except Exception: # noqa: BLE001
|
|
94
103
|
return None
|
|
95
104
|
for directory in dirs:
|
|
@@ -99,14 +108,14 @@ def _adopt_vl_tasks_from_disk(model_key, cfg, task):
|
|
|
99
108
|
if task not in (new_t or []):
|
|
100
109
|
continue
|
|
101
110
|
import dataclasses
|
|
102
|
-
from
|
|
111
|
+
from ..config.models.models_config import MODEL_REGISTRY_DICT
|
|
103
112
|
fresh = dataclasses.replace(cfg, tasks=list(new_t), primary_task=new_p)
|
|
104
113
|
MODEL_REGISTRY[model_key] = fresh
|
|
105
114
|
row = MODEL_REGISTRY_DICT.get(model_key)
|
|
106
115
|
if isinstance(row, dict):
|
|
107
116
|
row["tasks"], row["primary_task"] = list(new_t), new_p
|
|
108
117
|
try:
|
|
109
|
-
from
|
|
118
|
+
from ..config.models.models_default import refresh_task_registries
|
|
110
119
|
refresh_task_registries()
|
|
111
120
|
except Exception: # noqa: BLE001
|
|
112
121
|
logger.debug("task registry refresh after VL adopt failed", exc_info=True)
|
|
@@ -126,7 +135,7 @@ def _servable_catalog() -> list:
|
|
|
126
135
|
the raw catalog was not captured (registry built by another path), synthesize
|
|
127
136
|
rows from MODEL_REGISTRY itself, carrying the placement facts off cfg.extra so
|
|
128
137
|
capability ranking still prefers resident/available models."""
|
|
129
|
-
from
|
|
138
|
+
from ..config.models.models_config import catalog_rows
|
|
130
139
|
rows = catalog_rows()
|
|
131
140
|
if rows:
|
|
132
141
|
filtered = [r for r in rows
|
|
@@ -153,9 +162,9 @@ def _rank_for_task(task: Optional[str] = None,
|
|
|
153
162
|
"""The ranked decision for a task / media_type via the dependency-light
|
|
154
163
|
resolver: explicit(none here) -> binding -> default -> capability. Returns
|
|
155
164
|
the task_resolution.resolve() dict {model_key, source, reason, candidates}."""
|
|
156
|
-
from
|
|
157
|
-
from
|
|
158
|
-
from
|
|
165
|
+
from ..config.models.models_config import task_bindings
|
|
166
|
+
from ..categories import MEDIA_DEFAULTS, TASK_DEFAULTS
|
|
167
|
+
from . import task_resolution as _tr
|
|
159
168
|
return _tr.resolve(task=task, media_type=media_type,
|
|
160
169
|
catalog=_servable_catalog(), bindings=task_bindings(),
|
|
161
170
|
defaults=TASK_DEFAULTS, media_defaults=MEDIA_DEFAULTS)
|
|
@@ -205,7 +214,7 @@ def resolve_model_key_traced(
|
|
|
205
214
|
"""
|
|
206
215
|
# Direct callers (not via resolve()) must not see a cold, empty registry: load
|
|
207
216
|
# it here too. TTL-cached and fail-open, so the resolve() path pays nothing.
|
|
208
|
-
from
|
|
217
|
+
from ..config.models.models_config import refresh_registry
|
|
209
218
|
refresh_registry()
|
|
210
219
|
if task is not None and task not in KNOWN_TASKS_REGISTRY and task not in TASK_ROUTES:
|
|
211
220
|
raise KeyError(
|
|
@@ -225,7 +234,7 @@ def resolve_model_key_traced(
|
|
|
225
234
|
# Fail with NEAR MATCHES, not the whole registry. Two cases produce
|
|
226
235
|
# a None here: nothing matched, or a fuzzy tie the pipeline could
|
|
227
236
|
# not break (both land as an ambiguous/unknown 400 for the caller).
|
|
228
|
-
from
|
|
237
|
+
from .assure_model_key import fuzzy_model_candidates
|
|
229
238
|
near = fuzzy_model_candidates(requested)
|
|
230
239
|
if near:
|
|
231
240
|
raise ValueError(
|
|
@@ -238,6 +247,7 @@ def resolve_model_key_traced(
|
|
|
238
247
|
)
|
|
239
248
|
_refuse_if_unclassified(model_key, MODEL_REGISTRY[model_key])
|
|
240
249
|
if task is not None and task not in MODEL_REGISTRY[model_key].tasks \
|
|
250
|
+
and not _vl_answers_text(MODEL_REGISTRY[model_key], task) \
|
|
241
251
|
and _adopt_vl_tasks_from_disk(model_key, MODEL_REGISTRY[model_key], task) is None:
|
|
242
252
|
raise ValueError(
|
|
243
253
|
f"Model {model_key!r} does not support task={task!r}; "
|
|
@@ -279,7 +289,7 @@ def resolve_model_key_traced(
|
|
|
279
289
|
logger.debug("resolve_model_key: file=%s -> media=%s", file, media_type)
|
|
280
290
|
|
|
281
291
|
if media_type is not None:
|
|
282
|
-
from
|
|
292
|
+
from .task_resolution import MEDIA_TYPE_TO_TASK
|
|
283
293
|
if media_type not in MEDIA_DEFAULTS and media_type not in MEDIA_TYPE_TO_TASK:
|
|
284
294
|
raise KeyError(
|
|
285
295
|
f"No default model for media_type={media_type!r}; "
|
|
@@ -346,7 +356,7 @@ def resolve(prompt_kwargs: Dict[str, Any]) -> Resolution:
|
|
|
346
356
|
# reconcile_defaults() then heal the task-filtered views and TASK_DEFAULTS
|
|
347
357
|
# from that live set.
|
|
348
358
|
refresh_registry()
|
|
349
|
-
from
|
|
359
|
+
from ..config.models.models_default import (
|
|
350
360
|
reconcile_defaults, refresh_task_registries)
|
|
351
361
|
refresh_task_registries()
|
|
352
362
|
reconcile_defaults()
|
|
@@ -411,7 +421,7 @@ def resolve(prompt_kwargs: Dict[str, Any]) -> Resolution:
|
|
|
411
421
|
|
|
412
422
|
if task not in cfg.tasks:
|
|
413
423
|
cfg = _adopt_vl_tasks_from_disk(model_key, cfg, task) or cfg
|
|
414
|
-
if task not in cfg.tasks:
|
|
424
|
+
if task not in cfg.tasks and not _vl_answers_text(cfg, task):
|
|
415
425
|
raise ValueError(
|
|
416
426
|
f"Model {model_key!r} does not support task={task!r}; "
|
|
417
427
|
f"supported: {sorted(cfg.tasks)}"
|
|
@@ -544,11 +554,11 @@ def validate_registry() -> None:
|
|
|
544
554
|
missing_plugins: dict[str, list[str]] = {}
|
|
545
555
|
|
|
546
556
|
try:
|
|
547
|
-
from
|
|
557
|
+
from ..config.models.models_config import MODELS as _STAPLES
|
|
548
558
|
except Exception:
|
|
549
559
|
_STAPLES = {}
|
|
550
560
|
|
|
551
|
-
from
|
|
561
|
+
from ..categories import RUNNER_PAIRS
|
|
552
562
|
|
|
553
563
|
def _plugin_missing(framework, task) -> bool:
|
|
554
564
|
# A pair the ecosystem serves (categories.RUNNER_PAIRS) that no package
|
|
@@ -507,7 +507,7 @@ def resolve(task=None, model_key=None, media_type=None, *, catalog=None,
|
|
|
507
507
|
# LOADERS — thin stdlib fetchers (core_url, timeout). Never raise.
|
|
508
508
|
# ---------------------------------------------------------------------------
|
|
509
509
|
def _get_json(url, timeout):
|
|
510
|
-
from
|
|
510
|
+
from ..core_auth import core_headers
|
|
511
511
|
req = urllib.request.Request(url, headers=core_headers(url, {"Accept": "application/json"}))
|
|
512
512
|
with urllib.request.urlopen(req, timeout=timeout) as r:
|
|
513
513
|
return json.loads(r.read().decode("utf-8") or "null")
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
from typing import Any, Mapping, Optional, Union
|
|
3
3
|
from abstract_essentials import read_from_file
|
|
4
4
|
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
|
5
|
-
from
|
|
5
|
+
from .task_schemas import TaskResult
|
|
6
6
|
from hugpy_platform.constants import (
|
|
7
7
|
DEFAULT_MAX_TOKENS,
|
|
8
8
|
DEFAULT_TEMPERATURE,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from dataclasses import MISSING, asdict, dataclass, field, fields
|
|
2
2
|
from typing import Any, Optional
|
|
3
3
|
from pydantic import model_validator
|
|
4
|
-
from
|
|
4
|
+
from .metadata_schemas import ModelMetadata
|
|
5
5
|
from hugpy_platform.constants import DEFAULT_LOCAL_FILES_ONLY, DEFAULT_MAX_TOKENS
|
|
6
6
|
from hugpy_platform.utils import safe_dtype_name
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from typing import AsyncIterator, Protocol, Union, runtime_checkable
|
|
2
|
-
from
|
|
3
|
-
from
|
|
2
|
+
from .event_schemas import DoneEvent, ErrorEvent, StatusEvent, TokenEvent
|
|
3
|
+
from .task_schemas import TaskRequest, TaskResult
|
|
4
4
|
# ---------------------------------------------------------------------------
|
|
5
5
|
# Runner protocol
|
|
6
6
|
# ---------------------------------------------------------------------------
|
|
@@ -6,7 +6,7 @@ summarize, keywords, ASR, TTS, image/video generation) has a dedicated
|
|
|
6
6
|
front-door route; this module is the engine side of that:
|
|
7
7
|
|
|
8
8
|
* :data:`TASK_ROUTES` — the task -> (route, output) PROTOCOL table. It MIRRORS
|
|
9
|
-
the wrapper's RunnerSpec ``tasks``/``endpoint`` (fitevict/
|
|
9
|
+
the wrapper's RunnerSpec ``tasks``/``endpoint`` (fitevict/engines/runners).
|
|
10
10
|
Routes are protocol, so they live in code; MODEL NAMES never do (bindings
|
|
11
11
|
come from the DB via hugpy_core, see config.models.models_config.task_bindings).
|
|
12
12
|
* :func:`build_endpoint_request` — maps execute_prompt kwargs onto each route's
|
|
@@ -36,8 +36,8 @@ from typing import Optional
|
|
|
36
36
|
|
|
37
37
|
from pydantic import ConfigDict
|
|
38
38
|
|
|
39
|
-
from
|
|
40
|
-
from
|
|
39
|
+
from .schemas.event_schemas import DoneEvent, ErrorEvent, TokenEvent
|
|
40
|
+
from .schemas.task_schemas import TaskRequest, TaskResult
|
|
41
41
|
from hugpy_platform.utils import make_request_id
|
|
42
42
|
|
|
43
43
|
logger = logging.getLogger(__name__)
|
|
@@ -252,7 +252,7 @@ def build_endpoint_request(kwargs: dict, model_key: str, *, task: str,
|
|
|
252
252
|
# Only the Comfy checkpoint runner currently implements this image
|
|
253
253
|
# conditioning contract. Refuse before relay, including when an
|
|
254
254
|
# older remote Wrapper would otherwise ignore the new fields.
|
|
255
|
-
from
|
|
255
|
+
from .config.models.models_config import MODEL_REGISTRY
|
|
256
256
|
selected = MODEL_REGISTRY.get(model_key)
|
|
257
257
|
if getattr(selected, "framework", None) != "comfy":
|
|
258
258
|
raise ValueError("reference images require a Comfy checkpoint with "
|
|
@@ -344,7 +344,7 @@ class TaskEndpointRunner:
|
|
|
344
344
|
|
|
345
345
|
def _post(self, url: str, body: dict, timeout: float,
|
|
346
346
|
request_id: "str | None" = None) -> "tuple[int, dict]":
|
|
347
|
-
from
|
|
347
|
+
from .core_auth import core_headers
|
|
348
348
|
headers = {"Content-Type": "application/json"}
|
|
349
349
|
if request_id:
|
|
350
350
|
# core records it as this call's parent and forwards it as the chain's
|
|
@@ -311,13 +311,13 @@ def execute_prompt_no_think(*args: Any, **kwargs: Any) -> dict:
|
|
|
311
311
|
ctk.setdefault(k, v)
|
|
312
312
|
kwargs["chat_template_kwargs"] = ctk
|
|
313
313
|
|
|
314
|
-
from
|
|
314
|
+
from ..dispatch.dispatch import execute_prompt
|
|
315
315
|
|
|
316
316
|
result = execute_prompt(*args, **kwargs)
|
|
317
317
|
|
|
318
318
|
import inspect
|
|
319
319
|
if inspect.isawaitable(result):
|
|
320
|
-
from
|
|
320
|
+
from ..dispatch.dispatch import _run_coro_sync
|
|
321
321
|
result = _run_coro_sync(result)
|
|
322
322
|
|
|
323
323
|
return finalize_no_think(result)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hugpy-engine
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.15
|
|
4
4
|
Summary: Hugpy engine: model discovery and classification, allocation and eviction, native llama.cpp and GGUF runners, and the prompt-to-reply inference path with task and placement seams
|
|
5
5
|
Author-email: putkoff <support@hugpy.ai>
|
|
6
6
|
License-Expression: LicenseRef-Proprietary
|
|
@@ -27,28 +27,6 @@ and the call log. The engine itself does not load models in fleet mode.
|
|
|
27
27
|
Distribution `hugpy-engine`, import `hugpy_engine`. Dependencies:
|
|
28
28
|
`hugpy-platform`, `abstract-essentials`, `pydantic>=2`.
|
|
29
29
|
|
|
30
|
-
**Status: LIVE.** It is a library only: no service, no console script.
|
|
31
|
-
|
|
32
|
-
- Installed in `/opt/hugpy-media/venv` (0.3.7) and `/opt/hugpy-video/venv`
|
|
33
|
-
(0.3.8).
|
|
34
|
-
- Imported by `hugpy_media`, `hugpy_video` and `hugpy_oracle`.
|
|
35
|
-
- Core's live basic mode does not use it. Only core's legacy
|
|
36
|
-
`config/prompt.py` does, and that code is not live.
|
|
37
|
-
|
|
38
|
-
On 2026-10-15 the engine's last ties to `hugpy-storage` and `hugpy-control`
|
|
39
|
-
are being removed, targeting 0.3.9 and later:
|
|
40
|
-
|
|
41
|
-
- `vl_gguf_tasks` is ported in from `hugpy_storage.hugpy_marker`.
|
|
42
|
-
- The `hugpy_storage.model_paths.route_destination` call is dropped; it was
|
|
43
|
-
dead in fleet mode.
|
|
44
|
-
- `hugpy_storage.console.downloader.model_status` is replaced by registry
|
|
45
|
-
availability from `/v1/models`.
|
|
46
|
-
- The guarded imports of the retired `hugpy_control.settings.settings_store`
|
|
47
|
-
are deleted.
|
|
48
|
-
|
|
49
|
-
Check `pyproject.toml` for the current version. See
|
|
50
|
-
[docs/packages.md](../../docs/packages.md#versions-in-flight).
|
|
51
|
-
|
|
52
30
|
## Public API
|
|
53
31
|
|
|
54
32
|
```python
|
|
@@ -200,5 +178,5 @@ hugpy_engine/
|
|
|
200
178
|
See also:
|
|
201
179
|
|
|
202
180
|
- [docs/execute_prompt.md](../../docs/execute_prompt.md)
|
|
203
|
-
- [docs/arms.md](../../docs/
|
|
204
|
-
- [docs/packages.md](../../
|
|
181
|
+
- [docs/arms.md](../../hugpy-core/package/docs/ROUTES-CONVENTION.md)
|
|
182
|
+
- [docs/packages.md](../../README.md)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|