Spaces:
Runtime error
Runtime error
Commit ·
0082791
1
Parent(s): 2d6b491
handling error while formatting
Browse files- queryHelperManagerCoT.py +6 -2
queryHelperManagerCoT.py
CHANGED
|
@@ -59,8 +59,12 @@ class QueryHelperChainOfThought:
|
|
| 59 |
except:
|
| 60 |
print("Couldn't parse desired result from gpt response using method 2")
|
| 61 |
if parsedSql:
|
| 62 |
-
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
else:
|
| 65 |
responseToReturn = gptResponse
|
| 66 |
return responseToReturn
|
|
|
|
| 59 |
except:
|
| 60 |
print("Couldn't parse desired result from gpt response using method 2")
|
| 61 |
if parsedSql:
|
| 62 |
+
try:
|
| 63 |
+
formattedSql = sqlparse.format(sqlResult, reindent=True)
|
| 64 |
+
responseToReturn = formattedSql
|
| 65 |
+
except:
|
| 66 |
+
print("Error while formatting parsed sql result :", sqlResult)
|
| 67 |
+
responseToReturn = sqlResult
|
| 68 |
else:
|
| 69 |
responseToReturn = gptResponse
|
| 70 |
return responseToReturn
|