tests: extend remote inference tests (#1055)

This commit is contained in:
George
2025-07-31 21:00:32 +03:00
committed by George Panchuk
parent 8dee446ac9
commit 2b0160126a

View File

@@ -18,7 +18,9 @@ def test_remote_inference_image():
client = QdrantClient(url=QDRANT_URL, api_key=QDRANT_API_KEY, cloud_inference=True)
collection_name = "image_embeddings"
model_name = "Qdrant/clip-ViT-B-32-vision"
dim = 512 # Dimension of the CLIP ViT-B/32 model,
# we can't use get_embedding_size since it requires fastembed to be installed,
# and it is not required for cloud_inference
image_url = "https://qdrant.tech/example.png"
# Compare inference of image exposed via url and local file
@@ -37,9 +39,7 @@ def test_remote_inference_image():
client.create_collection(
collection_name=collection_name,
vectors_config=models.VectorParams(
size=client.get_embedding_size(model_name), distance=models.Distance.COSINE
),
vectors_config=models.VectorParams(size=dim, distance=models.Distance.COSINE),
)
client.upsert(
@@ -61,3 +61,19 @@ def test_remote_inference_image():
),
],
)
client.query_points(
collection_name,
query=models.FusionQuery(fusion=models.Fusion.RRF),
prefetch=[
models.Prefetch(
query=models.Image(
image=image_url,
model=model_name,
),
),
models.Prefetch(
query=models.Image(image=read_base64(image_path), model=model_name),
),
],
)