simsity
Simsity is a Super Simple Similarities Service[tm].
It's all about building a neighborhood. Literally!
This simple library is partially inspired by this blogpost by Max Woolfe. You don't always need a full fledged vector database. Polars and numpy might be all you need. And for those moments, simsity is all you need to build a neighborhood!
Install
You can install simsity via pip.
uv pip install simsity
The goal of simsity is to be minimal, to make rapid prototyping very easy and to be "just enough" for medium sized datasets. You will mainly interact with these two functions.
from simsity import create_index, load_index
As their names imply, you can use these to create an index or to load one from disk.
Quickstart
from simsity import create_index, load_index
from simsity.datasets import fetch_recipes
# Let's fetch some demo data
recipes = fetch_recipes()["text"].to_list()
# Let's use model2vec for embeddings
from model2vec import StaticModel
model = StaticModel.from_pretrained("minishlab/potion-base-8M")
# Populate the ANN vector index and use it.
index = create_index(recipes, model.encode)
texts, dists = index.query("pork")
# You can also query using vectors
v_pork = model.encode(["pork"])[0]
texts, dists = index.query_vector(v_pork)
You can also provide a path and then you'll be able to store/load everything.
# Make an index with a path
index = create_index(recipes, encoder, path="demo")
# Load an index from a path
reloaded_index = load_index(path="demo", encoder=encoder)
texts, dists = reloaded_index.query("pork")
That's it! Happy hacking!
Metadata
Release files for simsity 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| simsity-0.8.0.tar.gz | 334.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| simsity-0.8.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 338.9 kB
Release files / simsity-0.8.0.tar.gz
| Download URL | simsity-0.8.0.tar.gz |
|---|---|
| Size | 334.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b66f580958735d893b29b1b823783487412bced471e5b9c59513e7ce6d6357be
|
|
BLAKE2b-256 checksum How to use checksums |
bd469cf9435104849ff579d05dbd3c5105f1959fa0f346f1933d186b69c5f44f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.27
|
Release files / simsity-0.8.0-py3-none-any.whl
| Download URL | simsity-0.8.0-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fd69ed26384beeb74ee46716e62c10da98fde23c3064dc4b4db3b07008cf6eb1
|
|
BLAKE2b-256 checksum How to use checksums |
a63a6a9b9b673087b55b43897365218b662973a2697c266f007178d85b29bf79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.27
|