Open
Description
Tracked in #123043
The completion command will be used to execute a completion through an LLM using ES}QL.
Command grammar
| COMPLETION <prompt> WITH <inferenceId> (AS <targetField>)
where
param | required | description |
---|---|---|
prompt | required | Provides the prompt to be executed for the row.The prompt can be built from a mix a constant and field values. |
inferenceId | required | Endpoint used to do the completion(can be optional when we will have a default LLM in EIS). |
targetField | optionaldefault: completion | Name of the result column. |
Usage example:
Row by row
FROM search-movies
| WHERE match(plot, "Gandalf the grey")
| EVAL prompt= CONCAT(
"Extract movie genre:\n",
"<title>", title, "</title>",
"<actors>", MV_CONCAT(actors, ","), "</actors">,
"<plot>", plot, "</plot"
)
| COMPLETION prompt WITH "openai-completion" AS genre
| DROP prompt
Aggregated rows:
FROM business-news
| WHERE industry:technology AND date:today
| EVAL company_data = CONCAT(
"<title>", title, "</title>",
"<summary>", summary, "</summary">
"<article>", title, "</article"
)
| STATS company_data = VALUES(company_data) BY company
| EVAL prompt=CONCAT(
Summarize important news for the copmany\n",
"<company>", company, "</company>\n",
MV_CONCAT(company_data, "\n")
)
| COMPLETION prompt WITH "openai-completion" AS company_news
Development
- Grammar and logical plan ([ES|QL] COMPLETION command grammar and logical plan #126319)
- Logical plan analysis ([ES|QL] COMPLETION command analysis. #126677)
- Logical plan optimization ([ES|QL] COMPLETION command logical plan optimizer #126763)
- Physical plan and mapping (([ES|QL] COMPLETION command physical plan #126766)
- CompletionOperator (based on an aync operator)
- End to end tests
- Add telemetry
- Doc
- Tech preview (available in non-snapshot builds)