vanna-ai / vanna

🤖 Chat with your SQL database 📊. Accurate Text-to-SQL Generation via LLMs using RAG 🔄.
https://vanna.ai/docs/
MIT License
11.04k stars 862 forks source link

Add sql extraction in case of non-markdown response or CTE #350

Closed Aymane11 closed 5 months ago

Aymane11 commented 6 months ago

This PR adds two sql extraction methods:

1 - Extract SQL query from non-markdown responses, extracting the query between SELECT and ; 2 - Extract SQL query containing CTE (WITH clause), extracting the query between WITH and ;

Also it removes the f-string from strings with no placeholders (like f"Hello World")