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
346 stars 26 forks source link

AI generates SQL as text instead of using the tool #170

Open anthony2261 opened 1 month ago

anthony2261 commented 1 month ago

Sometimes the AI responds with SQL in the message text, instead of calling the QuerySQLDataBaseTool.

image

I suspect part of the reason is because of the way we gather the message history that's passed into the AI

image image

anthony2261 commented 1 month ago

Something that might help: checking "FunctionMessage" https://python.langchain.com/v0.2/docs/concepts/#messages

RamiAwar commented 1 month ago

I think function message is the equivalent of tool message when you use function calling. It might be rejected if you don't call a function.

But then even if it's not, don't lovee the solution.

Gonna try and think of other ways to solve this

RamiAwar commented 2 weeks ago

Is this fixed? @anthony2261

anthony2261 commented 2 weeks ago

No, wanna pick it up? It usually happens in chats with long histories, maybe like 10 messages +

On Mon, Jul 1, 2024, 8:40 AM Rami Awar @.***> wrote:

Is this fixed? @anthony2261 https://github.com/anthony2261

— Reply to this email directly, view it on GitHub https://github.com/RamiAwar/dataline/issues/170#issuecomment-2199281142, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGNDGF7WCIEZA3HYK5UBYCTZKDTWRAVCNFSM6AAAAABISYLH42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJZGI4DCMJUGI . You are receiving this because you were mentioned.Message ID: @.***>

RamiAwar commented 2 weeks ago

Nah forget it for now. We'll add a test for it or something