Class RerankOperatorOutputBuilder
java.lang.Object
org.elasticsearch.xpack.esql.inference.rerank.RerankOperatorOutputBuilder
- All Implemented Interfaces:
Closeable,AutoCloseable,org.elasticsearch.core.Releasable,InferenceOperator.OutputBuilder
Builds the output page for the
RerankOperator by adding
* reranked relevance scores into the specified score channel of the input page.-
Constructor Summary
ConstructorsConstructorDescriptionRerankOperatorOutputBuilder(DoubleBlock.Builder scoreBlockBuilder, Page inputPage, int scoreChannel) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInferenceResponse(InferenceAction.Response inferenceResponse) Extracts the ranked document results from the inference response and appends their relevance scores to the score block builder.Constructs a new outputPagewhich contains all original blocks from the input page, with the reranked scores inserted atscoreChannel.voidclose()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.xpack.esql.inference.InferenceOperator.OutputBuilder
releasePageOnAnyThread
-
Constructor Details
-
RerankOperatorOutputBuilder
public RerankOperatorOutputBuilder(DoubleBlock.Builder scoreBlockBuilder, Page inputPage, int scoreChannel)
-
-
Method Details
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceorg.elasticsearch.core.Releasable
-
buildOutput
Constructs a new outputPagewhich contains all original blocks from the input page, with the reranked scores inserted atscoreChannel.- Specified by:
buildOutputin interfaceInferenceOperator.OutputBuilder- Returns:
- The constructed output page.
-
addInferenceResponse
Extracts the ranked document results from the inference response and appends their relevance scores to the score block builder.If the response is not of type
ChatCompletionResultsanIllegalStateExceptionis thrown.The responses must be added in the same order as the corresponding inference requests were generated. Failing to preserve order may lead to incorrect or misaligned output rows.
- Specified by:
addInferenceResponsein interfaceInferenceOperator.OutputBuilder- Parameters:
inferenceResponse- The inference response to include.
-