Skip to main content

VLite Storage

VLite Storage is a Python library that provides vector similarity search capabilities using SQLite and the vectorlite packages. It allows you to store documents with their vector embeddings and perform efficient similarity searches. For creating text embeddings, it integrates with the Ollama server.

Features

  • Document storage with vector embeddings
  • Efficient similarity search using HNSW algorithm
  • Integration with Ollama for text embeddings
  • Support for document metadata
  • Simple and intuitive API

Installation

pip install vlite-storage

Prerequisites

  • Python 3.7+
  • Ollama server running locally (default: http://localhost:11434)
  • VectorLite SQLite extension

Quick Start

Here's a simple example of how to use VLite Storage:

from vlite_storage.embedders import OllamaEmbedder
from vlite_storage.storages import Storage

# Initialize embedder and storage
embedder = OllamaEmbedder()
dim = embedder.dimensions()
storage = Storage(db_name="my_database.db", dim=dim, embedding_fn=embedder)

# Add documents
storage.add(
    content="This is a sample document",
    metadata={"source": "example", "category": "sample"}
)

# Search for similar documents
results = storage.search("sample document", k=5)
for doc, distance in results:
    print(f"Content: {doc.content}")
    print(f"Metadata: {doc.metadata}")
    print(f"Distance: {distance}")

# Close the connection
storage.close()

API Reference

Storage Class

The main class for document storage and retrieval.

Storage(db_name: str, dim: int, embedding_fn: Optional[Callable[[str], np.ndarray]] = None)

Methods:

  • add(content: str, metadata: dict): Add a document with content and metadata
  • remove(rowid: int): Remove a document by ID
  • update(rowid: int, content: Optional[str], metadata: Optional[dict]): Update document content and/or metadata
  • get(rowid: int) -> Document: Retrieve a document by ID
  • search(text: str, k: int) -> List[Tuple[Document, float]]: Find k most similar documents
  • close(): Close the database connection

OllamaEmbedder Class

Class for generating text embeddings using Ollama models.

OllamaEmbedder(base_url: str = "http://localhost:11434", model_name: str = "bge-m3:latest")

Methods:

  • dimensions() -> int: Get embedding dimensions
  • __call__(texts: List[str]) -> np.ndarray: Generate embeddings for texts

Example Usage

Check the examples/ directory for more detailed examples, including:

  • Text chunk processing and storage
  • Similarity search in large documents
  • Metadata handling

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for vlite-storage 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vlite-storage 0.1.0
File Size Uploaded Provenance Actions
vlite_storage-0.1.0.tar.gz 4.6 kB Without provenance Details for vlite_storage-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vlite-storage 0.1.0
File Interpreter ABI Platform Actions
vlite_storage-0.1.0-py3-none-any.whl Python 3 none any Details for vlite_storage-0.1.0-py3-none-any.whl

Total release size: 9.7 kB

Release files / vlite_storage-0.1.0.tar.gz

Download URL vlite_storage-0.1.0.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2e489bf2f836eda38c9c2c3a673b1bc5979a45ea1fa7369004861e2040ab8960
BLAKE2b-256 checksum
How to use checksums
c10e4d9d3d35c218731c4d57fa9ae1d8d60ee9997d695ebb73c5c182059504d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.18.0 CPython/3.10.12 Linux/5.15.0-130-generic

Release files / vlite_storage-0.1.0-py3-none-any.whl

Download URL vlite_storage-0.1.0-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0f86300dc7835a652804b08573c03a457faa6e6958f0f769867493c183b2eeea
BLAKE2b-256 checksum
How to use checksums
3d044ca0609f69f69b60883d0b19406e7d283bf56577741889eb56777ba578f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.18.0 CPython/3.10.12 Linux/5.15.0-130-generic

Security for vlite-storage 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page