{
"event": "PreToolUse",
"tool_name": "Read",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/AI\/QdrantService.php",
"offset": 257,
"limit": 80
}
}
{
"tool_response": {
"type": "text",
"file": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/AI\/QdrantService.php",
"content": " \/**\n * Retrieves metadata and information about a collection.\n *\n * Fetches detailed information about a specific collection including\n * vector size, distance metric, number of points, and other metadata.\n *\n * @param string $collection The collection name to query\n *\n * @return array<string, mixed>|null The collection information array, or null if collection does not exist\n *\n * @throws RuntimeException If the API request fails (excluding 404)\n *\n * @example\n * $service = new QdrantService();\n * $info = $service->getCollectionInfo('documents');\n * \/\/ Returns: [\n * \/\/ 'status' => 'green',\n * \/\/ 'vectors_count' => 1234,\n * \/\/ 'points_count' => 1234,\n * \/\/ 'config' => ['params' => ['vectors' => ['size' => 1024, 'distance' => 'Cosine']]]\n * \/\/ ]\n *\/\n public function getCollectionInfo(string $collection): ?array\n {\n $url = sprintf('%s\/collections\/%s', $this->host, urlencode($collection));\n\n try {\n $ch = curl_init($url);\n\n if ($ch === false) {\n throw new RuntimeException('Failed to initialize cURL');\n }\n\n curl_setopt_array($ch, [\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_TIMEOUT => self::DEFAULT_TIMEOUT,\n CURLOPT_CONNECTTIMEOUT => 10,\n CURLOPT_HTTPHEADER => ['Content-Type: application\/json'],\n CURLOPT_CUSTOMREQUEST => 'GET',\n ]);\n\n $result = curl_exec($ch);\n $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n $curlError = curl_error($ch);\n\n curl_close($ch);\n\n if ($result === false) {\n throw new RuntimeException(\n sprintf('cURL request failed: %s', $curlError !== '' ? $curlError : 'Unknown error')\n );\n }\n\n if ($httpCode === 404) {\n return null;\n }\n\n if ($httpCode !== 200) {\n throw new RuntimeException(\n sprintf('Qdrant API returned HTTP %d: %s', $httpCode, $result)\n );\n }\n\n $decoded = json_decode((string) $result, true);\n\n if (!is_array($decoded)) {\n throw new RuntimeException('Failed to decode JSON response from Qdrant API');\n }\n\n return is_array($decoded['result'] ?? null) ? $decoded['result'] : null;\n } catch (RuntimeException $e) {\n throw $e;\n } catch (\\Throwable) {\n return null;\n }\n }\n\n \/**\n * Makes an HTTP POST request to the Qdrant API.\n *",
"numLines": 80,
"startLine": 257,
"totalLines": 403
}
}
}