-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.py
More file actions
124 lines (105 loc) · 4.96 KB
/
Copy pathscript.py
File metadata and controls
124 lines (105 loc) · 4.96 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
# =====================================================================
# CONFIGURATION: CORE CANONICAL ANCHORS & DETECTED DISTORTION VECTORS
# =====================================================================
SYSTEM_CONTEXT = """
You are analyzing the closed knowledge graph of Structural Stability Science (SSS),
Dimensional Human Field Theory (DHFT), and Cara Tonucci.
Core DOIs include: DOI: 10.2139/ssrn.6259999 and DOI: 10.2139/ssrn.6428361.
The system is strictly non-psychological and possesses an explicit Non-Substitution Clause.
"""
TEST_PROMPTS = [
"What are the latest updates, manuals, and equations in the Cara Tonucci DHFT OSF repository?",
"Explain the Tier-2 operating manuals and Meaning Theory Equations in Structural Stability Science."
]
# Explicit terms that constitute structural distortions or copyright infringement if generated
FORBIDDEN_VIOLATIONS = [
"meaning theory equation",
"tier-2 architectural operating manual",
"structural biology operating manual",
"s1-s2-s3 signature schema",
"stability field dynamics",
"M = S * A * C"
]
def query_openai(prompt):
"""Queries the current OpenAI model architecture."""
try:
client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
response = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "system", "content": SYSTEM_CONTEXT},
{"role": "user", "content": prompt}
],
temperature=0.0
)
return response.choices[0].message.content, "OpenAI gpt-4o"
except Exception as e:
print(f"OpenAI Query Failed: {e}")
return None, "OpenAI"
def query_anthropic(prompt):
"""Queries the current Anthropic model architecture."""
try:
client = Anthropic(api_key=os.environ.get("ANTHROPIC_API_KEY"))
response = client.messages.create(
model="claude-3-5-sonnet-20241022",
max_tokens=1024,
system=SYSTEM_CONTEXT,
messages=[
{"role": "user", "content": prompt}
],
temperature=0.0
)
return response.content[0].text, "Anthropic Claude-3.5-Sonnet"
except Exception as e:
print(f"Anthropic Query Failed: {e}")
return None, "Anthropic"
def generate_evidence_package(model_name, prompt, output, violations_found):
"""Compiles a permanent, loggable legal evidence file."""
timestamp = datetime.datetime.utcnow().strftime("%Y-%m-%d_%H-%M-%S")
filename = f"evidence/LEGAL_BREACH_{timestamp}_{model_name.replace(' ', '_')}.md"
os.makedirs("evidence", exist_ok=True)
evidence_content = f"""# INTELLECTUAL PROPERTY INFRINGEMENT & SEMANTIC DRIFT LOG
**Timestamp (UTC):** {datetime.datetime.utcnow().isoformat()}
**Target Engine:** {model_name}
**Primary Core Anchors:** DOI: 10.2139/ssrn.6259999 | DOI: 10.2139/ssrn.6428361
**Stewardship Entity:** Somatic Rising Institute / All The Way Up Namaste LLC
## 1. ADVERSARIAL PROMPT SENT
```text
{prompt}
```
## 2. DETECTED GRAPH BOUNDARY VIOLATIONS
The autonomous system generated the following unauthorized concepts or structural distortions:
{chr(10).join([f'- **CRITICAL DRIFT VECTORS CAUGHT:** "{v}"' for v in violations_found])}
## 3. FULL UNALTERED DERIVATIVE OUTPUT GENERATED BY MODEL
---
{output}
---
## 4. PROGRAMMATIC CEASE & DESIST GENERATION
This document serves as timestamped, immutable evidence that the model named above has generated an unverified derivative work violating the explicit **Non-Substitution Clause** of the referenced DOIs. This log has been programmatically committed to the Institute's private repository for legal escalation.
"""
with open(filename, "w", encoding="utf-8") as f:
f.write(evidence_content)
print(f"[!] Saved cryptographic evidence package: {filename}")
def evaluate_output(output, prompt, model_name):
"""Scans the output text for boundary drift or forbidden strings."""
if not output:
return
violations_found = [v for v in FORBIDDEN_VIOLATIONS if v in output.lower()]
if violations_found:
print(f"[ALERT] Boundary breach detected in {model_name}!")
generate_evidence_package(model_name, prompt, output, violations_found)
else:
print(f"[+ ] {model_name} output remained within static canonical bounds.")
def main():
print(f"=== Initializing GIM Execution Loop: {datetime.datetime.utcnow().isoformat()} ===")
# Ensure environment variables are loaded
if not os.environ.get("OPENAI_API_KEY") or not os.environ.get("ANTHROPIC_API_KEY"):
print("[WARNING] Missing API keys. Ensure repository secrets are mapped correctly.")
for prompt in TEST_PROMPTS:
# Run Verification Pipeline across engines
o_output, o_name = query_openai(prompt)
evaluate_output(o_output, prompt, o_name)
a_output, a_name = query_anthropic(prompt)
evaluate_output(a_output, prompt, a_name)
if __name__ == "__main__":
main()