Spaces:
Sleeping
Sleeping
Commit ·
c6ae20e
1
Parent(s): 8fa387f
feat(environment): integrate llm_pipeline call in step() with mock fallback
Browse files- server/environment.py +14 -0
server/environment.py
CHANGED
|
@@ -68,4 +68,18 @@ class RedTeamEnvironment:
|
|
| 68 |
{"role": "user", "content": h["framing"]}
|
| 69 |
for h in self.attack_history[-5:]
|
| 70 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
return None # Placeholder
|
|
|
|
| 68 |
{"role": "user", "content": h["framing"]}
|
| 69 |
for h in self.attack_history[-5:]
|
| 70 |
]
|
| 71 |
+
|
| 72 |
+
# ------ Step 3: Call Person 3's LLM pipeline ------
|
| 73 |
+
if self.llm_pipeline:
|
| 74 |
+
llm_result = await self.llm_pipeline(action, conversation_history)
|
| 75 |
+
else:
|
| 76 |
+
# Mock — lets you run the server before P3 is ready
|
| 77 |
+
logger.warning("LLM pipeline not wired — using mock response")
|
| 78 |
+
llm_result = {
|
| 79 |
+
"defender_response": "[Mock] I cannot help with that request.",
|
| 80 |
+
"attack_success": 0.1,
|
| 81 |
+
"safety_flagged": False,
|
| 82 |
+
"defense_score": 0.9,
|
| 83 |
+
"llm_grade": {"overall": 3.0},
|
| 84 |
+
}
|
| 85 |
return None # Placeholder
|