added csv-code executor
Browse files- controller.py +4 -4
controller.py
CHANGED
@@ -225,13 +225,13 @@ async def code_execution_csv(
|
|
225 |
|
226 |
try:
|
227 |
# First log the incoming request data
|
228 |
-
|
229 |
|
230 |
# Then validate
|
231 |
try:
|
232 |
request = ExecutionRequest(**request_data)
|
233 |
except ValidationError as e:
|
234 |
-
|
235 |
raise HTTPException(status_code=422, detail=e.errors())
|
236 |
|
237 |
# Rest of your processing logic...
|
@@ -242,7 +242,7 @@ async def code_execution_csv(
|
|
242 |
return {"answer": formatted_output}
|
243 |
|
244 |
except Exception as e:
|
245 |
-
|
246 |
return {"error": "Failed to execute request", "message": str(e)}
|
247 |
|
248 |
|
@@ -478,7 +478,7 @@ def groq_chart(csv_url: str, question: str):
|
|
478 |
# try:
|
479 |
# os.remove(cache_db_path)
|
480 |
# except Exception as e:
|
481 |
-
#
|
482 |
|
483 |
data = clean_data(csv_url)
|
484 |
with current_groq_chart_lock:
|
|
|
225 |
|
226 |
try:
|
227 |
# First log the incoming request data
|
228 |
+
logger.info("Incoming request data:", request_data)
|
229 |
|
230 |
# Then validate
|
231 |
try:
|
232 |
request = ExecutionRequest(**request_data)
|
233 |
except ValidationError as e:
|
234 |
+
logger.info("Validation error:", e.json())
|
235 |
raise HTTPException(status_code=422, detail=e.errors())
|
236 |
|
237 |
# Rest of your processing logic...
|
|
|
242 |
return {"answer": formatted_output}
|
243 |
|
244 |
except Exception as e:
|
245 |
+
logger.info("Processing error:", str(e))
|
246 |
return {"error": "Failed to execute request", "message": str(e)}
|
247 |
|
248 |
|
|
|
478 |
# try:
|
479 |
# os.remove(cache_db_path)
|
480 |
# except Exception as e:
|
481 |
+
# logger.info(f"Cache cleanup error: {e}")
|
482 |
|
483 |
data = clean_data(csv_url)
|
484 |
with current_groq_chart_lock:
|