vectorizedb


Namevectorizedb JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/aion-labs/vectorizedb
SummaryVectorizeDB is a database for vectorized data and metadata, allowing for fast similarity search and retrieval.
upload_time2024-02-03 18:19:57
maintainer
docs_urlNone
authorJJ Ben-Joseph
requires_python>3.9
licenseApache
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            VectorizeDB
===========

Overview
--------

VectorizeDB is a Python package designed for the efficient storage and retrieval of high-dimensional vectors. It's particularly useful in applications like machine learning and information retrieval. The package utilizes hnswlib for fast approximate nearest neighbor searches and LMDB for scalable and reliable storage.

Installation
------------

To install VectorizeDB, ensure you have Python 3.10 or higher. It can be installed via pip:

.. code-block:: bash

    pip install vectorizedb

Usage
-----

**Initialization**

.. code-block:: python

    from vectorizedb import Database

    # Initialize a new database
    db = Database(path="path/to/db", dim=128, readonly=False, similarity="cosine")

**Adding Data**

.. code-block:: python

    import numpy as np

    # Add a vector with an associated key
    db.add(key="sample_key", vector=np.random.rand(128))

    # Add a vector with metadata
    db.add(key="another_key", vector=np.random.rand(128), metadata={"info": "sample metadata"})

    # Another way to add data
    db["yet_another_key"] = (np.random.rand(128), {"info": "sample metadata"})

**Retrieving Data**

.. code-block:: python

    # Retrieve vector and metadata by key
    vector, metadata = db["sample_key"]

    # Check if a key exists in the database
    exists = "sample_key" in db

**Searching**

.. code-block:: python

    # Search for nearest neighbors of a vector
    results = db.search(vector=np.random.rand(128), k=5)
    for key, vector, distance, metadata in results:
        print(key, distance, metadata)

**Iterating Through Data**

.. code-block:: python

    # Iterate through all keys, vectors and metadata in the database
    for key, vector, metadata in db:
        print(key, metadata)

**Updating Data**

.. code-block:: python

    # Update a vector in the database
    db.update_vector("sample_key", np.random.rand(128))

    # Update metadata
    db.update_metadata("sample_key", {"info": "updated metadata"})

**Deleting Data**

.. code-block:: python

    # Delete a vector from the database by key
    del db["sample_key"]

**Database Length**

.. code-block:: python

    # Get the number of entries in the database
    length = len(db)

License
-------

VectorizeDB is released under the Apache License. For more details, see the LICENSE file included in the package.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/aion-labs/vectorizedb",
    "name": "vectorizedb",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">3.9",
    "maintainer_email": "",
    "keywords": "",
    "author": "JJ Ben-Joseph",
    "author_email": "jj@tensorspace.ai",
    "download_url": "https://files.pythonhosted.org/packages/ed/3e/b760e77e62001a3eac507aded33a9339978aa65b52d705cc8a0a2e26a640/vectorizedb-1.0.0.tar.gz",
    "platform": null,
    "description": "VectorizeDB\n===========\n\nOverview\n--------\n\nVectorizeDB is a Python package designed for the efficient storage and retrieval of high-dimensional vectors. It's particularly useful in applications like machine learning and information retrieval. The package utilizes hnswlib for fast approximate nearest neighbor searches and LMDB for scalable and reliable storage.\n\nInstallation\n------------\n\nTo install VectorizeDB, ensure you have Python 3.10 or higher. It can be installed via pip:\n\n.. code-block:: bash\n\n    pip install vectorizedb\n\nUsage\n-----\n\n**Initialization**\n\n.. code-block:: python\n\n    from vectorizedb import Database\n\n    # Initialize a new database\n    db = Database(path=\"path/to/db\", dim=128, readonly=False, similarity=\"cosine\")\n\n**Adding Data**\n\n.. code-block:: python\n\n    import numpy as np\n\n    # Add a vector with an associated key\n    db.add(key=\"sample_key\", vector=np.random.rand(128))\n\n    # Add a vector with metadata\n    db.add(key=\"another_key\", vector=np.random.rand(128), metadata={\"info\": \"sample metadata\"})\n\n    # Another way to add data\n    db[\"yet_another_key\"] = (np.random.rand(128), {\"info\": \"sample metadata\"})\n\n**Retrieving Data**\n\n.. code-block:: python\n\n    # Retrieve vector and metadata by key\n    vector, metadata = db[\"sample_key\"]\n\n    # Check if a key exists in the database\n    exists = \"sample_key\" in db\n\n**Searching**\n\n.. code-block:: python\n\n    # Search for nearest neighbors of a vector\n    results = db.search(vector=np.random.rand(128), k=5)\n    for key, vector, distance, metadata in results:\n        print(key, distance, metadata)\n\n**Iterating Through Data**\n\n.. code-block:: python\n\n    # Iterate through all keys, vectors and metadata in the database\n    for key, vector, metadata in db:\n        print(key, metadata)\n\n**Updating Data**\n\n.. code-block:: python\n\n    # Update a vector in the database\n    db.update_vector(\"sample_key\", np.random.rand(128))\n\n    # Update metadata\n    db.update_metadata(\"sample_key\", {\"info\": \"updated metadata\"})\n\n**Deleting Data**\n\n.. code-block:: python\n\n    # Delete a vector from the database by key\n    del db[\"sample_key\"]\n\n**Database Length**\n\n.. code-block:: python\n\n    # Get the number of entries in the database\n    length = len(db)\n\nLicense\n-------\n\nVectorizeDB is released under the Apache License. For more details, see the LICENSE file included in the package.\n",
    "bugtrack_url": null,
    "license": "Apache",
    "summary": "VectorizeDB is a database for vectorized data and metadata, allowing for fast similarity search and retrieval.",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://github.com/aion-labs/vectorizedb"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d098c452a4ec786010620a3a6f3fcad4d97e67b83c337c73436840ec80eb0605",
                "md5": "2a8de7641053df8045e843311ffbe7e3",
                "sha256": "dbadd21a5951cfc8a8e991a3b147b03238b3f95bb500930262b55b8989d3a880"
            },
            "downloads": -1,
            "filename": "vectorizedb-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2a8de7641053df8045e843311ffbe7e3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">3.9",
            "size": 9012,
            "upload_time": "2024-02-03T18:19:55",
            "upload_time_iso_8601": "2024-02-03T18:19:55.646523Z",
            "url": "https://files.pythonhosted.org/packages/d0/98/c452a4ec786010620a3a6f3fcad4d97e67b83c337c73436840ec80eb0605/vectorizedb-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ed3eb760e77e62001a3eac507aded33a9339978aa65b52d705cc8a0a2e26a640",
                "md5": "2cb2127a2d55aa8878cbf2ecab3cdfed",
                "sha256": "58871f06cf303b078a0c0dee71da401243e44ffb81e1dcfadce13c49ce9a029a"
            },
            "downloads": -1,
            "filename": "vectorizedb-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2cb2127a2d55aa8878cbf2ecab3cdfed",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">3.9",
            "size": 8343,
            "upload_time": "2024-02-03T18:19:57",
            "upload_time_iso_8601": "2024-02-03T18:19:57.265352Z",
            "url": "https://files.pythonhosted.org/packages/ed/3e/b760e77e62001a3eac507aded33a9339978aa65b52d705cc8a0a2e26a640/vectorizedb-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-03 18:19:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "aion-labs",
    "github_project": "vectorizedb",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "vectorizedb"
}
        
Elapsed time: 2.26729s