From 2f232638e8f7ba49c99806a1496d9c4f45ca4460 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Mon, 6 Jan 2025 12:24:37 +1300 Subject: [PATCH] Fix build Signed-off-by: Thomas Farr --- .../ingest/TextEmbeddingProcessor.java | 39 ------------------- .../ingest/TextEmbeddingProcessorTest.java | 19 ++------- 2 files changed, 3 insertions(+), 55 deletions(-) diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/TextEmbeddingProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/TextEmbeddingProcessor.java index d9aaa74b07..82f0ff1f4d 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/TextEmbeddingProcessor.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/TextEmbeddingProcessor.java @@ -65,9 +65,6 @@ public class TextEmbeddingProcessor extends ProcessorBase @Nullable private final Integer batchSize; - @Nullable - private final String description; - @Nonnull private final Map fieldMap; @@ -79,7 +76,6 @@ public class TextEmbeddingProcessor extends ProcessorBase private TextEmbeddingProcessor(Builder builder) { super(builder); this.batchSize = builder.batchSize; - this.description = builder.description; this.fieldMap = ApiTypeHelper.unmodifiableRequired(builder.fieldMap, this, "fieldMap"); this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); } @@ -104,17 +100,6 @@ public final Integer batchSize() { return this.batchSize; } - /** - * A brief description of the processor. - *

- * API name: {@code description} - *

- */ - @Nullable - public final String description() { - return this.description; - } - /** * Required - Contains key-value pairs that specify the mapping of a text field to a vector field. *

@@ -141,11 +126,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.batchSize); } - if (this.description != null) { - generator.writeKey("description"); - generator.write(this.description); - } - generator.writeKey("field_map"); generator.writeStartObject(); for (Map.Entry item0 : this.fieldMap.entrySet()) { @@ -177,8 +157,6 @@ public static Builder builder() { public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { @Nullable private Integer batchSize; - @Nullable - private String description; private Map fieldMap; private String modelId; @@ -187,7 +165,6 @@ public Builder() {} private Builder(TextEmbeddingProcessor o) { super(o); this.batchSize = o.batchSize; - this.description = o.description; this.fieldMap = _mapCopy(o.fieldMap); this.modelId = o.modelId; } @@ -195,7 +172,6 @@ private Builder(TextEmbeddingProcessor o) { private Builder(Builder o) { super(o); this.batchSize = o.batchSize; - this.description = o.description; this.fieldMap = _mapCopy(o.fieldMap); this.modelId = o.modelId; } @@ -221,18 +197,6 @@ public final Builder batchSize(@Nullable Integer value) { return this; } - /** - * A brief description of the processor. - *

- * API name: {@code description} - *

- */ - @Nonnull - public final Builder description(@Nullable String value) { - this.description = value; - return this; - } - /** * Required - Contains key-value pairs that specify the mapping of a text field to a vector field. *

@@ -301,7 +265,6 @@ public TextEmbeddingProcessor build() { protected static void setupTextEmbeddingProcessorDeserializer(ObjectDeserializer op) { setupProcessorBaseDeserializer(op); op.add(Builder::batchSize, JsonpDeserializer.integerDeserializer(), "batch_size"); - op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); op.add(Builder::fieldMap, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "field_map"); op.add(Builder::modelId, JsonpDeserializer.stringDeserializer(), "model_id"); } @@ -310,7 +273,6 @@ protected static void setupTextEmbeddingProcessorDeserializer(ObjectDeserializer public int hashCode() { int result = super.hashCode(); result = 31 * result + Objects.hashCode(this.batchSize); - result = 31 * result + Objects.hashCode(this.description); result = 31 * result + this.fieldMap.hashCode(); result = 31 * result + this.modelId.hashCode(); return result; @@ -325,7 +287,6 @@ public boolean equals(Object o) { if (o == null || this.getClass() != o.getClass()) return false; TextEmbeddingProcessor other = (TextEmbeddingProcessor) o; return Objects.equals(this.batchSize, other.batchSize) - && Objects.equals(this.description, other.description) && this.fieldMap.equals(other.fieldMap) && this.modelId.equals(other.modelId); } diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/ingest/TextEmbeddingProcessorTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/ingest/TextEmbeddingProcessorTest.java index fb6bd73e0e..e60b151d4d 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/ingest/TextEmbeddingProcessorTest.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/ingest/TextEmbeddingProcessorTest.java @@ -30,7 +30,7 @@ public void testJsonRoundtripWithDescriptionAndBatchSize() { baseTextEmbeddingProcessor().description("processor-description").batchSize(1).build() ).build(); String json = - "{\"text_embedding\":{\"tag\":\"some-tag\",\"model_id\":\"modelId\",\"field_map\":{\"input_field\":\"vector_field\"},\"description\":\"processor-description\",\"batch_size\":1}}"; + "{\"text_embedding\":{\"description\":\"processor-description\",\"tag\":\"some-tag\",\"batch_size\":1,\"field_map\":{\"input_field\":\"vector_field\"},\"model_id\":\"modelId\"}}"; TextEmbeddingProcessor deserialized = checkJsonRoundtrip(processor, json).textEmbedding(); assertEquals("modelId", deserialized.modelId()); @@ -45,7 +45,7 @@ public void testJsonRoundtripWithDescriptionAndBatchSize() { public void testJsonRoundtripWithoutDescription() { Processor processor = new Processor.Builder().textEmbedding(baseTextEmbeddingProcessor().batchSize(1).build()).build(); String json = - "{\"text_embedding\":{\"tag\":\"some-tag\",\"model_id\":\"modelId\",\"field_map\":{\"input_field\":\"vector_field\"},\"batch_size\":1}}"; + "{\"text_embedding\":{\"tag\":\"some-tag\",\"batch_size\":1,\"field_map\":{\"input_field\":\"vector_field\"},\"model_id\":\"modelId\"}}"; TextEmbeddingProcessor deserialized = checkJsonRoundtrip(processor, json).textEmbedding(); assertEquals("modelId", deserialized.modelId()); @@ -62,7 +62,7 @@ public void testJsonRoundtripWithoutBatchSize() { baseTextEmbeddingProcessor().description("processor-description").build() ).build(); String json = - "{\"text_embedding\":{\"tag\":\"some-tag\",\"model_id\":\"modelId\",\"field_map\":{\"input_field\":\"vector_field\"},\"description\":\"processor-description\"}}"; + "{\"text_embedding\":{\"description\":\"processor-description\",\"tag\":\"some-tag\",\"field_map\":{\"input_field\":\"vector_field\"},\"model_id\":\"modelId\"}}"; TextEmbeddingProcessor deserialized = checkJsonRoundtrip(processor, json).textEmbedding(); assertEquals("modelId", deserialized.modelId()); @@ -71,17 +71,4 @@ public void testJsonRoundtripWithoutBatchSize() { assertEquals("some-tag", deserialized.tag()); assertNull(deserialized.batchSize()); } - - @Test - public void testInvalidBatchSizeThrowsException() { - IllegalArgumentException exceptionWhenBatchSizeIsZero = assertThrows(IllegalArgumentException.class, () -> { - new Processor.Builder().textEmbedding(baseTextEmbeddingProcessor().batchSize(0).build()).build(); - }); - assertEquals("batchSize must be a positive integer", exceptionWhenBatchSizeIsZero.getMessage()); - - IllegalArgumentException exceptionWhenBatchSizeIsNegative = assertThrows(IllegalArgumentException.class, () -> { - new Processor.Builder().textEmbedding(baseTextEmbeddingProcessor().batchSize(-1).build()).build(); - }); - assertEquals("batchSize must be a positive integer", exceptionWhenBatchSizeIsNegative.getMessage()); - } }