Maybe you need to approach SQL the way code generation must be approached: don’t develop the whole statement or script at once, instead put together a plan and execute it step-by-step.
Not everything must be done via LLMs themselves. You could use one or more tools to help generate parts of the query.
Not everything must be done via LLMs themselves. You could use one or more tools to help generate parts of the query.
You might be interested in this:
https://www.pedronasc.com/articles/lessons-building-ai-data-...