mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-20 05:43:55 +00:00
docs: Add partition
parameter to DashVector (#19385)
**Description**: Add `partition` parameter to DashVector dashvector.ipynb **Related PR**: https://github.com/langchain-ai/langchain/pull/19023 **Twitter handle**: @CailinWang_ --------- Co-authored-by: root <root@Bluedot-AI>
This commit is contained in:
parent
515aab3312
commit
5402aef32e
@ -202,14 +202,41 @@
|
|||||||
"print(docs)"
|
"print(docs)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"### Operating band `partition` parameters"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"The `partition` parameter defaults to default, and if a non-existent `partition` parameter is passed in, the `partition` will be created automatically. "
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"metadata": {
|
"metadata": {},
|
||||||
"collapsed": false
|
|
||||||
},
|
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": []
|
"source": [
|
||||||
|
"texts = [\"foo\", \"bar\", \"baz\"]\n",
|
||||||
|
"metadatas = [{\"key\": i} for i in range(len(texts))]\n",
|
||||||
|
"ids = [\"0\", \"1\", \"2\"]\n",
|
||||||
|
"partition = \"langchain\"\n",
|
||||||
|
"\n",
|
||||||
|
"# add texts\n",
|
||||||
|
"dashvector.add_texts(texts, metadatas=metadatas, ids=ids, partition=partition)\n",
|
||||||
|
"\n",
|
||||||
|
"# similarity search\n",
|
||||||
|
"query = \"What did the president say about Ketanji Brown Jackson\"\n",
|
||||||
|
"docs = dashvector.similarity_search(query, partition=partition)\n",
|
||||||
|
"\n",
|
||||||
|
"# delete\n",
|
||||||
|
"dashvector.delete(ids=ids, partition=partition)"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
@ -228,7 +255,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.10.4"
|
"version": "3.11.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
Loading…
Reference in New Issue
Block a user