Skip to content

Commit 5167497

Browse files
authored
[Inference API] fix spell words: covertToString to convertToString (#119922)
1 parent f5ac68d commit 5167497

File tree

6 files changed

+15
-7
lines changed

6 files changed

+15
-7
lines changed

docs/changelog/119922.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 119922
2+
summary: "[Inference API] fix spell words: covertToString to convertToString"
3+
area: Machine Learning
4+
type: enhancement
5+
issues: []

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/external/request/alibabacloudsearch/AlibabaCloudSearchEmbeddingsRequestEntity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
3939
builder.startObject();
4040
builder.field(TEXTS_FIELD, input);
4141

42-
String inputType = covertToString(taskSettings.getInputType());
42+
String inputType = convertToString(taskSettings.getInputType());
4343
if (inputType != null) {
4444
builder.field(INPUT_TYPE_FIELD, inputType);
4545
}
@@ -49,7 +49,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
4949
}
5050

5151
// default for testing
52-
static String covertToString(InputType inputType) {
52+
static String convertToString(InputType inputType) {
5353
if (inputType == null) {
5454
return null;
5555
}

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/external/request/alibabacloudsearch/AlibabaCloudSearchSparseRequestEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public record AlibabaCloudSearchSparseRequestEntity(List<String> input, AlibabaC
3434
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
3535
builder.startObject();
3636
builder.field(TEXTS_FIELD, input);
37-
String inputType = AlibabaCloudSearchEmbeddingsRequestEntity.covertToString(taskSettings.getInputType());
37+
String inputType = AlibabaCloudSearchEmbeddingsRequestEntity.convertToString(taskSettings.getInputType());
3838
if (inputType != null) {
3939
builder.field(INPUT_TYPE_FIELD, inputType);
4040
}

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/external/request/cohere/CohereEmbeddingsRequestEntity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
5151
}
5252

5353
if (taskSettings.getInputType() != null) {
54-
builder.field(INPUT_TYPE_FIELD, covertToString(taskSettings.getInputType()));
54+
builder.field(INPUT_TYPE_FIELD, convertToString(taskSettings.getInputType()));
5555
}
5656

5757
if (embeddingType != null) {
@@ -67,7 +67,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
6767
}
6868

6969
// default for testing
70-
static String covertToString(InputType inputType) {
70+
static String convertToString(InputType inputType) {
7171
return switch (inputType) {
7272
case INGEST -> SEARCH_DOCUMENT;
7373
case SEARCH -> SEARCH_QUERY;

x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/external/request/alibabacloudsearch/AlibabaCloudSearchEmbeddingsRequestEntityTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void testXContent_WritesNoOptionalFields_WhenTheyAreNotDefined() throws I
5050
public void testConvertToString_ThrowsAssertionFailure_WhenInputTypeIsUnspecified() {
5151
var thrownException = expectThrows(
5252
AssertionError.class,
53-
() -> AlibabaCloudSearchEmbeddingsRequestEntity.covertToString(InputType.UNSPECIFIED)
53+
() -> AlibabaCloudSearchEmbeddingsRequestEntity.convertToString(InputType.UNSPECIFIED)
5454
);
5555
MatcherAssert.assertThat(thrownException.getMessage(), is("received invalid input type value [unspecified]"));
5656
}

x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/external/request/cohere/CohereEmbeddingsRequestEntityTests.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ public void testXContent_WritesNoOptionalFields_WhenTheyAreNotDefined() throws I
8484
}
8585

8686
public void testConvertToString_ThrowsAssertionFailure_WhenInputTypeIsUnspecified() {
87-
var thrownException = expectThrows(AssertionError.class, () -> CohereEmbeddingsRequestEntity.covertToString(InputType.UNSPECIFIED));
87+
var thrownException = expectThrows(
88+
AssertionError.class,
89+
() -> CohereEmbeddingsRequestEntity.convertToString(InputType.UNSPECIFIED)
90+
);
8891
MatcherAssert.assertThat(thrownException.getMessage(), is("received invalid input type value [unspecified]"));
8992
}
9093
}

0 commit comments

Comments
 (0)