From 88c2659a9cc594521e789ee8ad2442667d3c158c Mon Sep 17 00:00:00 2001 From: Hitonabi Date: Thu, 2 Jul 2026 11:25:46 +0200 Subject: [PATCH] P3: llama-swap capabilities deklariert + Plugin lernt Tool-Namen (Hermes-0.18-API) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - deploy-Config: capabilities (in/out/tools/context) je Modell — /v1/models informiert Clients korrekt; context = nutzbarer Kontext pro Request (c/parallel) - mc2-memory: sync_turn nutzt messages aus Hermes >=0.18 — nur Tool-NAMEN (Ergebnisse bleiben draussen: untrusted/Poisoning-Vektor); deployt, Postcheck gruen - Mem0 v3-Algorithmus auf der Box verifiziert (BM25/Entity/Hybrid in 2.0.8 aktiv) Co-Authored-By: Claude Fable 5 --- deploy/llama-swap.config.yaml | 30 +++++++++++++++++++++++++++ hermes/plugins/mc2-memory/__init__.py | 12 +++++++++++ 2 files changed, 42 insertions(+) diff --git a/deploy/llama-swap.config.yaml b/deploy/llama-swap.config.yaml index 06b8bc1..33cb109 100644 --- a/deploy/llama-swap.config.yaml +++ b/deploy/llama-swap.config.yaml @@ -13,24 +13,44 @@ models: aliases: - hermes - fast + # context = nutzbarer Kontext PRO REQUEST (c geteilt durch parallel-Slots). + capabilities: + in: [text] + out: [text] + tools: true + context: 65536 Qwen3.5-122B-A10B: cmd: | llama-server -m /srv/models/Qwen3.5-122B-A10B-GGUF/Q4_K_M/Qwen3.5-122B-A10B-Q4_K_M-00001-of-00003.gguf --host 127.0.0.1 --port ${PORT} -c 32768 -ngl 999 -fa on --no-mmap --jinja --cache-reuse 256 -cram 16384 ttl: 600 aliases: - heavy + capabilities: + in: [text] + out: [text] + tools: true + context: 32768 Qwen3-Coder-Next: cmd: | llama-server -m /srv/models/Qwen3-Coder-Next-GGUF/Qwen3-Coder-Next-Q4_K_M.gguf --host 127.0.0.1 --port ${PORT} -c 131072 -ngl 999 -fa on --no-mmap --jinja --cache-reuse 256 -cram 16384 ttl: 600 aliases: - coder + capabilities: + in: [text] + out: [text] + tools: true + context: 131072 Qwen3-VL-8B-Instruct: cmd: | llama-server -m /srv/models/Qwen3-VL-8B-Instruct-GGUF/Qwen3VL-8B-Instruct-Q4_K_M.gguf --host 127.0.0.1 --port ${PORT} -c 32768 -ngl 999 -fa on --no-mmap --mmproj /srv/models/Qwen3-VL-8B-Instruct-GGUF/mmproj-Qwen3VL-8B-Instruct-F16.gguf --jinja ttl: 300 aliases: - vision + capabilities: + in: [text, image] + out: [text] + context: 32768 Qwen3-Embedding-0.6B: cmd: | llama-server -m /srv/models/Qwen3-Embedding-0.6B-GGUF/Qwen3-Embedding-0.6B-Q8_0.gguf --host 127.0.0.1 --port ${PORT} --embedding --pooling last -ngl 999 -fa on --no-mmap -c 8192 @@ -43,12 +63,22 @@ models: ttl: 300 aliases: - coder-lite + capabilities: + in: [text] + out: [text] + tools: true + context: 131072 GLM-4.6V-Flash: cmd: | llama-server -m /srv/models/GLM-4.6V-Flash-GGUF/GLM-4.6V-Flash-Q4_K_M.gguf --host 127.0.0.1 --port ${PORT} -c 131072 -ngl 999 -fa on --no-mmap --mmproj /srv/models/GLM-4.6V-Flash-GGUF/mmproj-BF16.gguf --jinja ttl: 300 aliases: - scout + capabilities: + in: [text, image] + out: [text] + tools: true + context: 131072 groups: brains: swap: false diff --git a/hermes/plugins/mc2-memory/__init__.py b/hermes/plugins/mc2-memory/__init__.py index 9fba4fb..3b8cfa8 100644 --- a/hermes/plugins/mc2-memory/__init__.py +++ b/hermes/plugins/mc2-memory/__init__.py @@ -150,6 +150,18 @@ class MC2MemoryProvider(MemoryProvider): return msgs: List[Dict[str, str]] = [{"role": "user", "content": u}] a = (assistant_content or "").strip() + # Hermes ≥0.18 liefert optional den vollen Turn-Kontext (`messages`, inkl. Tool-Calls). + # Bewusst NUR die Tool-NAMEN mitlernen ("hat X per Tool Y geprüft") — Tool-ERGEBNISSE + # sind untrusted (Web-Inhalte!) und wären ein Poisoning-Vektor am Junk-Guard vorbei. + if messages: + tools = [] + for m in messages: + for tc in (m.get("tool_calls") or []): + name = ((tc.get("function") or {}).get("name") or "").strip() + if name and name not in tools: + tools.append(name) + if tools: + a = (a + f"\n[genutzte Tools: {', '.join(tools[:6])}]").strip() if a: msgs.append({"role": "assistant", "content": a[:4000]}) try: