update-inference.asciidoc 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. [role="xpack"]
  2. [[update-inference-api]]
  3. === Update inference API
  4. Updates an {infer} endpoint.
  5. 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.
  6. For built-in models and models uploaded through Eland, the {infer} APIs offer an alternative way to use and manage trained models.
  7. 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>>.
  8. [discrete]
  9. [[update-inference-api-request]]
  10. ==== {api-request-title}
  11. `POST _inference/<inference_id>/_update`
  12. `POST _inference/<task_type>/<inference_id>/_update`
  13. [discrete]
  14. [[update-inference-api-prereqs]]
  15. ==== {api-prereq-title}
  16. * Requires the `manage_inference` <<privileges-list-cluster,cluster privilege>> (the built-in inference_admin role grants this privilege)
  17. * Requires an existing {infer} endpoint, created by using the <<put-inference-api>>
  18. [discrete]
  19. [[update-inference-api-desc]]
  20. ==== {api-description-title}
  21. The update inference API enables you to update the task_settings, secrets, and/or num_allocations of an existing {infer} endpoint.
  22. To use the update API, you can modify `task_settings`, secrets (within `service_settings`), or `num_allocations`, depending on the specific endpoint service and task_type you've created.
  23. To view the updatable `task_settings`, the field names of secrets (specific to each service), and the services where `num_allocations` is applicable (only for the `elasticsearch` service), refer to the following list of services available through the {infer} API.
  24. You will find the available task types next to each service name.
  25. Click the links to review the service configuration details:
  26. * <<infer-service-alibabacloud-ai-search,AlibabaCloud AI Search>> (`completion`, `rerank`, `sparse_embedding`, `text_embedding`)
  27. * <<infer-service-amazon-bedrock,Amazon Bedrock>> (`completion`, `text_embedding`)
  28. * <<infer-service-anthropic,Anthropic>> (`completion`)
  29. * <<infer-service-azure-ai-studio,Azure AI Studio>> (`completion`, `text_embedding`)
  30. * <<infer-service-azure-openai,Azure OpenAI>> (`completion`, `text_embedding`)
  31. * <<infer-service-cohere,Cohere>> (`completion`, `rerank`, `text_embedding`)
  32. * <<infer-service-elasticsearch,Elasticsearch>> (`rerank`, `sparse_embedding`, `text_embedding` - this service is for built-in models and models uploaded through Eland)
  33. * <<infer-service-elser,ELSER>> (`sparse_embedding`)
  34. * <<infer-service-google-ai-studio,Google AI Studio>> (`completion`, `text_embedding`)
  35. * <<infer-service-google-vertex-ai,Google Vertex AI>> (`rerank`, `text_embedding`)
  36. * <<infer-service-hugging-face,Hugging Face>> (`text_embedding`)
  37. * <<infer-service-mistral,Mistral>> (`text_embedding`)
  38. * <<infer-service-openai,OpenAI>> (`completion`, `text_embedding`)
  39. [discrete]
  40. [[update-inference-api-path-params]]
  41. ==== {api-path-parms-title}
  42. `<inference_id>`::
  43. (Required, string)
  44. The unique identifier of the {infer} endpoint.
  45. `<task_type>`::
  46. (Optional, string)
  47. The type of {infer} task that the model performs.
  48. Refer to the service list in the <<put-inference-api-desc,API description section>> for the available task types.
  49. [discrete]
  50. [[update-inference-api-example]]
  51. ==== {api-examples-title}
  52. The following example shows how to update an API key of an {infer} endpoint called `my-inference-endpoint`:
  53. [source,console]
  54. ------------------------------------------------------------
  55. POST _inference/my-inference-endpoint/_update
  56. {
  57. "service_settings": {
  58. "api_key": "<API_KEY>"
  59. }
  60. }
  61. ------------------------------------------------------------
  62. // TEST[skip:TBD]