-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_processor.py
More file actions
71 lines (60 loc) · 2.12 KB
/
Copy pathdebug_processor.py
File metadata and controls
71 lines (60 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env python3
"""
Debug script to check Vertex AI processor status
"""
import sqlite3
from caching import load_cache
from vertex_grounded_research import perform_grounded_research
def debug_processing():
"""Debug the processing status"""
# Load cache
cache = load_cache()
print(f"Cache entries: {len(cache)}")
# Count Vertex AI entries
vertex_entries = [k for k in cache.keys() if 'vertex_grounded' in k]
print(f"Vertex AI cached entries: {len(vertex_entries)}")
# Check database
conn = sqlite3.connect('review_app/data/reviews.db')
cursor = conn.cursor()
# Get processed records
cursor.execute('''
SELECT COUNT(*) FROM records
WHERE enhanced_description LIKE '%VERTEX AI RESEARCH%'
''')
processed = cursor.fetchone()[0]
print(f"Database processed records: {processed}")
# Check next record to process
cursor.execute('''
SELECT id, record_number, title FROM records
WHERE enhanced_description NOT LIKE '%VERTEX AI RESEARCH%'
ORDER BY record_number
LIMIT 1
''')
next_record = cursor.fetchone()
if next_record:
id, record_number, title = next_record
print(f"Next record to process: #{record_number} - {title}")
# Test research on this record
record_data = {
'id': id,
'record_number': record_number,
'title': title,
'author': '',
'isbn': '',
'publisher': '',
'description': ''
}
print("Testing Vertex AI research...")
try:
results, cached = perform_grounded_research(record_data, cache)
if 'error' in results:
print(f"Research error: {results['error']}")
else:
print(f"Research successful! Cached: {cached}")
if 'verified_data' in results:
print(f"Verified data: {results['verified_data']}")
except Exception as e:
print(f"Research exception: {e}")
conn.close()
if __name__ == "__main__":
debug_processing()