From 190a432c03d22651c6eac100d2f3665b955e8f77 Mon Sep 17 00:00:00 2001 From: Max Hniebergall Date: Mon, 28 Oct 2024 15:54:39 -0400 Subject: [PATCH 1/4] Improve chunked results error message --- .../elasticsearch/xpack/core/inference/results/ResultUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/results/ResultUtils.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/results/ResultUtils.java index 4fe2c9ae486f1..bde051d42d06e 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/results/ResultUtils.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/results/ResultUtils.java @@ -14,7 +14,7 @@ public class ResultUtils { public static ElasticsearchStatusException createInvalidChunkedResultException(String expectedResultName, String receivedResultName) { return new ElasticsearchStatusException( - "Expected a chunked inference [{}] received [{}]", + "Received incompatible results. Check that your model_id matches the task_type of this endpoint. Expected chunked output of type [{}] but received [{}].", RestStatus.INTERNAL_SERVER_ERROR, expectedResultName, receivedResultName From dd9ac2b382a575d3fb6e871e9aa82baf3c0d4de0 Mon Sep 17 00:00:00 2001 From: Max Hniebergall Date: Mon, 28 Oct 2024 15:58:29 -0400 Subject: [PATCH 2/4] Update RestStatus to conflict --- .../elasticsearch/xpack/core/inference/results/ResultUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/results/ResultUtils.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/results/ResultUtils.java index bde051d42d06e..cbc3c57e69ed0 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/results/ResultUtils.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/results/ResultUtils.java @@ -15,7 +15,7 @@ public class ResultUtils { public static ElasticsearchStatusException createInvalidChunkedResultException(String expectedResultName, String receivedResultName) { return new ElasticsearchStatusException( "Received incompatible results. Check that your model_id matches the task_type of this endpoint. Expected chunked output of type [{}] but received [{}].", - RestStatus.INTERNAL_SERVER_ERROR, + RestStatus.CONFLICT, expectedResultName, receivedResultName ); From c09bcfa7126b5c0be30cc1040c86be6efec244cd Mon Sep 17 00:00:00 2001 From: Max Hniebergall Date: Mon, 28 Oct 2024 16:09:49 -0400 Subject: [PATCH 3/4] precommit --- .../xpack/core/inference/results/ResultUtils.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/results/ResultUtils.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/results/ResultUtils.java index cbc3c57e69ed0..eb68af7589717 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/results/ResultUtils.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/results/ResultUtils.java @@ -14,7 +14,8 @@ public class ResultUtils { public static ElasticsearchStatusException createInvalidChunkedResultException(String expectedResultName, String receivedResultName) { return new ElasticsearchStatusException( - "Received incompatible results. Check that your model_id matches the task_type of this endpoint. Expected chunked output of type [{}] but received [{}].", + "Received incompatible results. Check that your model_id matches the task_type of this endpoint. " + + "Expected chunked output of type [{}] but received [{}].", RestStatus.CONFLICT, expectedResultName, receivedResultName From 4cd3cd3f9a496510d03d94c750728c7f6021463f Mon Sep 17 00:00:00 2001 From: Max Hniebergall <137079448+maxhniebergall@users.noreply.github.com> Date: Mon, 28 Oct 2024 16:39:44 -0400 Subject: [PATCH 4/4] Update docs/changelog/115807.yaml --- docs/changelog/115807.yaml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 docs/changelog/115807.yaml diff --git a/docs/changelog/115807.yaml b/docs/changelog/115807.yaml new file mode 100644 index 0000000000000..d17cabca4bd03 --- /dev/null +++ b/docs/changelog/115807.yaml @@ -0,0 +1,5 @@ +pr: 115807 +summary: "[Inference API] Improve chunked results error message" +area: Machine Learning +type: enhancement +issues: []