From 7bb6d04fc7fa32800134fda7c303f7d3d515eb4b Mon Sep 17 00:00:00 2001 From: Apurv Agarwal Date: Thu, 28 Sep 2023 19:17:58 +0530 Subject: [PATCH] milvus collections (#11148) Description: There was no information about Milvus collections in the documentation, so I am adding that. Maintainer: @eyurtsev --- .../integrations/vectorstores/milvus.ipynb | 61 ++++++++++++++++++- 1 file changed, 58 insertions(+), 3 deletions(-) diff --git a/docs/extras/integrations/vectorstores/milvus.ipynb b/docs/extras/integrations/vectorstores/milvus.ipynb index c0e30f828..336498566 100644 --- a/docs/extras/integrations/vectorstores/milvus.ipynb +++ b/docs/extras/integrations/vectorstores/milvus.ipynb @@ -140,12 +140,67 @@ ] }, { - "cell_type": "code", - "execution_count": null, + "cell_type": "markdown", "id": "e40d558b", "metadata": {}, + "source": [ + "### Compartmentalize the data with Milvus Collections\n", + "\n", + "You can store different unrelated documents in different collections within same Milvus instance to maintain the context" + ] + }, + { + "cell_type": "markdown", + "id": "82c00f6e", + "metadata": {}, + "source": [ + "Here's how you can create a new collection" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f7ff38ab", + "metadata": {}, "outputs": [], - "source": [] + "source": [ + "vector_db = Milvus.from_documents(\n", + " docs,\n", + " embeddings,\n", + " collection_name = 'collection_1',\n", + " connection_args={\"host\": \"127.0.0.1\", \"port\": \"19530\"},\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "891cec1f", + "metadata": {}, + "source": [ + "And here is how you retrieve that stored collection" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e9e873e9", + "metadata": {}, + "outputs": [], + "source": [ + "vector_db = Milvus(\n", + " embeddings,\n", + " connection_args={\"host\": \"127.0.0.1\", \"port\": \"19530\"},\n", + " collection_name = 'collection_1'\n", + " )" + ] + }, + { + "cell_type": "markdown", + "id": "9cc65535", + "metadata": {}, + "source": [ + "After retreival you can go on querying it as usual." + ] } ], "metadata": {