From 5402aef32ef441b45be70a0bb32927ed0a7e8973 Mon Sep 17 00:00:00 2001 From: Cailin Wang Date: Sat, 23 Mar 2024 08:00:29 +0800 Subject: [PATCH] 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 --- .../vectorstores/dashvector.ipynb | 37 ++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/docs/docs/integrations/vectorstores/dashvector.ipynb b/docs/docs/integrations/vectorstores/dashvector.ipynb index 7ad14a0f78c..1694ca2ae2d 100644 --- a/docs/docs/integrations/vectorstores/dashvector.ipynb +++ b/docs/docs/integrations/vectorstores/dashvector.ipynb @@ -202,14 +202,41 @@ "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", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "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": { @@ -228,7 +255,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.4" + "version": "3.11.6" } }, "nbformat": 4,