Enhance Planning Exercise Path Builder and Retrieval Logic
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 41s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m23s

- Updated the path selection logic to incorporate semantic gating, ensuring only relevant exercises are considered based on semantic scores.
- Introduced new functions for building path target profiles and resolving semantic skill weights, enhancing the contextual understanding of exercise suggestions.
- Improved the retrieval process by applying dynamic retrieval weights based on semantic strength, refining the accuracy of exercise recommendations.
- Incremented version to 0.8.188 and updated changelog to document these enhancements in planning AI functionality.
This commit is contained in:
Lars committed 2026-05-23 12:38:38 +02:00
1 parent c2c736dafc
commit 5b73d1a1f5
6 files changed
+333 -73

No files matched your search

+18 -1
View File
@@ -14,7 +14,11 @@ from planning_exercise_profiles import (
load_exercise_match_profiles_bulk,
score_exercise_against_target,
)
from planning_exercise_semantics import PlanningSemanticBrief, score_exercise_semantic_relevance
from planning_exercise_semantics import (
PlanningSemanticBrief,
exercise_passes_path_semantic_gate,
score_exercise_semantic_relevance,
)
_MAX_LIBRARY_ROWS = 8000
_PROFILE_LOAD_BATCH = 400
@@ -195,6 +199,7 @@ def rank_visible_library_hits(
if isinstance(semantic_brief_raw, PlanningSemanticBrief):
semantic_brief = semantic_brief_raw
step_phase = pack.get("path_step_phase")
path_mode = pack.get("context_mode") == "progression_path"
last_planned_skills: Set[int] = set()
planned_ids = pack.get("planned_exercise_ids") or []
@@ -274,6 +279,18 @@ def rank_visible_library_hits(
step_phase=step_phase,
)
if (
path_mode
and semantic_brief
and semantic_brief.semantic_strength >= 0.55
and not exercise_passes_path_semantic_gate(
semantic_score=semantic_score,
title=str(row.get("title") or ""),
brief=semantic_brief,
)
):
continue
score = (
weights.get("semantic", 0.0) * semantic_score
+ weights["fulltext"] * ft_norm