feat(F-12): wiki-compile — grounded concept pages over RAG substrate #2
@@ -11,12 +11,14 @@ Compile-state (hash tracking for incremental re-runs) is persisted to
|
||||
Graceful degradation:
|
||||
- Missing ``formulas`` table (F-09 not present) → no formula embedding, no crash.
|
||||
- Missing ``verify_citations`` (F-10 not present) → local substring grounding check.
|
||||
- LLM unavailable (httpx.ConnectError or any exception) → empty ConceptPage, no crash.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import logging
|
||||
import re
|
||||
import textwrap
|
||||
from dataclasses import dataclass, field
|
||||
@@ -28,6 +30,8 @@ import yaml
|
||||
|
||||
from codex.config import get_settings
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Dataclasses
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -442,7 +446,11 @@ def compile_concept(
|
||||
|
||||
h = _chunk_hash(chunks)
|
||||
prompt = _build_synthesis_prompt(concept, chunks)
|
||||
raw_output = llm.generate(prompt, model=settings.wiki_llm_model)
|
||||
try:
|
||||
raw_output = llm.generate(prompt, model=settings.wiki_llm_model)
|
||||
except Exception as exc: # noqa: BLE001
|
||||
logger.warning("LLM unavailable (%s): skipping concept %s", exc, concept.slug)
|
||||
return ConceptPage(concept=concept, markdown="", claims=[], chunk_hash=h)
|
||||
|
||||
claims = _parse_claims(raw_output)
|
||||
claims = _run_grounding_guard(claims, chunks)
|
||||
|
||||
Reference in New Issue
Block a user