vanna-ai / vanna

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

System prompt does not consider inputs from add_sql_to_prompt #413

Closed sourabh-patil closed 2 months ago

sourabh-patil commented 2 months ago

Describe the bug In get_sql_prompt definition of VannaBase class, current code does not include similar Question-SQL pairs from db in system message

Expected behavior Current code considers inputs only from DDL (add_ddl_to_prompt) and documentation (add_documentation_to_prompt) collections from db. As per the Ask phase, we should consider reference SQL too.

Error logs/Screenshots https://github.com/vanna-ai/vanna/blob/7b962d59c7ad7a0e976f179473ab9f18d1e0581b/src/vanna/base/base.py#L557-L591

Additional context Correct me if I am wrong, also will try to PR if we need to add in reference SQL.

zainhoda commented 2 months ago

They're not added as part of the system prompt. They're instead added as user / assistant messages:

https://github.com/vanna-ai/vanna/blob/main/src/vanna/base/base.py#L583-L589

sourabh-patil commented 2 months ago

Oh I see. Apologies for my mistake. I suppose we are giving question and SQL pair as a few shot examples for LLM.