Expose Datasette instances to LLM as a tool
Install this plugin in the same environment as LLM. You'll need at least the 0.26a1 alpha.
llm install llm-tools-datasette
First find the URL to a database within your Datasette instance. For example, https://datasette.io/content
.
To use this with the LLM command-line tool:
llm --tool 'Datasette("https://datasette.io/content")' "Show tables" --td
This plugin works well with llm chat
:
llm chat --tool 'Datasette("https://datasette.io/content")' --td
(Omit the --td
option if you don't want to see debugging details.)
With the LLM Python API:
import llm
from llm_tools_datasette import Datasette
model = llm.get_model("gpt-4.1-mini")
result = model.chain(
"Show most interesting tables",
tools=[Datasette("https://datasette.io/content")],
).text()
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd llm-tools-datasette
python -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
llm install -e '.[test]'
To run the tests:
python -m pytest