Skip to main content

No project description provided

Project description

PyVectorDB

Simple Wrapper for Vector Database in Python which support CRUD and retrieve by distance.

Installation

pip install pyvectordb

Usage Example

PGVector

PGvector is an extension for PostgreSQL that allows the storage, indexing, and querying of vector embeddings. It is designed to support vector similarity search, which is useful in machine learning applications like natural language processing, image recognition, and recommendation systems. By storing vector embeddings as a data type, PGvector enables efficient similarity searches using distance metrics such as cosine similarity, Euclidean distance, inner product, etc.

import os
from pyvectordb import PostgresVector, Vector
from pyvectordb.distance_function import DistanceFunction

v = Vector(
    embedding=[2, 2, 1]
)

print("VECTOR", v)

pgv = PostgresVector(
    db_user=os.getenv("DB_USER"),
    db_password=os.getenv("DB_PASSWORD"),
    db_host=os.getenv("DB_HOST"),
    db_port=os.getenv("DB_PORT"),
    db_name=os.getenv("DB_NAME"),
)

new_v = pgv.create_vector(v)
print("CREATE_VECTOR", new_v)

new_v = pgv.read_vector(new_v.id)
print("READ_VECTOR", new_v)

new_v = pgv.update_vector(new_v)
print("UPDATE_VECTOR", new_v)

for x in pgv.get_neighbor_vectors(v, 5, DistanceFunction.L2_DISTANCE):
    print(f"{x}")

pgv.delete_vector(new_v.id)
print("DELETE_VECTOR")

Support or Anything

Reach me out on email razifrizqullah@gmail.com

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

pyvectordb-0.1.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

pyvectordb-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file pyvectordb-0.1.0.tar.gz.

File metadata

  • Download URL: pyvectordb-0.1.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.5 Darwin/23.0.0

File hashes

Hashes for pyvectordb-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ae171af1e809afd8ce3eac8062643bfdd8c6d131526e925286c5cd220a5a6b8a
MD5 2d057735498612314e2c2aef57a105ed
BLAKE2b-256 14aea70f66ee12a4fa2483dbfd5fc9c804ad7277b85fbd8ea0e469cdc9a5ff5e

See more details on using hashes here.

File details

Details for the file pyvectordb-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyvectordb-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.5 Darwin/23.0.0

File hashes

Hashes for pyvectordb-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 229710218ef813f0768a009f74c529b3bbfb4f875becbb330092c49c98a66d82
MD5 a8fe2d92d6e70d939b2ca51744a75178
BLAKE2b-256 f8a4e9117bdea17548922adca27480b94a6fd8dbe5dc086ede9c4ccaf2dff64f

See more details on using hashes here.

Supported by

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