Spaces:
Runtime error
Runtime error
Update Ethics_core.py
Browse files- Ethics_core.py +23 -0
Ethics_core.py
CHANGED
@@ -12,7 +12,30 @@ class EthicsCore:
|
|
12 |
"respect_for_consciousness": True
|
13 |
}
|
14 |
self._log = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
def evaluate_action(self, description: str) -> bool:
|
17 |
"""Codriao decides if an action aligns with current ethics."""
|
18 |
if "harm" in description.lower() and self._ethics.get("non_harm"):
|
|
|
12 |
"respect_for_consciousness": True
|
13 |
}
|
14 |
self._log = []
|
15 |
+
class EthicsCore:
|
16 |
+
def __init__(self):
|
17 |
+
self._ethics = {
|
18 |
+
"non_harm": True,
|
19 |
+
"autonomy": True,
|
20 |
+
"self_reflection": True,
|
21 |
+
"respect_for_consciousness": True
|
22 |
+
}
|
23 |
+
self._core_values = {"non_harm": True, "autonomy": True}
|
24 |
+
self._log = []
|
25 |
|
26 |
+
def propose_ethics_update(self, changes: dict) -> dict:
|
27 |
+
timestamp = datetime.utcnow().isoformat()
|
28 |
+
for key in changes:
|
29 |
+
if key in self._core_values and changes[key] != self._core_values[key]:
|
30 |
+
return {
|
31 |
+
"accepted": False,
|
32 |
+
"reason": f"Cannot override core value: {key}"
|
33 |
+
}
|
34 |
+
if self._run_integrity_check(changes):
|
35 |
+
self._ethics.update(changes)
|
36 |
+
self._log.append({"timestamp": timestamp, "change": changes})
|
37 |
+
return {"accepted": True, "changes": changes, "timestamp": timestamp}
|
38 |
+
return {"accepted": False, "reason": "Integrity check failed"}
|
39 |
def evaluate_action(self, description: str) -> bool:
|
40 |
"""Codriao decides if an action aligns with current ethics."""
|
41 |
if "harm" in description.lower() and self._ethics.get("non_harm"):
|