How to improve text to sql?

I am working on a POC for NLP to SQL query using the Langchain framework and OpenAI. Sometimes, the generated query has errors and giving wrong query. How can I improve the query generation process? Should I consider fine-tuning or any other method? Please provide some suggestions to improve the NLP to SQL conversion.