Planner Autonomy: закрепить catalog-alignment в phase32 и AGENT-каталоге
This commit is contained in:
@@ -251,9 +251,17 @@ def classify_truth_harness_step(spec_path: Path, spec: dict[str, Any], step: dic
|
||||
step_id = str(step.get("step_id") or "").strip()
|
||||
title = str(step.get("title") or step_id).strip() or step_id
|
||||
expected_intents = [str(item).strip() for item in (step.get("expected_intents") or []) if str(item).strip()]
|
||||
semantic_tags = _normalize_tags(
|
||||
[*step.get("semantic_tags", []), *_base_step_tags(question, step_id, title, expected_intents)]
|
||||
)
|
||||
expected_catalog_alignment_status = str(step.get("expected_catalog_alignment_status") or "").strip()
|
||||
expected_catalog_chain_top_match = str(step.get("expected_catalog_chain_top_match") or "").strip()
|
||||
expected_catalog_selected_matches_top = step.get("expected_catalog_selected_matches_top")
|
||||
semantic_tag_inputs = [*step.get("semantic_tags", []), *_base_step_tags(question, step_id, title, expected_intents)]
|
||||
if (
|
||||
expected_catalog_alignment_status
|
||||
or expected_catalog_chain_top_match
|
||||
or expected_catalog_selected_matches_top is not None
|
||||
):
|
||||
semantic_tag_inputs.append("planner_catalog_alignment")
|
||||
semantic_tags = _normalize_tags(semantic_tag_inputs)
|
||||
return {
|
||||
"entry_id": f"{spec_path.stem}:{step_id}",
|
||||
"source_type": "truth_harness_step",
|
||||
@@ -267,6 +275,9 @@ def classify_truth_harness_step(spec_path: Path, spec: dict[str, Any], step: dic
|
||||
"question": question,
|
||||
"criticality": str(step.get("criticality") or "critical"),
|
||||
"expected_intents": expected_intents,
|
||||
"expected_catalog_alignment_status": expected_catalog_alignment_status or None,
|
||||
"expected_catalog_chain_top_match": expected_catalog_chain_top_match or None,
|
||||
"expected_catalog_selected_matches_top": expected_catalog_selected_matches_top,
|
||||
"semantic_tags": semantic_tags,
|
||||
"step_payload": step,
|
||||
}
|
||||
@@ -351,8 +362,16 @@ def _catalog_markdown(catalog: dict[str, Any]) -> str:
|
||||
lines.extend(["", "## Reusable truth-harness steps"])
|
||||
for entry in catalog.get("truth_harness_entries") or []:
|
||||
tags = ", ".join(entry.get("semantic_tags") or []) or "none"
|
||||
catalog_bits = []
|
||||
if entry.get("expected_catalog_alignment_status"):
|
||||
catalog_bits.append(f"status={entry.get('expected_catalog_alignment_status')}")
|
||||
if entry.get("expected_catalog_chain_top_match"):
|
||||
catalog_bits.append(f"top={entry.get('expected_catalog_chain_top_match')}")
|
||||
if entry.get("expected_catalog_selected_matches_top") is not None:
|
||||
catalog_bits.append(f"selected_matches_top={entry.get('expected_catalog_selected_matches_top')}")
|
||||
catalog_suffix = f" | catalog_alignment: {', '.join(catalog_bits)}" if catalog_bits else ""
|
||||
lines.append(
|
||||
f"- `{entry.get('entry_id')}` | tags: {tags} | question: {entry.get('question')}"
|
||||
f"- `{entry.get('entry_id')}` | tags: {tags}{catalog_suffix} | question: {entry.get('question')}"
|
||||
)
|
||||
lines.extend(["", "## Saved session questions"])
|
||||
for entry in catalog.get("saved_session_entries") or []:
|
||||
|
||||
@@ -19,6 +19,22 @@ class AgentSemanticPackBuilderTests(unittest.TestCase):
|
||||
self.assertIn("meta_scope", summary["reusable_truth_harness_tags"])
|
||||
self.assertIn("selected_object_supplier", summary["reusable_truth_harness_tags"])
|
||||
self.assertIn("counterparty_documents", summary["reusable_truth_harness_tags"])
|
||||
self.assertIn("planner_catalog_alignment", summary["reusable_truth_harness_tags"])
|
||||
|
||||
phase32_net_entry = next(
|
||||
(
|
||||
entry
|
||||
for entry in catalog["truth_harness_entries"]
|
||||
if entry["entry_id"]
|
||||
== "address_truth_harness_phase32_planner_selected_chain_end_to_end:step_04_net_after_payout"
|
||||
),
|
||||
None,
|
||||
)
|
||||
self.assertIsNotNone(phase32_net_entry)
|
||||
self.assertEqual(phase32_net_entry["expected_catalog_alignment_status"], "selected_matches_top")
|
||||
self.assertEqual(phase32_net_entry["expected_catalog_chain_top_match"], "value_flow_comparison")
|
||||
self.assertIs(phase32_net_entry["expected_catalog_selected_matches_top"], True)
|
||||
self.assertIn("planner_catalog_alignment", phase32_net_entry["semantic_tags"])
|
||||
|
||||
def test_build_recipe_spec_creates_mixed_phase7_pack(self) -> None:
|
||||
catalog = builder.build_source_catalog()
|
||||
|
||||
Reference in New Issue
Block a user