feat: tools bei Modellen ohne Werkzeug-Vorlage klar ablehnen, nicht bestandenen Werkzeug-Test anzeigen (#1268)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 12:28:21 +01:00
parent 21d419aab1
commit 2ad3121c7c
9 changed files with 168 additions and 3 deletions

View File

@ -65,6 +65,12 @@ class Handler(BaseHTTPRequestHandler):
self._send_json(200, {"status": "ok"})
else:
self._send_json(503, {"error": {"message": "Loading model"}})
elif self.path == "/props":
kann = os.environ.get("FAKE_LLAMA_TOOLS")
if kann is None:
self._send_json(404, {})
else:
self._send_json(200, {"chat_template_caps": {"supports_tools": kann == "1"}})
elif self.path == "/v1/models":
alias = opt("--alias") or "modell"
self._send_json(200, {"object": "list", "data": [{"id": alias, "object": "model", "created": 0, "owned_by": "fake"}]})

View File

@ -111,6 +111,27 @@ async fn start_bereit_log_und_stopp() {
engine.stop(&inst, Duration::from_secs(1)).await.unwrap();
}
#[tokio::test]
async fn auskunft_der_chat_vorlage_zu_werkzeugen() {
for (wert, erwartet) in [
(Some("0"), Some(false)),
(Some("1"), Some(true)),
(None, None),
] {
let mut f = fixture("ok", 20);
if let Some(wert) = wert {
f.config
.env
.insert("FAKE_LLAMA_TOOLS".to_string(), wert.to_string());
}
let engine = LlamaCppEngine::new(f.config.clone());
let inst = engine.start(&profile(&f)).await.expect("Start");
assert_eq!(engine.tool_support(&inst).await, erwartet, "{wert:?}");
engine.stop(&inst, Duration::from_secs(5)).await.unwrap();
assert_eq!(engine.tool_support(&inst).await, None);
}
}
#[tokio::test]
async fn von_aussen_beendeter_prozess_wird_als_gone_erkannt() {
let f = fixture("ok", 20);