Skip to main content

Client library for the Qdrant vector search engine

Project description

Python Qdrant client library

Client library for the Qdrant vector search engine.

Library contains type definitions for all Qdrant API and allows to make both Sync and Async requests.

Pydantic is used for describing request models and httpx for handling http queries.

Client allows calls for all Qdrant API methods directly. It also provides some additional helper methods for frequently required operations, e.g. initial collection uploading.

Installation

pip install qdrant-client

Examples

Instance a client

from qdrant_client import QdrantClient

client = QdrantClient(host="localhost", port=6333)

Create a new collection

client.recreate_collection(
    collection_name="my_collection",
    vector_size=100
)

Get info about created collection

my_collection_info = client.http.collections_api.get_collection("my_collection")
print(my_collection_info.dict())

Search for similar vectors

query_vector = np.random.rand(100)
hits = client.search(
    collection_name="my_collection",
    query_vector=query_vector,
    query_filter=None,  # Don't use any filters for now, search across all indexed points
    append_payload=True,  # Also return a stored payload for found points
    top=5  # Return 5 closest points
)

Search for similar vectors with filtering condition

from qdrant_openapi_client.models.models import Filter, FieldCondition, Range

hits = client.search(
    collection_name="my_collection",
    query_vector=query_vector,
    query_filter=Filter(
        must=[  # These conditions are required for search results
            FieldCondition(
                key='rand_number',  # Condition based on values of `rand_number` field.
                range=Range(
                    gte=0.5  # Select only those results where `rand_number` >= 0.5
                )
            )
        ]
    ),
    append_payload=True,  # Also return a stored payload for found points
    top=5  # Return 5 closest points
)

Check out full example code

Project details


Release history Release notifications | RSS feed

This version

0.3.5

Download files

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

Source Distribution

qdrant_client-0.3.5.tar.gz (44.0 kB view details)

Uploaded Source

Built Distribution

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

qdrant_client-0.3.5-py3-none-any.whl (86.5 kB view details)

Uploaded Python 3

File details

Details for the file qdrant_client-0.3.5.tar.gz.

File metadata

  • Download URL: qdrant_client-0.3.5.tar.gz
  • Upload date:
  • Size: 44.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.7.6 Linux/5.0.0-38-generic

File hashes

Hashes for qdrant_client-0.3.5.tar.gz
Algorithm Hash digest
SHA256 17d3e888e6692da2f1b283a34ac164847502d4ddb707ec9b5d0548fece969a0f
MD5 d2fb067fa44d2e5af6989a780976af33
BLAKE2b-256 ff7c123344e5a0ba8013d72ded941a2f5cc77764422d383db8eb12f1abb3f078

See more details on using hashes here.

File details

Details for the file qdrant_client-0.3.5-py3-none-any.whl.

File metadata

  • Download URL: qdrant_client-0.3.5-py3-none-any.whl
  • Upload date:
  • Size: 86.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.7.6 Linux/5.0.0-38-generic

File hashes

Hashes for qdrant_client-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 65eae612ad1cfd77b6dbecdb48aa56d22518d340813a3da6a7495e7fa54929e1
MD5 9355a3b4fb279b06a33357405f7767e0
BLAKE2b-256 e78785072cbdbafc925754ec9716f0ec8a499d19e2391d86028d47974c1a1343

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