8000 GitHub - simonw/llm-tools-sqlite: LLM tools for running queries against SQLite
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

simonw/llm-tools-sqlite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

llm-tools-sqlite

PyPI Changelog Tests License

LLM tools for running queries against SQLite

Installation

Install this plugin in the same environment as LLM.

llm install llm-tools-sqlite

Usage

To use this with the LLM command-line tool:

llm -T 'SQLite("content.db")' \
  "Count rows in the most interesting looking table" --td

Or use llm chat to chat with your database over multiple rounds:

llm chat -T 'SQLite("content.db")' 

This tool currently only supports read-only queries. Attempts to write to the database will fail with an error.

With the LLM Python API:

import llm
from llm_tools_sqlite import SQLite

model = llm.get_model("gpt-4.1-mini")

result = model.chain(
    "Show me the three most interesting looking tables",
    tools=[SQLite("content.db")]
)
for s in result:
    print(s, end="", flush=True)

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd llm-tools-sqlite
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

LLM tools for running queries against SQLite

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Languages

0