Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I have seen good results from just describing the schema to ChatGPT-4 and then asking it to translate English to SQL. Does this work significantly better?


That’s mostly what the products and libraries around this like llamaindex or Langchain are doing. If you look at the Langchain sql agent all it’s doing is chaining together a series of prompts that take the users initial query, attempt to take in a db and discover its schema on the fly and then execute queries against it based on that discovered schema, ensuring the result makes sense.

The tough part is doing this at scale as part of a fully automated solution (picture a slack bot hooked up to your data warehouse that just does all of that for you that you converse with). When you have tens or hundreds of tables with relationships and metadata in that schema and you want your AI to be able to unprompted walk all of them, you’re then basically doing some context window shenanigans and building complex state machines to walk that schema

Unfortunately that’s kind of what you need if you want to achieve the dream of just having a db that you can ask arbitrary questions to with no other knowledge of sql or how it works. Else the end user has to have some prior knowledge of the schema and db’s to get value from the LLM. Which somewhat reduces the audience for said chatbot if you have to do that


That's basically what happens but the power is that in Python, you can do this:

sql = vn.generate_sql(question=...)

Which means that now the SQL can be executed and you can get the table, chart, etc in any interface.

Flask: https://github.com/vanna-ai/vanna-flask

Streamlit: https://github.com/vanna-ai/vanna-streamlit

Chainlit: https://github.com/vanna-ai/vanna-chainlit

Slack: https://github.com/vanna-ai/vanna-slack




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: