feat: stufen-spezifisches Token-Limit für die Solver-Stufe (LLM_MAX_TOKENS_SOLVER)
Die Solver-Stufe erzeugt langen Python-Code plus Reasoning. Bei komplexen Aufgaben (Portfoliomanagement: 4× je ~26k Reasoning-Tokens am 32k-Limit abgeschnitten, $0,28 für nichts) reichte das globale Limit nicht. DeepSeek V4.1 Flash unterstützt bis 393k Output-Tokens (OpenRouter). Neu: LLM_MAX_TOKENS_SOLVER (Default 65536, 0 = globales Limit gilt auch für den Solver). Wirkt nur für die Stufen 'Solver-Code' und 'Solver-Reparatur'. CLI-Option --max-tokens-solver. 438 Tests grün.
This commit is contained in:
parent
e80a104cf9
commit
e7a2b8de81
1 changed files with 51 additions and 11 deletions
|
|
@ -86,6 +86,28 @@ def test_max_tokens_is_sent_to_openrouter():
|
|||
assert completions["openrouter"].kwargs["max_tokens"] == llm.LLM_MAX_TOKENS >= 16000
|
||||
|
||||
|
||||
def test_solver_step_uses_higher_max_tokens():
|
||||
# beobachtet am Portfoliomanagement: 4× je ~26k Reasoning-Tokens am 32k-Limit abgeschnitten.
|
||||
# DeepSeek V4.1 Flash unterstützt bis 393k Output-Tokens (OpenRouter) – die Solver-Stufe bekommt
|
||||
# ein eigenes, höheres Limit, die übrigen Stufen bleiben beim globalen.
|
||||
s_solver, c_solver = fake_session()
|
||||
s_solver.create(str, [{"role": "user", "content": "x"}], step="Solver-Code")
|
||||
assert c_solver["openrouter"].kwargs["max_tokens"] == llm.LLM_MAX_TOKENS_SOLVER > llm.LLM_MAX_TOKENS
|
||||
s_repair, c_repair = fake_session()
|
||||
s_repair.create(str, [{"role": "user", "content": "y"}], step="Solver-Reparatur")
|
||||
assert c_repair["openrouter"].kwargs["max_tokens"] == llm.LLM_MAX_TOKENS_SOLVER
|
||||
s_extra, c_extra = fake_session()
|
||||
s_extra.create(str, [{"role": "user", "content": "z"}], step="Extraktion")
|
||||
assert c_extra["openrouter"].kwargs["max_tokens"] == llm.LLM_MAX_TOKENS
|
||||
|
||||
|
||||
def test_solver_max_tokens_zero_falls_back_to_global(monkeypatch):
|
||||
monkeypatch.setattr(llm, "LLM_MAX_TOKENS_SOLVER", 0)
|
||||
session, completions = fake_session()
|
||||
session.create(str, [{"role": "user", "content": "x"}], step="Solver-Code")
|
||||
assert completions["openrouter"].kwargs["max_tokens"] == llm.LLM_MAX_TOKENS
|
||||
|
||||
|
||||
# --- Modell je Pipeline-Stufe (LLM_MODEL_EXTRACTION, LLM_MODEL_SOLVER, ...) ---
|
||||
|
||||
def test_step_model_falls_back_to_session_model(monkeypatch):
|
||||
|
|
|
|||
Loading…
Reference in a new issue