diff --git a/docs/extras/modules/data_connection/vectorstores/integrations/alibabacloud_opensearch.ipynb b/docs/extras/modules/data_connection/vectorstores/integrations/alibabacloud_opensearch.ipynb index 9be5001157..871fcd7362 100644 --- a/docs/extras/modules/data_connection/vectorstores/integrations/alibabacloud_opensearch.ipynb +++ b/docs/extras/modules/data_connection/vectorstores/integrations/alibabacloud_opensearch.ipynb @@ -10,14 +10,32 @@ "\n", ">`OpenSearch` helps you develop high quality, maintenance-free, and high performance intelligent search services to provide your users with high search efficiency and accuracy.\n", "\n", - ">`OpenSearch` provides the vector search feature. In specific scenarios, especially test question search and image search scenarios, you can use the vector search feature together with the multimodal search feature to improve the accuracy of search results. This topic describes the syntax and usage notes of vector indexes.\n", + ">`OpenSearch` provides the vector search feature. In specific scenarios, especially test question search and image search scenarios, you can use the vector search feature together with the multimodal search feature to improve the accuracy of search results.\n", "\n", "This notebook shows how to use functionality related to the `Alibaba Cloud OpenSearch Vector Search Edition`.\n", "To run, you should have an [OpenSearch Vector Search Edition](https://opensearch.console.aliyun.com) instance up and running:\n", "\n", - "Read the [help document](https://www.alibabacloud.com/help/en/opensearch/latest/vector-search) to quickly familiarize and configure OpenSearch Vector Search Edition instance.\n" + "Read the [help document](https://www.alibabacloud.com/help/en/opensearch/latest/vector-search) to quickly familiarize and configure OpenSearch Vector Search Edition instance." ] }, + { + "cell_type": "markdown", + "source": [ + "After the instance is up and running, follow these steps to split documents, get embeddings, connect to the alibaba cloud opensearch instance, index documents, and perform vector retrieval." + ], + "metadata": { + "collapsed": false + } + }, + { + "cell_type": "markdown", + "source": [ + "We need to install the following Python packages first." + ], + "metadata": { + "collapsed": false + } + }, { "cell_type": "code", "execution_count": 1, @@ -29,10 +47,29 @@ }, { "cell_type": "markdown", - "metadata": {}, "source": [ - "After completing the configuration, follow these steps to connect to the instance, index documents, and perform vector retrieval." - ] + "We want to use `OpenAIEmbeddings` so we have to get the OpenAI API Key." + ], + "metadata": { + "collapsed": false + } + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [ + "import os\n", + "import getpass\n", + "\n", + "os.environ[\"OPENAI_API_KEY\"] = getpass.getpass(\"OpenAI API Key:\")\n" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } }, { "cell_type": "code", @@ -60,7 +97,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Split documents and get embeddings by call OpenAI API" + "Split documents and get embeddings." ] }, { @@ -123,7 +160,7 @@ " \"id\": \"id\", # The id field name mapping of index document.\n", " \"document\": \"document\", # The text field name mapping of index document.\n", " \"embedding\": \"embedding\", # The embedding field name mapping of index document.\n", - " \"metadata_x\": \"metadata_x,=\", # The metadata field name mapping of index document, could specify multiple, The value field contains mapping name and operator, the operator would be used when executing metadata filter query.\n", + " \"name_of_the_metadata_specified_during_search\": \"opensearch_metadata_field_name,=\", # The metadata field name mapping of index document, could specify multiple, The value field contains mapping name and operator, the operator would be used when executing metadata filter query.\n", " },\n", ")\n", "\n", @@ -139,7 +176,10 @@ "# \"id\": \"id\",\n", "# \"document\": \"document\",\n", "# \"embedding\": \"embedding\",\n", - "# \"metadata\": \"metadata,=\" #The value field contains mapping name and operator, the operator would be used when executing metadata filter query\n", + "# \"metadata_a\": \"metadata_a,=\" #The value field contains mapping name and operator, the operator would be used when executing metadata filter query\n", + "# \"metadata_b\": \"metadata_b,>\"\n", + "# \"metadata_c\": \"metadata_c,<\"\n", + "# \"metadata_else\": \"metadata_else,=\"\n", "# })" ] }, @@ -251,7 +291,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Query and retrieve data with metadata\n" + "Query and retrieve data with metadata.\n" ] }, { @@ -307,4 +347,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} +} \ No newline at end of file