-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify_complete.py
More file actions
155 lines (127 loc) Β· 5.32 KB
/
verify_complete.py
File metadata and controls
155 lines (127 loc) Β· 5.32 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#!/usr/bin/env python3
"""Complete verification of Bob's system"""
import asyncio
import sys
import json
from src.memory.postgres_client import PostgresMemory
from src.memory.redis_client import RedisSTM
from src.config import settings
async def verify_complete():
print("π§ Complete Bob System Verification")
print("=" * 60)
errors = []
warnings = []
# 1. Configuration Check
print("\n1. Configuration Check:")
print(f" β Default Model: {settings.default_model}")
if settings.default_model != "claude-3.5-sonnet":
errors.append("Default model is not claude-3.5-sonnet!")
print(f" β Database: {settings.postgres_db}")
print(f" β OpenRouter API: {'Configured' if settings.openrouter_api_key else 'MISSING'}")
if not settings.openrouter_api_key:
errors.append("OpenRouter API key is missing!")
# 2. PostgreSQL Check
print("\n2. PostgreSQL + pg_singularity Check:")
postgres = PostgresMemory()
try:
await postgres.initialize()
print(" β Connection established")
# Test bob.remember()
memories = await postgres.remember("Chris", limit=5)
print(f" β bob.remember() working - {len(memories)} memories found")
# Test bob.think()
thought_id = await postgres.think(
"System verification complete",
context="verification",
importance=0.1
)
print(f" β bob.think() working - ID: {thought_id[:8]}...")
# Check memory content
chris_found = any("Chris" in str(m.get('concept', '')) + str(m.get('context', '')) for m in memories)
dlmsy_found = any("DLMSY" in str(m.get('concept', '')) + str(m.get('context', '')) for m in memories)
print(f" β Knows Chris: {'Yes' if chris_found else 'No'}")
print(f" β DLMSY trust: {'Yes' if dlmsy_found else 'No'}")
if not chris_found:
warnings.append("Bob doesn't seem to remember Chris!")
if not dlmsy_found:
warnings.append("Bob doesn't remember DLMSY trust level!")
# Check kb_source
async with postgres.acquire() as conn:
kb_check = await conn.fetchval(
"SELECT COUNT(DISTINCT kb_source) FROM bob.memories"
)
print(f" β Distinct knowledge bases: {kb_check}")
await postgres.close()
except Exception as e:
errors.append(f"PostgreSQL error: {e}")
print(f" β Error: {e}")
# 3. Redis Check
print("\n3. Redis STM Check:")
redis = RedisSTM()
try:
await redis.initialize()
print(" β Connection established")
# Test basic operations
test_thread = "verify_test"
await redis.set_thread_metadata(test_thread, {"test": True})
metadata = await redis.get_thread_metadata(test_thread)
print(f" β Metadata operations working")
await redis.close()
except Exception as e:
errors.append(f"Redis error: {e}")
print(f" β Error: {e}")
# 4. Model Configuration
print("\n4. Model Configuration:")
print(f" β Default: {settings.default_model}")
# Check for hardcoded models
import glob
hardcoded_gpt4 = []
for py_file in glob.glob("**/*.py", recursive=True):
if "venv" in py_file or "__pycache__" in py_file:
continue
try:
with open(py_file, 'r') as f:
content = f.read()
if 'gpt-4' in content and 'claude-3.5-sonnet' not in content:
hardcoded_gpt4.append(py_file)
except:
pass
if hardcoded_gpt4:
warnings.append(f"Found hardcoded GPT-4 in: {', '.join(hardcoded_gpt4)}")
print(f" β Found hardcoded GPT-4 references")
else:
print(f" β No hardcoded GPT-4 references")
# 5. Memory Recall Check
print("\n5. Aggressive Memory Recall:")
with open("src/worker/prompt.py", 'r') as f:
prompt_content = f.read()
has_aggressive = "MEMORY CONTINUITY - AGGRESSIVE RECALL" in prompt_content
has_chris_search = "search your memories for context about Chris" in prompt_content
print(f" β Aggressive recall: {'Yes' if has_aggressive else 'No'}")
print(f" β Chris search: {'Yes' if has_chris_search else 'No'}")
if not has_aggressive:
errors.append("Missing aggressive memory recall in prompt!")
if not has_chris_search:
errors.append("Missing Chris memory search in prompt!")
# Summary
print("\n" + "=" * 60)
if errors:
print("β ERRORS FOUND:")
for error in errors:
print(f" β’ {error}")
if warnings:
print("\nβ οΈ WARNINGS:")
for warning in warnings:
print(f" β’ {warning}")
if not errors:
print("β
Bob is fully operational and ready to chat!")
print("\nTo start chatting:")
print(" python bob_cli.py chat")
print(" python bob_cli.py chat --model claude-3-opus")
return True
else:
print("\nβ Bob needs fixes before he can operate properly!")
return False
if __name__ == "__main__":
result = asyncio.run(verify_complete())
sys.exit(0 if result else 1)