Skip to main content

Python client for Vektonn

CI version Supported Python Versions license

Vektonn is a high-performance battle-tested kNN vector search engine for your data science applications. It helps you manage vectors' lifecycle and radically reduces time to market.

See documentation for more info.

Installation

Install the latest version:

$ pip install vektonn

Install specific version:

$ pip install vektonn==1.2.3

Upgrade to the latest version:

$ pip install --upgrade vektonn

Usage

Having Vektonn running on localhost:8081 and configured for QuickStart examples one can access it with synchronous Python client:

from vektonn import Vektonn

vektonn_client = Vektonn('http://localhost:8081')

or asynchronous one:

from vektonn import VektonnAsync

vektonn_client_async = VektonnAsync('http://localhost:8081')

To upload data to Vektonn use upload() method:

from vektonn.dtos import Attribute, AttributeValue, InputDataPoint, Vector

vektonn_client.upload(
    data_source_name='QuickStart.Source',
    data_source_version='1.0',
    input_data_points=[
        InputDataPoint(
            attributes=[
                Attribute(key='id', value=AttributeValue(int64=1)),
                Attribute(key='payload', value=AttributeValue(string='sample data point')),
            ],
            vector=Vector(is_sparse=False, coordinates=[3.14, 2.71]))
    ])

To query Vektonn for k nearest data points to the given query_vector use search() method:

from vektonn.dtos import Vector, SearchQuery

k = 10
query_vector = Vector(is_sparse=False, coordinates=[1.2, 3.4])

search_results = vektonn_client.search(
    index_name='QuickStart.Index',
    index_version='1.0',
    search_query=SearchQuery(k=k, query_vectors=[query_vector]))

print(f'For query vector {query_vector.coordinates} {k} nearest data points are:')
for fdp in search_results[0].nearest_data_points:
    attrs = {x.key: x.value for x in fdp.attributes}
    distance, vector, dp_id, payload = fdp.distance, fdp.vector, attrs['id'].int64, attrs['payload'].string
    print(f' - "{payload}" with id = {dp_id}, vector = {vector.coordinates}, distance = {distance}')

Metadata

Release files for vektonn 0.7.1

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

Source distribution (sdist)

Source distribution for vektonn 0.7.1
File Size Uploaded Provenance Actions
vektonn-0.7.1.tar.gz 10.6 kB Without provenance Details for vektonn-0.7.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vektonn 0.7.1
File Interpreter ABI Platform Actions
vektonn-0.7.1-py3-none-any.whl Python 3 none any Details for vektonn-0.7.1-py3-none-any.whl

Total release size: 21.9 kB

Release files / vektonn-0.7.1.tar.gz

Download URL vektonn-0.7.1.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8ad403b777edb5e7a06c46e1b6ab7b55d9eb497113bd02544dd69faeeddc5994
BLAKE2b-256 checksum
How to use checksums
91a1b77bed582ad7cc3695bb4eccb5a59191616dfe0b5fdcc726336185986c50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Release files / vektonn-0.7.1-py3-none-any.whl

Download URL vektonn-0.7.1-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2a041d2407c400ca758f53bc6241f4f0128a0d14aeedbcc10e732f1cc1fa2e8b
BLAKE2b-256 checksum
How to use checksums
e9f15f650f8b4fbb5d83fd719fd745754a6b29390bbffb2e7d48873c86898c63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Security for vektonn 0.7.1

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.

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