Enhance Planning Exercise Functionality and LLM Integration
Deploy Development / deploy (push) Successful in 41s
Test Suite / pytest-backend (push) Successful in 43s
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 1m15s
Deploy Development / deploy (push) Successful in 41s
Test Suite / pytest-backend (push) Successful in 43s
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 1m15s
- Added support for the new planning exercise expectation profile slug in the AI prompt runtime. - Refactored SQL parameter handling in the planning exercise retrieval process to ensure correct binding for full-text search. - Updated the planning exercise suggestion logic to incorporate LLM expectation handling, improving the accuracy of exercise recommendations. - Introduced new functions to determine when to run the LLM expectation pipeline, enhancing the decision-making process for exercise suggestions. - Incremented version to 0.8.176 and updated changelog to reflect these enhancements in planning AI capabilities.
This commit is contained in:
1 parent
04cc77d501
commit
5c882985e0
10 files changed
+332
-15
No files matched your search
@@ -0,0 +1,43 @@
|
||||
"""Tests Planungs-Retrieval SQL-Parameter."""
|
||||
from planning_exercise_retrieval import fetch_retrieval_candidate_rows
|
||||
|
||||
|
||||
def test_fetch_retrieval_binds_query_before_visibility_params():
|
||||
captured = {}
|
||||
|
||||
class _Cur:
|
||||
def execute(self, sql, params):
|
||||
captured["sql"] = sql
|
||||
captured["params"] = list(params)
|
||||
|
||||
def fetchall(self):
|
||||
return [
|
||||
{
|
||||
"id": 1,
|
||||
"title": "Test",
|
||||
"summary": "",
|
||||
"primary_focus_name": None,
|
||||
"ft_rank": 0.2,
|
||||
}
|
||||
]
|
||||
|
||||
fetch_retrieval_candidate_rows(
|
||||
_Cur(),
|
||||
vis_sql="(e.visibility = 'official' OR (e.visibility = 'private' AND e.created_by = %s))",
|
||||
vis_params=[42],
|
||||
query="nächste Übung planen",
|
||||
exercise_kind_any=None,
|
||||
target=__import__(
|
||||
"planning_exercise_profiles", fromlist=["PlanningTargetProfile"]
|
||||
).PlanningTargetProfile(),
|
||||
progression_successor_ids=set(),
|
||||
anchor_skill_ids={7},
|
||||
raw_pool_limit=10,
|
||||
)
|
||||
|
||||
params = captured["params"]
|
||||
assert params[0] == "nächste Übung planen"
|
||||
assert params[1] == 42
|
||||
assert params[2] == "archived"
|
||||
assert params[-2] == "nächste Übung planen"
|
||||
assert params[-1] == 10
|
||||
@@ -25,8 +25,10 @@ def test_resolve_planning_exercise_intent_keywords():
|
||||
|
||||
def test_classify_planning_scenario_preset():
|
||||
assert is_simple_preset_query("Schlage mir die nächste Übung vor")
|
||||
assert is_simple_preset_query("nächste Übung planen")
|
||||
assert classify_planning_scenario("", "suggest_next") == SCENARIO_PRESET_NEXT
|
||||
assert classify_planning_scenario("nächste übung", "suggest_next") == SCENARIO_PRESET_NEXT
|
||||
assert classify_planning_scenario("nächste Übung planen", "suggest_next") == SCENARIO_PRESET_NEXT
|
||||
|
||||
|
||||
def test_classify_planning_scenario_additive():
|
||||
@@ -78,6 +80,47 @@ def test_compose_retrieval_phase():
|
||||
)
|
||||
|
||||
|
||||
def test_should_run_llm_expectation_for_preset_with_planning_ref():
|
||||
from planning_exercise_target_pipeline import should_run_llm_expectation_pipeline
|
||||
|
||||
assert should_run_llm_expectation_pipeline(
|
||||
SCENARIO_PRESET_NEXT,
|
||||
include_llm_intent=True,
|
||||
has_planning_reference=True,
|
||||
)
|
||||
assert not should_run_llm_expectation_pipeline(
|
||||
SCENARIO_PRESET_NEXT,
|
||||
include_llm_intent=False,
|
||||
has_planning_reference=True,
|
||||
)
|
||||
assert not should_run_llm_expectation_pipeline(
|
||||
SCENARIO_ADDITIVE,
|
||||
include_llm_intent=True,
|
||||
has_planning_reference=True,
|
||||
)
|
||||
|
||||
|
||||
def test_should_skip_llm_rank_when_expectation_applied():
|
||||
from planning_exercise_target_pipeline import SCENARIO_PRESET_NEXT, should_run_llm_rank_pipeline
|
||||
|
||||
hits = [{"score": 0.5}, {"score": 0.48}, {"score": 0.47}, {"score": 0.46}]
|
||||
assert not should_run_llm_rank_pipeline(
|
||||
"",
|
||||
SCENARIO_PRESET_NEXT,
|
||||
include_llm_rank=True,
|
||||
query_intent_applied=False,
|
||||
llm_expectation_applied=True,
|
||||
hits=hits,
|
||||
)
|
||||
|
||||
|
||||
def test_compose_retrieval_phase_llm_expectation():
|
||||
assert (
|
||||
compose_retrieval_phase(llm_expectation=True)
|
||||
== "profile_v1+llm_expectation"
|
||||
)
|
||||
|
||||
|
||||
def test_query_only_expectation_without_planning_reference():
|
||||
from planning_exercise_profiles import PlanningTargetProfile
|
||||
from planning_exercise_target_pipeline import build_planning_target_with_query_pipeline
|
||||
|
||||
Reference in new issue
Block a user