Skip to main content

EmbedDB Python SDK — embedded vector database

Project description

EmbedDB Python SDK

Python bindings for EmbedDB — the embedded vector database.

Installation

pip install embeddb

Quick Start

import embeddb

# Open or create a database
db = embeddb.Database("data.embeddb")

# Create a collection
col = db.create_collection("docs", dimension=384, distance=embeddb.DistanceMetric.COSINE)

# Insert vectors
col.insert({"id": "doc1", "vector": [0.1] * 384, "metadata": {"title": "Hello"}})
col.insert({"id": "doc2", "vector": [0.2] * 384, "metadata": {"title": "World"}})

# Search
results = col.search(vector=[0.15] * 384, top_k=10)
for hit in results:
    print(f"{hit.id}: {hit.score:.4f}")

API

Database

  • Database(path) — Open or create a database
  • db.create_collection(name, dimension, distance) — Create a collection
  • db.get_collection(name) — Get an existing collection
  • db.close() — Close the database

Collection

  • col.insert(doc) — Insert a document {"id": str, "vector": [float], "metadata": dict}
  • col.search(vector, top_k=10) — Search for nearest neighbors

Distance Metrics

  • DistanceMetric.COSINE — Cosine distance
  • DistanceMetric.EUCLIDEAN — Euclidean (L2) distance
  • DistanceMetric.DOT_PRODUCT — Dot product similarity

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

vexra-1.1.0-cp311-cp311-manylinux_2_34_x86_64.whl (350.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

File details

Details for the file vexra-1.1.0-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for vexra-1.1.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 3fb9fe7b0a0938e321636b36aff41697023cc6b2d6197248dc74ae9d84b00513
MD5 a6f6354bc16cc6f627f66f86f92a21ce
BLAKE2b-256 9ffcabe2ccdb2d8fd3207487ee7dd20a472c549ac4f7cd7915cec54c064942ec

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