Skip to main content

A lightweight vector store built on SentenceTransformers

Project description

PocketVec 🗂️✨🧠

PocketVec is a lightweight vector store designed for small to medium datasets. It allows you to efficiently create embeddings for a list of text chunks and retrieve the most similar chunks using either cosine similarity or Euclidean distance.

PocketVec is ideal for users who want a fast and easy-to-use solution without needing heavy infrastructure or databases.

Quick Workflow Overview ⚡🔄

Texts → [Create embeddings] → [Retrieve similar chunks] → Results

     OR

Texts → [Create & Save embeddings] → [Load embeddings + Data] → [Retrieve similar chunks] → Results

Features ✅🚀

Lightweight & fast: Optimized for smaller datasets without external dependencies beyond sentence-transformers.

Flexible workflows:

Immediate use – create embeddings and retrieve related text chunks in one go, storing everything in memory.

Persistent embeddings – create embeddings, save them to a file, and reuse them later with the corresponding data chunks.

Similarity methods: Cosine similarity and Euclidean distance.

Easy integration: Works with any Python project with simple function calls.

How it works 🛠️🔍

Input: Provide your dataset as a list of text chunks.

Embedding: PocketVec generates embeddings for the texts using a HuggingFace sentence transformer.

Retrieve: Query the vector store to find the most similar chunks to your input query.

Optional persistence: Save embeddings for later use and reuse them with the original data chunks.

Recommended Usage 📝💡

PocketVec supports two main workflows:

One-step embeddings and retrieval

Create embeddings for your data chunks.

Retrieve the top N most similar chunks to your query.

Separate creation and retrieval

Generate embeddings and save them to a file.

Later, load the embeddings and provide the original data chunks to perform retrieval.

Similarity Metrics 📐🔢

PocketVec supports the following similarity/distance metrics:

Cosine similarity – measures angular similarity between vectors.

Euclidean distance – measures straight-line distance between vectors in space.

Examples 💻📂

For detailed usage, check the provided examples:

Basic workflow: Creating embeddings and retrieving related chunks in one go → examples/demo_basic.py

Persistent workflow: Saving embeddings and using them later → examples/demo_with_file.py

Installation 💾⚙️

Install PocketVec via pip:

pip install pocketvec

Dependencies

Python 3.8+

numpy

sentence-transformers

huggingface-hub

(These will be installed automatically when using pip.)

License 📜🔓

PocketVec is released under the MIT License.

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

pocketvec-0.1.2.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pocketvec-0.1.2-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file pocketvec-0.1.2.tar.gz.

File metadata

  • Download URL: pocketvec-0.1.2.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.5

File hashes

Hashes for pocketvec-0.1.2.tar.gz
Algorithm Hash digest
SHA256 3f9ac670e25844b8921c4d96724fd54221c254fbf5b2c89e526bad98484b28e0
MD5 330457f24ef275c1e9a81356a5619db9
BLAKE2b-256 c4c4fc413e54024278b91f58722a3356a26163229166bb8cf3c62939662e40a8

See more details on using hashes here.

File details

Details for the file pocketvec-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pocketvec-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.5

File hashes

Hashes for pocketvec-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bd47c2e473b1e4ba0907b0f081abbe03dddc04363f41d0e0a41d890b29cd64d1
MD5 71fede4876d84ce657ca3be4665cdd7b
BLAKE2b-256 1b98e0c4e6917f8d573d9634350bf916ebb7c6bb91c8845119895f06d0b9d2b2

See more details on using hashes here.

Supported by

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