merge main (phase 0: K5 fix, --no-cache, import assert) into research/semantic-kg
Conflict resolutions, the honest way: - extract/expert gap-step: main's deterministic COMPOSE wins over the branch's TRANSLATE LLM (main removed it 23/10 with measurement: the model was putting the ANSWER into retrieval queries). The branch's _extract_entities contract (question-blind extractor) is fed from compose's entities. - tablefrags/semantic tests: restored the branch's adapted versions + fixed their single-insert sys.path bug (parent.parent resolved to knowledge/, not code/ — the tests were silently importing MAIN's expert.py through the venv pth; same class as the run-085457 trap).
This commit is contained in:
+8
-2
@@ -165,7 +165,6 @@ _STAGE_BY_MODULE = {
|
||||
"AnswerSignature": "ANSWER",
|
||||
"ExtractSignature": "EXTRACT",
|
||||
"AnswerFromKG": "answer_kg",
|
||||
"TranslateSignature": "TRANSLATE",
|
||||
"SelectTableSignature": "SELECT_TABLE",
|
||||
"VerifyCountSignature": "VERIFY_COUNT",
|
||||
"SkimPromoteSignature": "PROMOTE",
|
||||
@@ -173,9 +172,14 @@ _STAGE_BY_MODULE = {
|
||||
}
|
||||
|
||||
|
||||
def configure_lm() -> dict:
|
||||
def configure_lm(no_cache: bool = False) -> dict:
|
||||
"""Configure dspy's default LM from config.yaml + FLOOP_LM env override.
|
||||
|
||||
no_cache=True builds the LM with dspy's response cache DISABLED for this
|
||||
process (his ruling 25/10: the cache is caching doing its job — the
|
||||
default stays cache=True; the flag exists for A/B and freshness testing
|
||||
so a repeated question is a real run, not a byte-identical replay).
|
||||
|
||||
Returns the active provider settings (for provenance logs).
|
||||
"""
|
||||
cfg = _load_yaml()["lm"]
|
||||
@@ -192,6 +196,8 @@ def configure_lm() -> dict:
|
||||
"temperature": p["temperature"],
|
||||
"api_key": os.environ.get(p.get("api_key_env", ""), "empty"),
|
||||
}
|
||||
if no_cache:
|
||||
kwargs["cache"] = False
|
||||
lm = dspy.LM(**kwargs)
|
||||
global _ACTIVE
|
||||
_ACTIVE = lm
|
||||
|
||||
Reference in New Issue
Block a user