Protokoll #25078

ID25078
Zeitstempel2025-12-28 02:10:37.245198
Clientroot
IP145.224.72.140
Modellclaude-sonnet-4-20250514
Statuspending
Tokens499 (Input: 499, Output: 0)
Dauer-
Request-Zeit2025-12-28 02:10:37.245198
Response-Zeit-

Request

{
    "event": "PreToolUse",
    "tool_name": "Bash",
    "tool_input": {
        "command": "DB_PASSWORD=\"v8mFLmkF2fth_r\" timeout 90 .\/venv\/bin\/python -c \"\nimport json\nimport ollama\nfrom db import db\n\ndb.connect()\n\n# Get chunks for doc 12\ncursor = db.execute('SELECT id, content FROM chunks WHERE document_id = 12 LIMIT 3')\nchunks = cursor.fetchall()\ncursor.close()\n\nPROMPT = '''Analysiere den Text semantisch. Antworte NUR mit JSON:\n{\\\"statement_form\\\": \\\"assertion|question|command|conditional\\\", \\\"intent\\\": \\\"explain|argue|define|compare|exemplify|warn|instruct\\\", \\\"frame\\\": \\\"theoretical|practical|historical|methodological|critical\\\", \\\"is_negated\\\": false, \\\"discourse_role\\\": \\\"thesis|evidence|example|counter|summary|definition\\\"}\n\nText: '''\n\nfor chunk in chunks:\n    print(f'Chunk {chunk[\\\"id\\\"]}...')\n    response = ollama.generate(model='mistral', prompt=PROMPT + chunk['content'][:1500], options={'num_predict': 200})\n    resp_text = response['response'].strip()\n    start = resp_text.find('{')\n    end = resp_text.rfind('}') + 1\n    if start >= 0 and end > start:\n        sem = json.loads(resp_text[start:end])\n        print(f'  -> {sem[\\\"statement_form\\\"]}, {sem.get(\\\"intent\\\")}, {sem.get(\\\"discourse_role\\\")}')\n        \n        # Store in DB\n        cursor = db.execute('''INSERT INTO chunk_text_semantics \n            (chunk_id, statement_form, intent, frame, is_negated, discourse_role, model_used)\n            VALUES (%s, %s, %s, %s, %s, %s, %s)\n            ON DUPLICATE KEY UPDATE statement_form=VALUES(statement_form), intent=VALUES(intent)''',\n            (chunk['id'], sem['statement_form'], sem.get('intent'), sem.get('frame'), \n             sem.get('is_negated', False), sem.get('discourse_role'), 'mistral'))\n        db.commit()\n        cursor.close()\n        print('  -> Saved!')\n\nprint('Done!')\ndb.disconnect()\n\"",
        "timeout": 180000,
        "description": "Test semantic analysis with DB storage"
    }
}

Response

-
← Vorheriger Zur Liste Nächster →