mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-21 02:17:12 +00:00
milvus collections (#11148)
Description: There was no information about Milvus collections in the documentation, so I am adding that. Maintainer: @eyurtsev
This commit is contained in:
parent
8ae9b71e41
commit
7bb6d04fc7
@ -140,12 +140,67 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "markdown",
|
||||||
"execution_count": null,
|
|
||||||
"id": "e40d558b",
|
"id": "e40d558b",
|
||||||
"metadata": {},
|
"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": [],
|
"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": {
|
"metadata": {
|
||||||
|
Loading…
Reference in New Issue
Block a user