Socket
Book a DemoInstallSign in
Socket

sqlite-utils-llm

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sqlite-utils-llm

Run llm from sqlite

pipPyPI
Version
0.3
Maintainers
1

sqlite-utils-llm

This is a plugin for sqlite-utils that adds a custom SQL function llm(model, prompt) that can be used to call out to an LLM model using the llm command line tool.

Installation

Have sqlite-utils and llm already installed, then install this package with pip:

sqlite-utils install sqlite-utils-llm

Example

Given the following combos.csv file with ice cream flavor combinations we want to complete the suggestion column with a flavor suggestion based on the other two flavors using an LLM.

flavor1,flavor2,suggestion
vanilla,chocolate,
strawberry,vanilla,
chocolate,strawberry,
mint,lemon,

Let's load the data into a SQLite database:

% sqlite-utils insert icecream.db combos combos.csv --csv --empty-null

Now we can use the llm function to update the suggestion column with a flavor suggestion:

% sqlite-utils query icecream.db "UPDATE combos set suggestion=llm('gpt-4o-mini', 'What other flavor would I like if I have choosen ' || flavor1 || ' and ' || flavor2 || '? Return just the name of the flavor.')"

Now we can query the table to see the suggestions:

% sqlite-utils query icecream.db "SELECT * FROM combos" --table
flavor1     flavor2     suggestion
----------  ----------  ------------
vanilla     chocolate   Strawberry
strawberry  vanilla     Chocolate
chocolate   strawberry  Vanilla
mint        lemon       Basil

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts