If the ai calls QuerySQLDataBaseTool more than once in a single shot, we get the openai.BadRequestError: Error code: 400 error "An assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'
Reason for this is because inside the QuerySQLDataBaseTool, we append a tool message and an ai message each time
And so we get tool messages separated by ai messages, which is problematic
This can also happen if another tool is used alongside the QuerySQLDataBaseTool
If the ai calls
QuerySQLDataBaseTool
more than once in a single shot, we get theopenai.BadRequestError: Error code: 400
error"An assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'
Reason for this is because inside the![image](https://github.com/RamiAwar/dataline/assets/26882839/d07dd8f0-2c6c-4632-88ef-7fec442800ec)
QuerySQLDataBaseTool
, we append a tool message and an ai message each timeAnd so we get tool messages separated by ai messages, which is problematic![image](https://github.com/RamiAwar/dataline/assets/26882839/201b39cd-3f1f-4a21-999b-94a2f91bd4dc)
This can also happen if another tool is used alongside the
QuerySQLDataBaseTool