Show HN: Vanna AI – Open-sourced text-to-SQL in Python (vanna.ai)
We've just open-sourced Vanna – a Python package that allows you to transform questions into SQL. We've leveraged LLMs to enable you to "ask" databases what you need, bypassing the need to "write" complex SQL.
Quick Overview:
- "Train" using DDL statements, documentation, or known correct SQL statements.
- "Ask" questions in natural language and receive SQL, tables, and charts in return.
- Open Source Flexibility: Swap storage mechanisms, customize LLMs, and choose your databases.
- Local or Hosted: Operate everything locally or use our hosted version for free (including complimentary LLM calls).
- Use it wherever Python is applicable. We provide code examples for integration in Jupyter, Streamlit, Slack, and more.
We would greatly appreciate your feedback, insights on issues, and contributions:
13 comments
[ 5.9 ms ] story [ 55.4 ms ] threadIf you want to use a locally-hosted LLM, that's also possible by implementing the necessary abstract methods: https://vanna.ai/docs/vanna.html#open-source-and-extending
https://arxiv.org/abs/2306.08891 One paper seems to suggest trained specialized model can outperform LLM in some tasks.
In the meantime, this post we wrote might be interesting for you:
https://vanna.ai/blog/ai-sql-accuracy.html
You call vn.train(sql=...) on each individual SQL statement that you have.
What'll happen under the hood is the package will use the 10 most relevant SQL statement examples, 10 most relevant pieces of documentation, and 10 most relevant DDL statements.
If using 10 examples exceeds the (approximate) token limit for the model, it'll pare down to a smaller number that'll fit into the context limit.