Skip to content

The agent engineering platform.

milvus collections (#11148)

Apurv Agarwal7bb6d04fc7fa
diff --git a/docs/extras/integrations/vectorstores/milvus.ipynb b/docs/extras/integrations/vectorstores/milvus.ipynb
index c0e30f8289..3364985666 100644
--- a/docs/extras/integrations/vectorstores/milvus.ipynb
+++ b/docs/extras/integrations/vectorstores/milvus.ipynb
@@ -139,13 +139,68 @@
"docs[0].page_content"
]
},
+ {
+ "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": "e40d558b",
+ "id": "f7ff38ab",
+ "metadata": {},
+ "outputs": [],
+ "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": []
+ "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": {