Improve the alibaba cloud opensearch vector store documentation (#6964)

Based on user feedback, we have improved the Alibaba Cloud OpenSearch
vector store documentation.

Co-authored-by: zhaoshengbo <shengbo.zsb@alibaba-inc.com>
pull/6927/head^2
zhaoshengbo 1 year ago committed by GitHub
parent ae5aa496ee
commit e8f24164f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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
}
}
Loading…
Cancel
Save