Steer docs-KB tool usage: params.system hint to query only co-op-relevant questions
This commit is contained in:
1 parent
32420f60f4
commit
a7a283d552
1 file changed
+23
+23
@@ -1970,6 +1970,29 @@ async def list_models(request: Request):
|
|||||||
if kb_entry not in model["info"]["meta"]["knowledge"]:
|
if kb_entry not in model["info"]["meta"]["knowledge"]:
|
||||||
model["info"]["meta"]["knowledge"].append(kb_entry)
|
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)
|
return JSONResponse(content=payload)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user