Search + K

Command Palette

Search for a command to run...

Sign In

Perform completion inference on the service

POST /_inference/completion/{inference_id}
Copy endpoint

Get responses for completion tasks. This API works only with the completion task type.

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, 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.

This API requires the monitor_inference cluster privilege (the built-in inference_admin and inference_user roles grant this privilege).

Parameters

path Path Parameters

Name Type
inference_id required

The inference Id

type TypesId = string

query Query Parameters

Name Type
timeout

Specifies the amount of time to wait for the inference request to complete.

type TypesDuration = string | "-1" | "0"

Request Body

application/json required
{ input: string[] | string;task_settings?: InferenceTypesTaskSettings
interface InferenceTypesTaskSettings {}
; }

Responses

200 application/json
interface InferenceTypesCompletionInferenceResult {
completion: InferenceTypesCompletionResult

The completion result object

interface InferenceTypesCompletionResult {
result: string;
}
[]
;
}