GenAICoder commited on
Commit
449b9b7
·
verified ·
1 Parent(s): 78e07b3

Update analytics/deep_dive_agentic.py

Browse files
Files changed (1) hide show
  1. analytics/deep_dive_agentic.py +13 -3
analytics/deep_dive_agentic.py CHANGED
@@ -180,17 +180,27 @@ def generate_analysis_requirements(question: str, acq: pd.DataFrame, perf: pd.Da
180
  # Extract JSON
181
  spec = _extract_json(response_text)
182
 
183
- if not spec or "requirements" not in spec:
184
  return {
185
  "success": False,
186
  "requirements": [],
187
- "error": "Failed to parse requirements from LLM response",
188
  "raw_response": response_text
189
  }
190
 
 
 
 
 
 
 
 
 
 
 
191
  return {
192
  "success": True,
193
- "requirements": spec.get("requirements", []),
194
  "error": None
195
  }
196
 
 
180
  # Extract JSON
181
  spec = _extract_json(response_text)
182
 
183
+ if not spec:
184
  return {
185
  "success": False,
186
  "requirements": [],
187
+ "error": f"Failed to parse JSON from LLM response: {response_text[:200]}",
188
  "raw_response": response_text
189
  }
190
 
191
+ requirements = spec.get("requirements", [])
192
+
193
+ if not requirements:
194
+ return {
195
+ "success": False,
196
+ "requirements": [],
197
+ "error": f"LLM returned no requirements. Response keys: {list(spec.keys())}",
198
+ "raw_response": response_text[:300]
199
+ }
200
+
201
  return {
202
  "success": True,
203
+ "requirements": requirements,
204
  "error": None
205
  }
206