Skip to main content

llm_embed(model_id, text) SQL function for Datasette

Project description

datasette-llm-embed

PyPI Changelog Tests License

Datasette plugin adding a llm_embed(model_id, text) SQL function.

Installation

datasette install datasette-llm-embed

Usage

Adds a SQL function that can be called like this:

select llm_embed('sentence-transformers/all-mpnet-base-v2', 'This is some text')

This embeds the provided text using the specified embedding model and returns a binary blob, suitable for use with plugins such as datasette-faiss.

The models need to be installed using LLM plugins such as llm-sentence-transformers.

Development

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

cd datasette-llm-embed
python3 -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'
To run the tests:
```bash
pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datasette-llm-embed-0.1a0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

datasette_llm_embed-0.1a0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file datasette-llm-embed-0.1a0.tar.gz.

File metadata

  • Download URL: datasette-llm-embed-0.1a0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for datasette-llm-embed-0.1a0.tar.gz
Algorithm Hash digest
SHA256 b4eca50b02fb18fd78d2fcf4e366c25e28af0c2b7940c5afb920422aab1dc202
MD5 27fe32ab362e286b0cc95f2390bd287e
BLAKE2b-256 8bbb5482bb58d0ff7566ba171ae443c34f7a11c1c5cd25c5275202054d0493fd

See more details on using hashes here.

File details

Details for the file datasette_llm_embed-0.1a0-py3-none-any.whl.

File metadata

File hashes

Hashes for datasette_llm_embed-0.1a0-py3-none-any.whl
Algorithm Hash digest
SHA256 3b7efb4033a28eb79ce4f55c821099021654c195d8ffb4522dc536f17040be3b
MD5 2198be7dd827c220fbbcf31f584b25cf
BLAKE2b-256 e1e17dd1176599d5ee689b8227530ae3c88dde89a97130d20d3bbdd6e1668fdf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page