diff --git a/backend/.env.example b/backend/.env.example index e7c0ba1..58b15df 100644 --- a/backend/.env.example +++ b/backend/.env.example @@ -72,3 +72,9 @@ SMTP_PASSWORD= SMTP_FROM= SMTP_USE_TLS=true SMTP_USE_SSL=false + +# Wave 5b evidence verification (vision fact-check of cited sheet text) +AGENT_VERIFY_MAX_CHECKS=20 +AGENT_VERIFY_SEVERITIES=critical,high +AGENT_VERIFY_REASONING_EFFORT=low +VERIFY_MAX_TOKENS=8192 diff --git a/backend/config.py b/backend/config.py index cd57da4..9921695 100644 --- a/backend/config.py +++ b/backend/config.py @@ -47,6 +47,18 @@ AGENT_CONFLICT_CONCURRENCY = int(os.getenv("AGENT_CONFLICT_CONCURRENCY", "4")) AGENT_SPECIALIST_CONCURRENCY = int(os.getenv("AGENT_SPECIALIST_CONCURRENCY", "4")) AGENT_RFI_CONCURRENCY = int(os.getenv("AGENT_RFI_CONCURRENCY", "4")) +# Wave 5b evidence verification (vision fact-check of cited sheet text) +AGENT_VERIFY_MODEL = os.getenv("AGENT_VERIFY_MODEL", "") or MODEL +AGENT_VERIFY_CONCURRENCY = int(os.getenv("AGENT_VERIFY_CONCURRENCY", "4")) +AGENT_VERIFY_MAX_CHECKS = int(os.getenv("AGENT_VERIFY_MAX_CHECKS", "20")) +AGENT_VERIFY_SEVERITIES = { + s.strip().lower() + for s in os.getenv("AGENT_VERIFY_SEVERITIES", "critical,high").split(",") + if s.strip() +} +AGENT_VERIFY_REASONING_EFFORT = os.getenv("AGENT_VERIFY_REASONING_EFFORT", "low").strip() +VERIFY_MAX_TOKENS = int(os.getenv("VERIFY_MAX_TOKENS", "8192")) + # Agent-mode human-review gate. When on (default), Agent runs stop after the # Brain merge and wait for human decisions before RFIs/final report/email go # out. AGENT_REVIEW_AUDIT_SAMPLE caps how many clean clusters get added to the diff --git a/backend/prompts.py b/backend/prompts.py index d640d53..7de5dd6 100644 --- a/backend/prompts.py +++ b/backend/prompts.py @@ -450,6 +450,26 @@ Clustered assertions (evidence): {evidence}""" +# --------------------------------------------------------------------------- +# Wave 5b - evidence verification (vision fact-check of cited sheet text) +# --------------------------------------------------------------------------- + +VERIFY_SYSTEM_PROMPT = """You are a meticulous construction document checker verifying machine-extracted evidence against the actual drawing sheet images. +For each evidence item you are given the sheet it was extracted from and the verbatim text the extractor claims appears there. +Judge each item against the images: +- confirmed: the text (or an obvious equivalent) appears on the cited sheet and means what the finding claims. +- corrected: the sheet shows a DIFFERENT value than the extracted text. Give the actual verbatim text. +- not_found: nothing like the extracted text appears on the cited sheet. +Be strict about numbers, quantities, and member sizes: "(2) 2x6" and "(5) 2x6" are different values. HSS16x4 and HSS16x16 are different values. +Use plain ASCII only. +Respond only with valid JSON.""" + +VERIFY_USER_INSTRUCTION = """Verify this finding's evidence against the attached sheet images. +Respond ONLY with a valid JSON object - no markdown fences, no explanation: +{ "verdicts": [ { "sheet": "string", "source_text": "the evidence text judged", "verdict": "confirmed | corrected | not_found", "actual_text": "verbatim sheet text when corrected, else null", "notes": "string or null" } ] } +Finding: {finding}""" + + # --------------------------------------------------------------------------- # Stage 6 - senior architect full-set QAQC review (NOT WIRED YET) # ---------------------------------------------------------------------------