Hey guys, i’m currently building an ai app that has an llm to write a sql query which i can then used to fetch the data from a postresql database.
My current approach is that i pass the llm with the table schema as well as some sample data (top 5 data in the table) for it to have some context.
However, the issue im currently facing is that the data the llm tries to query from the table may not actually exists or named differently.
For example, suppose im querying a table for car spare parts. The llm writes a sql query like SELECT * FROM spare_parts WHERE part_name = ‘Bumper’. However, bumper is stored as Fender in the table. This messes up the data retrieval.
Is my current approach good enough or should i consider switching to using embeddings ?