llm: extend HostPool fan-out from embeddings to chat/generation #654
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
llm.pool.HostPooldoes least-loaded fan-out with health + model checks, but onlyembed_textsuses it (raw/api/embed). Add the generation analog:generate_texts/chatfan-out over/api/chat(or the OpenAI-compat/v1/chat/completions) with the same least-loadedacquire()discipline, per-host in-flight limit (1-2 — Ollama serializes per-model anyway), timeouts, and tool-call passthrough.Design refinement: the generation fan-out should call
/api/chatwithoptions: {num_ctx: 8192}(per-request) instead of requiring the customqwen2.5:14b-ctx8kModelfile variant on every host. Then each fleet member needs only a vanillaollama pull qwen2.5:14b, and context size travels with the request rather than with per-host model state. (The OpenAI-compat/v1endpoint cannot carrynum_ctx, so the pool should speak native/api/chat— it already speaks native/api/embedfor the same reason.)Done (2026-09-03, commits 6425557..fafa3d4 on main; spec docs/superpowers/specs/2026-09-03-llm-corpus-recency-links-gpu-design.md).
LLM_OLLAMA_HOSTSentries carry declared VRAM (url@24);HostPool.acquire_generation()picks the largest live host that serves the model (re-probed per request, falls back when the rig is down);pick_model()usesqwen2.5:32bon ≥20 GB hosts, elseqwen2.5:14b;num_ctx8192 passed per request.GET /hostson the llm service andstack llm hostsCLI show the fleet + the generation pick./hosts→qwen2.5:32b @ 192.168.1.222; a chat through the container loaded 32b on the rig (21.8 GB resident). Embeds still fan out least-loaded across all three GPUs.