Spaces:
Running
Running
Pulastya B
commited on
Commit
Β·
9566116
1
Parent(s):
dd1f6f0
Add debug logging to session resolution to diagnose fallback issue
Browse files- src/orchestrator.py +5 -0
- src/session_memory.py +4 -0
src/orchestrator.py
CHANGED
|
@@ -2102,17 +2102,22 @@ You are a DOER. Complete workflows based on user intent."""
|
|
| 2102 |
if self.session:
|
| 2103 |
# Check if request has ambiguous references
|
| 2104 |
resolved_params = self.session.resolve_ambiguity(task_description)
|
|
|
|
|
|
|
| 2105 |
|
| 2106 |
# Use resolved params if user didn't specify
|
| 2107 |
if not file_path or file_path == "":
|
| 2108 |
if resolved_params.get("file_path"):
|
| 2109 |
file_path = resolved_params["file_path"]
|
| 2110 |
print(f"π Using dataset from session: {file_path}")
|
|
|
|
|
|
|
| 2111 |
|
| 2112 |
if not target_col:
|
| 2113 |
if resolved_params.get("target_col"):
|
| 2114 |
target_col = resolved_params["target_col"]
|
| 2115 |
print(f"π Using target column from session: {target_col}")
|
|
|
|
| 2116 |
|
| 2117 |
# Show session context if available
|
| 2118 |
if self.session.last_dataset or self.session.last_model:
|
|
|
|
| 2102 |
if self.session:
|
| 2103 |
# Check if request has ambiguous references
|
| 2104 |
resolved_params = self.session.resolve_ambiguity(task_description)
|
| 2105 |
+
print(f"[DEBUG] Orchestrator received resolved_params: {resolved_params}")
|
| 2106 |
+
print(f"[DEBUG] Current file_path: '{file_path}', target_col: '{target_col}'")
|
| 2107 |
|
| 2108 |
# Use resolved params if user didn't specify
|
| 2109 |
if not file_path or file_path == "":
|
| 2110 |
if resolved_params.get("file_path"):
|
| 2111 |
file_path = resolved_params["file_path"]
|
| 2112 |
print(f"π Using dataset from session: {file_path}")
|
| 2113 |
+
else:
|
| 2114 |
+
print(f"[DEBUG] No file_path in resolved_params")
|
| 2115 |
|
| 2116 |
if not target_col:
|
| 2117 |
if resolved_params.get("target_col"):
|
| 2118 |
target_col = resolved_params["target_col"]
|
| 2119 |
print(f"π Using target column from session: {target_col}")
|
| 2120 |
+
|
| 2121 |
|
| 2122 |
# Show session context if available
|
| 2123 |
if self.session.last_dataset or self.session.last_model:
|
src/session_memory.py
CHANGED
|
@@ -281,11 +281,15 @@ class SessionMemory:
|
|
| 281 |
# Generic "use that" or "try it" commands
|
| 282 |
if has_ambiguous_ref and not resolved:
|
| 283 |
# Fallback: use last dataset and target
|
|
|
|
| 284 |
if self.last_dataset:
|
| 285 |
resolved["file_path"] = self.last_dataset
|
|
|
|
| 286 |
if self.last_target_col:
|
| 287 |
resolved["target_col"] = self.last_target_col
|
|
|
|
| 288 |
|
|
|
|
| 289 |
return resolved
|
| 290 |
|
| 291 |
def _normalize_model_name(self, model_name: Optional[str]) -> Optional[str]:
|
|
|
|
| 281 |
# Generic "use that" or "try it" commands
|
| 282 |
if has_ambiguous_ref and not resolved:
|
| 283 |
# Fallback: use last dataset and target
|
| 284 |
+
print(f"[DEBUG] Session fallback triggered - has_ambiguous_ref={has_ambiguous_ref}, resolved={resolved}")
|
| 285 |
if self.last_dataset:
|
| 286 |
resolved["file_path"] = self.last_dataset
|
| 287 |
+
print(f"[DEBUG] Resolved file_path from session: {self.last_dataset}")
|
| 288 |
if self.last_target_col:
|
| 289 |
resolved["target_col"] = self.last_target_col
|
| 290 |
+
print(f"[DEBUG] Resolved target_col from session: {self.last_target_col}")
|
| 291 |
|
| 292 |
+
print(f"[DEBUG] resolve_ambiguity returning: {resolved}")
|
| 293 |
return resolved
|
| 294 |
|
| 295 |
def _normalize_model_name(self, model_name: Optional[str]) -> Optional[str]:
|