Create an AlibabaCloud AI Search inference endpoint Generally available; Added in 8.16.0
Path parameters
-
The type of the inference task that the model will perform.
Values are
completion
,rerank
,space_embedding
, ortext_embedding
. -
The unique identifier of the inference endpoint.
PUT /_inference/{task_type}/{alibabacloud_inference_id}
Console
PUT _inference/completion/alibabacloud_ai_search_completion { "service": "alibabacloud-ai-search", "service_settings": { "host" : "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", "api_key": "AlibabaCloud-API-Key", "service_id": "ops-qwen-turbo", "workspace" : "default" } }
resp = client.inference.put( task_type="completion", inference_id="alibabacloud_ai_search_completion", inference_config={ "service": "alibabacloud-ai-search", "service_settings": { "host": "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", "api_key": "AlibabaCloud-API-Key", "service_id": "ops-qwen-turbo", "workspace": "default" } }, )
const response = await client.inference.put({ task_type: "completion", inference_id: "alibabacloud_ai_search_completion", inference_config: { service: "alibabacloud-ai-search", service_settings: { host: "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", api_key: "AlibabaCloud-API-Key", service_id: "ops-qwen-turbo", workspace: "default", }, }, });
response = client.inference.put( task_type: "completion", inference_id: "alibabacloud_ai_search_completion", body: { "service": "alibabacloud-ai-search", "service_settings": { "host": "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", "api_key": "AlibabaCloud-API-Key", "service_id": "ops-qwen-turbo", "workspace": "default" } } )
$resp = $client->inference()->put([ "task_type" => "completion", "inference_id" => "alibabacloud_ai_search_completion", "body" => [ "service" => "alibabacloud-ai-search", "service_settings" => [ "host" => "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", "api_key" => "AlibabaCloud-API-Key", "service_id" => "ops-qwen-turbo", "workspace" => "default", ], ], ]);
curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d '{"service":"alibabacloud-ai-search","service_settings":{"host":"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com","api_key":"AlibabaCloud-API-Key","service_id":"ops-qwen-turbo","workspace":"default"}}' "$ELASTICSEARCH_URL/_inference/completion/alibabacloud_ai_search_completion"
Request examples
A completion task
Run `PUT _inference/completion/alibabacloud_ai_search_completion` to create an inference endpoint that performs a completion task.
{ "service": "alibabacloud-ai-search", "service_settings": { "host" : "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", "api_key": "AlibabaCloud-API-Key", "service_id": "ops-qwen-turbo", "workspace" : "default" } }
Run `PUT _inference/rerank/alibabacloud_ai_search_rerank` to create an inference endpoint that performs a rerank task.
{ "service": "alibabacloud-ai-search", "service_settings": { "api_key": "AlibabaCloud-API-Key", "service_id": "ops-bge-reranker-larger", "host": "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", "workspace": "default" } }
Run `PUT _inference/sparse_embedding/alibabacloud_ai_search_sparse` to create an inference endpoint that performs perform a sparse embedding task.
{ "service": "alibabacloud-ai-search", "service_settings": { "api_key": "AlibabaCloud-API-Key", "service_id": "ops-text-sparse-embedding-001", "host": "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", "workspace": "default" } }
Run `PUT _inference/text_embedding/alibabacloud_ai_search_embeddings` to create an inference endpoint that performs a text embedding task.
{ "service": "alibabacloud-ai-search", "service_settings": { "api_key": "AlibabaCloud-API-Key", "service_id": "ops-text-embedding-001", "host": "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", "workspace": "default" } }