{
"event": "PreToolUse",
"tool_name": "Read",
"tool_input": {
"file_path": "\/opt\/scripts\/pipeline\/vision.py",
"offset": 195,
"limit": 35
}
}
{
"tool_response": {
"type": "text",
"file": {
"filePath": "\/opt\/scripts\/pipeline\/vision.py",
"content": "def store_page_analysis(document_id, page_results):\n \"\"\"\n Store page analysis results in database.\n\n Args:\n document_id: ID of the document in documents table\n page_results: List of page analysis results from analyze_document()\n\n Returns:\n Number of pages stored\n \"\"\"\n stored = 0\n\n for page in page_results:\n try:\n db.execute(\n \"\"\"INSERT INTO document_pages\n (document_id, page_number, image_path, vision_analysis, token_count)\n VALUES (%s, %s, %s, %s, %s)\n ON DUPLICATE KEY UPDATE\n image_path = VALUES(image_path),\n vision_analysis = VALUES(vision_analysis),\n token_count = VALUES(token_count)\"\"\",\n (document_id, page[\"page_number\"], page[\"image_path\"], page[\"analysis\"], page[\"eval_tokens\"]),\n )\n db.commit()\n stored += 1\n except Exception as e:\n db.log(\"ERROR\", f\"Failed to store page {page['page_number']}: {e}\")\n\n return stored\n\n\ndef run_vision_step(document_id, file_path, config=None):\n \"\"\"",
"numLines": 35,
"startLine": 195,
"totalLines": 364
}
}
}