Implement Phase 1 of Planning Exercise Suggestion with Scenario Pipeline and LLM Intent Overlay
Deploy Development / deploy (push) Successful in 43s
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 1m14s
Deploy Development / deploy (push) Successful in 43s
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 1m14s
- Introduced the Scenario Pipeline for planning exercises, allowing for more nuanced query handling and exercise suggestions based on user intent. - Enhanced the `suggestPlanningExercises` API to include `include_llm_intent`, `scenario_kind`, and `query_intent_summary`, improving the context provided to the frontend. - Updated the `ExercisePickerModal` to display new information related to query intent and scenario classification, enhancing user experience during exercise selection. - Incremented application version to 0.8.171 and updated changelog to document the new features and improvements in the planning AI capabilities.
This commit is contained in:
1 parent
207817376d
commit
45e3b5f4f6
11 files changed
+794
-28
No files matched your search
@@ -1,6 +1,15 @@
|
||||
"""Tests für Planungs-Übungssuche (Intent, LLM-Rerank-Parser)."""
|
||||
"""Tests Planungs-Übungssuche: Intent, Szenario-Pipeline, LLM-Parser."""
|
||||
from planning_exercise_suggest import resolve_planning_exercise_intent
|
||||
from planning_exercise_intent import parse_planning_query_intent_response
|
||||
from planning_exercise_llm_rank import parse_planning_exercise_rank_response
|
||||
from planning_exercise_target_pipeline import (
|
||||
SCENARIO_ADDITIVE,
|
||||
SCENARIO_PRESET_NEXT,
|
||||
classify_planning_scenario,
|
||||
compose_retrieval_phase,
|
||||
is_simple_preset_query,
|
||||
should_run_llm_intent_pipeline,
|
||||
)
|
||||
|
||||
|
||||
def test_resolve_planning_exercise_intent_defaults():
|
||||
@@ -14,6 +23,43 @@ def test_resolve_planning_exercise_intent_keywords():
|
||||
assert resolve_planning_exercise_intent("progression graph", None) == "progression_next"
|
||||
|
||||
|
||||
def test_classify_planning_scenario_preset():
|
||||
assert is_simple_preset_query("Schlage mir die nächste Übung vor")
|
||||
assert classify_planning_scenario("", "suggest_next") == SCENARIO_PRESET_NEXT
|
||||
assert classify_planning_scenario("nächste übung", "suggest_next") == SCENARIO_PRESET_NEXT
|
||||
|
||||
|
||||
def test_classify_planning_scenario_additive():
|
||||
q = "Baut auf der Planung auf und trainiert zusätzlich Schnellkraft"
|
||||
assert classify_planning_scenario(q, "continue_plan_goal") == SCENARIO_ADDITIVE
|
||||
assert should_run_llm_intent_pipeline(q, SCENARIO_ADDITIVE, include_llm_intent=True)
|
||||
|
||||
|
||||
def test_should_skip_llm_for_preset():
|
||||
assert not should_run_llm_intent_pipeline("", SCENARIO_PRESET_NEXT, include_llm_intent=True)
|
||||
assert not should_run_llm_intent_pipeline(
|
||||
"nächste übung",
|
||||
SCENARIO_PRESET_NEXT,
|
||||
include_llm_intent=True,
|
||||
)
|
||||
|
||||
|
||||
def test_compose_retrieval_phase():
|
||||
assert compose_retrieval_phase(query_intent=False, llm_rank=False) == "profile_v1"
|
||||
assert compose_retrieval_phase(query_intent=True, llm_rank=True) == "profile_v1+query_intent+llm_rank"
|
||||
|
||||
|
||||
def test_parse_planning_query_intent_response():
|
||||
parsed = parse_planning_query_intent_response(
|
||||
'{"intent":"continue_plan_goal","scenario":"additive_constraint",'
|
||||
'"skill_hints":[{"name":"Schnellkraft","weight":1}],"emphasis":"additive",'
|
||||
'"rationale":"Zusatz Schnellkraft"}'
|
||||
)
|
||||
assert parsed.intent == "continue_plan_goal"
|
||||
assert parsed.scenario == "additive_constraint"
|
||||
assert parsed.skill_hints[0].name == "Schnellkraft"
|
||||
|
||||
|
||||
def test_parse_planning_exercise_rank_response_filters_ids():
|
||||
allowed = {10, 20, 30}
|
||||
ranked, reasons = parse_planning_exercise_rank_response(
|
||||
@@ -23,12 +69,3 @@ def test_parse_planning_exercise_rank_response_filters_ids():
|
||||
assert ranked == [20, 10]
|
||||
assert reasons[20] == "Passt gut"
|
||||
assert 999 not in reasons
|
||||
|
||||
|
||||
def test_parse_planning_exercise_rank_response_reasons_by_id_alias():
|
||||
ranked, reasons = parse_planning_exercise_rank_response(
|
||||
'{"ranked_ids":[5],"reasons_by_id":{"5":"Skill-Lücke"}}',
|
||||
{5},
|
||||
)
|
||||
assert ranked == [5]
|
||||
assert reasons[5] == "Skill-Lücke"
|
||||
Reference in new issue
Block a user