Skip to content

Commit a935afd

Browse files
committed
Update ChunkedInferenceError to return an empty chunk iterator
1 parent e843849 commit a935afd

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/results/ChunkedInferenceError.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,16 @@
77

88
package org.elasticsearch.xpack.core.inference.results;
99

10-
import org.elasticsearch.common.bytes.BytesArray;
1110
import org.elasticsearch.inference.ChunkedInference;
1211
import org.elasticsearch.xcontent.XContent;
1312

13+
import java.util.Collections;
1414
import java.util.Iterator;
15-
import java.util.stream.Stream;
1615

1716
public record ChunkedInferenceError(Exception exception) implements ChunkedInference {
1817

1918
@Override
2019
public Iterator<Chunk> chunksAsMatchedTextAndByteReference(XContent xcontent) {
21-
return Stream.of(exception).map(e -> new Chunk(e.getMessage(), new TextOffset(0, 0), BytesArray.EMPTY)).iterator();
20+
return Collections.emptyIterator();
2221
}
2322
}

0 commit comments

Comments
 (0)