mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-25 07:37:19 -04:00
94 lines
2.6 KiB
Text
94 lines
2.6 KiB
Text
[role="xpack"]
|
|
[[get-inference-api]]
|
|
=== Get {infer} API
|
|
|
|
Retrieves {infer} endpoint information.
|
|
|
|
IMPORTANT: The {infer} APIs enable you to use certain services, such as built-in {ml} 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 {infer} APIs offer an alternative way to use and manage trained models.
|
|
However, if you do not plan to use the {infer} APIs to use these models or if you want to use non-NLP models, use the <<ml-df-trained-models-apis>>.
|
|
|
|
|
|
[discrete]
|
|
[[get-inference-api-request]]
|
|
==== {api-request-title}
|
|
|
|
`GET /_inference`
|
|
|
|
`GET /_inference/_all`
|
|
|
|
`GET /_inference/<inference_id>`
|
|
|
|
`GET /_inference/<task_type>/_all`
|
|
|
|
`GET /_inference/<task_type>/<inference_id>`
|
|
|
|
[discrete]
|
|
[[get-inference-api-prereqs]]
|
|
==== {api-prereq-title}
|
|
|
|
* Requires the `monitor_inference` <<privileges-list-cluster,cluster privilege>>
|
|
(the built-in `inference_admin` and `inference_user` roles grant this privilege)
|
|
|
|
[discrete]
|
|
[[get-inference-api-desc]]
|
|
==== {api-description-title}
|
|
|
|
You can get information in a single API request for:
|
|
|
|
* a single {infer} endpoint by providing the task type and the {infer} ID,
|
|
* all of the {infer} endpoints for a certain task type by providing the task
|
|
type and a wildcard expression,
|
|
* all of the {infer} endpoints by using a wildcard expression.
|
|
|
|
|
|
[discrete]
|
|
[[get-inference-api-path-params]]
|
|
==== {api-path-parms-title}
|
|
|
|
`<inference_id>`::
|
|
(Optional, string)
|
|
The unique identifier of the {infer} endpoint.
|
|
|
|
|
|
`<task_type>`::
|
|
(Optional, string)
|
|
The type of {infer} task that the model performs.
|
|
|
|
|
|
[discrete]
|
|
[[get-inference-api-example]]
|
|
==== {api-examples-title}
|
|
|
|
The following API call retrieves information about the `my-elser-model` {infer}
|
|
model that can perform `sparse_embedding` tasks.
|
|
|
|
|
|
[source,console]
|
|
------------------------------------------------------------
|
|
GET _inference/sparse_embedding/my-elser-model
|
|
------------------------------------------------------------
|
|
// TEST[skip:TBD]
|
|
|
|
|
|
The API returns the following response:
|
|
|
|
[source,console-result]
|
|
------------------------------------------------------------
|
|
{
|
|
"inference_id": "my-elser-model",
|
|
"task_type": "sparse_embedding",
|
|
"service": "elasticsearch",
|
|
"service_settings": {
|
|
"num_allocations": 1,
|
|
"num_threads": 1,
|
|
"model_id": ".elser_model_2"
|
|
},
|
|
"chunking_settings": {
|
|
"strategy": "sentence",
|
|
"max_chunk_size": 250,
|
|
"sentence_overlap": 1
|
|
}
|
|
}
|
|
------------------------------------------------------------
|
|
// NOTCONSOLE
|