|
AQIT 0.1.0
|
Functions | |
| int | _port () |
| str | _base () |
| str | _url (str path) |
| tuple[int|None, Any] | _get (str path, float timeout=1.5) |
| tuple[int|None, Any] | _post (str path, dict|None body, float timeout=DEFAULT_TIMEOUT) |
| dict|None | health (float timeout=1.5) |
| dict|None | health_fast () |
| bool | is_running () |
| str|None | loaded_model () |
| bool | _port_occupied () |
| None | _write_state (int pid) |
| None | _clear_state () |
| bool | _spawn () |
| bool | ensure_running (float wait_seconds=40.0) |
| dict|None | switch_model (str model_id, float timeout=DEFAULT_TIMEOUT, *, Any on_tick=None) |
| dict|None | warm_sae (str model_id, int layer, float timeout=600) |
| dict|None | dispatch (str name, dict args, dict ctx, float timeout=DEFAULT_TIMEOUT) |
| bool | unload () |
| dict|None | prompt (str text, *, str|None model_id=None, int max_new_tokens=200, float temperature=0.7, float timeout=DEFAULT_TIMEOUT) |
| bool | stop () |
Variables | |
| _HOST = DEFAULT_ENGINE_HOST | |
| str | _LOG_PATH = Path.home() / ".aquin" / "daemon.log" |
| int | DEFAULT_TIMEOUT = 1800 |
| float | FAST_TIMEOUT = 0.2 |
|
protected |
Definition at line 48 of file model_daemon.py.
|
protected |
Definition at line 124 of file model_daemon.py.
Referenced by stop().
|
protected |
Definition at line 56 of file model_daemon.py.
References _url().
Referenced by _port_occupied(), and health().
|
protected |
Definition at line 44 of file model_daemon.py.
Referenced by _spawn(), and _write_state().
|
protected |
Something is listening on the port (may be a non-daemon chat server).
Definition at line 105 of file model_daemon.py.
References _get().
Referenced by ensure_running().
|
protected |
Definition at line 65 of file model_daemon.py.
References _url().
Referenced by dispatch(), prompt(), stop(), switch_model(), unload(), and warm_sae().
|
protected |
Spawn the daemon as a detached background process. Returns spawn success.
Definition at line 131 of file model_daemon.py.
References _port(), and _write_state().
Referenced by ensure_running().
|
protected |
Definition at line 52 of file model_daemon.py.
|
protected |
| dict | None dispatch | ( | str | name, |
| dict | args, | ||
| dict | ctx, | ||
| float | timeout = DEFAULT_TIMEOUT ) |
Run a tool in the daemon. Returns {"ok": bool, "result"|"error": ...} or None.
Definition at line 221 of file model_daemon.py.
References _post().
| bool ensure_running | ( | float | wait_seconds = 40.0 | ) |
Make sure the daemon HTTP server is up. Returns True if it is (or becomes) reachable. Does NOT load a model; use switch_model for that.
Definition at line 164 of file model_daemon.py.
References _port_occupied(), _spawn(), and is_running().
| dict | None health | ( | float | timeout = 1.5 | ) |
Return the daemon health payload, or None if no daemon is answering.
Definition at line 83 of file model_daemon.py.
References _get().
Referenced by health_fast(), is_running(), loaded_model(), and switch_model().
| dict | None health_fast | ( | ) |
Quick probe for status screens : fails fast when daemon is down.
Definition at line 91 of file model_daemon.py.
References health().
| bool is_running | ( | ) |
| str | None loaded_model | ( | ) |
Definition at line 100 of file model_daemon.py.
References health().
| dict | None prompt | ( | str | text, |
| * | , | ||
| str | None | model_id = None, | ||
| int | max_new_tokens = 200, | ||
| float | temperature = 0.7, | ||
| float | timeout = DEFAULT_TIMEOUT ) |
Generate a completion from the daemon's resident model.
Definition at line 235 of file model_daemon.py.
References _post().
| bool stop | ( | ) |
Ask the daemon to shut down and clear local state.
Definition at line 257 of file model_daemon.py.
References _clear_state(), and _post().
| dict | None switch_model | ( | str | model_id, |
| float | timeout = DEFAULT_TIMEOUT, | ||
| * | , | ||
| Any | on_tick = None ) |
Load model_id in the daemon, evicting any previously resident model.
Definition at line 184 of file model_daemon.py.
| bool unload | ( | ) |
Free the daemon's VRAM (keeps the daemon process alive).
Definition at line 229 of file model_daemon.py.
References _post().
| dict | None warm_sae | ( | str | model_id, |
| int | layer, | ||
| float | timeout = 600 ) |
Definition at line 214 of file model_daemon.py.
References _post().
|
protected |
Definition at line 36 of file model_daemon.py.
|
protected |
Definition at line 37 of file model_daemon.py.
| int aquin.engine.model_daemon.DEFAULT_TIMEOUT = 1800 |
Definition at line 40 of file model_daemon.py.
| float aquin.engine.model_daemon.FAST_TIMEOUT = 0.2 |
Definition at line 41 of file model_daemon.py.