Class CompletionOperatorRequestIterator
java.lang.Object
org.elasticsearch.xpack.esql.inference.completion.CompletionOperatorRequestIterator
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterator<InferenceAction.Request>,org.elasticsearch.core.Releasable,BulkInferenceRequestIterator
public class CompletionOperatorRequestIterator
extends Object
implements BulkInferenceRequestIterator
This iterator reads prompts from a
BytesRefBlock and converts them into individual InferenceAction.Request instances
of type TaskType.COMPLETION.-
Constructor Summary
ConstructorsConstructorDescriptionCompletionOperatorRequestIterator(BytesRefBlock promptBlock, String inferenceId) Constructs a new iterator from the given block of prompts. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Constructor Details
-
CompletionOperatorRequestIterator
Constructs a new iterator from the given block of prompts.- Parameters:
promptBlock- The input block containing prompts.inferenceId- The ID of the inference model to invoke.
-
-
Method Details
-
hasNext
public boolean hasNext()- Specified by:
hasNextin interfaceIterator<InferenceAction.Request>
-
next
- Specified by:
nextin interfaceIterator<InferenceAction.Request>
-
estimatedSize
public int estimatedSize()Description copied from interface:BulkInferenceRequestIteratorReturns an estimate of the number of requests that will be produced.This is typically used to pre-allocate buffers or output to th appropriate size.
- Specified by:
estimatedSizein interfaceBulkInferenceRequestIterator
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceorg.elasticsearch.core.Releasable
-