update
This commit is contained in:
@@ -11,8 +11,10 @@ UNI_DIR = PROJECT_ROOT / "uni"
|
||||
|
||||
|
||||
def _load_env(path: Path) -> None:
|
||||
"""Mini .env loader (no dependency): KEY=VALUE lines; existing env always wins
|
||||
(`make dev` already exports .env — this covers bare `uvicorn`/pytest starts)."""
|
||||
"""Mini .env loader (no dependency): KEY=VALUE lines. The FILE wins over inherited
|
||||
env: a --reload master keeps its startup environment forever, so "existing env wins"
|
||||
silently pinned stale values across .env edits (measured: file said 24, workers
|
||||
inherited 15 for hours). Trade-off: ad-hoc shell overrides lose against the file."""
|
||||
try:
|
||||
text = path.read_text(encoding="utf-8")
|
||||
except OSError:
|
||||
@@ -23,7 +25,7 @@ def _load_env(path: Path) -> None:
|
||||
continue
|
||||
key, _, value = line.partition("=")
|
||||
key, value = key.strip(), value.strip().strip('"').strip("'")
|
||||
if key and key not in os.environ:
|
||||
if key:
|
||||
os.environ[key] = value
|
||||
|
||||
|
||||
@@ -59,6 +61,15 @@ EMBEDDING_BLOCK_CAP = 25 # max. titles per block (keep the LLM list short/s
|
||||
# block context — from this cosine on two are the same statement (checked on aak: ≥0.88 are
|
||||
# without exception true duplicates). Conservative 0.90 so different aspects (∈NP ≠ NP-hard) stay separate.
|
||||
EMBEDDING_SUB_DUP = 0.90
|
||||
# Variant folding BEFORE the subblock consensus count: finders rephrase the same concept each
|
||||
# round, so exact-norm counting starves real concepts (measured Markdown run: 623/965 mentions
|
||||
# discarded, „Zeichenkodierung" 73/74). 0.90 folds true paraphrases at ~0 false folds (0.85/0.88
|
||||
# fold distinct aspects like ** vs ***). Antonym pairs measure 0.91–0.95 → negation guard required.
|
||||
SUB_VARIANT_COS = 0.90
|
||||
# Seed coverage check is LEXICAL first (token containment) — seeds are short fragment NAMES,
|
||||
# subs are statements: true covers measure 0.27–0.38 while a wrong hit measured 0.76. The
|
||||
# embedding stage only backs up the lexical one (catches „Line Breaks (Soft)" 0.888).
|
||||
SEED_COVER_COS = 0.80
|
||||
|
||||
# Umbrella grouping (block granularity level 2, step "Blocks-Gruppierung", AFTER the filter):
|
||||
# collapse sibling DEFINITIONS that are components of ONE umbrella concept (TM model:
|
||||
@@ -83,6 +94,12 @@ GROUP_RECONCILE_FLOOR = 0.75
|
||||
# umbrella). This floor is demoted to a near-zero backstop that only rejects a literally structureless
|
||||
# chain (random-pair baseline), set BELOW the legitimate heterogeneous minimum so it never kills a real model.
|
||||
GROUP_MIN_COS_FLOOR = 0.15
|
||||
# Fragment-demote backstop, same logic as GROUP_MIN_COS_FLOOR: fragment↔parent cosine is a BAD
|
||||
# fragment detector (measured, Markdown run: wrong demotes Blockzitate→Codeblöcke 0.353 and
|
||||
# Zeichenkodierung→Überschriften 0.640 sit ABOVE any usable floor, while true NP proof-gadget
|
||||
# demotes αu-Variablen→Cook/Levin 0.172 sit low). So this only vetoes judge/panel demotes with
|
||||
# NO containment match whose pair is literally structureless (Emoji→Tabelle 0.136).
|
||||
FRAGMENT_MIN_COS = 0.15
|
||||
|
||||
# Caps for concurrent CLI agent processes (env-overridable). Two nested limits, both always active:
|
||||
# a per-topic cap and a global cap across all topics. Defaults 10/10 = previous behavior (global
|
||||
@@ -125,15 +142,15 @@ QUELLE_RELEVANZ_SNIPPET = 800 # body characters per page in the prompt (URL i
|
||||
# Timeouts per agent step: (base seconds, seconds per block/section).
|
||||
# Applies equally to all providers — whoever is too slow gets restarted or overtaken.
|
||||
TIMEOUTS = {
|
||||
"research": (1800, 0), # fixed 30 min
|
||||
"research": (900, 0), # p95 measured 125 s (web mode); uni/link sections need headroom
|
||||
"research_mapping": (600, 3), # n = pre-merged entries
|
||||
"selection_mapping": (600, 2), # n = remaining entries (block inventory)
|
||||
"ergaenzung": (900, 0), # subject-field extension for projects (web research)
|
||||
"ergaenzung": (600, 0), # subject-field extension for projects (web research)
|
||||
"plan": (300, 5),
|
||||
"plan_judge": (600, 5), # judge reads up to 5 outlines, n = sections
|
||||
"content": (600, 90), # identify content per block in the chunk (web search)
|
||||
"content": (450, 30), # facts find/erg/fix — p95 measured 241 s (was 600+90n)
|
||||
"content_check": (300, 10), # content exam per block in the package
|
||||
"subblock": (900, 45), # find subblocks per block in the chunk (web search)
|
||||
"subblock": (400, 15), # finder round — p95 measured 124 s (was 900+45n)
|
||||
"subblock_check": (300, 15), # judge decides contested subblocks in the chunk
|
||||
"level": (300, 10), # classify subblocks per chunk
|
||||
"level_check": (300, 10), # judge decides contested levels in the chunk
|
||||
@@ -141,7 +158,7 @@ TIMEOUTS = {
|
||||
"relevance_check": (300, 10), # judge decides contested relevance in the chunk
|
||||
"question_pattern": (300, 15), # question patterns per block (subblocks × types)
|
||||
"question_pattern_check": (300, 10), # critic cleans up the pattern table per block
|
||||
"writer": (600, 120), # per section in the chunk
|
||||
"writer": (450, 60), # per section — split keeps sections ≤30 subs
|
||||
"lese_check": (300, 10), # per section in the package
|
||||
# guide board (per card = one block)
|
||||
"lernziele": (300, 5), # backward-design objectives per block
|
||||
@@ -194,15 +211,14 @@ PROVIDERS = {
|
||||
},
|
||||
}
|
||||
|
||||
# Role routing ACROSS provider stacks: generation (quick/guide) and judging (judge)
|
||||
# may run on different providers within ONE run — judge model ≠ generator model
|
||||
# (research-backed: cross-model judging avoids self-preference bias).
|
||||
# Value: "" = provider of the run; "minimax" = that stack's role model;
|
||||
# "provider:model" = explicit model override.
|
||||
# Role routing: by DEFAULT the run's provider (the UI choice) handles ALL roles —
|
||||
# the role only picks the model WITHIN that stack (PROVIDERS[stack][role]).
|
||||
# Opt-in cross-provider mixing via env: ROLE_JUDGE=claude routes every judge call
|
||||
# to the claude stack regardless of the UI choice ("provider:model" pins a model).
|
||||
ROLE_ROUTING = {
|
||||
"quick": os.getenv("ROLE_QUICK", "minimax"),
|
||||
"judge": os.getenv("ROLE_JUDGE", "claude"),
|
||||
"guide": os.getenv("ROLE_GUIDE", "minimax"),
|
||||
"quick": os.getenv("ROLE_QUICK", ""),
|
||||
"judge": os.getenv("ROLE_JUDGE", ""),
|
||||
"guide": os.getenv("ROLE_GUIDE", ""),
|
||||
"fast": os.getenv("ROLE_FAST", ""),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user