Skip to content

Commit

Permalink
Fix merge from main
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosdelest committed Feb 14, 2024
1 parent e278205 commit 8070f75
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.elasticsearch.inference.ModelSettings;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
Expand Down Expand Up @@ -256,9 +257,9 @@ private void performInferenceOnBulkItemRequest(
}
// TODO We won't batch until chunkedInfer has batching support
for (String inferenceFieldName : inferenceFieldNames) {
ActionListener<ChunkedInferenceServiceResults> inferenceResultsListener = new ActionListener<>() {
ActionListener<List<ChunkedInferenceServiceResults>> inferenceResultsListener = new ActionListener<>() {
@Override
public void onResponse(ChunkedInferenceServiceResults results) {
public void onResponse(List<ChunkedInferenceServiceResults> results) {
if (results == null) {
onBulkItemFailure.apply(
bulkItemRequest,
Expand All @@ -271,7 +272,13 @@ public void onResponse(ChunkedInferenceServiceResults results) {

Map<String, Object> inferenceFieldResult = new LinkedHashMap<>();
inferenceFieldResult.putAll(new ModelSettings(inferenceProvider.model).asMap());
inferenceFieldResult.put(INFERENCE_RESULTS, results.chunksAsMap());
inferenceFieldResult.put(
INFERENCE_RESULTS,
results.stream()
.map(ChunkedInferenceServiceResults::chunksAsMap)
.flatMap(Collection::stream)
.collect(Collectors.toList())
);
rootInferenceFieldMap.put(inferenceFieldName, inferenceFieldResult);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
import org.elasticsearch.core.Nullable;
import org.elasticsearch.inference.ModelConfigurations;
import org.elasticsearch.inference.ServiceSettings;
import org.elasticsearch.inference.SimilarityMeasure;
import org.elasticsearch.xcontent.ToXContentObject;
import org.elasticsearch.xcontent.XContentBuilder;
import org.elasticsearch.xpack.inference.common.SimilarityMeasure;

import java.io.IOException;
import java.net.URI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import org.elasticsearch.core.Nullable;
import org.elasticsearch.inference.ModelConfigurations;
import org.elasticsearch.inference.ServiceSettings;
import org.elasticsearch.inference.SimilarityMeasure;
import org.elasticsearch.xcontent.ToXContentObject;
import org.elasticsearch.xcontent.XContentBuilder;
import org.elasticsearch.xpack.inference.common.SimilarityMeasure;

import java.io.IOException;
import java.net.URI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import org.elasticsearch.core.Nullable;
import org.elasticsearch.inference.ModelConfigurations;
import org.elasticsearch.inference.ServiceSettings;
import org.elasticsearch.inference.SimilarityMeasure;
import org.elasticsearch.xcontent.ToXContentObject;
import org.elasticsearch.xcontent.XContentBuilder;
import org.elasticsearch.xpack.inference.common.SimilarityMeasure;
import org.elasticsearch.xpack.inference.services.ServiceUtils;
import org.elasticsearch.xpack.inference.services.openai.OpenAiParseContext;

Expand Down

0 comments on commit 8070f75

Please sign in to comment.