Skip to content

simonw/llm-tools-datasette

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

llm-tools-datasette

PyPI Changelog Tests License

Expose Datasette instances to LLM as a tool

Installation

Install this plugin in the same environment as LLM. You'll need at least the 0.26a1 alpha.

llm install llm-tools-datasette

Usage

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()

Development

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

About

Expose Datasette instances to LLM as a tool

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages