Skip to content

Commit

Permalink
[ML] Replace test-only SenderService API (#112718)
Browse files Browse the repository at this point in the history
This API was only being used by tests

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
prwhelan and elasticmachine authored Sep 16, 2024
1 parent 2371cae commit 2354e8f
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,6 @@ public void infer(
}
}

public void chunkedInfer(
Model model,
List<String> input,
Map<String, Object> taskSettings,
InputType inputType,
ChunkingOptions chunkingOptions,
TimeValue timeout,
ActionListener<List<ChunkedInferenceServiceResults>> listener
) {
init();
chunkedInfer(model, null, input, taskSettings, inputType, chunkingOptions, timeout, listener);
}

@Override
public void chunkedInfer(
Model model,
Expand All @@ -86,7 +73,7 @@ public void chunkedInfer(
ActionListener<List<ChunkedInferenceServiceResults>> listener
) {
init();
doChunkedInfer(model, null, input, taskSettings, inputType, chunkingOptions, timeout, listener);
doChunkedInfer(model, query, input, taskSettings, inputType, chunkingOptions, timeout, listener);
}

protected abstract void doInfer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,7 @@ public void testChunkedInfer_CallsInfer_ConvertsFloatResponse_ForEmbeddings() th
PlainActionFuture<List<ChunkedInferenceServiceResults>> listener = new PlainActionFuture<>();
service.chunkedInfer(
model,
null,
List.of("abc", "xyz"),
new HashMap<>(),
InputType.INGEST,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,7 @@ public void testChunkedInfer() throws IOException {
PlainActionFuture<List<ChunkedInferenceServiceResults>> listener = new PlainActionFuture<>();
service.chunkedInfer(
model,
null,
List.of("foo", "bar"),
new HashMap<>(),
InputType.INGEST,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1104,6 +1104,7 @@ public void testChunkedInfer_CallsInfer_ConvertsFloatResponse() throws IOExcepti
PlainActionFuture<List<ChunkedInferenceServiceResults>> listener = new PlainActionFuture<>();
service.chunkedInfer(
model,
null,
List.of("foo", "bar"),
new HashMap<>(),
InputType.INGEST,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,7 @@ public void testChunkedInfer_BatchesCalls() throws IOException {
// 2 inputs
service.chunkedInfer(
model,
null,
List.of("foo", "bar"),
new HashMap<>(),
InputType.UNSPECIFIED,
Expand Down Expand Up @@ -1301,6 +1302,7 @@ public void testChunkedInfer_BatchesCalls_Bytes() throws IOException {
// 2 inputs
service.chunkedInfer(
model,
null,
List.of("foo", "bar"),
new HashMap<>(),
InputType.UNSPECIFIED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ public void testChunkedInfer_PassesThrough() throws IOException {
PlainActionFuture<List<ChunkedInferenceServiceResults>> listener = new PlainActionFuture<>();
service.chunkedInfer(
model,
null,
List.of("input text"),
new HashMap<>(),
InputType.INGEST,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ public void testChunkedInfer_Batches() throws IOException {
PlainActionFuture<List<ChunkedInferenceServiceResults>> listener = new PlainActionFuture<>();
service.chunkedInfer(
model,
null,
input,
new HashMap<>(),
InputType.INGEST,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public void testChunkedInfer_CallsInfer_Elser_ConvertsFloatResponse() throws IOE
PlainActionFuture<List<ChunkedInferenceServiceResults>> listener = new PlainActionFuture<>();
service.chunkedInfer(
model,
null,
List.of("abc"),
new HashMap<>(),
InputType.INGEST,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ public void testChunkedInfer_CallsInfer_TextEmbedding_ConvertsFloatResponse() th
PlainActionFuture<List<ChunkedInferenceServiceResults>> listener = new PlainActionFuture<>();
service.chunkedInfer(
model,
null,
List.of("abc"),
new HashMap<>(),
InputType.INGEST,
Expand Down Expand Up @@ -671,6 +672,7 @@ public void testChunkedInfer() throws IOException {
PlainActionFuture<List<ChunkedInferenceServiceResults>> listener = new PlainActionFuture<>();
service.chunkedInfer(
model,
null,
List.of("abc"),
new HashMap<>(),
InputType.INGEST,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ public void testChunkedInfer_Embeddings_CallsInfer_ConvertsFloatResponse() throw
PlainActionFuture<List<ChunkedInferenceServiceResults>> listener = new PlainActionFuture<>();
service.chunkedInfer(
model,
null,
List.of("abc", "def"),
new HashMap<>(),
InputType.INGEST,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1254,6 +1254,7 @@ public void testChunkedInfer_Batches() throws IOException {
PlainActionFuture<List<ChunkedInferenceServiceResults>> listener = new PlainActionFuture<>();
service.chunkedInfer(
model,
null,
List.of("foo", "bar"),
new HashMap<>(),
InputType.INGEST,
Expand Down

0 comments on commit 2354e8f

Please sign in to comment.