Protokoll #24550
| ID | 24550 |
|---|---|
| Zeitstempel | 2025-12-27 23:47:13.667688 |
| Client | root |
| IP | Warning: Undefined array key "request_ip" in /var/www/dev.campus.systemische-tools.de/src/View/protokoll/show.php on line 13 Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/dev.campus.systemische-tools.de/src/View/protokoll/show.php on line 13 |
| Modell | claude-sonnet-4-20250514 |
| Status | pending |
| Tokens | 700 (Input: 0, Output: 0) |
| Dauer | - |
| Request-Zeit | Warning: Undefined array key "request_timestamp" in /var/www/dev.campus.systemische-tools.de/src/View/protokoll/show.php on line 18 |
| Response-Zeit | - |
Warning: Undefined array key "error_message" in /var/www/dev.campus.systemische-tools.de/src/View/protokoll/show.php on line 22
Request
{
"event": "PostToolUse",
"tool_name": "Read",
"tool_response": {
"type": "text",
"file": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/AI\/ScoringService.php",
"content": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Infrastructure\\AI;\n\n\/\/ @responsibility: Berechnet gewichtete Scores aus Vector-Similarity, Recency und Authority\n\nuse DateTimeInterface;\n\n\/**\n * Calculates weighted scores for RAG search results.\n *\n * Combines vector similarity with recency and authority factors\n * to produce a more nuanced ranking of search results.\n *\/\nfinal readonly class ScoringService\n{\n \/** Weight for vector similarity score (cosine) *\/\n private const WEIGHT_SIMILARITY = 0.7;\n\n \/** Weight for document recency *\/\n private const WEIGHT_RECENCY = 0.1;\n\n \/** Weight for source authority *\/\n private const WEIGHT_AUTHORITY = 0.2;\n\n \/**\n * Calculate weighted score combining similarity, recency, and authority.\n *\n * @param float $vectorScore The cosine similarity score from vector search (0.0-1.0)\n * @param DateTimeInterface $documentDate The document's processed\/created date\n * @param float $authorityScore The source authority score (0.0-1.0, default: 0.5)\n *\n * @return float The weighted score (0.0-1.0)\n *\/\n public function calculateScore(\n float $vectorScore,\n DateTimeInterface $documentDate,\n float $authorityScore = 0.5\n ): float {\n $recencyScore = $this->calculateRecency($documentDate);\n\n return (self::WEIGHT_SIMILARITY * $vectorScore)\n + (self::WEIGHT_RECENCY * $recencyScore)\n + (self::WEIGHT_AUTHORITY * $authorityScore);\n }\n\n \/**\n * Calculate recency score based on document age.\n *\n * Returns 1.0 for today, linearly decreasing to 0.0 at 365 days old.\n *\n * @param DateTimeInterface $date The document date\n *\n * @return float Recency score (0.0-1.0)\n *\/\n private function calculateRecency(DateTimeInterface $date): float\n {\n $now = new \\DateTime();\n $interval = $now->diff($date);\n $daysOld = $interval->days;\n\n \/\/ Documents older than 1 year get minimum recency score\n return max(0.0, 1.0 - ($daysOld \/ 365));\n }\n\n \/**\n * Get the weight configuration for transparency.\n *\n * @return array{similarity: float, recency: float, authority: float}\n *\/\n public function getWeights(): array\n {\n return [\n 'similarity' => self::WEIGHT_SIMILARITY,\n 'recency' => self::WEIGHT_RECENCY,\n 'authority' => self::WEIGHT_AUTHORITY,\n ];\n }\n}\n",
"numLines": 82,
"startLine": 1,
"totalLines": 82
}
}
}
Response
-