Perform completion inference on the service
Generally available; Added in 8.11.0
Path parameters
-
inference_id
string Required The inference Id
Query parameters
-
timeout
string Specifies the amount of time to wait for the inference request to complete.
Values are
-1
or0
.
Body
input
string | array[string] Required Inference input. Either a string or an array of strings.
-
task_settings
object
POST
/_inference/completion/{inference_id}
Console
POST _inference/completion/openai_chat_completions
{
"input": "What is Elastic?"
}
resp = client.inference.completion(
inference_id="openai_chat_completions",
input="What is Elastic?",
)
const response = await client.inference.completion({
inference_id: "openai_chat_completions",
input: "What is Elastic?",
});
response = client.inference.completion(
inference_id: "openai_chat_completions",
body: {
"input": "What is Elastic?"
}
)
$resp = $client->inference()->completion([
"inference_id" => "openai_chat_completions",
"body" => [
"input" => "What is Elastic?",
],
]);
curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d '{"input":"What is Elastic?"}' "$ELASTICSEARCH_URL/_inference/completion/openai_chat_completions"
Request example
Run `POST _inference/completion/openai_chat_completions` to perform a completion on the example question.
{
"input": "What is Elastic?"
}
Response examples (200)
A successful response from `POST _inference/completion/openai_chat_completions`.
{
"completion": [
{
"result": "Elastic is a company that provides a range of software solutions for search, logging, security, and analytics. Their flagship product is Elasticsearch, an open-source, distributed search engine that allows users to search, analyze, and visualize large volumes of data in real-time. Elastic also offers products such as Kibana, a data visualization tool, and Logstash, a log management and pipeline tool, as well as various other tools and solutions for data analysis and management."
}
]
}