Skip to content

Commit 099c35a

Browse files
committed
Polish error messagex
1 parent cc04a5a commit 099c35a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/chunking/EmbeddingRequestChunker.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import org.elasticsearch.xpack.core.inference.results.ChunkedInferenceEmbedding;
1818
import org.elasticsearch.xpack.core.inference.results.ChunkedInferenceError;
1919
import org.elasticsearch.xpack.core.inference.results.EmbeddingResults;
20-
import org.elasticsearch.xpack.core.inference.results.TextEmbeddingFloatResults;
2120
import org.elasticsearch.xpack.inference.chunking.Chunker.ChunkOffset;
2221

2322
import java.util.ArrayList;
@@ -148,7 +147,7 @@ public void onResponse(InferenceServiceResults inferenceServiceResults) {
148147
sendFinalResponse();
149148
}
150149
} else {
151-
onFailure(unexpectedResultTypeException(inferenceServiceResults.getWriteableName(), TextEmbeddingFloatResults.NAME));
150+
onFailure(unexpectedResultTypeException(inferenceServiceResults.getWriteableName()));
152151
}
153152
}
154153

@@ -161,12 +160,11 @@ private ElasticsearchStatusException numResultsDoesntMatchException(int numResul
161160
);
162161
}
163162

164-
private ElasticsearchStatusException unexpectedResultTypeException(String got, String expected) {
163+
private ElasticsearchStatusException unexpectedResultTypeException(String resultType) {
165164
return new ElasticsearchStatusException(
166-
"Unexpected inference result type [{}], expected a [{}]",
165+
"Unexpected inference result type [{}], expected [EmbeddingResults]",
167166
RestStatus.INTERNAL_SERVER_ERROR,
168-
got,
169-
expected
167+
resultType
170168
);
171169
}
172170

0 commit comments

Comments
 (0)