testscript für WP06 korrigiert
All checks were successful
Deploy mindnet to llm-node / deploy (push) Successful in 4s
All checks were successful
Deploy mindnet to llm-node / deploy (push) Successful in 4s
This commit is contained in:
parent
86faf5b8f0
commit
d2270fafdd
|
|
@ -1,6 +1,8 @@
|
|||
"""
|
||||
tests/test_wp06_decision.py — Flexibler Integrationstest für WP-06
|
||||
Update: Timeout auf 300s erhöht für CPU-Inference Cold-Starts.
|
||||
Update:
|
||||
- Timeout auf 300s erhöht.
|
||||
- Robusteres Auslesen der Metadaten (Payload/Source Fix).
|
||||
"""
|
||||
import requests
|
||||
import json
|
||||
|
|
@ -31,7 +33,9 @@ def test_decision_engine(query: str, port: int, expected_intent: str):
|
|||
|
||||
# 1. Intent Check
|
||||
intent = data.get("intent", "UNKNOWN")
|
||||
match = intent == expected_intent
|
||||
# Wir normalisieren auf Großbuchstaben für den Vergleich
|
||||
match = intent.upper() == expected_intent.upper()
|
||||
|
||||
print(f"\n1. INTENT DETECTION: [{'✅' if match else '❌'}]")
|
||||
print(f" Erkannt: {intent} (Erwartet: {expected_intent})")
|
||||
|
||||
|
|
@ -45,17 +49,21 @@ def test_decision_engine(query: str, port: int, expected_intent: str):
|
|||
print(" (Keine Quellen gefunden)")
|
||||
|
||||
for i, source in enumerate(sources):
|
||||
# Safe access auf Source-Dict
|
||||
src_meta = source.get("source", {})
|
||||
# --- 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)
|
||||
|
||||
# Marker für Ausgabe
|
||||
marker = " "
|
||||
if node_type in ["value", "principle", "goal", "experience", "belief", "profile"]:
|
||||
# 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(title)
|
||||
strategic_hits.append(f"{title} ({node_type})")
|
||||
else:
|
||||
marker = "📄"
|
||||
fact_hits.append(title)
|
||||
|
|
@ -77,7 +85,7 @@ def test_decision_engine(query: str, port: int, expected_intent: str):
|
|||
|
||||
except requests.exceptions.ReadTimeout:
|
||||
print(f"\n❌ TIMEOUT: Der Server hat nicht innerhalb von 300s geantwortet.")
|
||||
print(" Tipp: Prüfe die Server-Logs. Lädt er noch das Modell?")
|
||||
print(" Tipp: Prüfe die Server-Logs (Terminal 1). Lädt er noch das Modell?")
|
||||
sys.exit(1)
|
||||
except requests.exceptions.ConnectionError:
|
||||
print(f"\n❌ FEHLER: Keine Verbindung zu {api_url}. Läuft der Server?")
|
||||
|
|
@ -96,7 +104,7 @@ if __name__ == "__main__":
|
|||
help="Der Port der API (Default: 8002 für Dev).")
|
||||
parser.add_argument("--expect", "-e", type=str,
|
||||
default="DECISION",
|
||||
help="Der erwartete Intent (z.B. DECISION, EMPATHY).")
|
||||
help="Der erwartete Intent (z.B. DECISION, EMPATHY, FACT).")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user