stream: show WHAT was answered, not just counts
- LIST expert output renders the members (value is just the count; the opaque value=22 hid the actual rivers) - FANOUT line lists the sliced items by name - partial joins name which entity rows are missing
This commit is contained in:
+10
-2
@@ -155,8 +155,16 @@ class KnowledgeEngine:
|
|||||||
prov["parent_question"] = parent_question
|
prov["parent_question"] = parent_question
|
||||||
note = "" if value.upper() != "UNKNOWN" else "knowledge returned UNKNOWN"
|
note = "" if value.upper() != "UNKNOWN" else "knowledge returned UNKNOWN"
|
||||||
if streams is not None:
|
if streams is not None:
|
||||||
streams.output("EXPERT",
|
# LIST rows: value is the COUNT — the members are the real answer;
|
||||||
f"value={value} quote={(ans.get('quote') or '')[:80]} [{src}]")
|
# render them (first 10, then +N) or the log shows an opaque '22'
|
||||||
|
if isinstance(ans.get("list_items"), list) and ans["list_items"]:
|
||||||
|
items = ans["list_items"]
|
||||||
|
shown = ", ".join(items[:10]) + (f" (+{len(items) - 10} more)" if len(items) > 10 else "")
|
||||||
|
streams.output("EXPERT",
|
||||||
|
f"value={value} list={shown} [{src}]")
|
||||||
|
else:
|
||||||
|
streams.output("EXPERT",
|
||||||
|
f"value={value} quote={(ans.get('quote') or '')[:80]} [{src}]")
|
||||||
return EvidenceRow(
|
return EvidenceRow(
|
||||||
qid=qid,
|
qid=qid,
|
||||||
answer_type=answer_type,
|
answer_type=answer_type,
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ class FloopRun:
|
|||||||
attribute = self._attribute_of(q.text)
|
attribute = self._attribute_of(q.text)
|
||||||
self.streams.call("FANOUT", f"expanding {q.qid} into {len(items)} entity questions",
|
self.streams.call("FANOUT", f"expanding {q.qid} into {len(items)} entity questions",
|
||||||
think=self.tprefix + f"fan-out: {q.qid} over {list_eid}'s "
|
think=self.tprefix + f"fan-out: {q.qid} over {list_eid}'s "
|
||||||
f"{len(items)} items — one question per item, then a join")
|
f"{len(items)} items ({', '.join(items)}) — one question per item, then a join")
|
||||||
# 1) one entity question per item (no deps: the list row already exists)
|
# 1) one entity question per item (no deps: the list row already exists)
|
||||||
entity_qids: list[str] = []
|
entity_qids: list[str] = []
|
||||||
for item in items:
|
for item in items:
|
||||||
@@ -288,6 +288,12 @@ class FloopRun:
|
|||||||
total = sum(nums)
|
total = sum(nums)
|
||||||
partial = len(nums) < len(entity_rows)
|
partial = len(nums) < len(entity_rows)
|
||||||
self.streams.state(f"join: sum of {len(nums)} entity rows = {total}", think=True)
|
self.streams.state(f"join: sum of {len(nums)} entity rows = {total}", think=True)
|
||||||
|
if partial:
|
||||||
|
missing = [r.eid for r in entity_rows
|
||||||
|
if r.eid not in ids]
|
||||||
|
self.streams.state(
|
||||||
|
f"join partial: {len(nums)} of {len(entity_rows)} values summed; "
|
||||||
|
f"missing {', '.join(missing)}", think=True)
|
||||||
return EvidenceRow(
|
return EvidenceRow(
|
||||||
qid=q.qid, answer_type=AnswerType.FUNCTION,
|
qid=q.qid, answer_type=AnswerType.FUNCTION,
|
||||||
payload={"value": _fmt_num(total), "sum_of": ids,
|
payload={"value": _fmt_num(total), "sum_of": ids,
|
||||||
|
|||||||
Reference in New Issue
Block a user