Create inference API
editCreate inference API
editCreates an inference endpoint to perform an inference task.
- The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face.
- For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the Machine learning trained model APIs.
Request
editPUT /_inference/<task_type>/<inference_id>
Prerequisites
edit-
Requires the
manage_inference
cluster privilege (the built-ininference_admin
role grants this privilege)
Path parameters
edit-
<inference_id>
- (Required, string) The unique identifier of the inference endpoint.
-
<task_type>
-
(Required, string) The type of the inference task that the model will perform.
Refer to the service list in the API description section for the available task types.
Description
editThe create inference API enables you to create an inference endpoint and configure a machine learning model to perform a specific inference task.
The following services are available through the inference API. You can find the available task types next to the service name. Click the links to review the configuration details of the services:
-
AlibabaCloud AI Search (
completion
,rerank
,sparse_embedding
,text_embedding
) -
Amazon Bedrock (
completion
,text_embedding
) -
Anthropic (
completion
) -
Azure AI Studio (
completion
,text_embedding
) -
Azure OpenAI (
completion
,text_embedding
) -
Cohere (
completion
,rerank
,text_embedding
) -
Elasticsearch (
rerank
,sparse_embedding
,text_embedding
- this service is for built-in models and models uploaded through Eland) -
ELSER (
sparse_embedding
) -
Google AI Studio (
completion
,text_embedding
) -
Google Vertex AI (
rerank
,text_embedding
) -
Hugging Face (
text_embedding
) -
Mistral (
text_embedding
) -
OpenAI (
completion
,text_embedding
) -
Watsonx inference service (
text_embedding
)
The Elasticsearch and ELSER services run on a machine learning node in your Elasticsearch cluster. The rest of the services connect to external providers.