Files
qdrant-client/tests/congruence_tests/test_optional_vectors.py
Andrey Vasnetsov 329b4150cf v1.2.0 (#173)
* wip: interface for new APIs

* upd docker version

* remove duplicated comments + extent interface

* start implementing remote client + remove duplicated comments there

* implement remote methods

* quantization converter

* extend coverege

* wip: saving and loading of optional vectors

* update and delete vectors test

* rm unused imports

* nested filters

* fix mypy

* fix pyright

* wip: add search groups and recommend groups (#174)

* wip: add search groups and recommend groups

* fix: fix signature

* fix: fix mypy

* simplify group-by and condition checks

* fix tests

---------

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>

* add match except condition + improve group-by tests

* fix: lock typing exchanges due to broken release

* tests: add maybe and maybe_null checks to group tests

* new: add new methods to type stubs

---------

Co-authored-by: George <george.panchuk@qdrant.tech>
2023-05-24 11:06:10 +02:00

86 lines
2.0 KiB
Python

import numpy as np
from qdrant_client.http.models import models
from tests.congruence_tests.test_common import (
COLLECTION_NAME,
NUM_VECTORS,
compare_client_results,
generate_fixtures,
image_vector_size,
init_client,
init_local,
init_remote,
)
def test_simple_opt_vectors_search():
fixture_records = generate_fixtures()
local_client = init_local()
init_client(local_client, fixture_records)
remote_client = init_remote()
init_client(remote_client, fixture_records)
ids_to_delete = [x for x in range(NUM_VECTORS) if x % 5 == 0]
vectors_to_retrieve = [x for x in range(20)]
local_client.delete_vectors(
collection_name=COLLECTION_NAME,
vectors=["image"],
points=ids_to_delete,
)
remote_client.delete_vectors(
collection_name=COLLECTION_NAME,
vectors=["image"],
points=ids_to_delete,
)
compare_client_results(
local_client,
remote_client,
lambda c: sorted(
c.retrieve(
COLLECTION_NAME,
vectors_to_retrieve,
with_payload=False,
with_vectors=["image", "code"],
),
key=lambda x: x.id,
),
)
new_vector = np.random.rand(image_vector_size).tolist()
update_vectors = [
models.PointVectors(
id=i,
vector={"image": new_vector},
)
for i in range(6)
]
local_client.update_vectors(
collection_name=COLLECTION_NAME,
vectors=update_vectors,
)
remote_client.update_vectors(
collection_name=COLLECTION_NAME,
vectors=update_vectors,
)
compare_client_results(
local_client,
remote_client,
lambda c: sorted(
c.retrieve(
COLLECTION_NAME,
vectors_to_retrieve,
with_payload=False,
with_vectors=["image", "code"],
),
key=lambda x: x.id,
),
)