Live data from Hacker News

Vanna.ai: Chat with your SQL database

github.com

51–60 of 243 posts

Re: Vanna.ai: Chat with your SQL database

#51
post #37
post #34

Sorry, maybe I'm just too tired to see it, but how much control do you have over the SQL query that is generated by the AI? Is there a risk that it could access unwanted portions or, worse, delete parts of your data? (the AI equivalent of Bobby Tables, so to speak)

Why not give it access to relevant parts of the database only? And read only access too?

[deleted]

Re: Vanna.ai: Chat with your SQL database

#52
post #45

Prompts are quite straightforward. - OpenAI: https://github.com/vanna-ai/vanna/blob/a4cdf7593ac0c584f7d74... - Mistral: https://github.com/vanna-ai/vanna/blob/a4cdf7593ac0c584f7d74...

Many of these AI "products" - Is it just feeding text into LLMs in a structured manner?

Re: Vanna.ai: Chat with your SQL database

#53
post #34

Sorry, maybe I'm just too tired to see it, but how much control do you have over the SQL query that is generated by the AI? Is there a risk that it could access unwanted portions or, worse, delete parts of your data? (the AI equivalent of Bobby Tables, so to speak)

In some SQL providers, your can define rules that dynamically mask fields, suppress rows, etc. based upon connection-specific details (e.g. user or tenant ID).

So, you could have all connections from the LLM-enabled systems enforce masking of PII, whereas any back-office connections get to see unmasked data. Doing things at this level makes it very difficult to break out of the intended policy framework.

Re: Vanna.ai: Chat with your SQL database

#54
I built a demo of something similar, using LlamaIndex to query data as it streamed into ClickHouse.

I think this has a lot of real world potential, particularly when you move between the query and a GenAI task:

https://youtu.be/F3Eup8yQiQQ?si=pa_JrUbBNyvPXlV0

https://youtu.be/7G-VwZ_fC5M?si=TxDQgi-w5f41xRJL

I generally found this worked quite well. It was good at identifying which fields to query and how to build where clauses and aggregations. It could pull off simple joins but started to break down much past there.

I agree with the peer comment that being able to process and respond to error logs would make it more robust.

Re: Vanna.ai: Chat with your SQL database

#56
post #27
post #14

The most success I had with AI+SQL was when I started feeding errors from the sql provider back to the LLM after each iteration. I also had a formatted error message wrapper that would strongly suggest querying system tables to discover schema information. These little tweaks made it scary good at finding queries, even ones requiring 4+ table joins. Even without any examples or fine tuning data.

Please turn this into a product. There's enormous demand for that.

There are already several products out there with varying success.

Some findings after I played with it awhile:

- Langchain already does something like this - a lot of the challenge is not with the query itself but efficiently summarizing data to fit in the context window. In other words if you give me 1-4 tables I can give you a product that will work well pretty easy. But when your data warehouse has tens or hundreds of tables with columns and meta types now we need to chain together a string of queries to arrive at the answer and we are basically building a state machine of sorts that has to do fun and creative RAG stuff - the single biggest thing that made a difference in effectiveness was not what op mentioned at all, but instead having a good summary of what every column in the db was stored in the db. This can be AI generated itself, but the way Langchain attempts to do it on the fly is slow and rather ineffective (or at least was the case when I played with it last summer, it might be better now).

Not affiliated, but after reviewing the products out there the data team I was working with ended up selecting getdot.ai as it had the right mix of price, ease of use, and effectiveness.

Re: Vanna.ai: Chat with your SQL database

#57
post #28

Is the architecture they use in this diagram currently the best way to train LLMs in general on custom data sets? https://raw.githubusercontent.com/vanna-ai/vanna/main/img/va... That is, store your trained custom data in vector db and then use RAG to retrieve relevant content and inject that into the prompt of the LLM the user is querying with? As opposed to fine tuning or other methods?

All the podcasts I've been listening to recommend RAG over fine-tuning. My intuition is that having the relevant knowledge in the context rather than the weights brings it closer to the outputs, thereby making it much more likely to provide accurate information and avoid hallucinations/confabulations.

Do you have any podcasts you would reccomend with this type of content?

Re: Vanna.ai: Chat with your SQL database

#58

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

Re: Vanna.ai: Chat with your SQL database

#59

Earlier quoted context omitted.

Maybe my prompting needs to improve, I tried recently to get chatgpt to provide a schema for an sqlite database that implements vcard data in a normalised way. I gave up...

ChatGPT-3.5 or ChatGPT-4? There is a big difference. For fun, I just asked ChatGPT-4 to generate a normalized database representation of vcard information: https://chat.openai.com/share/1c88813c-0a50-4ec6-ba92-4d6ff8... It seems like a reasonable start to me.

Chatgpt 3.5. Maybe I should pay for a couple of months access to 4 to see the difference. Is it worth the money?

Re: Vanna.ai: Chat with your SQL database

#60
post #42
post #27

Earlier quoted context omitted.

Please turn this into a product. There's enormous demand for that.

I feel like by the time I could turn it into a product, Microsoft & friends will release something that makes it look like a joke. If there is no one on the SQL Server team working on this right now, I don't know what the hell their leadership is thinking. I am not chasing this rabbit. Someone else will almost certainly catch it first. For now, this is a fun toy I enjoy in my free time. The moment I try to make money…

You can just make a GitHub repo with what you have. It'd still be valuable to the community
Post reply on HN