Perform completion inference on the service Generally available

POST /_inference/completion/{inference_id}

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 or 0.

application/json

Body

Responses

  • 200 application/json
    Hide response attribute Show response attribute object
    • completion array[object] Required

      The completion result object

      Hide completion attribute Show completion attribute object
      • result string Required
POST /_inference/completion/{inference_id}
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." } ] }