This release is a pre-release and may not be stable for production use.
datasette-embeddings
Store and query embedding vectors in Datasette tables
Installation
Install this plugin in the same environment as Datasette.
datasette install datasette-embeddings
Usage
Adds an enrichment for calculating and storing OpenAI embedding vectors for content in a table.
Users get to select the embedding model and the template (e.g. {{ title }} {{ body }}) for the columns they would like to embed.
Embeddings are stored as binary values in columns in a new table called _embeddings_NAME, where NAME is the name of the original source table.
The vectors are stored in columns that match the name of the embedding model, for example emb_text_embedding_3_large_256 for the text-embedding-3-large-256 model.
If you do not configure an OpenAI API key users will be asked for one any time they run the enrichment.
You can set an API key with plugin configuration like this:
plugins:
datasette-embeddings:
api_key:
$env: OPENAI_API_KEY
Then set the OPENAI_API_KEY environment variable before you start Datasette.
This plugin adds a "Semantic search against this table" table action item for tables with embeddings, but only if the API key environment variable has been configured as the key is needed to calculate embeddings for the user's search query.
Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd datasette-embeddings
python3 -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest
The tests use captured examples of embedding APIs. The easiest way to re-generate these is to do the following:
rm -rf tests/cassettesto remove the previous recordingsexport OPENAPI_API_KEY='...'to set an OpenAI API keypytest --record-mode onceto recreate the cassettes
Metadata
Release files for datasette-embeddings 0.1a3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| datasette-embeddings-0.1a3.tar.gz | 12.5 kB | Without provenance | Details for datasette-embeddings-0.1a3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| datasette_embeddings-0.1a3-py3-none-any.whl | Python 3 | none | any | Details for datasette_embeddings-0.1a3-py3-none-any.whl |
Total release size: 23.8 kB
Release files / datasette-embeddings-0.1a3.tar.gz
| Download URL | datasette-embeddings-0.1a3.tar.gz |
|---|---|
| Size | 12.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
342fb1ffc3136e009794337f5c0fa4095a1d9201bf65e26a083428b91860c4f6
|
|
BLAKE2b-256 checksum How to use checksums |
961ae54cffc0906915ca3a587c0d4db1860e2a08311753093259563dd6012095
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Release files / datasette_embeddings-0.1a3-py3-none-any.whl
| Download URL | datasette_embeddings-0.1a3-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
016feffe56ffeb8908f8897e049436e80631a93a29acefa062e0d4029d7ec7ee
|
|
BLAKE2b-256 checksum How to use checksums |
1813ce89669790c0ce923001645fb0e7a3f6ca94413df427ed40ea5b6cd671fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Security for datasette-embeddings 0.1a3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.