Enhance Stage Specification Refinement and Rematch Logic
Deploy Development / deploy (push) Successful in 46s
Test Suite / pytest-backend (push) Successful in 44s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Successful in 1m22s
Deploy Development / deploy (push) Successful in 46s
Test Suite / pytest-backend (push) Successful in 44s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Successful in 1m22s
- Updated `max_rematch_rounds` in `ProgressionPathSuggestRequest` to allow for a maximum of 3 rounds, improving flexibility in rematch processes. - Introduced `_track_rejected` function to track rejected exercises by major step index, enhancing the rematch logic to account for previously rejected exercises. - Enhanced `_run_roadmap_rematch_loop` to utilize the new rejection tracking, ensuring better handling of off-topic steps during rematching. - Improved `detect_off_topic_steps` to incorporate refined scoring and reasoning for stage fit, enhancing the accuracy of off-topic detection. - Updated `refine_stage_spec_artifact` to merge stage exclusion phrases more effectively, improving the clarity of anti-pattern handling. - Bumped version to 0.8.228 to reflect the new features and improvements.
This commit is contained in:
1 parent
f36a747efa
commit
a49987408b
9 files changed
+269
-74
No files matched your search
@@ -110,7 +110,7 @@ class ProgressionPathSuggestRequest(BaseModel):
|
||||
include_path_qa: bool = True
|
||||
auto_rematch_after_qa: bool = True
|
||||
auto_refine_stage_spec: bool = True
|
||||
max_rematch_rounds: int = Field(default=2, ge=0, le=3)
|
||||
max_rematch_rounds: int = Field(default=3, ge=0, le=4)
|
||||
include_llm_path_qa: bool = True
|
||||
include_path_reorder: bool = True
|
||||
include_ai_gap_fill: bool = True
|
||||
@@ -1297,6 +1297,23 @@ def _run_roadmap_rematch_loop(
|
||||
current_stripped = list(stripped_off_topic or [])
|
||||
use_initial_off_topic = not current_stripped
|
||||
off_topic_steps: List[Dict[str, Any]] = []
|
||||
rejected_by_major: Dict[int, Set[int]] = {}
|
||||
|
||||
def _track_rejected(items: Sequence[Mapping[str, Any]]) -> None:
|
||||
for item in items or []:
|
||||
if not isinstance(item, dict):
|
||||
continue
|
||||
eid = item.get("exercise_id")
|
||||
midx = item.get("roadmap_major_step_index")
|
||||
if eid is None or midx is None:
|
||||
continue
|
||||
try:
|
||||
rejected_by_major.setdefault(int(midx), set()).add(int(eid))
|
||||
except (TypeError, ValueError):
|
||||
continue
|
||||
|
||||
_track_rejected(off_topic_before_strip)
|
||||
_track_rejected(current_stripped)
|
||||
|
||||
for round_idx in range(max_rounds):
|
||||
mini_qa = run_multistage_path_qa(
|
||||
@@ -1357,12 +1374,20 @@ def _run_roadmap_rematch_loop(
|
||||
slot_indices=slot_indices,
|
||||
rematch_reasons=rematch_reasons,
|
||||
match_slot_fn=_match_roadmap_slot,
|
||||
rejected_by_major=rejected_by_major,
|
||||
)
|
||||
rematch_rounds += 1
|
||||
for entry in round_log:
|
||||
tagged = dict(entry)
|
||||
tagged["round"] = rematch_rounds
|
||||
rematch_log.append(tagged)
|
||||
rid = entry.get("replaced_exercise_id")
|
||||
midx = entry.get("roadmap_major_step_index")
|
||||
if rid is not None and midx is not None:
|
||||
try:
|
||||
rejected_by_major.setdefault(int(midx), set()).add(int(rid))
|
||||
except (TypeError, ValueError):
|
||||
pass
|
||||
|
||||
current_stripped = prune_stripped_after_rematch(current_stripped, round_log)
|
||||
roadmap_unfilled = _merge_rematch_unfilled(roadmap_unfilled, rematch_new_unfilled)
|
||||
@@ -1374,6 +1399,7 @@ def _run_roadmap_rematch_loop(
|
||||
brief=semantic_brief,
|
||||
goal_query=goal_query,
|
||||
)
|
||||
_track_rejected(off_topic_steps)
|
||||
if round_idx + 1 >= max_rounds:
|
||||
break
|
||||
if not off_topic_steps and not roadmap_unfilled:
|
||||
|
||||
Reference in new issue
Block a user