neue Test
This commit is contained in:
1 parent
d2270fafdd
commit
bd36d78025
3 files changed
+41
-41
No files matched your search
@@ -1,8 +1,10 @@
|
||||
"""
|
||||
tests/test_wp06_decision.py — Flexibler Integrationstest für WP-06
|
||||
Update:
|
||||
- Timeout auf 300s erhöht.
|
||||
- Robusteres Auslesen der Metadaten (Payload/Source Fix).
|
||||
- Timeout 300s.
|
||||
- Zeigt Intent Source an.
|
||||
- Payload/Source Fallback für Metadaten.
|
||||
- Debug-Dump bei unknown Type.
|
||||
"""
|
||||
import requests
|
||||
import json
|
||||
@@ -24,7 +26,7 @@ def test_decision_engine(query: str, port: int, expected_intent: str):
|
||||
print(f"FRAGE: '{query}'")
|
||||
print("... warte auf LLM (kann auf CPU >120s dauern) ...")
|
||||
|
||||
# FIX: Timeout auf 300 erhöht, passend zur Server-Config
|
||||
# FIX: Timeout auf 300 erhöht
|
||||
response = requests.post(f"{api_url}/chat/", json=payload, timeout=300)
|
||||
response.raise_for_status()
|
||||
data = response.json()
|
||||
@@ -33,11 +35,14 @@ def test_decision_engine(query: str, port: int, expected_intent: str):
|
||||
|
||||
# 1. Intent Check
|
||||
intent = data.get("intent", "UNKNOWN")
|
||||
# Wir normalisieren auf Großbuchstaben für den Vergleich
|
||||
source_method = data.get("intent_source", "Unknown Source")
|
||||
|
||||
match = intent.upper() == expected_intent.upper()
|
||||
|
||||
print(f"\n1. INTENT DETECTION: [{'✅' if match else '❌'}]")
|
||||
print(f" Erkannt: {intent} (Erwartet: {expected_intent})")
|
||||
print(f" Erkannt: {intent}")
|
||||
print(f" Erwartet: {expected_intent}")
|
||||
print(f" Methode: {source_method}")
|
||||
|
||||
# 2. Source Check (Strategic Retrieval)
|
||||
sources = data.get("sources", [])
|
||||
@@ -48,19 +53,25 @@ def test_decision_engine(query: str, port: int, expected_intent: str):
|
||||
if not sources:
|
||||
print(" (Keine Quellen gefunden)")
|
||||
|
||||
debug_printed = False
|
||||
|
||||
for i, source in enumerate(sources):
|
||||
# --- FIX: Robusterer Zugriff auf Metadaten ---
|
||||
# Qdrant liefert Daten oft in 'payload', Mindnet DTOs manchmal in 'source'
|
||||
# Wir prüfen beides, um "Typ: unknown" zu vermeiden.
|
||||
src_meta = source.get("payload") or source.get("source") or {}
|
||||
|
||||
node_type = src_meta.get("type", "unknown")
|
||||
title = source.get("note_id", "Unknown")
|
||||
score = source.get("total_score", 0.0)
|
||||
|
||||
# DEBUG: Wenn Typ unknown ist, dumpen wir das erste Objekt
|
||||
if node_type == "unknown" and not debug_printed:
|
||||
print(f"\n 🔴 DEBUG: Raw Data von Quelle {i+1} (da Typ unknown):")
|
||||
print(json.dumps(source, indent=2, ensure_ascii=False))
|
||||
print(" ------------------------------------------------")
|
||||
debug_printed = True
|
||||
|
||||
# Marker für Ausgabe
|
||||
marker = " "
|
||||
# Liste aller strategischen Typen, die wir besonders hervorheben wollen
|
||||
if node_type in ["value", "principle", "goal", "experience", "belief", "profile", "decision"]:
|
||||
marker = "🎯" # Strategischer Treffer
|
||||
strategic_hits.append(f"{title} ({node_type})")
|
||||
|
||||
Reference in new issue
Block a user