Class CompletionOperator
java.lang.Object
org.elasticsearch.compute.operator.AsyncOperator<InferenceOperator.OngoingInferenceResult>
org.elasticsearch.xpack.esql.inference.InferenceOperator
org.elasticsearch.xpack.esql.inference.completion.CompletionOperator
- All Implemented Interfaces:
Closeable,AutoCloseable,Operator,org.elasticsearch.core.Releasable
CompletionOperator is an InferenceOperator that performs inference using prompt-based model (e.g., text completion).
It evaluates a prompt expression for each input row, constructs inference requests, and emits the model responses as output.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordFactory for creatingCompletionOperatorinstances.Nested classes/interfaces inherited from class org.elasticsearch.xpack.esql.inference.InferenceOperator
InferenceOperator.OngoingInferenceResult, InferenceOperator.OutputBuilderNested classes/interfaces inherited from class org.elasticsearch.compute.operator.AsyncOperator
AsyncOperator.StatusNested classes/interfaces inherited from interface org.elasticsearch.compute.operator.Operator
Operator.OperatorFactory -
Field Summary
Fields inherited from interface org.elasticsearch.compute.operator.Operator
MIN_TARGET_PAGE_SIZE, NOT_BLOCKED, TARGET_PAGE_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionCompletionOperator(DriverContext driverContext, BulkInferenceRunner bulkInferenceRunner, String inferenceId, EvalOperator.ExpressionEvaluator promptEvaluator, int maxOutstandingPages) -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoClose()protected CompletionOperatorOutputBuilderoutputBuilder(Page input) Creates a newCompletionOperatorOutputBuilderto collect and emit the completion results.protected BulkInferenceRequestIteratorConstructs the completion inference requests iterator for the given input page by evaluating the prompt expression.toString()Methods inherited from class org.elasticsearch.xpack.esql.inference.InferenceOperator
blockFactory, getOutput, inferenceId, performAsync, releaseFetchedOnAnyThreadMethods inherited from class org.elasticsearch.compute.operator.AsyncOperator
addInput, close, fetchFromBuffer, finish, isBlocked, isFinished, needsInput, releasePageOnAnyThread, status, status
-
Constructor Details
-
CompletionOperator
public CompletionOperator(DriverContext driverContext, BulkInferenceRunner bulkInferenceRunner, String inferenceId, EvalOperator.ExpressionEvaluator promptEvaluator, int maxOutstandingPages)
-
-
Method Details
-
doClose
protected void doClose()- Specified by:
doClosein classAsyncOperator<InferenceOperator.OngoingInferenceResult>
-
toString
-
requests
Constructs the completion inference requests iterator for the given input page by evaluating the prompt expression.- Specified by:
requestsin classInferenceOperator- Parameters:
inputPage- The input data page.
-
outputBuilder
Creates a newCompletionOperatorOutputBuilderto collect and emit the completion results.- Specified by:
outputBuilderin classInferenceOperator- Parameters:
input- The input page for which results will be constructed.
-