Closed simonw closed 5 months ago
Idea: table action menu item too, which only includes the current table and any tables in its foreign key graph rather than the full schema.
I'd like you to be able to toggle tables on and off as well.
Neat trick: run explain select ...
and see if there are any errors, then round-trip those errors back through the model up to X times to see if we can get a query that works.
Not bad for a first prototype!
Claude is a bit fiddly about order - you HAVE to go user / assistant / user - but this worked: https://github.com/datasette/datasette-assistant/blob/05f32011d7ef3cab854d444302bcca332bf575f7/datasette_assistant/__init__.py#L25-L31
Goal is to have a database action menu item which takes the user to a form where they ask a question.
The question is passed to an LLM (starting with Claude 3 Haiku) along with the DB schema and they are redirect to the resulting SQL query answer.
Long term I want lots of explanations. For the moment I'll go with "include extensive SQL comments".