From a7a283d552ceb92d594f603a7ca9472599d2583a Mon Sep 17 00:00:00 2001 From: Inferencebot Date: Thu, 8 Oct 2026 09:38:05 -0600 Subject: [PATCH] Steer docs-KB tool usage: params.system hint to query only co-op-relevant questions --- app/main.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/main.py b/app/main.py index 3c288e9..d1435af 100644 --- a/app/main.py +++ b/app/main.py @@ -1970,6 +1970,29 @@ async def list_models(request: Request): if kb_entry not in model["info"]["meta"]["knowledge"]: model["info"]["meta"]["knowledge"].append(kb_entry) + # Steering: with knowledge attached, the model gets a + # query_knowledge_files tool and tends to call it on every + # prompt — including questions unrelated to the co-op — which + # adds an embedding call + vector search (latency) before + # answering. params.system is merged ahead of any system + # content by Open WebUI's middleware, so a short instruction + # here keeps the tool for co-op questions without suppressing + # it entirely. + model.setdefault("params", {}) + steering = ( + "The attached knowledge contains the Inference Cooperative's " + "own documentation (membership, models, API, governance). " + "Query it only when the user's question actually concerns " + "the co-op, its services, or its governance — for general " + "questions, just answer directly." + ) + existing = model["params"].get("system") + if existing: + if "Inference Cooperative's" not in existing: + model["params"]["system"] = existing + "\n\n" + steering + else: + model["params"]["system"] = steering + return JSONResponse(content=payload)