Path parameters
- inference_id
string Required The unique identifier for the inference endpoint.
Body
input
string | array[string] Required The text on which you want to perform the inference task. It can be a single string or an array.
NOTE: Inference endpoints for the completion task type currently only support a single string as input.
- task_settings
object
POST /_inference/completion/{inference_id}/_stream
Console
POST _inference/completion/openai-completion/_stream
{
"input": "What is Elastic?"
}
resp = client.inference.stream_completion(
inference_id="openai-completion",
input="What is Elastic?",
)
const response = await client.inference.streamCompletion({
inference_id: "openai-completion",
input: "What is Elastic?",
});
response = client.inference.stream_completion(
inference_id: "openai-completion",
body: {
"input": "What is Elastic?"
}
)
$resp = $client->inference()->streamCompletion([
"inference_id" => "openai-completion",
"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-completion/_stream"
Request example
Run `POST _inference/completion/openai-completion/_stream` to perform a completion on the example question with .
{
"input": "What is Elastic?"
}