Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

package org.elasticsearch.xpack.inference;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.lucene.util.SetOnce;
import org.elasticsearch.action.support.MappedActionFilter;
import org.elasticsearch.client.internal.Client;
Expand Down Expand Up @@ -209,8 +207,6 @@ public class InferencePlugin extends Plugin
ClusterPlugin,
PersistentTaskPlugin {

private static final Logger logger = LogManager.getLogger(InferencePlugin.class);

/**
* When this setting is true the verification check that
* connects to the external service will not be made at
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.elasticsearch.TransportVersion;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.ValidationException;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.core.TimeValue;
Expand All @@ -34,10 +33,6 @@
import org.elasticsearch.xpack.core.inference.action.InferenceAction;
import org.elasticsearch.xpack.core.inference.chunking.ChunkingSettingsBuilder;
import org.elasticsearch.xpack.core.inference.chunking.EmbeddingRequestChunker;
import org.elasticsearch.xpack.core.inference.results.ChunkedInferenceEmbedding;
import org.elasticsearch.xpack.core.inference.results.ChunkedInferenceError;
import org.elasticsearch.xpack.core.inference.results.SparseEmbeddingResults;
import org.elasticsearch.xpack.core.ml.inference.results.ErrorInferenceResults;
import org.elasticsearch.xpack.inference.external.http.sender.ChatCompletionInput;
import org.elasticsearch.xpack.inference.external.http.sender.EmbeddingsInput;
import org.elasticsearch.xpack.inference.external.http.sender.HttpRequestSender;
Expand All @@ -62,8 +57,6 @@
import java.util.Map;
import java.util.Set;

import static org.elasticsearch.inference.InferenceStringGroup.toInferenceStringList;
import static org.elasticsearch.xpack.core.inference.results.ResultUtils.createInvalidChunkedResultException;
import static org.elasticsearch.xpack.inference.services.ServiceFields.MAX_INPUT_TOKENS;
import static org.elasticsearch.xpack.inference.services.ServiceFields.MODEL_ID;
import static org.elasticsearch.xpack.inference.services.ServiceUtils.createInvalidModelException;
Expand Down Expand Up @@ -515,18 +508,6 @@ public static SimilarityMeasure defaultDenseTextEmbeddingsSimilarity() {
return SimilarityMeasure.COSINE;
}

private static List<ChunkedInference> translateToChunkedResults(InferenceInputs inputs, InferenceServiceResults inferenceResults) {
if (inferenceResults instanceof SparseEmbeddingResults sparseEmbeddingResults) {
var inputsAsList = toInferenceStringList(inputs.castTo(EmbeddingsInput.class).getInputs());
return ChunkedInferenceEmbedding.listOf(inputsAsList, sparseEmbeddingResults);
} else if (inferenceResults instanceof ErrorInferenceResults error) {
return List.of(new ChunkedInferenceError(error.getException()));
} else {
String expectedClass = Strings.format("%s", SparseEmbeddingResults.class.getSimpleName());
throw createInvalidChunkedResultException(expectedClass, inferenceResults.getWriteableName());
}
}

private TraceContext getCurrentTraceInfo() {
var threadPool = getServiceComponents().threadPool();

Expand Down