-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Implement GDS and Martensite Metrics in TactileDialecticianAgent #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -48,5 +48,43 @@ def test_hickam_ooda_loop_paraconsistent_tension(self): | |||||||||||||||||||||||||||||||||||||||||||||||||
| self.assertTrue(checklist["epistemic_escrow_secured"]) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| self.assertTrue(checklist["symbolic_scar_integrity_maintained"]) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| def test_gds_computation_and_logging(self): | ||||||||||||||||||||||||||||||||||||||||||||||||||
| context = { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "intent": "Simple short text", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "query_domain": "A", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "drivers": ["speed"], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "lens": "Test Lens" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| # Test low GDS (< 0.5) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| context["query_domain"] = "AAAA" | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| result = self.agent.execute_hickam_ooda_loop(context) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| self.assertEqual(result["status"], "COMPLETE") | ||||||||||||||||||||||||||||||||||||||||||||||||||
| self.assertIn("Contrastive_Delta", result) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| self.assertIn("Martensite_Metrics", result) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| contrastive_delta = result["Contrastive_Delta"] | ||||||||||||||||||||||||||||||||||||||||||||||||||
| self.assertTrue(contrastive_delta["hitl_required"]) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| self.assertLess(contrastive_delta["gds_score"], 0.5) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| # Verify it logged to SymbolicScar.jsonl | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import os | ||||||||||||||||||||||||||||||||||||||||||||||||||
| self.assertTrue(os.path.exists("SymbolicScar.jsonl")) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| with open("SymbolicScar.jsonl", "r") as f: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| lines = f.readlines() | ||||||||||||||||||||||||||||||||||||||||||||||||||
| last_line = lines[-1] | ||||||||||||||||||||||||||||||||||||||||||||||||||
| self.assertIn("ontological_correction", last_line) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| self.assertIn("Test Lens", last_line) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| # Cleanup | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if os.path.exists("SymbolicScar.jsonl"): | ||||||||||||||||||||||||||||||||||||||||||||||||||
| os.remove("SymbolicScar.jsonl") | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+74
to
+85
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If any of the assertions fail during the test, the cleanup code at the end of the test method will not be executed, leaving the temporary
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| if __name__ == '__main__': | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| unittest.main() | ||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opening a file for writing without specifying an encoding can lead to platform-dependent
UnicodeEncodeError(e.g., on Windows systems where the default encoding is not UTF-8). Additionally, performing file I/O operations without error handling can crash the entire agent's execution loop if there are permission issues or if the disk is full. It is safer to specifyencoding="utf-8"and wrap the file write in atry-exceptblock to log anyIOErrorgracefully.