Spaces:
Running
Running
Pulastya B commited on
Commit Β·
dba2298
1
Parent(s): 8b86ea3
Fixed the broken Attributes of Parallel executor
Browse files- src/orchestrator.py +39 -7
src/orchestrator.py
CHANGED
|
@@ -1559,33 +1559,65 @@ You receive quality reports from EDA agent and deliver clean data to modeling ag
|
|
| 1559 |
if not plot_title or plot_title == "Output Path":
|
| 1560 |
plot_title = plot_path.split("/")[-1].replace("_", " ").replace(".html", "").replace(".png", "").title()
|
| 1561 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1562 |
plots.append({
|
| 1563 |
"title": plot_title,
|
| 1564 |
"path": plot_path,
|
| 1565 |
-
"url": f"/outputs/{
|
| 1566 |
"type": "html" if plot_path.endswith(".html") else "image"
|
| 1567 |
})
|
| 1568 |
print(f"[DEBUG] Added plot to array:")
|
| 1569 |
print(f"[DEBUG] title: {plot_title}")
|
| 1570 |
-
print(f"[DEBUG] url: /outputs/{
|
| 1571 |
print(f"[DEBUG] type: {'html' if plot_path.endswith('.html') else 'image'}")
|
| 1572 |
|
| 1573 |
# === COLLECT PLOT FILES (from plot_paths key) ===
|
| 1574 |
if "plot_paths" in nested_result:
|
| 1575 |
for plot_path in nested_result["plot_paths"]:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1576 |
plots.append({
|
| 1577 |
"title": plot_path.split("/")[-1].replace("_", " ").replace(".png", "").replace(".html", "").title(),
|
| 1578 |
"path": plot_path,
|
| 1579 |
-
"url": f"/outputs/{
|
| 1580 |
"type": "html" if plot_path.endswith(".html") else "image"
|
| 1581 |
})
|
| 1582 |
|
| 1583 |
# === COLLECT DATA FILES ===
|
| 1584 |
if "output_path" in nested_result and nested_result["output_path"].endswith(".csv"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1585 |
artifacts["data_files"].append({
|
| 1586 |
-
"name":
|
| 1587 |
-
"path":
|
| 1588 |
-
"url": f"/outputs/{
|
| 1589 |
})
|
| 1590 |
|
| 1591 |
# Build COMPREHENSIVE response template following user's format
|
|
@@ -3241,7 +3273,7 @@ You receive quality reports from EDA agent and deliver clean data to modeling ag
|
|
| 3241 |
messages.append(response_message)
|
| 3242 |
|
| 3243 |
# π PARALLEL EXECUTION: Detect multiple independent tool calls
|
| 3244 |
-
if len(tool_calls) > 1
|
| 3245 |
print(f"π Detected {len(tool_calls)} tool calls - attempting parallel execution")
|
| 3246 |
|
| 3247 |
# Extract tool executions with proper weight classification
|
|
|
|
| 1559 |
if not plot_title or plot_title == "Output Path":
|
| 1560 |
plot_title = plot_path.split("/")[-1].replace("_", " ").replace(".html", "").replace(".png", "").title()
|
| 1561 |
|
| 1562 |
+
# Clean path for URL - handle both ./outputs and /tmp paths
|
| 1563 |
+
if plot_path.startswith('./outputs/'):
|
| 1564 |
+
url_path = plot_path.replace('./outputs/', '')
|
| 1565 |
+
elif plot_path.startswith('/tmp/data_science_agent/outputs/'):
|
| 1566 |
+
url_path = plot_path.replace('/tmp/data_science_agent/outputs/', '')
|
| 1567 |
+
elif plot_path.startswith('/tmp/data_science_agent/'):
|
| 1568 |
+
url_path = plot_path.replace('/tmp/data_science_agent/', '')
|
| 1569 |
+
else:
|
| 1570 |
+
# Just use filename for other paths
|
| 1571 |
+
url_path = plot_path.split('/')[-1]
|
| 1572 |
+
|
| 1573 |
plots.append({
|
| 1574 |
"title": plot_title,
|
| 1575 |
"path": plot_path,
|
| 1576 |
+
"url": f"/outputs/{url_path}",
|
| 1577 |
"type": "html" if plot_path.endswith(".html") else "image"
|
| 1578 |
})
|
| 1579 |
print(f"[DEBUG] Added plot to array:")
|
| 1580 |
print(f"[DEBUG] title: {plot_title}")
|
| 1581 |
+
print(f"[DEBUG] url: /outputs/{url_path}")
|
| 1582 |
print(f"[DEBUG] type: {'html' if plot_path.endswith('.html') else 'image'}")
|
| 1583 |
|
| 1584 |
# === COLLECT PLOT FILES (from plot_paths key) ===
|
| 1585 |
if "plot_paths" in nested_result:
|
| 1586 |
for plot_path in nested_result["plot_paths"]:
|
| 1587 |
+
# Clean path for URL
|
| 1588 |
+
if plot_path.startswith('./outputs/'):
|
| 1589 |
+
url_path = plot_path.replace('./outputs/', '')
|
| 1590 |
+
elif plot_path.startswith('/tmp/data_science_agent/outputs/'):
|
| 1591 |
+
url_path = plot_path.replace('/tmp/data_science_agent/outputs/', '')
|
| 1592 |
+
elif plot_path.startswith('/tmp/data_science_agent/'):
|
| 1593 |
+
url_path = plot_path.replace('/tmp/data_science_agent/', '')
|
| 1594 |
+
else:
|
| 1595 |
+
url_path = plot_path.split('/')[-1]
|
| 1596 |
+
|
| 1597 |
plots.append({
|
| 1598 |
"title": plot_path.split("/")[-1].replace("_", " ").replace(".png", "").replace(".html", "").title(),
|
| 1599 |
"path": plot_path,
|
| 1600 |
+
"url": f"/outputs/{url_path}",
|
| 1601 |
"type": "html" if plot_path.endswith(".html") else "image"
|
| 1602 |
})
|
| 1603 |
|
| 1604 |
# === COLLECT DATA FILES ===
|
| 1605 |
if "output_path" in nested_result and nested_result["output_path"].endswith(".csv"):
|
| 1606 |
+
data_path = nested_result["output_path"]
|
| 1607 |
+
# Clean path for URL
|
| 1608 |
+
if data_path.startswith('./outputs/'):
|
| 1609 |
+
url_path = data_path.replace('./outputs/', '')
|
| 1610 |
+
elif data_path.startswith('/tmp/data_science_agent/outputs/'):
|
| 1611 |
+
url_path = data_path.replace('/tmp/data_science_agent/outputs/', '')
|
| 1612 |
+
elif data_path.startswith('/tmp/data_science_agent/'):
|
| 1613 |
+
url_path = data_path.replace('/tmp/data_science_agent/', '')
|
| 1614 |
+
else:
|
| 1615 |
+
url_path = data_path.split('/')[-1]
|
| 1616 |
+
|
| 1617 |
artifacts["data_files"].append({
|
| 1618 |
+
"name": data_path.split("/")[-1],
|
| 1619 |
+
"path": data_path,
|
| 1620 |
+
"url": f"/outputs/{url_path}"
|
| 1621 |
})
|
| 1622 |
|
| 1623 |
# Build COMPREHENSIVE response template following user's format
|
|
|
|
| 3273 |
messages.append(response_message)
|
| 3274 |
|
| 3275 |
# π PARALLEL EXECUTION: Detect multiple independent tool calls
|
| 3276 |
+
if len(tool_calls) > 1:
|
| 3277 |
print(f"π Detected {len(tool_calls)} tool calls - attempting parallel execution")
|
| 3278 |
|
| 3279 |
# Extract tool executions with proper weight classification
|