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.5.0

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.5.0.tar.gz (18.7 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.5.0-py3-none-any.whl (22.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qdrant_client-0.5.0.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using 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.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for qdrant_client-0.5.0.tar.gz
Algorithm Hash digest
SHA256 671fccb1cfdf8c3eb15579513101328264a406deb9d61f2e9fb65d3add157cec
MD5 6ce6b35c988c83ee02025ea9ccd9fcde
BLAKE2b-256 f2b96f583d3b06d3a25b37e29293af591794d23b1a81e2ace0544e81440ad670

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qdrant_client-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 22.4 kB
  • Tags: Python 3
  • Uploaded using 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.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for qdrant_client-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e97b29b39a9e82d340e7439cc089a797f85e1acc6ad15f5b8a94442f04cb3521
MD5 96aee53ca5975751c2235e322478b6f1
BLAKE2b-256 e4e131ff857938cd58c7cd7ff110ea5e1be1ee50937f8fc261cf6bc01b2ab849

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