Spaces:
Sleeping
Sleeping
Update agent_logic.py
Browse files- agent_logic.py +19 -2
agent_logic.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# agent_logic.py (Fixed: OpenAI and Nebius Initialization)
|
| 2 |
import asyncio
|
| 3 |
from typing import AsyncGenerator, Dict, Optional, List, Tuple
|
| 4 |
import json
|
|
@@ -256,7 +256,24 @@ class StrategicSelectorAgent:
|
|
| 256 |
yield "Deploying: Static Heterogeneous Team (Cognitive Diversity)..."
|
| 257 |
|
| 258 |
# --- UNPACK 4 VALUES FROM CALIBRATOR ---
|
| 259 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 260 |
|
| 261 |
# Track Calibration Cost explicitly
|
| 262 |
calib_step_cost = add_usage(calib_usage)
|
|
|
|
| 1 |
+
# agent_logic.py (Fixed: OpenAI and Nebius Initialization + Robust Unpacking)
|
| 2 |
import asyncio
|
| 3 |
from typing import AsyncGenerator, Dict, Optional, List, Tuple
|
| 4 |
import json
|
|
|
|
| 256 |
yield "Deploying: Static Heterogeneous Team (Cognitive Diversity)..."
|
| 257 |
|
| 258 |
# --- UNPACK 4 VALUES FROM CALIBRATOR ---
|
| 259 |
+
# Safely call and unpack, providing debugging if it fails
|
| 260 |
+
calib_result = await self.calibrator.calibrate_team(current_problem)
|
| 261 |
+
|
| 262 |
+
if calib_result is None:
|
| 263 |
+
raise ValueError("CRITICAL ERROR: calibrate_team returned None. Please verify mcp_servers.py on the server.")
|
| 264 |
+
|
| 265 |
+
if len(calib_result) != 4:
|
| 266 |
+
# Fallback logic if server has old mcp_servers.py (e.g. 2 or 3 values)
|
| 267 |
+
if len(calib_result) == 2:
|
| 268 |
+
team_plan, calibration_errors = calib_result
|
| 269 |
+
calib_details, calib_usage = [], [] # Defaults
|
| 270 |
+
elif len(calib_result) == 3:
|
| 271 |
+
team_plan, calibration_errors, calib_details = calib_result
|
| 272 |
+
calib_usage = [] # Default
|
| 273 |
+
else:
|
| 274 |
+
raise ValueError(f"Calibrator returned {len(calib_result)} values, expected 4.")
|
| 275 |
+
else:
|
| 276 |
+
team_plan, calibration_errors, calib_details, calib_usage = calib_result
|
| 277 |
|
| 278 |
# Track Calibration Cost explicitly
|
| 279 |
calib_step_cost = add_usage(calib_usage)
|