Refactorin KnowledgeExpert.answer_question too long function

This commit is contained in:
2026-10-28 17:27:56 +01:00
parent 12fb3c78b2
commit 77fef0a499
3 changed files with 463 additions and 183 deletions
+16
View File
@@ -78,6 +78,22 @@ tests/state.py unit tests (no LLM)
tests/traces.py exporter tests (no network)
```
### Knowledge pipeline structure
`KnowledgeExpert.answer_question` in `knowledge/expert.py` orchestrates proof,
stored answers, and article-by-article gathering with early exit. Focused methods
handle stored-answer gating, query composition/search, cached fetching, skimming,
and post-ingestion answer checks. Stateless module-level helpers build probe
seeds, rank article titles, and filter goal-relevant skim notices. Run-wide page
and link caches survive calls; extraction entities, skim notices, and pending
skim leads reset per call after the proof path falls through.
Offline orchestration regression tests (no Wikipedia, embedder, or LLM required):
```bash
.venv/bin/python knowledge/tests/answer_question.py
```
## Viewing a run as traces (Jaeger, 2026-10-27)
Every run records `events.jsonl`; `floop/traces.py` replays it as one