C-Loftus / talon-ai-tools

Query LLMs and AI tools with voice commands
MIT License
39 stars 14 forks source link

Sql support #55

Closed C-Loftus closed 3 months ago

C-Loftus commented 3 months ago

Essentially model shell but for sql

C-Loftus commented 3 months ago

@jaresty opinions on this? I don't write that much sql so wasn't sure

jaresty commented 3 months ago

I think this could be pretty useful, but I'm pretty sure you'd need to pass in at least a database schema for it to produce valuable outputs. Have you tried it?

C-Loftus commented 3 months ago

Yeah I was using moreso for very basic things that was agnostic of the schema. But if the schema has natural language names then it performs relatively well I think for straightforward queries. If you disagree lmk though you probably do more SQL than I do.

Probably out of scope for this PR but it would be positive to use a dynamic list to generate the capture for the schema at runtime. Might be interesting to investigate if this feature becomes more useful.

On Tue, Apr 16, 2024 at 5:29 PM Schwa Aresty @.***> wrote:

I think this could be pretty useful, but I'm pretty sure you'd need to pass in at least a database schema for it to produce valuable outputs. Have you tried it?

— Reply to this email directly, view it on GitHub https://github.com/C-Loftus/talon-ai-tools/pull/55#issuecomment-2059952187, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ2T6ZYTX7JPQRZFIMPTDSLY5WJ3RAVCNFSM6AAAAABGKAG4AGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJZHE2TEMJYG4 . You are receiving this because you authored the thread.Message ID: @.***>

jaresty commented 3 months ago

Could you share some example prompts and responses? I think it would be helpful to get a sense of how to use it. I'm curious enough to give it a try.

C-Loftus commented 3 months ago

Sure and no pressure obviously, just was curious since I value your perspective.

I think as well it would be relatively straightforward to get the schema and pass it into the prompt to make sure the syntax is valid, but that's once again probably out of scope for the PR since we'd need a talon setting for a db endpoint, which is a bit of feature creep perhaps

model sequel what is my database version

model sequel get the counts of all names in the user table

model sequel generate a schema for table that represents a city in a geospatial application

Once again this is stuff that is moreso used for educating/fixing syntax/pair programming and since it uses the confirmation GUI doesn't run anything automatically

jaresty commented 3 months ago

Those seem like practical use cases. I'm wondering if there's a concept missing from the gpt usage: a way to pin some context to be sent with a query.

I could imagine a usage similar to how rango marks work. You could name a mark, add to it, and then send it to ChatGPT by name. Something like this:

Or something like that that allows you to add the schema to the context before sending it.

C-Loftus commented 3 months ago

Yeah I agree generally that adding state is probably going to be a next step. I'm honestly not sure the proper pattern for this though, and I think we would need to have some sort of graphical interface, since it could start to get pretty confusing if the user forgot they associated a particular schema with the current query or in general marked something.

The first thought that came to my mind would be something like a clipboard helper but for model queries, so you could almost load in state via a gui by saying the number in the gui helper, but once again this adds extra verbosity.

I think I will probably merge this as is for now and then continue to think about state.