You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
** *`task_type` (Optional, Enum("sparse_embedding" | "text_embedding" | "rerank" | "completion" | "chat_completion"))*: The task type
8039
8039
** *`inference_id` (Optional, string)*: The inference Id
8040
8040
8041
+
[discrete]
8042
+
==== inference
8043
+
Perform inference on the service.
8044
+
8045
+
This API enables you to use machine learning models to perform specific tasks on data that you provide as an input.
8046
+
It returns a response with the results of the tasks.
8047
+
The inference endpoint you use can perform one specific task that has been defined when the endpoint was created with the create inference API.
8048
+
8049
+
For details about using this API with a service, such as Amazon Bedrock, Anthropic, or HuggingFace, refer to the service-specific documentation.
8050
+
8051
+
> info
8052
+
> The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, 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.
** *`inference_id` (string)*: The unique identifier for the inference endpoint.
8065
+
** *`input` (string | string[])*: The text on which you want to perform the inference task.
8066
+
It can be a single string or an array.
8067
+
8068
+
> info
8069
+
> Inference endpoints for the `completion` task type currently only support a single string as input.
8070
+
** *`task_type` (Optional, Enum("sparse_embedding" | "text_embedding" | "rerank" | "completion" | "chat_completion"))*: The type of inference task that the model performs.
8071
+
** *`query` (Optional, string)*: The query input, which is required only for the `rerank` task.
8072
+
It is not required for other tasks.
8073
+
** *`task_settings` (Optional, User-defined value)*: Task settings for the individual inference request.
8074
+
These settings are specific to the task type you specified and override the task settings specified when initializing the service.
8075
+
** *`timeout` (Optional, string | -1 | 0)*: The amount of time to wait for the inference request to complete.
Copy file name to clipboardExpand all lines: src/api/api/inference.ts
+52Lines changed: 52 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -209,6 +209,58 @@ export default class Inference {
209
209
returnawaitthis.transport.request({ path, method, querystring, body, meta },options)
210
210
}
211
211
212
+
/**
213
+
* Perform inference on the service. This API enables you to use machine learning models to perform specific tasks on data that you provide as an input. It returns a response with the results of the tasks. The inference endpoint you use can perform one specific task that has been defined when the endpoint was created with the create inference API. For details about using this API with a service, such as Amazon Bedrock, Anthropic, or HuggingFace, refer to the service-specific documentation. > info > The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, 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.
214
+
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/post-inference-api.html | Elasticsearch API documentation}
returnawaitthis.transport.request({ path, method, querystring, body, meta },options)
262
+
}
263
+
212
264
/**
213
265
* Create an inference endpoint. When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. After creating the endpoint, wait for the model deployment to complete before using it. To verify the deployment status, use the get trained model statistics API. Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. IMPORTANT: 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.
214
266
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.18/put-inference-api.html | Elasticsearch API documentation}
0 commit comments