{
"event": "PreToolUse",
"tool_name": "Bash",
"tool_input": {
"command": ".\/venv\/bin\/python -c \"\nimport requests\nfrom datetime import datetime, timedelta\n\n# Embedding von Ollama\nresp = requests.post('http:\/\/localhost:11434\/api\/embeddings', json={\n 'model': 'mxbai-embed-large',\n 'prompt': 'Was ist systemisches Coaching?'\n})\nvector = resp.json()['embedding']\n\n# Suche in Qdrant via REST\nsearch_resp = requests.post('http:\/\/localhost:6333\/collections\/documents\/points\/search', json={\n 'vector': vector,\n 'limit': 5,\n 'with_payload': True\n})\nresults = search_resp.json().get('result', [])\n\n# Scoring analog zu ScoringService.php\nWEIGHT_SIMILARITY = 0.7\nWEIGHT_RECENCY = 0.1\nWEIGHT_AUTHORITY = 0.2\n\ndef calculate_recency(date_str):\n if not date_str:\n return 0.5\n try:\n doc_date = datetime.fromisoformat(date_str.replace('Z', '+00:00'))\n days_old = (datetime.now(doc_date.tzinfo) - doc_date).days\n return max(0.0, 1.0 - (days_old \/ 365))\n except:\n return 0.5\n\nprint('=== RAG mit Weighted Scoring ===')\nprint(f'Formel: {WEIGHT_SIMILARITY}×sim + {WEIGHT_RECENCY}×recency + {WEIGHT_AUTHORITY}×authority\\\\n')\n\nfor i, r in enumerate(results):\n payload = r.get('payload', {})\n title = payload.get('document_title', 'N\/A')[:40]\n raw_score = r.get('score', 0)\n \n # Recency aus processed_at\n processed_at = payload.get('processed_at')\n recency = calculate_recency(processed_at)\n \n # Authority (default 0.5)\n authority = float(payload.get('authority_score', 0.5))\n \n # Weighted Score\n weighted = (WEIGHT_SIMILARITY * raw_score) + (WEIGHT_RECENCY * recency) + (WEIGHT_AUTHORITY * authority)\n \n print(f'{i+1}. {title}')\n print(f' Raw: {raw_score:.4f} | Recency: {recency:.2f} | Auth: {authority:.1f} → Weighted: {weighted:.4f}')\n\" 2>&1",
"timeout": 60000,
"description": "Test weighted scoring"
}
}
{
"tool_response": {
"stdout": "=== RAG mit Weighted Scoring ===\nFormel: 0.7×sim + 0.1×recency + 0.2×authority\n\n1. Booklet_ProblemeLoesungen_RELAUNCH2026.p\n Raw: 0.8739 | Recency: 0.50 | Auth: 0.5 → Weighted: 0.7618\n2. Booklet_ProzessAuftrag_RELAUNCH2026.pdf\n Raw: 0.8466 | Recency: 0.50 | Auth: 0.5 → Weighted: 0.7426\n3. Booklet_AufstellungEntscheidung__RELAUNC\n Raw: 0.8462 | Recency: 0.50 | Auth: 0.5 → Weighted: 0.7423\n4. Booklet_AufstellungEntscheidung__RELAUNC\n Raw: 0.8462 | Recency: 0.50 | Auth: 0.5 → Weighted: 0.7423\n5. Booklet_AufstellungEntscheidung__RELAUNC\n Raw: 0.8462 | Recency: 0.50 | Auth: 0.5 → Weighted: 0.7423",
"stderr": "",
"interrupted": false,
"isImage": false
}
}