Skip to content

Commit b9dea69

Browse files
weizijunszabosteve
andauthored
[Inference API] Add Docs for AlibabaCloud AI Search Support for the Inference API (#112273)
Co-authored-by: István Zoltán Szabó <[email protected]>
1 parent aa67bdb commit b9dea69

17 files changed

+475
-0
lines changed

docs/changelog/112273.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 111181
2+
summary: "[Inference API] Add Docs for AlibabaCloud AI Search Support for the Inference API"
3+
area: Machine Learning
4+
type: enhancement
5+
issues: [ ]

docs/reference/inference/inference-apis.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ include::delete-inference.asciidoc[]
3939
include::get-inference.asciidoc[]
4040
include::post-inference.asciidoc[]
4141
include::put-inference.asciidoc[]
42+
include::service-alibabacloud-ai-search.asciidoc[]
4243
include::service-amazon-bedrock.asciidoc[]
4344
include::service-anthropic.asciidoc[]
4445
include::service-azure-ai-studio.asciidoc[]

docs/reference/inference/put-inference.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ The create {infer} API enables you to create an {infer} endpoint and configure a
3939

4040
The following services are available through the {infer} API, click the links to review the configuration details of the services:
4141

42+
* <<infer-service-alibabacloud-ai-search,AlibabaCloud AI Search>>
4243
* <<infer-service-amazon-bedrock,Amazon Bedrock>>
4344
* <<infer-service-anthropic,Anthropic>>
4445
* <<infer-service-azure-ai-studio,Azure AI Studio>>
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
[[infer-service-alibabacloud-ai-search]]
2+
=== AlibabaCloud AI Search {infer} service
3+
4+
Creates an {infer} endpoint to perform an {infer} task with the `alibabacloud-ai-search` service.
5+
6+
[discrete]
7+
[[infer-service-alibabacloud-ai-search-api-request]]
8+
==== {api-request-title}
9+
10+
`PUT /_inference/<task_type>/<inference_id>`
11+
12+
[discrete]
13+
[[infer-service-alibabacloud-ai-search-api-path-params]]
14+
==== {api-path-parms-title}
15+
16+
`<inference_id>`::
17+
(Required, string)
18+
include::inference-shared.asciidoc[tag=inference-id]
19+
20+
`<task_type>`::
21+
(Required, string)
22+
include::inference-shared.asciidoc[tag=task-type]
23+
+
24+
--
25+
Available task types:
26+
27+
* `text_embedding`,
28+
* `sparse_embedding`.
29+
* `rerank`.
30+
--
31+
32+
[discrete]
33+
[[infer-service-alibabacloud-ai-search-api-request-body]]
34+
==== {api-request-body-title}
35+
36+
`service`::
37+
(Required, string) The type of service supported for the specified task type.
38+
In this case,
39+
`alibabacloud-ai-search`.
40+
41+
`service_settings`::
42+
(Required, object)
43+
include::inference-shared.asciidoc[tag=service-settings]
44+
+
45+
--
46+
These settings are specific to the `alibabacloud-ai-search` service.
47+
--
48+
49+
`api_key`:::
50+
(Required, string)
51+
A valid API key for the AlibabaCloud AI Search API.
52+
53+
`service_id`:::
54+
(Required, string)
55+
The name of the model service to use for the {infer} task.
56+
+
57+
--
58+
Available service_ids for the `text_embedding` task:
59+
60+
* `ops-text-embedding-001`
61+
* `ops-text-embedding-zh-001`
62+
* `ops-text-embedding-en-001`
63+
* `ops-text-embedding-002`
64+
65+
For the supported `text_embedding` service_ids, refer to the https://help.aliyun.com/zh/open-search/search-platform/developer-reference/text-embedding-api-details[documentation].
66+
67+
Available service_id for the `sparse_embedding` task:
68+
69+
* `ops-text-sparse-embedding-001`
70+
71+
For the supported `sparse_embedding` service_id, refer to the https://help.aliyun.com/zh/open-search/search-platform/developer-reference/text-sparse-embedding-api-details[documentation].
72+
73+
Available service_id for the `rerank` task is:
74+
75+
* `ops-bge-reranker-larger`
76+
77+
For the supported `rerank` service_id, refer to the https://help.aliyun.com/zh/open-search/search-platform/developer-reference/ranker-api-details[documentation].
78+
--
79+
80+
`host`:::
81+
(Required, string)
82+
The name of the host address used for the {infer} task. You can find the host address at https://opensearch.console.aliyun.com/cn-shanghai/rag/api-key[ the API keys section] of the documentation.
83+
84+
`workspace`:::
85+
(Required, string)
86+
The name of the workspace used for the {infer} task.
87+
88+
`rate_limit`:::
89+
(Optional, object)
90+
By default, the `alibabacloud-ai-search` service sets the number of requests allowed per minute to `1000`.
91+
This helps to minimize the number of rate limit errors returned from AlibabaCloud AI Search.
92+
To modify this, set the `requests_per_minute` setting of this object in your service settings:
93+
+
94+
--
95+
include::inference-shared.asciidoc[tag=request-per-minute-example]
96+
--
97+
98+
99+
`task_settings`::
100+
(Optional, object)
101+
include::inference-shared.asciidoc[tag=task-settings]
102+
+
103+
.`task_settings` for the `text_embedding` task type
104+
[%collapsible%closed]
105+
=====
106+
`input_type`:::
107+
(Optional, string)
108+
Specifies the type of input passed to the model.
109+
Valid values are:
110+
* `ingest`: for storing document embeddings in a vector database.
111+
* `search`: for storing embeddings of search queries run against a vector database to find relevant documents.
112+
=====
113+
+
114+
.`task_settings` for the `sparse_embedding` task type
115+
[%collapsible%closed]
116+
=====
117+
`input_type`:::
118+
(Optional, string)
119+
Specifies the type of input passed to the model.
120+
Valid values are:
121+
* `ingest`: for storing document embeddings in a vector database.
122+
* `search`: for storing embeddings of search queries run against a vector database to find relevant documents.
123+
124+
`return_token`:::
125+
(Optional, boolean)
126+
If `true`, the token name will be returned in the response. Defaults to `false` which means only the token ID will be returned in the response.
127+
=====
128+
129+
[discrete]
130+
[[inference-example-alibabacloud-ai-search]]
131+
==== AlibabaCloud AI Search service examples
132+
133+
The following example shows how to create an {infer} endpoint called `alibabacloud_ai_search_embeddings` to perform a `text_embedding` task type.
134+
135+
[source,console]
136+
------------------------------------------------------------
137+
PUT _inference/text_embedding/alibabacloud_ai_search_embeddings
138+
{
139+
"service": "alibabacloud-ai-search",
140+
"service_settings": {
141+
"api_key": "<api_key>",
142+
"service_id": "ops-text-embedding-001",
143+
"host": "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com",
144+
"workspace": "default"
145+
}
146+
}
147+
------------------------------------------------------------
148+
// TEST[skip:TBD]
149+
150+
The following example shows how to create an {infer} endpoint called
151+
`alibabacloud_ai_search_sparse` to perform a `sparse_embedding` task type.
152+
153+
[source,console]
154+
------------------------------------------------------------
155+
PUT _inference/sparse_embedding/alibabacloud_ai_search_sparse
156+
{
157+
"service": "alibabacloud-ai-search",
158+
"service_settings": {
159+
"api_key": "<api_key>",
160+
"service_id": "ops-text-sparse-embedding-001",
161+
"host": "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com",
162+
"workspace": "default"
163+
}
164+
}
165+
------------------------------------------------------------
166+
// TEST[skip:TBD]
167+
168+
The next example shows how to create an {infer} endpoint called
169+
`alibabacloud_ai_search_rerank` to perform a `rerank` task type.
170+
171+
[source,console]
172+
------------------------------------------------------------
173+
PUT _inference/rerank/alibabacloud_ai_search_rerank
174+
{
175+
"service": "alibabacloud-ai-search",
176+
"service_settings": {
177+
"api_key": "<api_key>",
178+
"service_id": "ops-bge-reranker-larger",
179+
"host": "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com",
180+
"workspace": "default"
181+
}
182+
}
183+
------------------------------------------------------------
184+
// TEST[skip:TBD]

docs/reference/search/search-your-data/semantic-search-inference.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Azure based examples use models available through https://ai.azure.com/explore/m
1717
or https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models[Azure OpenAI].
1818
Mistral examples use the `mistral-embed` model from https://docs.mistral.ai/getting-started/models/[the Mistral API].
1919
Amazon Bedrock examples use the `amazon.titan-embed-text-v1` model from https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html[the Amazon Bedrock base models].
20+
AlibabaCloud AI Search examples use the `ops-text-embedding-zh-001` model from https://help.aliyun.com/zh/open-search/search-platform/developer-reference/text-embedding-api-details[the AlibabaCloud AI Search base models].
2021

2122
Click the name of the service you want to use on any of the widgets below to review the corresponding instructions.
2223

docs/reference/tab-widgets/inference-api/infer-api-ingest-pipeline-widget.asciidoc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@
4949
id="infer-api-ingest-amazon-bedrock">
5050
Amazon Bedrock
5151
</button>
52+
<button role="tab"
53+
aria-selected="false"
54+
aria-controls="infer-api-ingest-alibabacloud-ai-search-tab"
55+
id="infer-api-ingest-alibabacloud-ai-search">
56+
AlibabaCloud AI Search
57+
</button>
5258
</div>
5359
<div tabindex="0"
5460
role="tabpanel"
@@ -135,6 +141,17 @@ include::infer-api-ingest-pipeline.asciidoc[tag=mistral]
135141

136142
include::infer-api-ingest-pipeline.asciidoc[tag=amazon-bedrock]
137143

144+
++++
145+
</div>
146+
<div tabindex="0"
147+
role="tabpanel"
148+
id="infer-api-ingest-alibabacloud-ai-search-tab"
149+
aria-labelledby="infer-api-ingest-alibabacloud-ai-search"
150+
hidden="">
151+
++++
152+
153+
include::infer-api-ingest-pipeline.asciidoc[tag=alibabacloud-ai-search]
154+
138155
++++
139156
</div>
140157
</div>

docs/reference/tab-widgets/inference-api/infer-api-ingest-pipeline.asciidoc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,29 @@ PUT _ingest/pipeline/amazon_bedrock_embeddings
216216
and the `output_field` that will contain the {infer} results.
217217

218218
// end::amazon-bedrock[]
219+
220+
// tag::alibabacloud-ai-search[]
221+
222+
[source,console]
223+
--------------------------------------------------
224+
PUT _ingest/pipeline/alibabacloud_ai_search_embeddings
225+
{
226+
"processors": [
227+
{
228+
"inference": {
229+
"model_id": "alibabacloud_ai_search_embeddings", <1>
230+
"input_output": { <2>
231+
"input_field": "content",
232+
"output_field": "content_embedding"
233+
}
234+
}
235+
}
236+
]
237+
}
238+
--------------------------------------------------
239+
<1> The name of the inference endpoint you created by using the
240+
<<put-inference-api>>, it's referred to as `inference_id` in that step.
241+
<2> Configuration object that defines the `input_field` for the {infer} process
242+
and the `output_field` that will contain the {infer} results.
243+
244+
// end::alibabacloud-ai-search[]

docs/reference/tab-widgets/inference-api/infer-api-mapping-widget.asciidoc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@
4949
id="infer-api-mapping-amazon-bedrock">
5050
Amazon Bedrock
5151
</button>
52+
<button role="tab"
53+
aria-selected="false"
54+
aria-controls="infer-api-mapping-alibabacloud-ai-search-tab"
55+
id="infer-api-mapping-alibabacloud-ai-search">
56+
AlibabaCloud AI Search
57+
</button>
5258
</div>
5359
<div tabindex="0"
5460
role="tabpanel"
@@ -135,6 +141,17 @@ include::infer-api-mapping.asciidoc[tag=mistral]
135141

136142
include::infer-api-mapping.asciidoc[tag=amazon-bedrock]
137143

144+
++++
145+
</div>
146+
<div tabindex="0"
147+
role="tabpanel"
148+
id="infer-api-mapping-alibabacloud-ai-search-tab"
149+
aria-labelledby="infer-api-mapping-alibabacloud-ai-search"
150+
hidden="">
151+
++++
152+
153+
include::infer-api-mapping.asciidoc[tag=alibabacloud-ai-search]
154+
138155
++++
139156
</div>
140157
</div>

docs/reference/tab-widgets/inference-api/infer-api-mapping.asciidoc

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,3 +270,35 @@ the {infer} pipeline configuration in the next step.
270270
<6> The field type which is text in this example.
271271

272272
// end::amazon-bedrock[]
273+
274+
// tag::alibabacloud-ai-search[]
275+
276+
[source,console]
277+
--------------------------------------------------
278+
PUT alibabacloud-ai-search-embeddings
279+
{
280+
"mappings": {
281+
"properties": {
282+
"content_embedding": { <1>
283+
"type": "dense_vector", <2>
284+
"dims": 1024, <3>
285+
"element_type": "float"
286+
},
287+
"content": { <4>
288+
"type": "text" <5>
289+
}
290+
}
291+
}
292+
}
293+
--------------------------------------------------
294+
<1> The name of the field to contain the generated tokens. It must be referenced
295+
in the {infer} pipeline configuration in the next step.
296+
<2> The field to contain the tokens is a `dense_vector` field.
297+
<3> The output dimensions of the model. This value may be different depending on the underlying model used.
298+
See the https://help.aliyun.com/zh/open-search/search-platform/developer-reference/text-embedding-api-details[AlibabaCloud AI Search embedding model] documentation.
299+
<4> The name of the field from which to create the dense vector representation.
300+
In this example, the name of the field is `content`. It must be referenced in
301+
the {infer} pipeline configuration in the next step.
302+
<5> The field type which is text in this example.
303+
304+
// end::alibabacloud-ai-search[]

docs/reference/tab-widgets/inference-api/infer-api-reindex-widget.asciidoc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@
4949
id="infer-api-reindex-amazon-bedrock">
5050
Amazon Bedrock
5151
</button>
52+
<button role="tab"
53+
aria-selected="false"
54+
aria-controls="infer-api-reindex-alibabacloud-ai-search-tab"
55+
id="infer-api-reindex-alibabacloud-ai-search">
56+
AlibabaCloud AI Search
57+
</button>
5258
</div>
5359
<div tabindex="0"
5460
role="tabpanel"
@@ -135,6 +141,17 @@ include::infer-api-reindex.asciidoc[tag=mistral]
135141

136142
include::infer-api-reindex.asciidoc[tag=amazon-bedrock]
137143

144+
++++
145+
</div>
146+
<div tabindex="0"
147+
role="tabpanel"
148+
id="infer-api-reindex-alibabacloud-ai-search-tab"
149+
aria-labelledby="infer-api-reindex-alibabacloud-ai-search"
150+
hidden="">
151+
++++
152+
153+
include::infer-api-reindex.asciidoc[tag=alibabacloud-ai-search]
154+
138155
++++
139156
</div>
140157
</div>

0 commit comments

Comments
 (0)