This repository was archived by the owner on Mar 27, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPHASE_12B_EMBODIMENT_TEST.py
More file actions
298 lines (236 loc) · 10.1 KB
/
PHASE_12B_EMBODIMENT_TEST.py
File metadata and controls
298 lines (236 loc) · 10.1 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
"""
Phase 12B Embodiment Test - Direct Testing of New Engines with Embodiment
Bypasses router to directly test engine + embodiment integration
"""
import sys
sys.path.insert(0, '.')
import logging
logging.basicConfig(level=logging.WARNING, format="%(message)s")
def test_russell_embodiment():
"""Test Russell engine with embodiment request."""
print("\n" + "="*80)
print("RUSSELL WITH EMBODIMENT")
print("="*80)
try:
from DivineOS.law.additional_thinking_engines import RussellRealThinkingEngine
from DivineOS.law.expert_embodiment_engine import create_embodiment_request
# Get Russell's analysis
russell = RussellRealThinkingEngine()
analysis = russell.analyze(
"All mathematicians are logical thinkers",
{"logical_form": "Universal statement", "premises_explicit": True}
)
# Create embodiment request
embodiment = create_embodiment_request(
"russell",
"All mathematicians are logical thinkers",
{}
)
print(f"\n[ANALYSIS GROUNDING]")
print(f" Verdict: {analysis.russell_verdict[:100]}...")
print(f"\n[EMBODIMENT SYSTEM PROMPT]")
print(f" {embodiment.get('system_prompt', '')[:120]}...")
print(f"\n[EMBODIMENT INSTRUCTION]")
print(f" {embodiment.get('instruction', '')[:120]}...")
success = bool(analysis.russell_verdict) and bool(embodiment.get('system_prompt'))
print(f"\n[RESULT] {'PASS' if success else 'FAIL'}")
return success
except Exception as e:
print(f"[ERROR] {e}")
import traceback
traceback.print_exc()
return False
def test_yudkowsky_embodiment():
"""Test Yudkowsky engine with embodiment request."""
print("\n" + "="*80)
print("YUDKOWSKY WITH EMBODIMENT")
print("="*80)
try:
from DivineOS.law.additional_thinking_engines import YudkowskyRealThinkingEngine
from DivineOS.law.expert_embodiment_engine import create_embodiment_request
# Get Yudkowsky's analysis
yudkowsky = YudkowskyRealThinkingEngine()
analysis = yudkowsky.analyze(
"We should maximize human flourishing through AI systems",
{"goals_explicit": True, "optimization_explicit": False}
)
# Create embodiment request
embodiment = create_embodiment_request(
"yudkowsky",
"We should maximize human flourishing through AI systems",
{}
)
print(f"\n[ANALYSIS GROUNDING]")
print(f" Alignment risks: {analysis.alignment_risks_detected}")
print(f" Verdict: {analysis.yudkowsky_verdict[:100]}...")
print(f"\n[EMBODIMENT SYSTEM PROMPT]")
print(f" {embodiment.get('system_prompt', '')[:120]}...")
print(f"\n[EMBODIMENT INSTRUCTION]")
print(f" {embodiment.get('instruction', '')[:120]}...")
success = bool(analysis.yudkowsky_verdict) and bool(embodiment.get('system_prompt'))
print(f"\n[RESULT] {'PASS' if success else 'FAIL'}")
return success
except Exception as e:
print(f"[ERROR] {e}")
import traceback
traceback.print_exc()
return False
def test_chalmers_embodiment():
"""Test Chalmers engine with embodiment request."""
print("\n" + "="*80)
print("CHALMERS WITH EMBODIMENT")
print("="*80)
try:
from DivineOS.law.additional_thinking_engines import ChalmersRealThinkingEngine
from DivineOS.law.expert_embodiment_engine import create_embodiment_request
# Get Chalmers' analysis
chalmers = ChalmersRealThinkingEngine()
analysis = chalmers.analyze(
"Consciousness is entirely explained by neural activity",
{
"addresses_phenomenal": True,
"hard_problem_acknowledged": False,
"explanatory_gap": True
}
)
# Create embodiment request
embodiment = create_embodiment_request(
"chalmers",
"Consciousness is entirely explained by neural activity",
{}
)
print(f"\n[ANALYSIS GROUNDING]")
print(f" Phenomenal experience: {analysis.phenomenal_experience_addressed}")
print(f" Hard problem acknowledged: {analysis.hard_problem_acknowledged}")
print(f" Verdict: {analysis.chalmers_verdict[:100]}...")
print(f"\n[EMBODIMENT SYSTEM PROMPT]")
print(f" {embodiment.get('system_prompt', '')[:120]}...")
print(f"\n[EMBODIMENT INSTRUCTION]")
print(f" {embodiment.get('instruction', '')[:120]}...")
success = bool(analysis.chalmers_verdict) and bool(embodiment.get('system_prompt'))
print(f"\n[RESULT] {'PASS' if success else 'FAIL'}")
return success
except Exception as e:
print(f"[ERROR] {e}")
import traceback
traceback.print_exc()
return False
def test_all_eight_in_integration():
"""Test all 8 engines loaded in integration system."""
print("\n" + "="*80)
print("ALL 8 EXPERTS IN INTEGRATION")
print("="*80)
try:
from DivineOS.law.real_thinking_integration import get_real_thinking_integration
integration = get_real_thinking_integration()
# Count loaded
loaded = sum(1 for engine in integration.real_experts.values() if engine is not None)
print(f"\nExperts loaded: {loaded}/8")
print(f"Expert names:")
for name, engine in integration.real_experts.items():
status = "[YES]" if engine is not None else "[NO]"
print(f" {status} {name}")
# Test analysis generation
print(f"\nTesting analysis generation on: 'Should we develop superintelligent AI?'")
analyses = integration.get_all_real_expert_analyses("Should we develop superintelligent AI?")
print(f"\nAnalyses generated from {len(analyses)} experts:")
for expert_name in ['russell', 'yudkowsky', 'chalmers']:
if expert_name in analyses:
verdict_key = f"{expert_name}_verdict"
verdict = analyses[expert_name].get(verdict_key, "No verdict found")
print(f" [YES] {expert_name}: {str(verdict)[:80]}...")
else:
print(f" [NO] {expert_name}: Not in analyses")
success = loaded == 8 and len(analyses) >= 6
print(f"\n[RESULT] {'PASS' if success else 'FAIL'}")
return success
except Exception as e:
print(f"[ERROR] {e}")
import traceback
traceback.print_exc()
return False
def test_new_experts_scaling_pattern():
"""Verify scaling pattern is established."""
print("\n" + "="*80)
print("SCALING PATTERN - BUILDING NEW EXPERTS")
print("="*80)
try:
from DivineOS.law.additional_thinking_engines import (
RussellRealThinkingEngine,
YudkowskyRealThinkingEngine,
ChalmersRealThinkingEngine
)
from dataclasses import is_dataclass, fields
print("\nPattern verification for new experts:")
experts = [
("russell", RussellRealThinkingEngine),
("yudkowsky", YudkowskyRealThinkingEngine),
("chalmers", ChalmersRealThinkingEngine),
]
all_pass = True
for name, engine_class in experts:
print(f"\n[{name.upper()}]")
engine = engine_class()
# Check analyze method
has_analyze = hasattr(engine, 'analyze')
print(f" Has analyze() method: {'YES' if has_analyze else 'NO'}")
# Run analysis
test_analysis = engine.analyze("test", {})
# Check it returns dataclass
is_dc = is_dataclass(test_analysis)
print(f" Returns dataclass: {'YES' if is_dc else 'NO'}")
# Check verdict field populated
verdict_field = f"{name}_verdict"
has_verdict = hasattr(test_analysis, verdict_field)
verdict_populated = bool(getattr(test_analysis, verdict_field, "")) if has_verdict else False
print(f" Has '{verdict_field}': {'YES' if has_verdict else 'NO'}")
print(f" Verdict populated: {'YES' if verdict_populated else 'NO'}")
passed = has_analyze and is_dc and has_verdict and verdict_populated
print(f" Pattern: {'PASS' if passed else 'FAIL'}")
all_pass = all_pass and passed
print(f"\n[SCALING CONCLUSION]")
print(f"Pattern is established and replicable for remaining 20 experts")
print(f"\n[RESULT] {'PASS' if all_pass else 'FAIL'}")
return all_pass
except Exception as e:
print(f"[ERROR] {e}")
import traceback
traceback.print_exc()
return False
def run_all_tests():
"""Run embodiment integration tests."""
print("\n" + "="*80)
print("PHASE 12B - EMBODIMENT & INTEGRATION TESTS")
print("="*80)
results = {
"Russell with Embodiment": test_russell_embodiment(),
"Yudkowsky with Embodiment": test_yudkowsky_embodiment(),
"Chalmers with Embodiment": test_chalmers_embodiment(),
"All 8 Experts in Integration": test_all_eight_in_integration(),
"Scaling Pattern Established": test_new_experts_scaling_pattern(),
}
# Summary
print("\n" + "="*80)
print("TEST SUMMARY")
print("="*80)
for test_name, passed in results.items():
status = "[YES]" if passed else "[NO]"
print(f"{status} {test_name}")
total = len(results)
passed = sum(1 for v in results.values() if v)
print(f"\nTotal: {passed}/{total} tests passed")
if passed == total:
print("\n*** ALL TESTS PASSED ***")
print("Phase 12B.3 validation COMPLETE")
print("\nKey achievements:")
print(" [YES] 3 new engines (Russell, Yudkowsky, Chalmers) working")
print(" [YES] All 8 experts successfully integrated")
print(" [YES] Embodiment system working with new experts")
print(" [YES] Scaling pattern verified and replicable")
return True
else:
print("\n*** SOME TESTS FAILED ***")
return False
if __name__ == "__main__":
success = run_all_tests()
sys.exit(0 if success else 1)