Skip to main content

Python Client Library for the Arc Vector Search Engine

Project description

arc-vector-python

Python library and client for arc-vector database

Installation

// remote install
pip install arc-vector-python

// local install by package
pip install arc_vector_python-1.6.2.tar.gz

Features

  1. Type hints for all API methods
  2. Local mode - use same API without running server
  3. REST and gRPC support
  4. Minimal dependencies

Connect to ArcVector Server

To connect to Qdrant server, simply specify host and port:

from arc_vector_client import ArcVectorClient
from arc_vector_client.models import Distance, VectorParams
# REST
client = ArcVectorClient(url="http://localhost:8333")
# gRPC
client = ArcVectorClient(host="localhost", grpc_port=8334, prefer_grpc=True)

Async client

Starting from version 1.6.2, all python client methods are available in async version.

To use it, just import AsyncArcVectorClient instead of ArcVectorClient:

from arc_vector_client import AsyncArcVectorClient, models
import numpy as np
import asyncio

async def main():
    # Your async code using ArcVectorClient might be put here
    client = AsyncArcVectorClient(url="http://localhost:8333")
    # client = AsyncArcVectorClient(host="localhost", grpc_port=8334, prefer_grpc=True)
    await client.create_collection(
        collection_name="my_collection",
        vectors_config=models.VectorParams(size=10, distance=models.Distance.COSINE),
    )

    await client.upsert(
        collection_name="my_collection",
        points=[
            models.PointStruct(
                id=i,
                vector=np.random.rand(10).tolist(),
            )
            for i in range(100)
        ],
    )

    res = await client.search(
        collection_name="my_collection",
        query_vector=np.random.rand(10).tolist(),  # type: ignore
        limit=10,
    )

    print(res)

asyncio.run(main())

Both, gRPC and REST API are supported in async mode. More examples can be found here.

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

arc_vector_python-1.6.4.tar.gz (145.2 kB view details)

Uploaded Source

Built Distribution

arc_vector_python-1.6.4-py3-none-any.whl (174.8 kB view details)

Uploaded Python 3

File details

Details for the file arc_vector_python-1.6.4.tar.gz.

File metadata

  • Download URL: arc_vector_python-1.6.4.tar.gz
  • Upload date:
  • Size: 145.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Darwin/21.6.0

File hashes

Hashes for arc_vector_python-1.6.4.tar.gz
Algorithm Hash digest
SHA256 679a59d22233a3ec1f8d12c62807035be6c3ae9c6f438c988f013c225f1cdd69
MD5 66c169a2c93c156541b098d63312742e
BLAKE2b-256 57a3311da7edaca17d2cda9c7eaf47330eeee6037868cce7f8862acb0bbd8664

See more details on using hashes here.

File details

Details for the file arc_vector_python-1.6.4-py3-none-any.whl.

File metadata

File hashes

Hashes for arc_vector_python-1.6.4-py3-none-any.whl
Algorithm Hash digest
SHA256 cb7b1306b03b49edeaf4f190304572030a1af1aeaf866ec2b275fca21450b1be
MD5 0048f14aaa21615ef8d84088abb9e628
BLAKE2b-256 535611d2166cbe37656fbf736a8ffd698d59281910fe6648f4dadc2182282fd6

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