diff --git a/examples/vector_databases/qdrant/Using_Qdrant_for_embeddings_search.ipynb b/examples/vector_databases/qdrant/Using_Qdrant_for_embeddings_search.ipynb index ffb598d24a..caab9c4830 100644 --- a/examples/vector_databases/qdrant/Using_Qdrant_for_embeddings_search.ipynb +++ b/examples/vector_databases/qdrant/Using_Qdrant_for_embeddings_search.ipynb @@ -109,7 +109,7 @@ { "data": { "text/plain": [ - "'vector_database_wikipedia_articles_embedded (10).zip'" + "'vector_database_wikipedia_articles_embedded.zip'" ] }, "execution_count": 3, @@ -508,46 +508,6 @@ ")" ] }, - { - "cell_type": "code", - "execution_count": 14, - "id": "9f39a8c395554ca3", - "metadata": { - "ExecuteTime": { - "end_time": "2024-05-21T23:56:21.577594Z", - "start_time": "2024-05-21T23:56:21.460740Z" - } - }, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 14, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "vector_size = len(article_df['content_vector'][0])\n", - "\n", - "qdrant.recreate_collection(\n", - " collection_name='Articles',\n", - " vectors_config={\n", - " 'title': rest.VectorParams(\n", - " distance=rest.Distance.COSINE,\n", - " size=vector_size,\n", - " ),\n", - " 'content': rest.VectorParams(\n", - " distance=rest.Distance.COSINE,\n", - " size=vector_size,\n", - " ),\n", - " }\n", - ")" - ] - }, { "cell_type": "markdown", "id": "e95be6e0c9af4c21", @@ -571,13 +531,13 @@ "name": "stderr", "output_type": "stream", "text": [ - "Upserting articles: 100%|█████████████████████████████████████████████████████████████████████████████████████| 25000/25000 [02:52<00:00, 144.82it/s]\n" + "Upserting articles: 100%|██████████| 25000/25000 [06:50<00:00, 60.93it/s]\n" ] } ], "source": [ "from qdrant_client.models import PointStruct # Import the PointStruct to store the vector and payload\n", - "from tqdm import tqdm # Library to show the progress bar \n", + "from tqdm import tqdm # Library to show the progress bar\n", "\n", "# Populate collection with vectors using tqdm to show progress\n", "for k, v in tqdm(article_df.iterrows(), desc=\"Upserting articles\", total=len(article_df)):\n", @@ -587,7 +547,7 @@ " points=[\n", " PointStruct(\n", " id=k,\n", - " vector={'title': v['title_vector'], \n", + " vector={'title': v['title_vector'],\n", " 'content': v['content_vector']},\n", " payload={\n", " 'id': v['id'],\n", @@ -652,22 +612,21 @@ "outputs": [], "source": [ "def query_qdrant(query, collection_name, vector_name='title', top_k=20):\n", - "\n", " # Creates embedding vector from user query\n", " embedded_query = openai.embeddings.create(\n", " input=query,\n", " model=EMBEDDING_MODEL,\n", " ).data[0].embedding # We take the first embedding from the list\n", - " \n", + "\n", " query_results = qdrant.search(\n", " collection_name=collection_name,\n", " query_vector=(\n", " vector_name, embedded_query\n", " ),\n", - " limit=top_k, \n", + " limit=top_k,\n", " query_filter=None\n", " )\n", - " \n", + "\n", " return query_results" ] }, @@ -777,12 +736,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" - }, - "vscode": { - "interpreter": { - "hash": "fd16a328ca3d68029457069b79cb0b38eb39a0f5ccc4fe4473d3047707df8207" - } + "version": "3.13.0" } }, "nbformat": 4,