RamiAwar / dataline

Chat with your data - AI data analysis and visualization on CSV, Postgres, MySQL, Snowflake, SQLite...
https://dataline.app
GNU General Public License v3.0
129 stars 6 forks source link

Issue with Parallel Tool calling the `QuerySQLDataBaseTool` #204

Closed anthony2261 closed 2 weeks ago

anthony2261 commented 3 weeks ago

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 image

And so we get tool messages separated by ai messages, which is problematic image

This can also happen if another tool is used alongside the QuerySQLDataBaseTool