Skip to main content

Query databases and tables with AI assistance

Project description

datasette-query-assistant

PyPI Changelog Tests License

Query databases and tables with AI assistance

Early alpha.

Installation

Install this plugin in the same environment as Datasette.

datasette install datasette-query-assistant

Configuration

Set the model ID to be used by this plugin by adding this to your Datasette configuration:

plugins:
  datasette-query-assistant:
    model: openai/gpt-4.1-mini
    key_env_var: OPENAI_API_KEY

To use the openai/gpt-4.1-mini model you'll need to install llm-openai-plugin in addition to datasette-query-assistant.

If the model needs an API key, set the key_env_var to the name of an environment variable and ensure that environment variable is correctly set.

You can use any model that is available via an LLM plugin

Usage

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 a commented SQL query that will hopefully answer it.

Development

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 API:

pytest -x --record-mode=rewrite --inline-snapshot=fix

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datasette_query_assistant-0.1a5.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

datasette_query_assistant-0.1a5-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file datasette_query_assistant-0.1a5.tar.gz.

File metadata

File hashes

Hashes for datasette_query_assistant-0.1a5.tar.gz
Algorithm Hash digest
SHA256 0f3c871ab23cbd77c2cc2953a0614db6d31aee57a6921f8c0f3a1e75a4b89b14
MD5 6c1e7208429def4194cf1fca60116904
BLAKE2b-256 551bd7eb6671f13b272227670ab2ad8fb948cdc2a0f08e561f621da303dba504

See more details on using hashes here.

Provenance

The following attestation bundles were made for datasette_query_assistant-0.1a5.tar.gz:

Publisher: publish.yml on datasette/datasette-query-assistant

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file datasette_query_assistant-0.1a5-py3-none-any.whl.

File metadata

File hashes

Hashes for datasette_query_assistant-0.1a5-py3-none-any.whl
Algorithm Hash digest
SHA256 354a248c05b774f074140c9abcd838fb1b20d83a9cf8f3861008578bdaa174db
MD5 1b20655e6627eaba5912bd7ef305bbfc
BLAKE2b-256 3de5dd67c760f1e02061a8dd9e24033c5c8f345644e990bd5d44b8628bf6b535

See more details on using hashes here.

Provenance

The following attestation bundles were made for datasette_query_assistant-0.1a5-py3-none-any.whl:

Publisher: publish.yml on datasette/datasette-query-assistant

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page