datasette-query-assistant by datasette
117 downloads this week Star
README source code
Query databases and tables with AI assistance
Early alpha.
Install this plugin in the same environment as Datasette.
datasette install datasette-query-assistant
This plugin currently requires you to set the ANTHROPIC_API_KEY
environment variable to a working Anthropic API key.
Users with execute-sql
permission will gain a database action menu item for "Query this database with AI assistance" which will let them ask a question and be redirected to SQL that will hopefully answer it.
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd datasette-query-assistant
python3 -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest
To re-generate the tests with refreshed examples from the Claude 3 API:
pytest -x --record-mode=rewrite --inline-snapshot=fix