Interactive SQLite shell with LLM support
Project description
tsellm
Interactive SQLite shell with LLM support
Usage |
Installation |
How
tsellm is an interactive SQLite shell with LLM Support.
Available as pip install tsellm
.
Usage
Let's create a simple SQLite database with some data.
sqlite3 prompts.db <<EOF
CREATE TABLE [prompts] (
[prompt] TEXT
);
INSERT INTO prompts VALUES('hello world!');
INSERT INTO prompts VALUES('how are you?');
INSERT INTO prompts VALUES('is this real life?');
INSERT INTO prompts VALUES('1+1=?');
EOF
CLI
You can use any of the llm plugins
You can execute LLM-powered SQL queries directly in the CLI, like so:
First let's install a dummy plugin
llm install llm-markov
tsellm prompts.db "select prompt(prompt, 'markov') from prompts"
Now let's try a more complex one,
llm install llm-gpt4all
tsellm prompts.db "select prompt(prompt, 'orca-2-7b') from prompts"
Interactive Shell
You can enter an interactive REPL-style shell to manipulate your database.
tsellm prompts.db
There you can do queries the normal way:
ALTER TABLE prompts ADD COLUMN orca;
UPDATE PROMPTS SET orca=prompt(prompt, 'orca-2-7b');
Installation
pip install tsellm
How
tsellm relies on the following facts:
- SQLite is bundled with the standard Python library (
import sqlite3
) - Python 3.12 ships with a SQLite interactive shell
- one can create Python-written user-defined functions to be used in SQLite queries (see create_function)
- Simon Willison has gone through the process of creating the beautiful llm Python library and CLI
Development
pip install -e '.[test]'
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file tsellm-0.1.0a1.tar.gz
.
File metadata
- Download URL: tsellm-0.1.0a1.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d6e97e48664a346f6edd5df8bdab18876ec84fb20b8c08bdb3ada2889ed246c |
|
MD5 | 86947f4d6f3fd9195d63154697ff3810 |
|
BLAKE2b-256 | 2d6dc600d9017cb52fbec639ed60b0c6141e327bf780e5fe9eacc149cae20710 |
File details
Details for the file tsellm-0.1.0a1-py3-none-any.whl
.
File metadata
- Download URL: tsellm-0.1.0a1-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5ed596d4eebbd5a52a5accef5ef0639cc9dac619f93ac1a0979d248b4a7b95e |
|
MD5 | ad01b8b63a771e2515c9117a8e54258f |
|
BLAKE2b-256 | e00e425f7e4988c5063f2a1720c480ef988a2ce7e243e136c37a32ec6cb76a5f |