From 5c9fee17362fde730ba11490caf299e5a0000499 Mon Sep 17 00:00:00 2001 From: Wolfgang Ihloff Date: Wed, 29 Nov 2023 19:59:03 +0000 Subject: [PATCH] Update aleph-alpha-search.md to take into account for deprecated functions both in Aleph Alpha and Qdrant (#432) --- .../documentation/tutorials/aleph-alpha-search.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/qdrant-landing/content/documentation/tutorials/aleph-alpha-search.md b/qdrant-landing/content/documentation/tutorials/aleph-alpha-search.md index b0de4bccb..96753a110 100644 --- a/qdrant-landing/content/documentation/tutorials/aleph-alpha-search.md +++ b/qdrant-landing/content/documentation/tutorials/aleph-alpha-search.md @@ -27,7 +27,10 @@ https://deepai.org generated the images with pangrams used as input prompts.* You will be using [COCO](https://cocodataset.org/), a large-scale object detection, segmentation, and captioning dataset. It provides various splits, 330,000 images in total. For demonstration purposes, this tutorials uses the [2017 validation split](http://images.cocodataset.org/zips/train2017.zip) that contains 5000 images from different -categories. +categories with total size about 19GB. +```terminal +wget http://images.cocodataset.org/zips/train2017.zip +``` ## Prerequisites @@ -53,7 +56,7 @@ model = "luminous-base" ## Vectorize the dataset -In this example, images are stored in the `val2017` directory: +In this example, images have been extracted and are stored in the `val2017` directory: ```python from aleph_alpha_client import ( @@ -61,7 +64,7 @@ from aleph_alpha_client import ( AsyncClient, SemanticEmbeddingRequest, SemanticRepresentation, - ImagePrompt, + Image, ) from glob import glob @@ -71,7 +74,7 @@ async with AsyncClient(token=aa_token) as client: for i, image_path in enumerate(glob("./val2017/*.jpg")): # Convert the JPEG file into the embedding by calling # Aleph Alpha API - prompt = ImagePrompt.from_file(image_path) + prompt = Image.from_file(image_path) prompt = Prompt.from_image(prompt) query_params = { "prompt": prompt, @@ -95,10 +98,10 @@ Add all created embeddings, along with their ids and payloads into the `COCO` co import qdrant_client from qdrant_client.http.models import Batch, VectorParams, Distance -qdrant_client = qdrant_client.Qdrant.Client() +qdrant_client = qdrant_client.QdrantClient() qdrant_client.recreate_collection( collection_name="COCO", - vector_params=VectorParams( + vectors_config=VectorParams( size=len(vectors[0]), distance=Distance.COSINE, )