Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial prototype #1

Closed
simonw opened this issue Mar 26, 2024 · 4 comments
Closed

Initial prototype #1

simonw opened this issue Mar 26, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@simonw
Copy link
Contributor

simonw commented Mar 26, 2024

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".

@simonw simonw added the enhancement New feature or request label Mar 26, 2024
@simonw
Copy link
Contributor Author

simonw commented Mar 26, 2024

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.

@simonw
Copy link
Contributor Author

simonw commented Mar 26, 2024

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.

simonw added a commit that referenced this issue Mar 26, 2024
@simonw
Copy link
Contributor Author

simonw commented Mar 26, 2024

Not bad for a first prototype!

demo

@simonw
Copy link
Contributor Author

simonw commented Mar 26, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant