From 21b93973422d7c6daae10f07abf879b430458357 Mon Sep 17 00:00:00 2001 From: shiyu22 Date: Tue, 16 May 2023 07:16:57 +0800 Subject: [PATCH] Update the milvus example (#4706) # Fix issue when running example - add the query content - update the `user` parameter with Zilliz Signed-off-by: shiyu22 --- .../vectorstores/examples/milvus.ipynb | 40 ++++++++++---- .../vectorstores/examples/zilliz.ipynb | 52 ++++++++++++++----- 2 files changed, 70 insertions(+), 22 deletions(-) diff --git a/docs/modules/indexes/vectorstores/examples/milvus.ipynb b/docs/modules/indexes/vectorstores/examples/milvus.ipynb index 59800466..89d8ca07 100644 --- a/docs/modules/indexes/vectorstores/examples/milvus.ipynb +++ b/docs/modules/indexes/vectorstores/examples/milvus.ipynb @@ -43,10 +43,10 @@ }, "outputs": [ { - "name": "stdin", + "name": "stdout", "output_type": "stream", "text": [ - "OpenAI API Key: ········\n" + "OpenAI API Key:········\n" ] } ], @@ -59,7 +59,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "aac9563e", "metadata": { "tags": [] @@ -74,7 +74,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "id": "a3c3999a", "metadata": { "tags": [] @@ -92,7 +92,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "dcf88bdf", "metadata": { "tags": [] @@ -108,23 +108,43 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "id": "a8c513ab", "metadata": {}, "outputs": [], "source": [ + "query = \"What did the president say about Ketanji Brown Jackson\"\n", "docs = vector_db.similarity_search(query)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "id": "fc516993", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so Americans can know who is funding our elections. \\n\\nTonight, I’d like to honor someone who has dedicated his life to serve this country: Justice Stephen Breyer—an Army veteran, Constitutional scholar, and retiring Justice of the United States Supreme Court. Justice Breyer, thank you for your service. \\n\\nOne of the most serious constitutional responsibilities a President has is nominating someone to serve on the United States Supreme Court. \\n\\nAnd I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji Brown Jackson. One of our nation’s top legal minds, who will continue Justice Breyer’s legacy of excellence.'" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "docs[0]" + "docs[0].page_content" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e40d558b", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { @@ -143,7 +163,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.6" + "version": "3.9.12" } }, "nbformat": 4, diff --git a/docs/modules/indexes/vectorstores/examples/zilliz.ipynb b/docs/modules/indexes/vectorstores/examples/zilliz.ipynb index 052d443b..decf4b53 100644 --- a/docs/modules/indexes/vectorstores/examples/zilliz.ipynb +++ b/docs/modules/indexes/vectorstores/examples/zilliz.ipynb @@ -36,10 +36,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "d6691489-1ebc-40fa-bc09-b0916903a24d", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "OpenAI API Key:········\n" + ] + } + ], "source": [ "import os\n", "import getpass\n", @@ -49,7 +57,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "19a71422", "metadata": {}, "outputs": [], @@ -62,7 +70,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "id": "aac9563e", "metadata": {}, "outputs": [], @@ -75,7 +83,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "a3c3999a", "metadata": {}, "outputs": [], @@ -91,7 +99,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "id": "dcf88bdf", "metadata": {}, "outputs": [], @@ -101,7 +109,7 @@ " embeddings,\n", " connection_args={\n", " \"uri\": ZILLIZ_CLOUD_URI,\n", - " \"username\": ZILLIZ_CLOUD_USERNAME,\n", + " \"user\": ZILLIZ_CLOUD_USERNAME,\n", " \"password\": ZILLIZ_CLOUD_PASSWORD,\n", " \"secure\": True\n", " }\n", @@ -110,23 +118,43 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "id": "a8c513ab", "metadata": {}, "outputs": [], "source": [ + "query = \"What did the president say about Ketanji Brown Jackson\"\n", "docs = vector_db.similarity_search(query)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "id": "fc516993", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so Americans can know who is funding our elections. \\n\\nTonight, I’d like to honor someone who has dedicated his life to serve this country: Justice Stephen Breyer—an Army veteran, Constitutional scholar, and retiring Justice of the United States Supreme Court. Justice Breyer, thank you for your service. \\n\\nOne of the most serious constitutional responsibilities a President has is nominating someone to serve on the United States Supreme Court. \\n\\nAnd I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji Brown Jackson. One of our nation’s top legal minds, who will continue Justice Breyer’s legacy of excellence.'" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "docs[0]" + "docs[0].page_content" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "dc85398b", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { @@ -145,7 +173,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.6" + "version": "3.9.12" } }, "nbformat": 4,