diff --git a/projekt-matching/projektmatch/llm.py b/projekt-matching/projektmatch/llm.py index 210af4c..b03415a 100644 --- a/projekt-matching/projektmatch/llm.py +++ b/projekt-matching/projektmatch/llm.py @@ -94,9 +94,10 @@ vor Signalwörtern; "idealerweise" INNERHALB einer Must-Zeile lässt die \ Zeile Must bleiben. Nice-Signalwörter gelten NUR für die Zeile, in der \ sie selbst stehen — sie färben NIE auf folgende Zeilen ab: Jede Zeile \ eines Anforderungs-Abschnitts OHNE eigenes Nice-Signalwort ist Must, \ -auch wenn direkt davor Nice-Zeilen stehen. Beispiel: Auf "Idealerweise \ -zusätzlich Erfahrung mit X" (Nice) folgt "Erfahrung mit Y" ohne \ -Signalwort → Y ist Must. +auch wenn direkt davor Nice-Zeilen stehen — AUSNAHME: Zeilen unter einer \ +expliziten Nice-to-haves-Überschrift bleiben Nice. Beispiel: Auf \ +"Idealerweise zusätzlich Erfahrung mit X" (Nice) folgt "Erfahrung mit Y" \ +ohne Signalwort → Y ist Must. - miscType nur für Misc-Zeilen relevant (sonst "other"): start = \ Projektstart/Verfügbarkeit (startDate als ISO-Datum YYYY-MM-DD, wenn ein \ konkretes Datum genannt ist, sonst null); workload = Auslastung \ @@ -146,6 +147,8 @@ def _post(base, model, messages, schema): def chat_json(base, model, messages, schema, attempts=3): + if attempts < 1: + raise ValueError("attempts must be >= 1") last = None for attempt in range(attempts): resp = _post(base, model, messages, schema) diff --git a/projekt-matching/tests/test_llm.py b/projekt-matching/tests/test_llm.py index 8771e68..5a5fd92 100644 --- a/projekt-matching/tests/test_llm.py +++ b/projekt-matching/tests/test_llm.py @@ -25,6 +25,7 @@ def test_chat_json_strips_think_and_parses(): assert out == {"a": 1} body = p.call_args.kwargs["json"] assert "max_tokens" not in body + assert body["chat_template_kwargs"] == {"enable_thinking": False} assert body["response_format"]["json_schema"]["schema"] == {"type": "object"}