{
"event": "PreToolUse",
"tool_name": "Grep",
"tool_input": {
"pattern": "upsert.*Qdrant|json.*payload",
"path": "\/var\/www\/scripts\/pipeline\/embed.py",
"output_mode": "content",
"-B": 5,
"-A": 15
}
}
{
"tool_response": {
"mode": "content",
"numFiles": 0,
"filenames": [],
"content": "47-def store_in_qdrant(collection, point_id, vector, payload):\n48- \"\"\"Store embedding in Qdrant.\"\"\"\n49- try:\n50- response = requests.put(\n51- f\"http:\/\/{QDRANT_HOST}:{QDRANT_PORT}\/collections\/{collection}\/points\",\n52: json={\"points\": [{\"id\": point_id, \"vector\": vector, \"payload\": payload}]},\n53- headers={\"Content-Type\": \"application\/json\"},\n54- timeout=30,\n55- )\n56- response.raise_for_status()\n57- return True\n58- except Exception as e:\n59- db.log(\"ERROR\", f\"Qdrant storage failed: {e}\")\n60- return False\n61-\n62-\n63-def embed_chunks(chunks, document_id, document_title, source_path, progress=None):\n64- \"\"\"\n65- Generate embeddings for chunks and store in Qdrant.\n66- Returns number of successfully embedded chunks.\n67- \"\"\"\n--\n171- return []\n172-\n173- try:\n174- response = requests.post(\n175- f\"http:\/\/{QDRANT_HOST}:{QDRANT_PORT}\/collections\/{collection}\/points\/search\",\n176: json={\"vector\": embedding, \"limit\": limit, \"with_payload\": True},\n177- headers={\"Content-Type\": \"application\/json\"},\n178- timeout=30,\n179- )\n180- response.raise_for_status()\n181- data = response.json()\n182- return data.get(\"result\", [])\n183- except Exception as e:\n184- db.log(\"ERROR\", f\"Qdrant search failed: {e}\")\n185- return []\n186-\n187-\n188-if __name__ == \"__main__\":\n189- import sys\n190-\n191- if len(sys.argv) > 1:",
"numLines": 43
}
}