From 9008370875820bb5f0f5ed9be8bc8e0dc6d48c01 Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Fri, 24 Oct 2025 14:58:14 +0200 Subject: [PATCH 01/35] feat: add text2vec-cohere vectorizer --- .../v1/api/collections/VectorConfig.java | 8 +- .../vectorizers/Text2VecCohereVectorizer.java | 159 ++++++++++++++++++ 2 files changed, 162 insertions(+), 5 deletions(-) create mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecCohereVectorizer.java diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index ae13f70c..0976621e 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -21,13 +21,15 @@ import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecContextionaryVectorizer; import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecWeaviateVectorizer; import io.weaviate.client6.v1.internal.ObjectBuilder; +import io.weaviate.client6.v1.internal.TaggedUnion; import io.weaviate.client6.v1.internal.json.JsonEnum; -public interface VectorConfig { +public interface VectorConfig extends TaggedUnion { public enum Kind implements JsonEnum { NONE("none"), IMG2VEC_NEURAL("img2vec-neural"), TEXT2VEC_CONTEXTIONARY("text2vec-contextionary"), + TEXT2VEC_COHERE("text2vec-cohere"), TEXT2VEC_WEAVIATE("text2vec-weaviate"), MULTI2VEC_CLIP("multi2vec-clip"); @@ -48,10 +50,6 @@ public static Kind valueOfJson(String jsonValue) { } } - Kind _kind(); - - Object _self(); - /** Get vector index configuration for this vector. */ VectorIndex vectorIndex(); diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecCohereVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecCohereVectorizer.java new file mode 100644 index 00000000..dee0cc9d --- /dev/null +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecCohereVectorizer.java @@ -0,0 +1,159 @@ +package io.weaviate.client6.v1.api.collections.vectorizers; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.function.Function; + +import com.google.gson.annotations.SerializedName; + +import io.weaviate.client6.v1.api.collections.Quantization; +import io.weaviate.client6.v1.api.collections.VectorConfig; +import io.weaviate.client6.v1.api.collections.VectorIndex; +import io.weaviate.client6.v1.internal.ObjectBuilder; + +public record Text2VecCohereVectorizer( + @SerializedName("model") String model, + @SerializedName("truncate") Truncate truncate, + @SerializedName("baseUrl") String baseUrl, + + /** + * Weaviate defaults to {@code true} if the value is not provided. + * Because text2vec-cohere cannot handle underscores in collection names, + * this quickly becomes inconvenient. + * + * To avoid that we send "vectorizeClassName": false all the time + * and make it impossible to enable this feature, as it is deprecated. + */ + @Deprecated @SerializedName("vectorizeClassName") boolean vectorizeCollectionName, + /** Properties included in the embedding. */ + @SerializedName("sourceProperties") List sourceProperties, + /** Vector index configuration. */ + VectorIndex vectorIndex, + /** Vector quantization method. */ + Quantization quantization) implements VectorConfig { + + @Override + public VectorConfig.Kind _kind() { + return VectorConfig.Kind.TEXT2VEC_COHERE; + } + + @Override + public Object _self() { + return this; + } + + public enum Truncate { + @SerializedName("NONE") + NONE, + @SerializedName("START") + START, + @SerializedName("END") + END, + @SerializedName("LEFT") + LEFT, + @SerializedName("RIGHT") + RIGHT; + } + + public static Text2VecCohereVectorizer of() { + return of(ObjectBuilder.identity()); + } + + public static Text2VecCohereVectorizer of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Canonical constructor always sets {@link #vectorizeCollectionName} to false. + */ + public Text2VecCohereVectorizer( + String model, + Truncate truncate, + String baseUrl, + + boolean vectorizeCollectionName, + List sourceProperties, + VectorIndex vectorIndex, + Quantization quantization) { + this.model = model; + this.truncate = truncate; + this.baseUrl = baseUrl; + + this.vectorizeCollectionName = false; + this.sourceProperties = Collections.emptyList(); + this.vectorIndex = vectorIndex; + this.quantization = quantization; + } + + public Text2VecCohereVectorizer(Builder builder) { + this( + builder.model, + builder.truncate, + builder.baseUrl, + builder.vectorizeCollectionName, + builder.sourceProperties, + builder.vectorIndex, + builder.quantization); + } + + public static class Builder implements ObjectBuilder { + private final boolean vectorizeCollectionName = false; + private Quantization quantization; + private List sourceProperties = new ArrayList<>(); + private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + + private String model; + private Truncate truncate; + private String baseUrl; + + public Builder baseUrl(String baseUrl) { + this.baseUrl = baseUrl; + return this; + } + + public Builder model(String model) { + this.model = model; + return this; + } + + public Builder truncate(Truncate truncate) { + this.truncate = truncate; + return this; + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(String... properties) { + return sourceProperties(Arrays.asList(properties)); + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(List properties) { + this.sourceProperties.addAll(properties); + return this; + } + + /** + * Override default vector index configuration. + * + * HNSW + * is the default vector index. + */ + public Builder vectorIndex(VectorIndex vectorIndex) { + this.vectorIndex = vectorIndex; + return this; + } + + public Builder quantization(Quantization quantization) { + this.quantization = quantization; + return this; + } + + public Text2VecCohereVectorizer build() { + return new Text2VecCohereVectorizer(this); + } + } +} From 6c204d085987bffaf5474b336292abaeb2521a71 Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 27 Oct 2025 14:42:52 +0100 Subject: [PATCH 02/35] feat: add text2vec-huggingface module --- .../v1/api/collections/VectorConfig.java | 1 + .../vectorizers/Text2VecCohereVectorizer.java | 3 - .../Text2VecHuggingfaceVectorizer.java | 185 ++++++++++++++++++ 3 files changed, 186 insertions(+), 3 deletions(-) create mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecHuggingfaceVectorizer.java diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index 0976621e..c6868a6f 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -30,6 +30,7 @@ public enum Kind implements JsonEnum { IMG2VEC_NEURAL("img2vec-neural"), TEXT2VEC_CONTEXTIONARY("text2vec-contextionary"), TEXT2VEC_COHERE("text2vec-cohere"), + TEXT2VEC_HUGGINGFACE("text2vec-huggingface"), TEXT2VEC_WEAVIATE("text2vec-weaviate"), MULTI2VEC_CLIP("multi2vec-clip"); diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecCohereVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecCohereVectorizer.java index dee0cc9d..bef7f392 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecCohereVectorizer.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecCohereVectorizer.java @@ -20,9 +20,6 @@ public record Text2VecCohereVectorizer( /** * Weaviate defaults to {@code true} if the value is not provided. - * Because text2vec-cohere cannot handle underscores in collection names, - * this quickly becomes inconvenient. - * * To avoid that we send "vectorizeClassName": false all the time * and make it impossible to enable this feature, as it is deprecated. */ diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecHuggingfaceVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecHuggingfaceVectorizer.java new file mode 100644 index 00000000..f9d102b4 --- /dev/null +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecHuggingfaceVectorizer.java @@ -0,0 +1,185 @@ +package io.weaviate.client6.v1.api.collections.vectorizers; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.function.Function; + +import com.google.gson.annotations.SerializedName; + +import io.weaviate.client6.v1.api.collections.Quantization; +import io.weaviate.client6.v1.api.collections.VectorConfig; +import io.weaviate.client6.v1.api.collections.VectorIndex; +import io.weaviate.client6.v1.internal.ObjectBuilder; + +public record Text2VecHuggingfaceVectorizer( + @SerializedName("endpointURL") String baseUrl, + @SerializedName("model") String model, + @SerializedName("passageModel") String passageModel, + @SerializedName("queryModel") String queryModel, + @SerializedName("useCache") Boolean useCache, + @SerializedName("useGPU") Boolean useGpu, + @SerializedName("waitForModel") Boolean waitForModel, + + /** + * Weaviate defaults to {@code true} if the value is not provided. + * To avoid that we send "vectorizeClassName": false all the time + * and make it impossible to enable this feature, as it is deprecated. + */ + @Deprecated @SerializedName("vectorizeClassName") boolean vectorizeCollectionName, + /** Properties included in the embedding. */ + @SerializedName("sourceProperties") List sourceProperties, + /** Vector index configuration. */ + VectorIndex vectorIndex, + /** Vector quantization method. */ + Quantization quantization) implements VectorConfig { + + @Override + public VectorConfig.Kind _kind() { + return VectorConfig.Kind.TEXT2VEC_HUGGINGFACE; + } + + @Override + public Object _self() { + return this; + } + + public static Text2VecHuggingfaceVectorizer of() { + return of(ObjectBuilder.identity()); + } + + public static Text2VecHuggingfaceVectorizer of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Canonical constructor always sets {@link #vectorizeCollectionName} to false. + */ + public Text2VecHuggingfaceVectorizer( + String baseUrl, + String model, + String passageModel, + String queryModel, + Boolean useCache, + Boolean useGpu, + Boolean waitForModel, + + boolean vectorizeCollectionName, + List sourceProperties, + VectorIndex vectorIndex, + Quantization quantization) { + this.baseUrl = baseUrl; + this.model = model; + this.passageModel = passageModel; + this.queryModel = queryModel; + this.useCache = useCache; + this.useGpu = useGpu; + this.waitForModel = waitForModel; + + this.vectorizeCollectionName = false; + this.sourceProperties = Collections.emptyList(); + this.vectorIndex = vectorIndex; + this.quantization = quantization; + } + + public Text2VecHuggingfaceVectorizer(Builder builder) { + this( + builder.baseUrl, + builder.model, + builder.passageModel, + builder.queryModel, + builder.useCache, + builder.useGpu, + builder.waitForModel, + builder.vectorizeCollectionName, + builder.sourceProperties, + builder.vectorIndex, + builder.quantization); + } + + public static class Builder implements ObjectBuilder { + private final boolean vectorizeCollectionName = false; + private Quantization quantization; + private List sourceProperties = new ArrayList<>(); + private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + + private String baseUrl; + private String model; + private String passageModel; + private String queryModel; + private Boolean useCache; + private Boolean useGpu; + private Boolean waitForModel; + + public Builder baseUrl(String baseUrl) { + this.baseUrl = baseUrl; + return this; + } + + public Builder model(String model) { + this.model = model; + return this; + } + + /** The model to use for passage vectorization. */ + public Builder passageModel(String passageModel) { + this.passageModel = passageModel; + return this; + } + + /** The model to use for query vectorization. */ + public Builder queryModel(String queryModel) { + this.queryModel = queryModel; + return this; + } + + public Builder useCache(boolean useCache) { + this.useCache = useCache; + return this; + } + + public Builder useGpu(boolean useGpu) { + this.useGpu = useGpu; + return this; + } + + public Builder waitForModel(boolean waitForModel) { + this.waitForModel = waitForModel; + return this; + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(String... properties) { + return sourceProperties(Arrays.asList(properties)); + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(List properties) { + this.sourceProperties.addAll(properties); + return this; + } + + /** + * Override default vector index configuration. + * + * HNSW + * is the default vector index. + */ + public Builder vectorIndex(VectorIndex vectorIndex) { + this.vectorIndex = vectorIndex; + return this; + } + + public Builder quantization(Quantization quantization) { + this.quantization = quantization; + return this; + } + + public Text2VecHuggingfaceVectorizer build() { + return new Text2VecHuggingfaceVectorizer(this); + } + } +} From f374b61acb48a61bf8752d85ccb33b7967b5dabb Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 27 Oct 2025 14:45:40 +0100 Subject: [PATCH 03/35] feat: add text2vec-morph vectorizer --- .../v1/api/collections/VectorConfig.java | 1 + .../vectorizers/Text2VecMorphVectorizer.java | 104 ++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecMorphVectorizer.java diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index c6868a6f..b49b0832 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -31,6 +31,7 @@ public enum Kind implements JsonEnum { TEXT2VEC_CONTEXTIONARY("text2vec-contextionary"), TEXT2VEC_COHERE("text2vec-cohere"), TEXT2VEC_HUGGINGFACE("text2vec-huggingface"), + TEXT2VEC_MORPH("text2vec-morph"), TEXT2VEC_WEAVIATE("text2vec-weaviate"), MULTI2VEC_CLIP("multi2vec-clip"); diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecMorphVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecMorphVectorizer.java new file mode 100644 index 00000000..8fd7660d --- /dev/null +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecMorphVectorizer.java @@ -0,0 +1,104 @@ +package io.weaviate.client6.v1.api.collections.vectorizers; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.function.Function; + +import com.google.gson.annotations.SerializedName; + +import io.weaviate.client6.v1.api.collections.Quantization; +import io.weaviate.client6.v1.api.collections.VectorConfig; +import io.weaviate.client6.v1.api.collections.VectorIndex; +import io.weaviate.client6.v1.internal.ObjectBuilder; + +public record Text2VecMorphVectorizer( + @SerializedName("baseURL") String baseUrl, + @SerializedName("model") String model, + + /** Properties included in the embedding. */ + @SerializedName("sourceProperties") List sourceProperties, + /** Vector index configuration. */ + VectorIndex vectorIndex, + /** Vector quantization method. */ + Quantization quantization) implements VectorConfig { + + @Override + public VectorConfig.Kind _kind() { + return VectorConfig.Kind.TEXT2VEC_HUGGINGFACE; + } + + @Override + public Object _self() { + return this; + } + + public static Text2VecMorphVectorizer of() { + return of(ObjectBuilder.identity()); + } + + public static Text2VecMorphVectorizer of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + public Text2VecMorphVectorizer(Builder builder) { + this( + builder.baseUrl, + builder.model, + builder.sourceProperties, + builder.vectorIndex, + builder.quantization); + } + + public static class Builder implements ObjectBuilder { + private Quantization quantization; + private List sourceProperties = new ArrayList<>(); + private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + + private String baseUrl; + private String model; + + public Builder baseUrl(String baseUrl) { + this.baseUrl = baseUrl; + return this; + } + + public Builder model(String model) { + this.model = model; + return this; + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(String... properties) { + return sourceProperties(Arrays.asList(properties)); + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(List properties) { + this.sourceProperties.addAll(properties); + return this; + } + + /** + * Override default vector index configuration. + * + * HNSW + * is the default vector index. + */ + public Builder vectorIndex(VectorIndex vectorIndex) { + this.vectorIndex = vectorIndex; + return this; + } + + public Builder quantization(Quantization quantization) { + this.quantization = quantization; + return this; + } + + public Text2VecMorphVectorizer build() { + return new Text2VecMorphVectorizer(this); + } + } +} From c38376a1c02f1b0eac93cf478c3a19e6093bdfad Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 27 Oct 2025 14:49:02 +0100 Subject: [PATCH 04/35] feat: add text2vec-model2vec vectorizer --- .../v1/api/collections/VectorConfig.java | 1 + .../vectorizers/Text2VecCohereVectorizer.java | 6 +- .../Text2VecModel2VecVectorizer.java | 123 ++++++++++++++++++ 3 files changed, 127 insertions(+), 3 deletions(-) create mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecModel2VecVectorizer.java diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index b49b0832..9d657e45 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -32,6 +32,7 @@ public enum Kind implements JsonEnum { TEXT2VEC_COHERE("text2vec-cohere"), TEXT2VEC_HUGGINGFACE("text2vec-huggingface"), TEXT2VEC_MORPH("text2vec-morph"), + TEXT2VEC_MODEL2VEC("text2vec-model2vec"), TEXT2VEC_WEAVIATE("text2vec-weaviate"), MULTI2VEC_CLIP("multi2vec-clip"); diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecCohereVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecCohereVectorizer.java index bef7f392..aa1ff3d3 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecCohereVectorizer.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecCohereVectorizer.java @@ -14,9 +14,9 @@ import io.weaviate.client6.v1.internal.ObjectBuilder; public record Text2VecCohereVectorizer( + @SerializedName("baseUrl") String baseUrl, @SerializedName("model") String model, @SerializedName("truncate") Truncate truncate, - @SerializedName("baseUrl") String baseUrl, /** * Weaviate defaults to {@code true} if the value is not provided. @@ -67,9 +67,9 @@ public static Text2VecCohereVectorizer of( * Canonical constructor always sets {@link #vectorizeCollectionName} to false. */ public Text2VecCohereVectorizer( + String baseUrl, String model, Truncate truncate, - String baseUrl, boolean vectorizeCollectionName, List sourceProperties, @@ -87,9 +87,9 @@ public Text2VecCohereVectorizer( public Text2VecCohereVectorizer(Builder builder) { this( + builder.baseUrl, builder.model, builder.truncate, - builder.baseUrl, builder.vectorizeCollectionName, builder.sourceProperties, builder.vectorIndex, diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecModel2VecVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecModel2VecVectorizer.java new file mode 100644 index 00000000..63ba7caa --- /dev/null +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecModel2VecVectorizer.java @@ -0,0 +1,123 @@ +package io.weaviate.client6.v1.api.collections.vectorizers; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.function.Function; + +import com.google.gson.annotations.SerializedName; + +import io.weaviate.client6.v1.api.collections.Quantization; +import io.weaviate.client6.v1.api.collections.VectorConfig; +import io.weaviate.client6.v1.api.collections.VectorIndex; +import io.weaviate.client6.v1.internal.ObjectBuilder; + +public record Text2VecModel2VecVectorizer( + @SerializedName("inferenceURL") String baseUrl, + + /** + * Weaviate defaults to {@code true} if the value is not provided. + * To avoid that we send "vectorizeClassName": false all the time + * and make it impossible to enable this feature, as it is deprecated. + */ + @Deprecated @SerializedName("vectorizeClassName") boolean vectorizeCollectionName, + /** Properties included in the embedding. */ + @SerializedName("sourceProperties") List sourceProperties, + /** Vector index configuration. */ + VectorIndex vectorIndex, + /** Vector quantization method. */ + Quantization quantization) implements VectorConfig { + + @Override + public VectorConfig.Kind _kind() { + return VectorConfig.Kind.TEXT2VEC_COHERE; + } + + @Override + public Object _self() { + return this; + } + + public static Text2VecModel2VecVectorizer of() { + return of(ObjectBuilder.identity()); + } + + public static Text2VecModel2VecVectorizer of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Canonical constructor always sets {@link #vectorizeCollectionName} to false. + */ + public Text2VecModel2VecVectorizer( + String baseUrl, + + boolean vectorizeCollectionName, + List sourceProperties, + VectorIndex vectorIndex, + Quantization quantization) { + this.baseUrl = baseUrl; + + this.vectorizeCollectionName = false; + this.sourceProperties = Collections.emptyList(); + this.vectorIndex = vectorIndex; + this.quantization = quantization; + } + + public Text2VecModel2VecVectorizer(Builder builder) { + this( + builder.baseUrl, + builder.vectorizeCollectionName, + builder.sourceProperties, + builder.vectorIndex, + builder.quantization); + } + + public static class Builder implements ObjectBuilder { + private final boolean vectorizeCollectionName = false; + private Quantization quantization; + private List sourceProperties = new ArrayList<>(); + private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + + private String baseUrl; + + public Builder baseUrl(String baseUrl) { + this.baseUrl = baseUrl; + return this; + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(String... properties) { + return sourceProperties(Arrays.asList(properties)); + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(List properties) { + this.sourceProperties.addAll(properties); + return this; + } + + /** + * Override default vector index configuration. + * + * HNSW + * is the default vector index. + */ + public Builder vectorIndex(VectorIndex vectorIndex) { + this.vectorIndex = vectorIndex; + return this; + } + + public Builder quantization(Quantization quantization) { + this.quantization = quantization; + return this; + } + + public Text2VecModel2VecVectorizer build() { + return new Text2VecModel2VecVectorizer(this); + } + } +} From cbc0e8fdaf818e0bb12107df3e17833e4d40e010 Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 27 Oct 2025 14:51:14 +0100 Subject: [PATCH 05/35] chore: standardize namic in text2vec-weaviate vectorizer --- .../vectorizers/Text2VecWeaviateVectorizer.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecWeaviateVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecWeaviateVectorizer.java index 629befb7..05972637 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecWeaviateVectorizer.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecWeaviateVectorizer.java @@ -14,7 +14,7 @@ public record Text2VecWeaviateVectorizer( /** Weaviate Embeddings Service base URL. */ - @SerializedName("baseUrl") String inferenceUrl, + @SerializedName("baseURL") String baseUrl, /** Dimensionality of the generated vectors. */ @SerializedName("dimensions") Integer dimensions, /** Embedding model. */ @@ -46,7 +46,7 @@ public static Text2VecWeaviateVectorizer of(Function { private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; private Quantization quantization; - private String inferenceUrl; + private String baseUrl; private Integer dimensions; private String model; private List sourceProperties = new ArrayList<>(); @@ -70,8 +70,8 @@ public static class Builder implements ObjectBuilder * to a Weaviate Cloud instance: the client will automatically set the necessary * headers. */ - public Builder inferenceUrl(String inferenceUrl) { - this.inferenceUrl = inferenceUrl; + public Builder baseUrl(String baseUrl) { + this.baseUrl = baseUrl; return this; } From efb3974968b629349b537c338efd53cf6b5f293c Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 27 Oct 2025 14:54:01 +0100 Subject: [PATCH 06/35] feat: add text2vec-voyageai vectorizer --- .../v1/api/collections/VectorConfig.java | 1 + .../Text2VecVoyageAiVectorizer.java | 143 ++++++++++++++++++ 2 files changed, 144 insertions(+) create mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecVoyageAiVectorizer.java diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index 9d657e45..45f5e2f4 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -30,6 +30,7 @@ public enum Kind implements JsonEnum { IMG2VEC_NEURAL("img2vec-neural"), TEXT2VEC_CONTEXTIONARY("text2vec-contextionary"), TEXT2VEC_COHERE("text2vec-cohere"), + TEXT2VEC_VOYAGEAI("text2vec-voyageai"), TEXT2VEC_HUGGINGFACE("text2vec-huggingface"), TEXT2VEC_MORPH("text2vec-morph"), TEXT2VEC_MODEL2VEC("text2vec-model2vec"), diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecVoyageAiVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecVoyageAiVectorizer.java new file mode 100644 index 00000000..cd3da6e0 --- /dev/null +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecVoyageAiVectorizer.java @@ -0,0 +1,143 @@ +package io.weaviate.client6.v1.api.collections.vectorizers; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.function.Function; + +import com.google.gson.annotations.SerializedName; + +import io.weaviate.client6.v1.api.collections.Quantization; +import io.weaviate.client6.v1.api.collections.VectorConfig; +import io.weaviate.client6.v1.api.collections.VectorIndex; +import io.weaviate.client6.v1.internal.ObjectBuilder; + +public record Text2VecVoyageAiVectorizer( + @SerializedName("baseUrl") String baseUrl, + @SerializedName("model") String model, + @SerializedName("truncate") Boolean truncate, + + /** + * Weaviate defaults to {@code true} if the value is not provided. + * To avoid that we send "vectorizeClassName": false all the time + * and make it impossible to enable this feature, as it is deprecated. + */ + @Deprecated @SerializedName("vectorizeClassName") boolean vectorizeCollectionName, + /** Properties included in the embedding. */ + @SerializedName("sourceProperties") List sourceProperties, + /** Vector index configuration. */ + VectorIndex vectorIndex, + /** Vector quantization method. */ + Quantization quantization) implements VectorConfig { + + @Override + public VectorConfig.Kind _kind() { + return VectorConfig.Kind.TEXT2VEC_VOYAGEAI; + } + + @Override + public Object _self() { + return this; + } + + public static Text2VecVoyageAiVectorizer of() { + return of(ObjectBuilder.identity()); + } + + public static Text2VecVoyageAiVectorizer of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Canonical constructor always sets {@link #vectorizeCollectionName} to false. + */ + public Text2VecVoyageAiVectorizer( + String baseUrl, + String model, + Boolean truncate, + + boolean vectorizeCollectionName, + List sourceProperties, + VectorIndex vectorIndex, + Quantization quantization) { + this.model = model; + this.truncate = truncate; + this.baseUrl = baseUrl; + + this.vectorizeCollectionName = false; + this.sourceProperties = Collections.emptyList(); + this.vectorIndex = vectorIndex; + this.quantization = quantization; + } + + public Text2VecVoyageAiVectorizer(Builder builder) { + this( + builder.baseUrl, + builder.model, + builder.truncate, + builder.vectorizeCollectionName, + builder.sourceProperties, + builder.vectorIndex, + builder.quantization); + } + + public static class Builder implements ObjectBuilder { + private final boolean vectorizeCollectionName = false; + private Quantization quantization; + private List sourceProperties = new ArrayList<>(); + private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + + private String model; + private Boolean truncate; + private String baseUrl; + + public Builder baseUrl(String baseUrl) { + this.baseUrl = baseUrl; + return this; + } + + public Builder model(String model) { + this.model = model; + return this; + } + + public Builder truncate(boolean truncate) { + this.truncate = truncate; + return this; + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(String... properties) { + return sourceProperties(Arrays.asList(properties)); + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(List properties) { + this.sourceProperties.addAll(properties); + return this; + } + + /** + * Override default vector index configuration. + * + * HNSW + * is the default vector index. + */ + public Builder vectorIndex(VectorIndex vectorIndex) { + this.vectorIndex = vectorIndex; + return this; + } + + public Builder quantization(Quantization quantization) { + this.quantization = quantization; + return this; + } + + public Text2VecVoyageAiVectorizer build() { + return new Text2VecVoyageAiVectorizer(this); + } + } +} From e07ee011d7bcbc71386acacd3f99013c2bc6a089 Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 27 Oct 2025 15:02:53 +0100 Subject: [PATCH 07/35] feat: add text2vec-transformers vectorizer --- .../v1/api/collections/VectorConfig.java | 1 + .../Text2VecTransformersVectorizer.java | 127 ++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecTransformersVectorizer.java diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index 45f5e2f4..0d0b2b99 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -34,6 +34,7 @@ public enum Kind implements JsonEnum { TEXT2VEC_HUGGINGFACE("text2vec-huggingface"), TEXT2VEC_MORPH("text2vec-morph"), TEXT2VEC_MODEL2VEC("text2vec-model2vec"), + TEXT2VEC_TRANSFORMERS("text2vec-transformers"), TEXT2VEC_WEAVIATE("text2vec-weaviate"), MULTI2VEC_CLIP("multi2vec-clip"); diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecTransformersVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecTransformersVectorizer.java new file mode 100644 index 00000000..e6dcba73 --- /dev/null +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecTransformersVectorizer.java @@ -0,0 +1,127 @@ +package io.weaviate.client6.v1.api.collections.vectorizers; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.function.Function; + +import com.google.gson.annotations.SerializedName; + +import io.weaviate.client6.v1.api.collections.Quantization; +import io.weaviate.client6.v1.api.collections.VectorConfig; +import io.weaviate.client6.v1.api.collections.VectorIndex; +import io.weaviate.client6.v1.internal.ObjectBuilder; + +public record Text2VecTransformersVectorizer( + @SerializedName("inferenceUrl") String baseUrl, + @SerializedName("passageInferenceUrl") String passageInferenceUrl, + @SerializedName("queryInferenceUrl") String queryInferenceUrl, + @SerializedName("poolingStrategy") PoolingStrategy poolingStrategy, + + /** Properties included in the embedding. */ + @SerializedName("sourceProperties") List sourceProperties, + /** Vector index configuration. */ + VectorIndex vectorIndex, + /** Vector quantization method. */ + Quantization quantization) implements VectorConfig { + + @Override + public VectorConfig.Kind _kind() { + return VectorConfig.Kind.TEXT2VEC_TRANSFORMERS; + } + + @Override + public Object _self() { + return this; + } + + public enum PoolingStrategy { + @SerializedName("MASKED_MEAN") + MASKED_MEAN, + @SerializedName("CLS") + CLS; + } + + public static Text2VecTransformersVectorizer of() { + return of(ObjectBuilder.identity()); + } + + public static Text2VecTransformersVectorizer of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + public Text2VecTransformersVectorizer(Builder builder) { + this( + builder.baseUrl, + builder.passageInferenceUrl, + builder.queryInferenceUrl, + builder.poolingStrategy, + builder.sourceProperties, + builder.vectorIndex, + builder.quantization); + } + + public static class Builder implements ObjectBuilder { + private Quantization quantization; + private List sourceProperties = new ArrayList<>(); + private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + + private String baseUrl; + private String passageInferenceUrl; + private String queryInferenceUrl; + private PoolingStrategy poolingStrategy; + + public Builder baseUrl(String baseUrl) { + this.baseUrl = baseUrl; + return this; + } + + public Builder passageInferenceUrl(String passageInferenceUrl) { + this.passageInferenceUrl = passageInferenceUrl; + return this; + } + + public Builder queryInferenceUrl(String queryInferenceUrl) { + this.queryInferenceUrl = queryInferenceUrl; + return this; + } + + public Builder poolingStrategy(PoolingStrategy poolingStrategy) { + this.poolingStrategy = poolingStrategy; + return this; + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(String... properties) { + return sourceProperties(Arrays.asList(properties)); + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(List properties) { + this.sourceProperties.addAll(properties); + return this; + } + + /** + * Override default vector index configuration. + * + * HNSW + * is the default vector index. + */ + public Builder vectorIndex(VectorIndex vectorIndex) { + this.vectorIndex = vectorIndex; + return this; + } + + public Builder quantization(Quantization quantization) { + this.quantization = quantization; + return this; + } + + public Text2VecTransformersVectorizer build() { + return new Text2VecTransformersVectorizer(this); + } + } +} From 7b5437e3d16505b692a3f263a8cf840336c85c14 Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 27 Oct 2025 15:34:44 +0100 Subject: [PATCH 08/35] chore: add Google's vectorizers --- .../v1/api/collections/VectorConfig.java | 26 ++- .../vectorizers/Text2VecCohereVectorizer.java | 2 +- .../Text2VecContextionaryVectorizer.java | 2 +- .../Text2VecGoogleAiStudioVectorizer.java | 104 +++++++++++ .../vectorizers/Text2VecGoogleVectorizer.java | 163 ++++++++++++++++++ .../Text2VecHuggingfaceVectorizer.java | 2 +- .../Text2VecModel2VecVectorizer.java | 3 +- 7 files changed, 288 insertions(+), 14 deletions(-) create mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecGoogleAiStudioVectorizer.java create mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecGoogleVectorizer.java diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index 0d0b2b99..05afc6de 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -30,11 +30,13 @@ public enum Kind implements JsonEnum { IMG2VEC_NEURAL("img2vec-neural"), TEXT2VEC_CONTEXTIONARY("text2vec-contextionary"), TEXT2VEC_COHERE("text2vec-cohere"), - TEXT2VEC_VOYAGEAI("text2vec-voyageai"), + TEXT2VEC_GOOGLE("text2vec-google"), + TEXT2VEC_GOOGLEAISTUDIO("text2vec-google"), TEXT2VEC_HUGGINGFACE("text2vec-huggingface"), TEXT2VEC_MORPH("text2vec-morph"), TEXT2VEC_MODEL2VEC("text2vec-model2vec"), TEXT2VEC_TRANSFORMERS("text2vec-transformers"), + TEXT2VEC_VOYAGEAI("text2vec-voyageai"), TEXT2VEC_WEAVIATE("text2vec-weaviate"), MULTI2VEC_CLIP("multi2vec-clip"); @@ -323,19 +325,25 @@ public VectorConfig read(JsonReader in) throws IOException { var vectorizerObject = jsonObject.get("vectorizer").getAsJsonObject(); var vectorizerName = vectorizerObject.keySet().iterator().next(); + var concreteVectorizer = vectorizerObject.get(vectorizerName).getAsJsonObject(); + + // Each individual vectorizer has a `VectorIndex vectorIndex` field. + concreteVectorizer.add("vectorIndex", vectorIndex); VectorConfig.Kind kind; - try { - kind = VectorConfig.Kind.valueOfJson(vectorizerName); - } catch (IllegalArgumentException e) { - return null; + if (vectorizerName.equals(VectorConfig.Kind.TEXT2VEC_GOOGLE.jsonValue())) { + kind = concreteVectorizer.has("projectId") + ? VectorConfig.Kind.TEXT2VEC_GOOGLE + : VectorConfig.Kind.TEXT2VEC_GOOGLEAISTUDIO; + } else { + try { + kind = VectorConfig.Kind.valueOfJson(vectorizerName); + } catch (IllegalArgumentException e) { + return null; + } } var adapter = delegateAdapters.get(kind); - var concreteVectorizer = vectorizerObject.get(vectorizerName).getAsJsonObject(); - - // Each individual vectorizer has a `VectorIndex vectorIndex` field. - concreteVectorizer.add("vectorIndex", vectorIndex); // Each individual vectorizer has a `Quantization quantization` field. // We need to specify the kind in order for diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecCohereVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecCohereVectorizer.java index aa1ff3d3..71418ee2 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecCohereVectorizer.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecCohereVectorizer.java @@ -80,7 +80,7 @@ public Text2VecCohereVectorizer( this.baseUrl = baseUrl; this.vectorizeCollectionName = false; - this.sourceProperties = Collections.emptyList(); + this.sourceProperties = sourceProperties; this.vectorIndex = vectorIndex; this.quantization = quantization; } diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecContextionaryVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecContextionaryVectorizer.java index 9f7a4808..00a2b98e 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecContextionaryVectorizer.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecContextionaryVectorizer.java @@ -55,7 +55,7 @@ public static Text2VecContextionaryVectorizer of( public Text2VecContextionaryVectorizer(boolean vectorizeCollectionName, List sourceProperties, VectorIndex vectorIndex, Quantization quantization) { this.vectorizeCollectionName = false; - this.sourceProperties = Collections.emptyList(); + this.sourceProperties = sourceProperties; this.vectorIndex = vectorIndex; this.quantization = quantization; } diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecGoogleAiStudioVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecGoogleAiStudioVectorizer.java new file mode 100644 index 00000000..b477ca6d --- /dev/null +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecGoogleAiStudioVectorizer.java @@ -0,0 +1,104 @@ +package io.weaviate.client6.v1.api.collections.vectorizers; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.function.Function; + +import com.google.gson.annotations.SerializedName; + +import io.weaviate.client6.v1.api.collections.Quantization; +import io.weaviate.client6.v1.api.collections.VectorConfig; +import io.weaviate.client6.v1.api.collections.VectorIndex; +import io.weaviate.client6.v1.internal.ObjectBuilder; + +public record Text2VecGoogleAiStudioVectorizer( + @SerializedName("model") String model, + @SerializedName("titleProperty") String titleProperty, + + /** Properties included in the embedding. */ + @SerializedName("sourceProperties") List sourceProperties, + /** Vector index configuration. */ + VectorIndex vectorIndex, + /** Vector quantization method. */ + Quantization quantization) implements VectorConfig { + + @Override + public VectorConfig.Kind _kind() { + return VectorConfig.Kind.TEXT2VEC_GOOGLEAISTUDIO; + } + + @Override + public Object _self() { + return this; + } + + public static Text2VecGoogleAiStudioVectorizer of() { + return of(ObjectBuilder.identity()); + } + + public static Text2VecGoogleAiStudioVectorizer of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + public Text2VecGoogleAiStudioVectorizer(Builder builder) { + this( + builder.model, + builder.titleProperty, + builder.sourceProperties, + builder.vectorIndex, + builder.quantization); + } + + public static class Builder implements ObjectBuilder { + private Quantization quantization; + private List sourceProperties = new ArrayList<>(); + private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + + private String model; + private String titleProperty; + + public Builder model(String model) { + this.model = model; + return this; + } + + public Builder titleProperty(String titleProperty) { + this.titleProperty = titleProperty; + return this; + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(String... properties) { + return sourceProperties(Arrays.asList(properties)); + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(List properties) { + this.sourceProperties.addAll(properties); + return this; + } + + /** + * Override default vector index configuration. + * + * HNSW + * is the default vector index. + */ + public Builder vectorIndex(VectorIndex vectorIndex) { + this.vectorIndex = vectorIndex; + return this; + } + + public Builder quantization(Quantization quantization) { + this.quantization = quantization; + return this; + } + + public Text2VecGoogleAiStudioVectorizer build() { + return new Text2VecGoogleAiStudioVectorizer(this); + } + } +} diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecGoogleVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecGoogleVectorizer.java new file mode 100644 index 00000000..c891e1a5 --- /dev/null +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecGoogleVectorizer.java @@ -0,0 +1,163 @@ +package io.weaviate.client6.v1.api.collections.vectorizers; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.function.Function; + +import com.google.gson.annotations.SerializedName; + +import io.weaviate.client6.v1.api.collections.Quantization; +import io.weaviate.client6.v1.api.collections.VectorConfig; +import io.weaviate.client6.v1.api.collections.VectorIndex; +import io.weaviate.client6.v1.internal.ObjectBuilder; + +public record Text2VecGoogleVectorizer( + @SerializedName("apiEndpoint") String baseUrl, + @SerializedName("model") String model, + @SerializedName("titleProperty") String titleProperty, + @SerializedName("dimensions") Integer dimensions, + @SerializedName("projectId") String projectId, + + /** + * Weaviate defaults to {@code true} if the value is not provided. + * To avoid that we send "vectorizeClassName": false all the time + * and make it impossible to enable this feature, as it is deprecated. + */ + @Deprecated @SerializedName("vectorizeClassName") boolean vectorizeCollectionName, + /** Properties included in the embedding. */ + @SerializedName("sourceProperties") List sourceProperties, + /** Vector index configuration. */ + VectorIndex vectorIndex, + /** Vector quantization method. */ + Quantization quantization) implements VectorConfig { + + @Override + public VectorConfig.Kind _kind() { + return VectorConfig.Kind.TEXT2VEC_GOOGLE; + } + + @Override + public Object _self() { + return this; + } + + public static Text2VecGoogleVectorizer of() { + return of(ObjectBuilder.identity()); + } + + public static Text2VecGoogleVectorizer of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Canonical constructor always sets {@link #vectorizeCollectionName} to false. + */ + public Text2VecGoogleVectorizer( + String baseUrl, + String model, + String titleProperty, + Integer dimensions, + String projectId, + + boolean vectorizeCollectionName, + List sourceProperties, + VectorIndex vectorIndex, + Quantization quantization) { + this.baseUrl = baseUrl; + this.model = model; + this.titleProperty = titleProperty; + this.dimensions = dimensions; + this.projectId = projectId; + + this.vectorizeCollectionName = false; + this.sourceProperties = sourceProperties; + this.vectorIndex = vectorIndex; + this.quantization = quantization; + } + + public Text2VecGoogleVectorizer(Builder builder) { + this( + builder.baseUrl, + builder.model, + builder.titleProperty, + builder.dimensions, + builder.projectId, + + builder.vectorizeCollectionName, + builder.sourceProperties, + builder.vectorIndex, + builder.quantization); + } + + public static class Builder implements ObjectBuilder { + private final boolean vectorizeCollectionName = false; + private Quantization quantization; + private List sourceProperties = new ArrayList<>(); + private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + + private String baseUrl; + private String model; + private String titleProperty; + private Integer dimensions; + private String projectId; + + public Builder baseUrl(String baseUrl) { + this.baseUrl = baseUrl; + return this; + } + + public Builder model(String model) { + this.model = model; + return this; + } + + public Builder dimensions(int dimensions) { + this.dimensions = dimensions; + return this; + } + + public Builder titleProperty(String titleProperty) { + this.titleProperty = titleProperty; + return this; + } + + public Builder projectId(String projectId) { + this.projectId = projectId; + return this; + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(String... properties) { + return sourceProperties(Arrays.asList(properties)); + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(List properties) { + this.sourceProperties.addAll(properties); + return this; + } + + /** + * Override default vector index configuration. + * + * HNSW + * is the default vector index. + */ + public Builder vectorIndex(VectorIndex vectorIndex) { + this.vectorIndex = vectorIndex; + return this; + } + + public Builder quantization(Quantization quantization) { + this.quantization = quantization; + return this; + } + + public Text2VecGoogleVectorizer build() { + return new Text2VecGoogleVectorizer(this); + } + } +} diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecHuggingfaceVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecHuggingfaceVectorizer.java index f9d102b4..9b18947e 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecHuggingfaceVectorizer.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecHuggingfaceVectorizer.java @@ -79,7 +79,7 @@ public Text2VecHuggingfaceVectorizer( this.waitForModel = waitForModel; this.vectorizeCollectionName = false; - this.sourceProperties = Collections.emptyList(); + this.sourceProperties = sourceProperties; this.vectorIndex = vectorIndex; this.quantization = quantization; } diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecModel2VecVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecModel2VecVectorizer.java index 63ba7caa..a852734c 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecModel2VecVectorizer.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecModel2VecVectorizer.java @@ -2,7 +2,6 @@ import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.List; import java.util.function.Function; @@ -61,7 +60,7 @@ public Text2VecModel2VecVectorizer( this.baseUrl = baseUrl; this.vectorizeCollectionName = false; - this.sourceProperties = Collections.emptyList(); + this.sourceProperties = sourceProperties; this.vectorIndex = vectorIndex; this.quantization = quantization; } From 63f34db09c5eeb569cd7ce5a0f86bfda4664f73d Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 27 Oct 2025 15:41:08 +0100 Subject: [PATCH 09/35] feat: add text2vec-openai vectorizer --- .../v1/api/collections/VectorConfig.java | 1 + .../vectorizers/Text2VecOpenAiVectorizer.java | 174 ++++++++++++++++++ 2 files changed, 175 insertions(+) create mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecOpenAiVectorizer.java diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index 05afc6de..8c34a437 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -35,6 +35,7 @@ public enum Kind implements JsonEnum { TEXT2VEC_HUGGINGFACE("text2vec-huggingface"), TEXT2VEC_MORPH("text2vec-morph"), TEXT2VEC_MODEL2VEC("text2vec-model2vec"), + TEXT2VEC_OPENAI("text2vec-openai"), TEXT2VEC_TRANSFORMERS("text2vec-transformers"), TEXT2VEC_VOYAGEAI("text2vec-voyageai"), TEXT2VEC_WEAVIATE("text2vec-weaviate"), diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecOpenAiVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecOpenAiVectorizer.java new file mode 100644 index 00000000..a781fb21 --- /dev/null +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecOpenAiVectorizer.java @@ -0,0 +1,174 @@ +package io.weaviate.client6.v1.api.collections.vectorizers; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.function.Function; + +import com.google.gson.annotations.SerializedName; + +import io.weaviate.client6.v1.api.collections.Quantization; +import io.weaviate.client6.v1.api.collections.VectorConfig; +import io.weaviate.client6.v1.api.collections.VectorIndex; +import io.weaviate.client6.v1.internal.ObjectBuilder; + +public record Text2VecOpenAiVectorizer( + @SerializedName("baseUrl") String baseUrl, + @SerializedName("model") String model, + @SerializedName("modelVersion") String modelVersion, + @SerializedName("dimensions") Integer dimensions, + @SerializedName("type") ModelType modelType, + + /** + * Weaviate defaults to {@code true} if the value is not provided. + * To avoid that we send "vectorizeClassName": false all the time + * and make it impossible to enable this feature, as it is deprecated. + */ + @Deprecated @SerializedName("vectorizeClassName") boolean vectorizeCollectionName, + /** Properties included in the embedding. */ + @SerializedName("sourceProperties") List sourceProperties, + /** Vector index configuration. */ + VectorIndex vectorIndex, + /** Vector quantization method. */ + Quantization quantization) implements VectorConfig { + + @Override + public VectorConfig.Kind _kind() { + return VectorConfig.Kind.TEXT2VEC_OPENAI; + } + + public static String TEXT_EMBEDDING_3_SMALL = "text-embeding-3-small"; + public static String TEXT_EMBEDDING_3_LARGE = "text-embeding-3-large"; + public static String TEXT_EMBEDDING_ADA_002 = "text-embeding-ada-002"; + + @Override + public Object _self() { + return this; + } + + public enum ModelType { + @SerializedName("CODE") + CODE, + @SerializedName("TEXT") + TEXT; + } + + public static Text2VecOpenAiVectorizer of() { + return of(ObjectBuilder.identity()); + } + + public static Text2VecOpenAiVectorizer of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Canonical constructor always sets {@link #vectorizeCollectionName} to false. + */ + public Text2VecOpenAiVectorizer( + String baseUrl, + String model, + String modelVersion, + Integer dimensions, + ModelType modelType, + + boolean vectorizeCollectionName, + List sourceProperties, + VectorIndex vectorIndex, + Quantization quantization) { + this.baseUrl = baseUrl; + this.model = model; + this.modelVersion = modelVersion; + this.dimensions = dimensions; + this.modelType = modelType; + + this.vectorizeCollectionName = false; + this.sourceProperties = sourceProperties; + this.vectorIndex = vectorIndex; + this.quantization = quantization; + } + + public Text2VecOpenAiVectorizer(Builder builder) { + this( + builder.baseUrl, + builder.model, + builder.modelVersion, + builder.dimensions, + builder.modelType, + + builder.vectorizeCollectionName, + builder.sourceProperties, + builder.vectorIndex, + builder.quantization); + } + + public static class Builder implements ObjectBuilder { + private final boolean vectorizeCollectionName = false; + private Quantization quantization; + private List sourceProperties = new ArrayList<>(); + private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + + private String baseUrl; + private String model; + private String modelVersion; + private Integer dimensions; + private ModelType modelType; + + public Builder baseUrl(String baseUrl) { + this.baseUrl = baseUrl; + return this; + } + + public Builder model(String model) { + this.model = model; + return this; + } + + public Builder dimensions(int dimensions) { + this.dimensions = dimensions; + return this; + } + + public Builder modelVersion(String modelVersion) { + this.modelVersion = modelVersion; + return this; + } + + public Builder modelType(ModelType modelType) { + this.modelType = modelType; + return this; + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(String... properties) { + return sourceProperties(Arrays.asList(properties)); + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(List properties) { + this.sourceProperties.addAll(properties); + return this; + } + + /** + * Override default vector index configuration. + * + * HNSW + * is the default vector index. + */ + public Builder vectorIndex(VectorIndex vectorIndex) { + this.vectorIndex = vectorIndex; + return this; + } + + public Builder quantization(Quantization quantization) { + this.quantization = quantization; + return this; + } + + public Text2VecOpenAiVectorizer build() { + return new Text2VecOpenAiVectorizer(this); + } + } +} From 1762ba3e9309dd9c665aed633e282856a0a49576 Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 27 Oct 2025 15:43:30 +0100 Subject: [PATCH 10/35] feat: add text2vec-ollama vectorizer --- .../v1/api/collections/VectorConfig.java | 1 + .../vectorizers/Text2VecOllamaVectorizer.java | 133 ++++++++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecOllamaVectorizer.java diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index 8c34a437..e696de5f 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -36,6 +36,7 @@ public enum Kind implements JsonEnum { TEXT2VEC_MORPH("text2vec-morph"), TEXT2VEC_MODEL2VEC("text2vec-model2vec"), TEXT2VEC_OPENAI("text2vec-openai"), + TEXT2VEC_OLLAMA("text2vec-ollama"), TEXT2VEC_TRANSFORMERS("text2vec-transformers"), TEXT2VEC_VOYAGEAI("text2vec-voyageai"), TEXT2VEC_WEAVIATE("text2vec-weaviate"), diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecOllamaVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecOllamaVectorizer.java new file mode 100644 index 00000000..f2f0a0ad --- /dev/null +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecOllamaVectorizer.java @@ -0,0 +1,133 @@ +package io.weaviate.client6.v1.api.collections.vectorizers; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.function.Function; + +import com.google.gson.annotations.SerializedName; + +import io.weaviate.client6.v1.api.collections.Quantization; +import io.weaviate.client6.v1.api.collections.VectorConfig; +import io.weaviate.client6.v1.api.collections.VectorIndex; +import io.weaviate.client6.v1.internal.ObjectBuilder; + +public record Text2VecOllamaVectorizer( + @SerializedName("apiEndpoint") String baseUrl, + @SerializedName("model") String model, + + /** + * Weaviate defaults to {@code true} if the value is not provided. + * To avoid that we send "vectorizeClassName": false all the time + * and make it impossible to enable this feature, as it is deprecated. + */ + @Deprecated @SerializedName("vectorizeClassName") boolean vectorizeCollectionName, + /** Properties included in the embedding. */ + @SerializedName("sourceProperties") List sourceProperties, + /** Vector index configuration. */ + VectorIndex vectorIndex, + /** Vector quantization method. */ + Quantization quantization) implements VectorConfig { + + @Override + public VectorConfig.Kind _kind() { + return VectorConfig.Kind.TEXT2VEC_OLLAMA; + } + + @Override + public Object _self() { + return this; + } + + public static Text2VecOllamaVectorizer of() { + return of(ObjectBuilder.identity()); + } + + public static Text2VecOllamaVectorizer of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Canonical constructor always sets {@link #vectorizeCollectionName} to false. + */ + public Text2VecOllamaVectorizer( + String baseUrl, + String model, + + boolean vectorizeCollectionName, + List sourceProperties, + VectorIndex vectorIndex, + Quantization quantization) { + this.baseUrl = baseUrl; + this.model = model; + + this.vectorizeCollectionName = false; + this.sourceProperties = sourceProperties; + this.vectorIndex = vectorIndex; + this.quantization = quantization; + } + + public Text2VecOllamaVectorizer(Builder builder) { + this( + builder.baseUrl, + builder.model, + + builder.vectorizeCollectionName, + builder.sourceProperties, + builder.vectorIndex, + builder.quantization); + } + + public static class Builder implements ObjectBuilder { + private final boolean vectorizeCollectionName = false; + private Quantization quantization; + private List sourceProperties = new ArrayList<>(); + private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + + private String baseUrl; + private String model; + + public Builder baseUrl(String baseUrl) { + this.baseUrl = baseUrl; + return this; + } + + public Builder model(String model) { + this.model = model; + return this; + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(String... properties) { + return sourceProperties(Arrays.asList(properties)); + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(List properties) { + this.sourceProperties.addAll(properties); + return this; + } + + /** + * Override default vector index configuration. + * + * HNSW + * is the default vector index. + */ + public Builder vectorIndex(VectorIndex vectorIndex) { + this.vectorIndex = vectorIndex; + return this; + } + + public Builder quantization(Quantization quantization) { + this.quantization = quantization; + return this; + } + + public Text2VecOllamaVectorizer build() { + return new Text2VecOllamaVectorizer(this); + } + } +} From 68fcb209404a1b986d4e062be9fd2fcb952608b4 Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 27 Oct 2025 15:45:43 +0100 Subject: [PATCH 11/35] feat: add text2vec-mistral vectorizer --- .../v1/api/collections/VectorConfig.java | 1 + .../Text2VecMistralVectorizer.java | 135 ++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecMistralVectorizer.java diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index e696de5f..3a300b7f 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -33,6 +33,7 @@ public enum Kind implements JsonEnum { TEXT2VEC_GOOGLE("text2vec-google"), TEXT2VEC_GOOGLEAISTUDIO("text2vec-google"), TEXT2VEC_HUGGINGFACE("text2vec-huggingface"), + TEXT2VEC_MISTRAL("text2vec-mistral"), TEXT2VEC_MORPH("text2vec-morph"), TEXT2VEC_MODEL2VEC("text2vec-model2vec"), TEXT2VEC_OPENAI("text2vec-openai"), diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecMistralVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecMistralVectorizer.java new file mode 100644 index 00000000..efabaff8 --- /dev/null +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecMistralVectorizer.java @@ -0,0 +1,135 @@ +package io.weaviate.client6.v1.api.collections.vectorizers; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.function.Function; + +import com.google.gson.annotations.SerializedName; + +import io.weaviate.client6.v1.api.collections.Quantization; +import io.weaviate.client6.v1.api.collections.VectorConfig; +import io.weaviate.client6.v1.api.collections.VectorIndex; +import io.weaviate.client6.v1.internal.ObjectBuilder; + +public record Text2VecMistralVectorizer( + @SerializedName("baseURL") String baseUrl, + @SerializedName("model") String model, + + /** + * Weaviate defaults to {@code true} if the value is not provided. + * To avoid that we send "vectorizeClassName": false all the time + * and make it impossible to enable this feature, as it is deprecated. + */ + @Deprecated @SerializedName("vectorizeClassName") boolean vectorizeCollectionName, + /** Properties included in the embedding. */ + @SerializedName("sourceProperties") List sourceProperties, + /** Vector index configuration. */ + VectorIndex vectorIndex, + /** Vector quantization method. */ + Quantization quantization) implements VectorConfig { + + @Override + public VectorConfig.Kind _kind() { + return VectorConfig.Kind.TEXT2VEC_MISTRAL; + } + + @Override + public Object _self() { + return this; + } + + public static String MISTRAL_EMBED = "mistral-embed"; + + public static Text2VecMistralVectorizer of() { + return of(ObjectBuilder.identity()); + } + + public static Text2VecMistralVectorizer of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Canonical constructor always sets {@link #vectorizeCollectionName} to false. + */ + public Text2VecMistralVectorizer( + String baseUrl, + String model, + + boolean vectorizeCollectionName, + List sourceProperties, + VectorIndex vectorIndex, + Quantization quantization) { + this.baseUrl = baseUrl; + this.model = model; + + this.vectorizeCollectionName = false; + this.sourceProperties = sourceProperties; + this.vectorIndex = vectorIndex; + this.quantization = quantization; + } + + public Text2VecMistralVectorizer(Builder builder) { + this( + builder.baseUrl, + builder.model, + + builder.vectorizeCollectionName, + builder.sourceProperties, + builder.vectorIndex, + builder.quantization); + } + + public static class Builder implements ObjectBuilder { + private final boolean vectorizeCollectionName = false; + private Quantization quantization; + private List sourceProperties = new ArrayList<>(); + private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + + private String baseUrl; + private String model; + + public Builder baseUrl(String baseUrl) { + this.baseUrl = baseUrl; + return this; + } + + public Builder model(String model) { + this.model = model; + return this; + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(String... properties) { + return sourceProperties(Arrays.asList(properties)); + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(List properties) { + this.sourceProperties.addAll(properties); + return this; + } + + /** + * Override default vector index configuration. + * + * HNSW + * is the default vector index. + */ + public Builder vectorIndex(VectorIndex vectorIndex) { + this.vectorIndex = vectorIndex; + return this; + } + + public Builder quantization(Quantization quantization) { + this.quantization = quantization; + return this; + } + + public Text2VecMistralVectorizer build() { + return new Text2VecMistralVectorizer(this); + } + } +} From 51bfc4a68e860f256ef14f10d11c67a35604b696 Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 27 Oct 2025 15:48:38 +0100 Subject: [PATCH 12/35] feat: add text2vec-nvidia vectorizer --- .../v1/api/collections/VectorConfig.java | 1 + .../vectorizers/Text2VecNvidiaVectorizer.java | 143 ++++++++++++++++++ 2 files changed, 144 insertions(+) create mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecNvidiaVectorizer.java diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index 3a300b7f..2a7ea6d2 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -36,6 +36,7 @@ public enum Kind implements JsonEnum { TEXT2VEC_MISTRAL("text2vec-mistral"), TEXT2VEC_MORPH("text2vec-morph"), TEXT2VEC_MODEL2VEC("text2vec-model2vec"), + TEXT2VEC_NVIDIA("text2vec-nvidia"), TEXT2VEC_OPENAI("text2vec-openai"), TEXT2VEC_OLLAMA("text2vec-ollama"), TEXT2VEC_TRANSFORMERS("text2vec-transformers"), diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecNvidiaVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecNvidiaVectorizer.java new file mode 100644 index 00000000..e06016c8 --- /dev/null +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecNvidiaVectorizer.java @@ -0,0 +1,143 @@ +package io.weaviate.client6.v1.api.collections.vectorizers; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.function.Function; + +import com.google.gson.annotations.SerializedName; + +import io.weaviate.client6.v1.api.collections.Quantization; +import io.weaviate.client6.v1.api.collections.VectorConfig; +import io.weaviate.client6.v1.api.collections.VectorIndex; +import io.weaviate.client6.v1.internal.ObjectBuilder; + +public record Text2VecNvidiaVectorizer( + @SerializedName("baseURL") String baseUrl, + @SerializedName("model") String model, + @SerializedName("truncate") Boolean truncate, + + /** + * Weaviate defaults to {@code true} if the value is not provided. + * To avoid that we send "vectorizeClassName": false all the time + * and make it impossible to enable this feature, as it is deprecated. + */ + @Deprecated @SerializedName("vectorizeClassName") boolean vectorizeCollectionName, + /** Properties included in the embedding. */ + @SerializedName("sourceProperties") List sourceProperties, + /** Vector index configuration. */ + VectorIndex vectorIndex, + /** Vector quantization method. */ + Quantization quantization) implements VectorConfig { + + @Override + public VectorConfig.Kind _kind() { + return VectorConfig.Kind.TEXT2VEC_NVIDIA; + } + + @Override + public Object _self() { + return this; + } + + public static Text2VecNvidiaVectorizer of() { + return of(ObjectBuilder.identity()); + } + + public static Text2VecNvidiaVectorizer of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Canonical constructor always sets {@link #vectorizeCollectionName} to false. + */ + public Text2VecNvidiaVectorizer( + String baseUrl, + String model, + Boolean truncate, + + boolean vectorizeCollectionName, + List sourceProperties, + VectorIndex vectorIndex, + Quantization quantization) { + this.baseUrl = baseUrl; + this.model = model; + this.truncate = truncate; + + this.vectorizeCollectionName = false; + this.sourceProperties = sourceProperties; + this.vectorIndex = vectorIndex; + this.quantization = quantization; + } + + public Text2VecNvidiaVectorizer(Builder builder) { + this( + builder.baseUrl, + builder.model, + builder.truncate, + + builder.vectorizeCollectionName, + builder.sourceProperties, + builder.vectorIndex, + builder.quantization); + } + + public static class Builder implements ObjectBuilder { + private final boolean vectorizeCollectionName = false; + private Quantization quantization; + private List sourceProperties = new ArrayList<>(); + private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + + private String baseUrl; + private String model; + private Boolean truncate; + + public Builder baseUrl(String baseUrl) { + this.baseUrl = baseUrl; + return this; + } + + public Builder model(String model) { + this.model = model; + return this; + } + + public Builder truncate(Boolean truncate) { + this.truncate = truncate; + return this; + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(String... properties) { + return sourceProperties(Arrays.asList(properties)); + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(List properties) { + this.sourceProperties.addAll(properties); + return this; + } + + /** + * Override default vector index configuration. + * + * HNSW + * is the default vector index. + */ + public Builder vectorIndex(VectorIndex vectorIndex) { + this.vectorIndex = vectorIndex; + return this; + } + + public Builder quantization(Quantization quantization) { + this.quantization = quantization; + return this; + } + + public Text2VecNvidiaVectorizer build() { + return new Text2VecNvidiaVectorizer(this); + } + } +} From 33356897cee599505c5bc8a1deaf16d65e138f06 Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 27 Oct 2025 15:58:53 +0100 Subject: [PATCH 13/35] feat: add Jina vectorizers --- .../v1/api/collections/VectorConfig.java | 2 + .../Text2MultiVecJinaAiVectorizer.java | 133 ++++++++++++++++++ .../vectorizers/Text2VecJinaAiVectorizer.java | 126 +++++++++++++++++ 3 files changed, 261 insertions(+) create mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2MultiVecJinaAiVectorizer.java create mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecJinaAiVectorizer.java diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index 2a7ea6d2..a987ac7e 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -33,6 +33,8 @@ public enum Kind implements JsonEnum { TEXT2VEC_GOOGLE("text2vec-google"), TEXT2VEC_GOOGLEAISTUDIO("text2vec-google"), TEXT2VEC_HUGGINGFACE("text2vec-huggingface"), + TEXT2VEC_JINAAI("text2vec-jinaai"), + TEXT2MULTIVEC_JINAAI("text2multivec-jinaai"), TEXT2VEC_MISTRAL("text2vec-mistral"), TEXT2VEC_MORPH("text2vec-morph"), TEXT2VEC_MODEL2VEC("text2vec-model2vec"), diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2MultiVecJinaAiVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2MultiVecJinaAiVectorizer.java new file mode 100644 index 00000000..f8fc5e06 --- /dev/null +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2MultiVecJinaAiVectorizer.java @@ -0,0 +1,133 @@ +package io.weaviate.client6.v1.api.collections.vectorizers; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.function.Function; + +import com.google.gson.annotations.SerializedName; + +import io.weaviate.client6.v1.api.collections.Quantization; +import io.weaviate.client6.v1.api.collections.VectorConfig; +import io.weaviate.client6.v1.api.collections.VectorIndex; +import io.weaviate.client6.v1.internal.ObjectBuilder; + +public record Text2MultiVecJinaAiVectorizer( + @SerializedName("model") String model, + @SerializedName("dimensions") Integer dimensions, + + /** + * Weaviate defaults to {@code true} if the value is not provided. + * To avoid that we send "vectorizeClassName": false all the time + * and make it impossible to enable this feature, as it is deprecated. + */ + @Deprecated @SerializedName("vectorizeClassName") boolean vectorizeCollectionName, + /** Properties included in the embedding. */ + @SerializedName("sourceProperties") List sourceProperties, + /** Vector index configuration. */ + VectorIndex vectorIndex, + /** Vector quantization method. */ + Quantization quantization) implements VectorConfig { + + @Override + public VectorConfig.Kind _kind() { + return VectorConfig.Kind.TEXT2MULTIVEC_JINAAI; + } + + @Override + public Object _self() { + return this; + } + + public static Text2MultiVecJinaAiVectorizer of() { + return of(ObjectBuilder.identity()); + } + + public static Text2MultiVecJinaAiVectorizer of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Canonical constructor always sets {@link #vectorizeCollectionName} to false. + */ + public Text2MultiVecJinaAiVectorizer( + String model, + Integer dimensions, + + boolean vectorizeCollectionName, + List sourceProperties, + VectorIndex vectorIndex, + Quantization quantization) { + this.model = model; + this.dimensions = dimensions; + + this.vectorizeCollectionName = false; + this.sourceProperties = sourceProperties; + this.vectorIndex = vectorIndex; + this.quantization = quantization; + } + + public Text2MultiVecJinaAiVectorizer(Builder builder) { + this( + builder.model, + builder.dimensions, + + builder.vectorizeCollectionName, + builder.sourceProperties, + builder.vectorIndex, + builder.quantization); + } + + public static class Builder implements ObjectBuilder { + private final boolean vectorizeCollectionName = false; + private Quantization quantization; + private List sourceProperties = new ArrayList<>(); + private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + + private String model; + private Integer dimensions; + + public Builder model(String model) { + this.model = model; + return this; + } + + public Builder dimensions(int dimensions) { + this.dimensions = dimensions; + return this; + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(String... properties) { + return sourceProperties(Arrays.asList(properties)); + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(List properties) { + this.sourceProperties.addAll(properties); + return this; + } + + /** + * Override default vector index configuration. + * + * HNSW + * is the default vector index. + */ + public Builder vectorIndex(VectorIndex vectorIndex) { + this.vectorIndex = vectorIndex; + return this; + } + + public Builder quantization(Quantization quantization) { + this.quantization = quantization; + return this; + } + + public Text2MultiVecJinaAiVectorizer build() { + return new Text2MultiVecJinaAiVectorizer(this); + } + } +} diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecJinaAiVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecJinaAiVectorizer.java new file mode 100644 index 00000000..acec520c --- /dev/null +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecJinaAiVectorizer.java @@ -0,0 +1,126 @@ +package io.weaviate.client6.v1.api.collections.vectorizers; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.function.Function; + +import com.google.gson.annotations.SerializedName; + +import io.weaviate.client6.v1.api.collections.Quantization; +import io.weaviate.client6.v1.api.collections.VectorConfig; +import io.weaviate.client6.v1.api.collections.VectorIndex; +import io.weaviate.client6.v1.internal.ObjectBuilder; + +public record Text2VecJinaAiVectorizer( + @SerializedName("model") String model, + + /** + * Weaviate defaults to {@code true} if the value is not provided. + * To avoid that we send "vectorizeClassName": false all the time + * and make it impossible to enable this feature, as it is deprecated. + */ + @Deprecated @SerializedName("vectorizeClassName") boolean vectorizeCollectionName, + /** Properties included in the embedding. */ + @SerializedName("sourceProperties") List sourceProperties, + /** Vector index configuration. */ + VectorIndex vectorIndex, + /** Vector quantization method. */ + Quantization quantization) implements VectorConfig { + + @Override + public VectorConfig.Kind _kind() { + return VectorConfig.Kind.TEXT2VEC_JINAAI; + } + + @Override + public Object _self() { + return this; + } + + public static String JINA_EMBEDDINGS_V2_BASE_EN = "jina-embeddings-v2-base-en"; + public static String JINA_EMBEDDINGS_V2_SMALL_EN = "jina-embeddings-v2-small-en"; + + public static Text2VecJinaAiVectorizer of() { + return of(ObjectBuilder.identity()); + } + + public static Text2VecJinaAiVectorizer of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Canonical constructor always sets {@link #vectorizeCollectionName} to false. + */ + public Text2VecJinaAiVectorizer( + String model, + + boolean vectorizeCollectionName, + List sourceProperties, + VectorIndex vectorIndex, + Quantization quantization) { + this.model = model; + + this.vectorizeCollectionName = false; + this.sourceProperties = sourceProperties; + this.vectorIndex = vectorIndex; + this.quantization = quantization; + } + + public Text2VecJinaAiVectorizer(Builder builder) { + this( + builder.model, + + builder.vectorizeCollectionName, + builder.sourceProperties, + builder.vectorIndex, + builder.quantization); + } + + public static class Builder implements ObjectBuilder { + private final boolean vectorizeCollectionName = false; + private Quantization quantization; + private List sourceProperties = new ArrayList<>(); + private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + + private String model; + + public Builder model(String model) { + this.model = model; + return this; + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(String... properties) { + return sourceProperties(Arrays.asList(properties)); + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(List properties) { + this.sourceProperties.addAll(properties); + return this; + } + + /** + * Override default vector index configuration. + * + * HNSW + * is the default vector index. + */ + public Builder vectorIndex(VectorIndex vectorIndex) { + this.vectorIndex = vectorIndex; + return this; + } + + public Builder quantization(Quantization quantization) { + this.quantization = quantization; + return this; + } + + public Text2VecJinaAiVectorizer build() { + return new Text2VecJinaAiVectorizer(this); + } + } +} From 75710aaf69a3effd4361a51bde66caeacff11c88 Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 27 Oct 2025 16:02:14 +0100 Subject: [PATCH 14/35] feat: add text2vec-databricks vectorizer --- .../v1/api/collections/VectorConfig.java | 1 + .../Text2VecDatabricksVectorizer.java | 133 ++++++++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecDatabricksVectorizer.java diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index a987ac7e..d8e0e19b 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -30,6 +30,7 @@ public enum Kind implements JsonEnum { IMG2VEC_NEURAL("img2vec-neural"), TEXT2VEC_CONTEXTIONARY("text2vec-contextionary"), TEXT2VEC_COHERE("text2vec-cohere"), + TEXT2VEC_DATABRICKS("text2vec-databricks"), TEXT2VEC_GOOGLE("text2vec-google"), TEXT2VEC_GOOGLEAISTUDIO("text2vec-google"), TEXT2VEC_HUGGINGFACE("text2vec-huggingface"), diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecDatabricksVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecDatabricksVectorizer.java new file mode 100644 index 00000000..960b9aa1 --- /dev/null +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecDatabricksVectorizer.java @@ -0,0 +1,133 @@ +package io.weaviate.client6.v1.api.collections.vectorizers; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.function.Function; + +import com.google.gson.annotations.SerializedName; + +import io.weaviate.client6.v1.api.collections.Quantization; +import io.weaviate.client6.v1.api.collections.VectorConfig; +import io.weaviate.client6.v1.api.collections.VectorIndex; +import io.weaviate.client6.v1.internal.ObjectBuilder; + +public record Text2VecDatabricksVectorizer( + @SerializedName("endpoint") String baseUrl, + @SerializedName("instruction") String instruction, + + /** + * Weaviate defaults to {@code true} if the value is not provided. + * To avoid that we send "vectorizeClassName": false all the time + * and make it impossible to enable this feature, as it is deprecated. + */ + @Deprecated @SerializedName("vectorizeClassName") boolean vectorizeCollectionName, + /** Properties included in the embedding. */ + @SerializedName("sourceProperties") List sourceProperties, + /** Vector index configuration. */ + VectorIndex vectorIndex, + /** Vector quantization method. */ + Quantization quantization) implements VectorConfig { + + @Override + public VectorConfig.Kind _kind() { + return VectorConfig.Kind.TEXT2VEC_MISTRAL; + } + + @Override + public Object _self() { + return this; + } + + public static Text2VecDatabricksVectorizer of() { + return of(ObjectBuilder.identity()); + } + + public static Text2VecDatabricksVectorizer of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Canonical constructor always sets {@link #vectorizeCollectionName} to false. + */ + public Text2VecDatabricksVectorizer( + String baseUrl, + String instruction, + + boolean vectorizeCollectionName, + List sourceProperties, + VectorIndex vectorIndex, + Quantization quantization) { + this.baseUrl = baseUrl; + this.instruction = instruction; + + this.vectorizeCollectionName = false; + this.sourceProperties = sourceProperties; + this.vectorIndex = vectorIndex; + this.quantization = quantization; + } + + public Text2VecDatabricksVectorizer(Builder builder) { + this( + builder.baseUrl, + builder.instruction, + + builder.vectorizeCollectionName, + builder.sourceProperties, + builder.vectorIndex, + builder.quantization); + } + + public static class Builder implements ObjectBuilder { + private final boolean vectorizeCollectionName = false; + private Quantization quantization; + private List sourceProperties = new ArrayList<>(); + private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + + private String baseUrl; + private String instruction; + + public Builder baseUrl(String baseUrl) { + this.baseUrl = baseUrl; + return this; + } + + public Builder instruction(String instruction) { + this.instruction = instruction; + return this; + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(String... properties) { + return sourceProperties(Arrays.asList(properties)); + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(List properties) { + this.sourceProperties.addAll(properties); + return this; + } + + /** + * Override default vector index configuration. + * + * HNSW + * is the default vector index. + */ + public Builder vectorIndex(VectorIndex vectorIndex) { + this.vectorIndex = vectorIndex; + return this; + } + + public Builder quantization(Quantization quantization) { + this.quantization = quantization; + return this; + } + + public Text2VecDatabricksVectorizer build() { + return new Text2VecDatabricksVectorizer(this); + } + } +} From 400f6c349bd8a013114960ce5bb900d54caf7aaf Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 27 Oct 2025 16:55:20 +0100 Subject: [PATCH 15/35] feat: add Azure OpenAI vectorizer --- .../v1/api/collections/VectorConfig.java | 5 + .../Text2VecAzureOpenAiVectorizer.java | 143 ++++++++++++++++++ .../vectorizers/Text2VecOpenAiVectorizer.java | 2 +- 3 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecAzureOpenAiVectorizer.java diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index d8e0e19b..baaf3bd6 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -41,6 +41,7 @@ public enum Kind implements JsonEnum { TEXT2VEC_MODEL2VEC("text2vec-model2vec"), TEXT2VEC_NVIDIA("text2vec-nvidia"), TEXT2VEC_OPENAI("text2vec-openai"), + TEXT2VEC_AZURE_OPENAI("text2vec-openai"), TEXT2VEC_OLLAMA("text2vec-ollama"), TEXT2VEC_TRANSFORMERS("text2vec-transformers"), TEXT2VEC_VOYAGEAI("text2vec-voyageai"), @@ -342,6 +343,10 @@ public VectorConfig read(JsonReader in) throws IOException { kind = concreteVectorizer.has("projectId") ? VectorConfig.Kind.TEXT2VEC_GOOGLE : VectorConfig.Kind.TEXT2VEC_GOOGLEAISTUDIO; + } else if (vectorizerName.equals(VectorConfig.Kind.TEXT2VEC_OPENAI.jsonValue())) { + kind = concreteVectorizer.has("deployementId") + ? VectorConfig.Kind.TEXT2VEC_AZURE_OPENAI + : VectorConfig.Kind.TEXT2VEC_OPENAI; } else { try { kind = VectorConfig.Kind.valueOfJson(vectorizerName); diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecAzureOpenAiVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecAzureOpenAiVectorizer.java new file mode 100644 index 00000000..121ad478 --- /dev/null +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecAzureOpenAiVectorizer.java @@ -0,0 +1,143 @@ +package io.weaviate.client6.v1.api.collections.vectorizers; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.function.Function; + +import com.google.gson.annotations.SerializedName; + +import io.weaviate.client6.v1.api.collections.Quantization; +import io.weaviate.client6.v1.api.collections.VectorConfig; +import io.weaviate.client6.v1.api.collections.VectorIndex; +import io.weaviate.client6.v1.internal.ObjectBuilder; + +public record Text2VecAzureOpenAiVectorizer( + @SerializedName("baseURL") String baseUrl, + @SerializedName("deploymentId") String deploymentId, + @SerializedName("resourceName") String resourceName, + + /** + * Weaviate defaults to {@code true} if the value is not provided. + * To avoid that we send "vectorizeClassName": false all the time + * and make it impossible to enable this feature, as it is deprecated. + */ + @Deprecated @SerializedName("vectorizeClassName") boolean vectorizeCollectionName, + /** Properties included in the embedding. */ + @SerializedName("sourceProperties") List sourceProperties, + /** Vector index configuration. */ + VectorIndex vectorIndex, + /** Vector quantization method. */ + Quantization quantization) implements VectorConfig { + + @Override + public VectorConfig.Kind _kind() { + return VectorConfig.Kind.TEXT2VEC_AZURE_OPENAI; + } + + @Override + public Object _self() { + return this; + } + + public static Text2VecAzureOpenAiVectorizer of() { + return of(ObjectBuilder.identity()); + } + + public static Text2VecAzureOpenAiVectorizer of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Canonical constructor always sets {@link #vectorizeCollectionName} to false. + */ + public Text2VecAzureOpenAiVectorizer( + String baseUrl, + String deploymentId, + String resourceName, + + boolean vectorizeCollectionName, + List sourceProperties, + VectorIndex vectorIndex, + Quantization quantization) { + this.baseUrl = baseUrl; + this.deploymentId = deploymentId; + this.resourceName = resourceName; + + this.vectorizeCollectionName = false; + this.sourceProperties = sourceProperties; + this.vectorIndex = vectorIndex; + this.quantization = quantization; + } + + public Text2VecAzureOpenAiVectorizer(Builder builder) { + this( + builder.baseUrl, + builder.deploymentId, + builder.resourceName, + + builder.vectorizeCollectionName, + builder.sourceProperties, + builder.vectorIndex, + builder.quantization); + } + + public static class Builder implements ObjectBuilder { + private final boolean vectorizeCollectionName = false; + private Quantization quantization; + private List sourceProperties = new ArrayList<>(); + private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + + private String baseUrl; + private String deploymentId; + private String resourceName; + + public Builder baseUrl(String baseUrl) { + this.baseUrl = baseUrl; + return this; + } + + public Builder deploymentId(String deploymentId) { + this.deploymentId = deploymentId; + return this; + } + + public Builder resourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(String... properties) { + return sourceProperties(Arrays.asList(properties)); + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(List properties) { + this.sourceProperties.addAll(properties); + return this; + } + + /** + * Override default vector index configuration. + * + * HNSW + * is the default vector index. + */ + public Builder vectorIndex(VectorIndex vectorIndex) { + this.vectorIndex = vectorIndex; + return this; + } + + public Builder quantization(Quantization quantization) { + this.quantization = quantization; + return this; + } + + public Text2VecAzureOpenAiVectorizer build() { + return new Text2VecAzureOpenAiVectorizer(this); + } + } +} diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecOpenAiVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecOpenAiVectorizer.java index a781fb21..12892d89 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecOpenAiVectorizer.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecOpenAiVectorizer.java @@ -13,7 +13,7 @@ import io.weaviate.client6.v1.internal.ObjectBuilder; public record Text2VecOpenAiVectorizer( - @SerializedName("baseUrl") String baseUrl, + @SerializedName("baseURL") String baseUrl, @SerializedName("model") String model, @SerializedName("modelVersion") String modelVersion, @SerializedName("dimensions") Integer dimensions, From b74ac15b4ec17fe1f784c8f12bb5aed23ae22aed Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 27 Oct 2025 16:59:32 +0100 Subject: [PATCH 16/35] feat: add ref2vec-centroid vectorizer --- .../v1/api/collections/VectorConfig.java | 1 + .../Ref2VecCentroidVectorizer.java | 115 ++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Ref2VecCentroidVectorizer.java diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index baaf3bd6..7636fc7a 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -34,6 +34,7 @@ public enum Kind implements JsonEnum { TEXT2VEC_GOOGLE("text2vec-google"), TEXT2VEC_GOOGLEAISTUDIO("text2vec-google"), TEXT2VEC_HUGGINGFACE("text2vec-huggingface"), + REF2VEC_CENTROID("text2vec-huggingface"), TEXT2VEC_JINAAI("text2vec-jinaai"), TEXT2MULTIVEC_JINAAI("text2multivec-jinaai"), TEXT2VEC_MISTRAL("text2vec-mistral"), diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Ref2VecCentroidVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Ref2VecCentroidVectorizer.java new file mode 100644 index 00000000..f5384796 --- /dev/null +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Ref2VecCentroidVectorizer.java @@ -0,0 +1,115 @@ +package io.weaviate.client6.v1.api.collections.vectorizers; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.function.Function; + +import com.google.gson.annotations.SerializedName; + +import io.weaviate.client6.v1.api.collections.Quantization; +import io.weaviate.client6.v1.api.collections.VectorConfig; +import io.weaviate.client6.v1.api.collections.VectorIndex; +import io.weaviate.client6.v1.internal.ObjectBuilder; + +public record Ref2VecCentroidVectorizer( + @SerializedName("referenceProperties") List referenceProperties, + @SerializedName("method") Method method, + + /** Properties included in the embedding. */ + @SerializedName("sourceProperties") List sourceProperties, + /** Vector index configuration. */ + VectorIndex vectorIndex, + /** Vector quantization method. */ + Quantization quantization) implements VectorConfig { + + @Override + public VectorConfig.Kind _kind() { + return VectorConfig.Kind.REF2VEC_CENTROID; + } + + @Override + public Object _self() { + return this; + } + + public enum Method { + @SerializedName("MEAN") + MEAN; + } + + public static Ref2VecCentroidVectorizer of() { + return of(ObjectBuilder.identity()); + } + + public static Ref2VecCentroidVectorizer of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + public Ref2VecCentroidVectorizer(Builder builder) { + this( + builder.referenceProperties, + builder.method, + builder.sourceProperties, + builder.vectorIndex, + builder.quantization); + } + + public static class Builder implements ObjectBuilder { + private Quantization quantization; + private List sourceProperties = new ArrayList<>(); + private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + + private List referenceProperties = new ArrayList<>(); + private Method method = Method.MEAN; + + /** Add properties to include in the embedding. */ + public Builder referenceProperties(String... properties) { + return referenceProperties(Arrays.asList(properties)); + } + + /** Add properties to include in the embedding. */ + public Builder referenceProperties(List properties) { + this.referenceProperties.addAll(properties); + return this; + } + + public Builder method(Method method) { + this.method = method; + return this; + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(String... properties) { + return sourceProperties(Arrays.asList(properties)); + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(List properties) { + this.sourceProperties.addAll(properties); + return this; + } + + /** + * Override default vector index configuration. + * + * HNSW + * is the default vector index. + */ + public Builder vectorIndex(VectorIndex vectorIndex) { + this.vectorIndex = vectorIndex; + return this; + } + + public Builder quantization(Quantization quantization) { + this.quantization = quantization; + return this; + } + + public Ref2VecCentroidVectorizer build() { + return new Ref2VecCentroidVectorizer(this); + } + } +} From ba4713578a536c220dbb174a2d09d029db9023bf Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 27 Oct 2025 17:00:18 +0100 Subject: [PATCH 17/35] fix: remove sourceProperties from ref2vec --- .../vectorizers/Ref2VecCentroidVectorizer.java | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Ref2VecCentroidVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Ref2VecCentroidVectorizer.java index f5384796..1ff22d9d 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Ref2VecCentroidVectorizer.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Ref2VecCentroidVectorizer.java @@ -16,8 +16,6 @@ public record Ref2VecCentroidVectorizer( @SerializedName("referenceProperties") List referenceProperties, @SerializedName("method") Method method, - /** Properties included in the embedding. */ - @SerializedName("sourceProperties") List sourceProperties, /** Vector index configuration. */ VectorIndex vectorIndex, /** Vector quantization method. */ @@ -51,14 +49,12 @@ public Ref2VecCentroidVectorizer(Builder builder) { this( builder.referenceProperties, builder.method, - builder.sourceProperties, builder.vectorIndex, builder.quantization); } public static class Builder implements ObjectBuilder { private Quantization quantization; - private List sourceProperties = new ArrayList<>(); private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; private List referenceProperties = new ArrayList<>(); @@ -80,17 +76,6 @@ public Builder method(Method method) { return this; } - /** Add properties to include in the embedding. */ - public Builder sourceProperties(String... properties) { - return sourceProperties(Arrays.asList(properties)); - } - - /** Add properties to include in the embedding. */ - public Builder sourceProperties(List properties) { - this.sourceProperties.addAll(properties); - return this; - } - /** * Override default vector index configuration. * From fa87e9e0478a6ea44ae8165ae0a0ea09d221f9ff Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 27 Oct 2025 17:11:14 +0100 Subject: [PATCH 18/35] chore: add AWS vectorizer module --- .../v1/api/collections/VectorConfig.java | 1 + .../vectorizers/Text2VecAwsVectorizer.java | 204 ++++++++++++++++++ 2 files changed, 205 insertions(+) create mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecAwsVectorizer.java diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index 7636fc7a..979e15f2 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -28,6 +28,7 @@ public interface VectorConfig extends TaggedUnion { public enum Kind implements JsonEnum { NONE("none"), IMG2VEC_NEURAL("img2vec-neural"), + TEXT2VEC_AWS("text2vec-aws"), TEXT2VEC_CONTEXTIONARY("text2vec-contextionary"), TEXT2VEC_COHERE("text2vec-cohere"), TEXT2VEC_DATABRICKS("text2vec-databricks"), diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecAwsVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecAwsVectorizer.java new file mode 100644 index 00000000..0596bdd6 --- /dev/null +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecAwsVectorizer.java @@ -0,0 +1,204 @@ +package io.weaviate.client6.v1.api.collections.vectorizers; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.function.Function; + +import com.google.gson.annotations.SerializedName; + +import io.weaviate.client6.v1.api.collections.Quantization; +import io.weaviate.client6.v1.api.collections.VectorConfig; +import io.weaviate.client6.v1.api.collections.VectorIndex; +import io.weaviate.client6.v1.internal.ObjectBuilder; + +public record Text2VecAwsVectorizer( + @SerializedName("endpoint") String baseUrl, + @SerializedName("model") String model, + @SerializedName("region") String region, + @SerializedName("service") Service service, + + /** + * Weaviate defaults to {@code true} if the value is not provided. + * To avoid that we send "vectorizeClassName": false all the time + * and make it impossible to enable this feature, as it is deprecated. + */ + @Deprecated @SerializedName("vectorizeClassName") boolean vectorizeCollectionName, + /** Properties included in the embedding. */ + @SerializedName("sourceProperties") List sourceProperties, + /** Vector index configuration. */ + VectorIndex vectorIndex, + /** Vector quantization method. */ + Quantization quantization) implements VectorConfig { + + @Override + public VectorConfig.Kind _kind() { + return VectorConfig.Kind.TEXT2VEC_AWS; + } + + @Override + public Object _self() { + return this; + } + + public enum Service { + @SerializedName("BEDROCK") + BEDROCK, + @SerializedName("SAGEMAKER") + SAGEMAKER; + } + + public static final String AMAZON_TITAN_EMBED_TEXT_V1 = "amazon.titan-embed-text-v1"; + public static final String COHERE_EMBED_ENGLISH_V3 = "cohere.embed-english-v3"; + public static final String COHERE_EMBED_MULTILINGUAL_V3 = "cohere.embed-multilingual-v3"; + + public static Text2VecAwsVectorizer bedrock(String model) { + return bedrock(model, ObjectBuilder.identity()); + } + + public static Text2VecAwsVectorizer bedrock( + String model, + Function> fn) { + return fn.apply(new BedrockBuilder(model)).build(); + } + + public static Text2VecAwsVectorizer sagemaker(String baseUrl) { + return sagemaker(baseUrl, ObjectBuilder.identity()); + } + + public static Text2VecAwsVectorizer sagemaker( + String baseUrl, + Function> fn) { + return fn.apply(new SagemakerBuilder(baseUrl)).build(); + } + + /** + * Canonical constructor always sets {@link #vectorizeCollectionName} to false. + */ + public Text2VecAwsVectorizer( + String baseUrl, + String model, + String region, + Service service, + + boolean vectorizeCollectionName, + List sourceProperties, + VectorIndex vectorIndex, + Quantization quantization) { + this.baseUrl = baseUrl; + this.model = model; + this.region = region; + this.service = service; + + this.vectorizeCollectionName = false; + this.sourceProperties = sourceProperties; + this.vectorIndex = vectorIndex; + this.quantization = quantization; + } + + public Text2VecAwsVectorizer(Builder builder) { + this( + builder.baseUrl, + builder.model, + builder.region, + builder.service, + + builder.vectorizeCollectionName, + builder.sourceProperties, + builder.vectorIndex, + builder.quantization); + } + + private abstract static class Builder implements ObjectBuilder { + private final boolean vectorizeCollectionName = false; + private Quantization quantization; + private List sourceProperties = new ArrayList<>(); + private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + + private String baseUrl; + private String model; + private String region; + private Service service; + + /** Required for {@link Service#SAGEMAKER}. */ + protected Builder baseUrl(String baseUrl) { + this.baseUrl = baseUrl; + return this; + } + + /** Required for {@link Service#BEDROCK}. */ + protected Builder model(String model) { + this.model = model; + return this; + } + + public Builder region(String region) { + this.region = region; + return this; + } + + public Builder service(Service service) { + this.service = service; + return this; + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(String... properties) { + return sourceProperties(Arrays.asList(properties)); + } + + /** Add properties to include in the embedding. */ + public Builder sourceProperties(List properties) { + this.sourceProperties.addAll(properties); + return this; + } + + /** + * Override default vector index configuration. + * + * HNSW + * is the default vector index. + */ + public Builder vectorIndex(VectorIndex vectorIndex) { + this.vectorIndex = vectorIndex; + return this; + } + + public Builder quantization(Quantization quantization) { + this.quantization = quantization; + return this; + } + + public Text2VecAwsVectorizer build() { + return new Text2VecAwsVectorizer(this); + } + } + + public static class BedrockBuilder extends Builder { + public BedrockBuilder(String model) { + super(); + super.service(Service.BEDROCK); + super.model(model); + } + + @Override + /** Required for {@link Service#BEDROCK}. */ + public Builder model(String model) { + return super.model(model); + } + } + + public static class SagemakerBuilder extends Builder { + public SagemakerBuilder(String baseUrl) { + super(); + super.service(Service.SAGEMAKER); + super.baseUrl(baseUrl); + } + + /** Required for {@link Service#SAGEMAKER}. */ + protected Builder baseUrl(String baseUrl) { + return super.baseUrl(baseUrl); + } + } +} From 20be1f3f4610d4fb434f13e5fb1f5adefa182efa Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 27 Oct 2025 17:24:09 +0100 Subject: [PATCH 19/35] feat: multi2vec-aws module --- .../v1/api/collections/VectorConfig.java | 1 + .../vectorizers/Img2VecNeuralVectorizer.java | 3 +- .../vectorizers/Multi2VecAwsVectorizer.java | 168 ++++++++++++++++++ .../vectorizers/Multi2VecClipVectorizer.java | 18 +- 4 files changed, 181 insertions(+), 9 deletions(-) create mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecAwsVectorizer.java diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index 979e15f2..d3f9252a 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -48,6 +48,7 @@ public enum Kind implements JsonEnum { TEXT2VEC_TRANSFORMERS("text2vec-transformers"), TEXT2VEC_VOYAGEAI("text2vec-voyageai"), TEXT2VEC_WEAVIATE("text2vec-weaviate"), + MULTI2VEC_AWS("multi2vec-aws"), MULTI2VEC_CLIP("multi2vec-clip"); private static final Map jsonValueMap = JsonEnum.collectNames(Kind.values()); diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Img2VecNeuralVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Img2VecNeuralVectorizer.java index c5611ef1..12467d28 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Img2VecNeuralVectorizer.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Img2VecNeuralVectorizer.java @@ -44,9 +44,10 @@ public Img2VecNeuralVectorizer(Builder builder) { public static class Builder implements ObjectBuilder { private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; - private List imageFields = new ArrayList<>(); private Quantization quantization; + private List imageFields = new ArrayList<>(); + /** Add BLOB properties to include in the embedding. */ public Builder imageFields(List fields) { this.imageFields = fields; diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecAwsVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecAwsVectorizer.java new file mode 100644 index 00000000..ea39fe33 --- /dev/null +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecAwsVectorizer.java @@ -0,0 +1,168 @@ +package io.weaviate.client6.v1.api.collections.vectorizers; + +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Function; + +import com.google.gson.annotations.SerializedName; + +import io.weaviate.client6.v1.api.collections.Quantization; +import io.weaviate.client6.v1.api.collections.VectorConfig; +import io.weaviate.client6.v1.api.collections.VectorIndex; +import io.weaviate.client6.v1.internal.ObjectBuilder; + +public record Multi2VecAwsVectorizer( + @SerializedName("model") String model, + @SerializedName("dimensions") Integer dimensions, + @SerializedName("region") String region, + /** BLOB properties included in the embedding. */ + @SerializedName("imageFields") List imageFields, + /** TEXT properties included in the embedding. */ + @SerializedName("textFields") List textFields, + /** Weights of the included properties. */ + @SerializedName("weights") Weights weights, + /** Vector index configuration. */ + VectorIndex vectorIndex, + /** Vector quantization method. */ + Quantization quantization) implements VectorConfig { + + private static record Weights( + /** + * Weights of the BLOB properties. Values appear in the same order as the + * corresponding property names in {@code imageFields}. + */ + @SerializedName("imageWeights") List imageWeights, + /** + * Weights of the TEXT properties. Values appear in the same order as the + * corresponding property names in {@code textFields}. + */ + @SerializedName("textWeights") List textWeights) { + } + + @Override + public VectorConfig.Kind _kind() { + return VectorConfig.Kind.MULTI2VEC_AWS; + } + + @Override + public Object _self() { + return this; + } + + public static Multi2VecAwsVectorizer of() { + return of(ObjectBuilder.identity()); + } + + public static Multi2VecAwsVectorizer of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + public Multi2VecAwsVectorizer(Builder builder) { + this( + builder.model, + builder.dimensions, + builder.region, + builder.imageFields.keySet().stream().toList(), + builder.textFields.keySet().stream().toList(), + new Weights( + builder.imageFields.values().stream().toList(), + builder.textFields.values().stream().toList()), + builder.vectorIndex, + builder.quantization); + } + + public static class Builder implements ObjectBuilder { + private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + private Quantization quantization; + + private Map imageFields = new LinkedHashMap<>(); + private Map textFields = new LinkedHashMap<>(); + + private String model; + private Integer dimensions; + private String region; + + public Builder model(String model) { + this.model = model; + return this; + } + + public Builder dimensions(int dimensions) { + this.dimensions = dimensions; + return this; + } + + public Builder region(String region) { + this.region = region; + return this; + } + + /** Add BLOB properties to include in the embedding. */ + public Builder imageFields(List fields) { + fields.forEach(field -> imageFields.put(field, null)); + return this; + } + + /** Add BLOB properties to include in the embedding. */ + public Builder imageFields(String... fields) { + return imageFields(Arrays.asList(fields)); + } + + /** + * Add BLOB property to include in the embedding. + * + * @param field Property name. + * @param weight Custom weight between 0.0 and 1.0. + */ + public Builder imageField(String field, float weight) { + imageFields.put(field, weight); + return this; + } + + /** Add TEXT properties to include in the embedding. */ + public Builder textFields(List fields) { + fields.forEach(field -> textFields.put(field, null)); + return this; + } + + /** Add TEXT properties to include in the embedding. */ + public Builder textFields(String... fields) { + return textFields(Arrays.asList(fields)); + } + + /** + * Add TEXT property to include in the embedding. + * + * @param field Property name. + * @param weight Custom weight between 0.0 and 1.0. + */ + public Builder textField(String field, float weight) { + textFields.put(field, weight); + return this; + } + + /** + * Override default vector index configuration. + * + * HNSW + * is the default vector index. + */ + public Builder vectorIndex(VectorIndex vectorIndex) { + this.vectorIndex = vectorIndex; + return this; + } + + public Builder quantization(Quantization quantization) { + this.quantization = quantization; + return this; + } + + @Override + public Multi2VecAwsVectorizer build() { + return new Multi2VecAwsVectorizer(this); + } + } +} diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecClipVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecClipVectorizer.java index 07ccfb0e..036f77a4 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecClipVectorizer.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecClipVectorizer.java @@ -1,7 +1,7 @@ package io.weaviate.client6.v1.api.collections.vectorizers; import java.util.Arrays; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.function.Function; @@ -15,7 +15,7 @@ public record Multi2VecClipVectorizer( /** Base URL of the embedding service. */ - @SerializedName("inferenceUrl") String inferenceUrl, + @SerializedName("inferenceUrl") String baseUrl, /** BLOB properties included in the embedding. */ @SerializedName("imageFields") List imageFields, /** TEXT properties included in the embedding. */ @@ -60,7 +60,7 @@ public static Multi2VecClipVectorizer of(Function { private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; private Quantization quantization; - private String inferenceUrl; - private Map imageFields = new HashMap<>(); - private Map textFields = new HashMap<>(); + + private Map imageFields = new LinkedHashMap<>(); + private Map textFields = new LinkedHashMap<>(); + + private String baseUrl; /** Set base URL of the embedding service. */ - public Builder inferenceUrl(String inferenceUrl) { - this.inferenceUrl = inferenceUrl; + public Builder baseUrl(String baseUrl) { + this.baseUrl = baseUrl; return this; } From e7227b94657032bef486c788f2ca747fda97e798 Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 27 Oct 2025 17:37:56 +0100 Subject: [PATCH 20/35] feat: muli2vec-nvidia module --- .../v1/api/collections/VectorConfig.java | 2 + .../Multi2VecNvidiaVectorizer.java | 180 ++++++++++++++++++ 2 files changed, 182 insertions(+) create mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecNvidiaVectorizer.java diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index d3f9252a..e4c33005 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -49,6 +49,8 @@ public enum Kind implements JsonEnum { TEXT2VEC_VOYAGEAI("text2vec-voyageai"), TEXT2VEC_WEAVIATE("text2vec-weaviate"), MULTI2VEC_AWS("multi2vec-aws"), + MULTI2VEC_COHERE("multi2vec-cohere"), + MULTI2VEC_NVIDIA("multi2vec-nvidia"), MULTI2VEC_CLIP("multi2vec-clip"); private static final Map jsonValueMap = JsonEnum.collectNames(Kind.values()); diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecNvidiaVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecNvidiaVectorizer.java new file mode 100644 index 00000000..29dcc959 --- /dev/null +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecNvidiaVectorizer.java @@ -0,0 +1,180 @@ +package io.weaviate.client6.v1.api.collections.vectorizers; + +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Function; + +import com.google.gson.annotations.SerializedName; + +import io.weaviate.client6.v1.api.collections.Quantization; +import io.weaviate.client6.v1.api.collections.VectorConfig; +import io.weaviate.client6.v1.api.collections.VectorIndex; +import io.weaviate.client6.v1.internal.ObjectBuilder; + +public record Multi2VecNvidiaVectorizer( + /** Base URL of the embedding service. */ + @SerializedName("baseURL") String baseUrl, + /** Inference model to use. */ + @SerializedName("model") String model, + /** Whether to apply truncation. */ + @SerializedName("truncate") Boolean truncate, + @SerializedName("output_encoding") String outputEncoding, + /** BLOB properties included in the embedding. */ + @SerializedName("imageFields") List imageFields, + /** TEXT properties included in the embedding. */ + @SerializedName("textFields") List textFields, + /** Weights of the included properties. */ + @SerializedName("weights") Weights weights, + /** Vector index configuration. */ + VectorIndex vectorIndex, + /** Vector quantization method. */ + Quantization quantization) implements VectorConfig { + + private static record Weights( + /** + * Weights of the BLOB properties. Values appear in the same order as the + * corresponding property names in {@code imageFields}. + */ + @SerializedName("imageWeights") List imageWeights, + /** + * Weights of the TEXT properties. Values appear in the same order as the + * corresponding property names in {@code textFields}. + */ + @SerializedName("textWeights") List textWeights) { + } + + @Override + public VectorConfig.Kind _kind() { + return VectorConfig.Kind.MULTI2VEC_NVIDIA; + } + + @Override + public Object _self() { + return this; + } + + public static Multi2VecNvidiaVectorizer of() { + return of(ObjectBuilder.identity()); + } + + public static Multi2VecNvidiaVectorizer of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + public Multi2VecNvidiaVectorizer(Builder builder) { + this( + builder.baseUrl, + builder.model, + builder.truncate, + builder.outputEncoding, + builder.imageFields.keySet().stream().toList(), + builder.textFields.keySet().stream().toList(), + new Weights( + builder.imageFields.values().stream().toList(), + builder.textFields.values().stream().toList()), + builder.vectorIndex, + builder.quantization); + } + + public static class Builder implements ObjectBuilder { + private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + private Quantization quantization; + + private Map imageFields = new LinkedHashMap<>(); + private Map textFields = new LinkedHashMap<>(); + + private String baseUrl; + private String model; + private Boolean truncate; + private String outputEncoding; + + /** Set base URL of the embedding service. */ + public Builder baseUrl(String baseUrl) { + this.baseUrl = baseUrl; + return this; + } + + public Builder model(String model) { + this.model = model; + return this; + } + + public Builder truncate(Boolean truncate) { + this.truncate = truncate; + return this; + } + + public Builder outputEncoding(String outputEncoding) { + this.outputEncoding = outputEncoding; + return this; + } + + /** Add BLOB properties to include in the embedding. */ + public Builder imageFields(List fields) { + fields.forEach(field -> imageFields.put(field, null)); + return this; + } + + /** Add BLOB properties to include in the embedding. */ + public Builder imageFields(String... fields) { + return imageFields(Arrays.asList(fields)); + } + + /** + * Add BLOB property to include in the embedding. + * + * @param field Property name. + * @param weight Custom weight between 0.0 and 1.0. + */ + public Builder imageField(String field, float weight) { + imageFields.put(field, weight); + return this; + } + + /** Add TEXT properties to include in the embedding. */ + public Builder textFields(List fields) { + fields.forEach(field -> textFields.put(field, null)); + return this; + } + + /** Add TEXT properties to include in the embedding. */ + public Builder textFields(String... fields) { + return textFields(Arrays.asList(fields)); + } + + /** + * Add TEXT property to include in the embedding. + * + * @param field Property name. + * @param weight Custom weight between 0.0 and 1.0. + */ + public Builder textField(String field, float weight) { + textFields.put(field, weight); + return this; + } + + /** + * Override default vector index configuration. + * + * HNSW + * is the default vector index. + */ + public Builder vectorIndex(VectorIndex vectorIndex) { + this.vectorIndex = vectorIndex; + return this; + } + + public Builder quantization(Quantization quantization) { + this.quantization = quantization; + return this; + } + + @Override + public Multi2VecNvidiaVectorizer build() { + return new Multi2VecNvidiaVectorizer(this); + } + } +} From cd473bcf927808ef82f1ec846fc6b52ed188baae Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 27 Oct 2025 17:38:15 +0100 Subject: [PATCH 21/35] feat: add multi2vec-cohere module --- .../Multi2VecCohereVectorizer.java | 201 ++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecCohereVectorizer.java diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecCohereVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecCohereVectorizer.java new file mode 100644 index 00000000..c6e0baee --- /dev/null +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecCohereVectorizer.java @@ -0,0 +1,201 @@ +package io.weaviate.client6.v1.api.collections.vectorizers; + +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Function; + +import com.google.gson.annotations.SerializedName; + +import io.weaviate.client6.v1.api.collections.Quantization; +import io.weaviate.client6.v1.api.collections.VectorConfig; +import io.weaviate.client6.v1.api.collections.VectorIndex; +import io.weaviate.client6.v1.internal.ObjectBuilder; + +public record Multi2VecCohereVectorizer( + /** Base URL of the embedding service. */ + @SerializedName("baseURL") String baseUrl, + /** Inference model to use. */ + @SerializedName("model") String model, + /** The truncate strategy to use. */ + @SerializedName("truncate") String truncate, + /** BLOB properties included in the embedding. */ + @SerializedName("imageFields") List imageFields, + /** TEXT properties included in the embedding. */ + @SerializedName("textFields") List textFields, + /** Weights of the included properties. */ + @SerializedName("weights") Weights weights, + /** + * Weaviate defaults to {@code true} if the value is not provided. + * To avoid that we send "vectorizeClassName": false all the time + * and make it impossible to enable this feature, as it is deprecated. + */ + @Deprecated @SerializedName("vectorizeClassName") boolean vectorizeCollectionName, + /** Vector index configuration. */ + VectorIndex vectorIndex, + /** Vector quantization method. */ + Quantization quantization) implements VectorConfig { + + private static record Weights( + /** + * Weights of the BLOB properties. Values appear in the same order as the + * corresponding property names in {@code imageFields}. + */ + @SerializedName("imageWeights") List imageWeights, + /** + * Weights of the TEXT properties. Values appear in the same order as the + * corresponding property names in {@code textFields}. + */ + @SerializedName("textWeights") List textWeights) { + } + + @Override + public VectorConfig.Kind _kind() { + return VectorConfig.Kind.MULTI2VEC_COHERE; + } + + @Override + public Object _self() { + return this; + } + + public static Multi2VecCohereVectorizer of() { + return of(ObjectBuilder.identity()); + } + + public static Multi2VecCohereVectorizer of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + public Multi2VecCohereVectorizer( + String baseUrl, + String model, + String truncate, + List imageFields, + List textFields, + Weights weights, + boolean vectorizeCollectionName, + VectorIndex vectorIndex, + Quantization quantization) { + this.vectorizeCollectionName = false; + this.baseUrl = baseUrl; + this.model = model; + this.truncate = truncate; + this.imageFields = imageFields; + this.textFields = textFields; + this.weights = weights; + this.vectorIndex = vectorIndex; + this.quantization = quantization; + } + + public Multi2VecCohereVectorizer(Builder builder) { + this( + builder.baseUrl, + builder.model, + builder.truncate, + builder.imageFields.keySet().stream().toList(), + builder.textFields.keySet().stream().toList(), + new Weights( + builder.imageFields.values().stream().toList(), + builder.textFields.values().stream().toList()), + builder.vectorizeCollectionName, + builder.vectorIndex, + builder.quantization); + } + + public static class Builder implements ObjectBuilder { + private final boolean vectorizeCollectionName = false; + private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + private Quantization quantization; + + private Map imageFields = new LinkedHashMap<>(); + private Map textFields = new LinkedHashMap<>(); + + private String baseUrl; + private String model; + private String truncate; + + /** Set base URL of the embedding service. */ + public Builder baseUrl(String baseUrl) { + this.baseUrl = baseUrl; + return this; + } + + public Builder model(String model) { + this.model = model; + return this; + } + + public Builder truncate(String truncate) { + this.truncate = truncate; + return this; + } + + /** Add BLOB properties to include in the embedding. */ + public Builder imageFields(List fields) { + fields.forEach(field -> imageFields.put(field, null)); + return this; + } + + /** Add BLOB properties to include in the embedding. */ + public Builder imageFields(String... fields) { + return imageFields(Arrays.asList(fields)); + } + + /** + * Add BLOB property to include in the embedding. + * + * @param field Property name. + * @param weight Custom weight between 0.0 and 1.0. + */ + public Builder imageField(String field, float weight) { + imageFields.put(field, weight); + return this; + } + + /** Add TEXT properties to include in the embedding. */ + public Builder textFields(List fields) { + fields.forEach(field -> textFields.put(field, null)); + return this; + } + + /** Add TEXT properties to include in the embedding. */ + public Builder textFields(String... fields) { + return textFields(Arrays.asList(fields)); + } + + /** + * Add TEXT property to include in the embedding. + * + * @param field Property name. + * @param weight Custom weight between 0.0 and 1.0. + */ + public Builder textField(String field, float weight) { + textFields.put(field, weight); + return this; + } + + /** + * Override default vector index configuration. + * + * HNSW + * is the default vector index. + */ + public Builder vectorIndex(VectorIndex vectorIndex) { + this.vectorIndex = vectorIndex; + return this; + } + + public Builder quantization(Quantization quantization) { + this.quantization = quantization; + return this; + } + + @Override + public Multi2VecCohereVectorizer build() { + return new Multi2VecCohereVectorizer(this); + } + } +} From 21dc2e58af59cd35effc75d160b7cbb0ed2424ed Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 27 Oct 2025 17:54:27 +0100 Subject: [PATCH 22/35] feat: add multi2multivec-jinaai and multi2vec-bind vectorizer modules --- .../v1/api/collections/VectorConfig.java | 8 +- .../Multi2MultiVecJinaAiVectorizer.java | 102 ++++++ .../vectorizers/Multi2VecBindVectorizer.java | 338 ++++++++++++++++++ 3 files changed, 445 insertions(+), 3 deletions(-) create mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2MultiVecJinaAiVectorizer.java create mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecBindVectorizer.java diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index e4c33005..efa0e46f 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -27,7 +27,6 @@ public interface VectorConfig extends TaggedUnion { public enum Kind implements JsonEnum { NONE("none"), - IMG2VEC_NEURAL("img2vec-neural"), TEXT2VEC_AWS("text2vec-aws"), TEXT2VEC_CONTEXTIONARY("text2vec-contextionary"), TEXT2VEC_COHERE("text2vec-cohere"), @@ -37,7 +36,6 @@ public enum Kind implements JsonEnum { TEXT2VEC_HUGGINGFACE("text2vec-huggingface"), REF2VEC_CENTROID("text2vec-huggingface"), TEXT2VEC_JINAAI("text2vec-jinaai"), - TEXT2MULTIVEC_JINAAI("text2multivec-jinaai"), TEXT2VEC_MISTRAL("text2vec-mistral"), TEXT2VEC_MORPH("text2vec-morph"), TEXT2VEC_MODEL2VEC("text2vec-model2vec"), @@ -48,10 +46,14 @@ public enum Kind implements JsonEnum { TEXT2VEC_TRANSFORMERS("text2vec-transformers"), TEXT2VEC_VOYAGEAI("text2vec-voyageai"), TEXT2VEC_WEAVIATE("text2vec-weaviate"), + IMG2VEC_NEURAL("img2vec-neural"), MULTI2VEC_AWS("multi2vec-aws"), + MULTI2VEC_BIND("multi2vec-bind"), MULTI2VEC_COHERE("multi2vec-cohere"), MULTI2VEC_NVIDIA("multi2vec-nvidia"), - MULTI2VEC_CLIP("multi2vec-clip"); + MULTI2VEC_CLIP("multi2vec-clip"), + TEXT2MULTIVEC_JINAAI("text2multivec-jinaai"), + MULTI2MULTIVEC_JINAAI("multi2multivec-jinaai"); private static final Map jsonValueMap = JsonEnum.collectNames(Kind.values()); private final String jsonValue; diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2MultiVecJinaAiVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2MultiVecJinaAiVectorizer.java new file mode 100644 index 00000000..a4daa8a7 --- /dev/null +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2MultiVecJinaAiVectorizer.java @@ -0,0 +1,102 @@ +package io.weaviate.client6.v1.api.collections.vectorizers; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.function.Function; + +import com.google.gson.annotations.SerializedName; + +import io.weaviate.client6.v1.api.collections.Quantization; +import io.weaviate.client6.v1.api.collections.VectorConfig; +import io.weaviate.client6.v1.api.collections.VectorIndex; +import io.weaviate.client6.v1.internal.ObjectBuilder; + +public record Multi2MultiVecJinaAiVectorizer( + /** BLOB properties included in the embedding. */ + @SerializedName("imageFields") List imageFields, + /** TEXT properties included in the embedding. */ + @SerializedName("textFields") List textFields, + /** Vector index configuration. */ + VectorIndex vectorIndex, + /** Vector quantization method. */ + Quantization quantization) implements VectorConfig { + + @Override + public VectorConfig.Kind _kind() { + return VectorConfig.Kind.MULTI2MULTIVEC_JINAAI; + } + + @Override + public Object _self() { + return this; + } + + public static Multi2MultiVecJinaAiVectorizer of() { + return of(ObjectBuilder.identity()); + } + + public static Multi2MultiVecJinaAiVectorizer of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + public Multi2MultiVecJinaAiVectorizer(Builder builder) { + this( + builder.imageFields, + builder.textFields, + builder.vectorIndex, + builder.quantization); + } + + public static class Builder implements ObjectBuilder { + private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + private Quantization quantization; + + private final List imageFields = new ArrayList<>(); + private final List textFields = new ArrayList<>(); + + /** Add BLOB properties to include in the embedding. */ + public Builder imageFields(List fields) { + imageFields.addAll(fields); + return this; + } + + /** Add BLOB properties to include in the embedding. */ + public Builder imageFields(String... fields) { + return imageFields(Arrays.asList(fields)); + } + + /** Add TEXT properties to include in the embedding. */ + public Builder textFields(List fields) { + textFields.addAll(fields); + return this; + } + + /** Add TEXT properties to include in the embedding. */ + public Builder textFields(String... fields) { + return textFields(Arrays.asList(fields)); + } + + /** + * Override default vector index configuration. + * + * HNSW + * is the default vector index. + */ + public Builder vectorIndex(VectorIndex vectorIndex) { + this.vectorIndex = vectorIndex; + return this; + } + + public Builder quantization(Quantization quantization) { + this.quantization = quantization; + return this; + } + + @Override + public Multi2MultiVecJinaAiVectorizer build() { + return new Multi2MultiVecJinaAiVectorizer(this); + } + } +} diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecBindVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecBindVectorizer.java new file mode 100644 index 00000000..22e74962 --- /dev/null +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecBindVectorizer.java @@ -0,0 +1,338 @@ +package io.weaviate.client6.v1.api.collections.vectorizers; + +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Function; + +import com.google.gson.annotations.SerializedName; + +import io.weaviate.client6.v1.api.collections.Quantization; +import io.weaviate.client6.v1.api.collections.VectorConfig; +import io.weaviate.client6.v1.api.collections.VectorIndex; +import io.weaviate.client6.v1.internal.ObjectBuilder; + +public record Multi2VecBindVectorizer( + /** BLOB image properties included in the embedding. */ + @SerializedName("imageFields") List imageFields, + /** BLOB audio properties included in the embedding. */ + @SerializedName("audioFields") List audioFields, + /** BLOB video properties included in the embedding. */ + @SerializedName("videoFields") List videoFields, + /** BLOB depth properties included in the embedding. */ + @SerializedName("depthFields") List depthFields, + /** BLOB thermal properties included in the embedding. */ + @SerializedName("thermalFields") List thermalFields, + /** BLOB IMU properties included in the embedding. */ + @SerializedName("imuFields") List imuFields, + /** TEXT properties included in the embedding. */ + @SerializedName("textFields") List textFields, + /** Weights of the included properties. */ + @SerializedName("weights") Weights weights, + /** + * Weaviate defaults to {@code true} if the value is not provided. + * To avoid that we send "vectorizeClassName": false all the time + * and make it impossible to enable this feature, as it is deprecated. + */ + @Deprecated @SerializedName("vectorizeClassName") boolean vectorizeCollectionName, + /** Vector index configuration. */ + VectorIndex vectorIndex, + /** Vector quantization method. */ + Quantization quantization) implements VectorConfig { + + private static record Weights( + /** + * Weights of the BLOB image properties. Values appear in the same order as the + * corresponding property names in {@code imageFields}. + */ + @SerializedName("imageWeights") List imageWeights, + /** + * Weights of the BLOB audio properties. Values appear in the same order as the + * corresponding property names in {@code audioFields}. + */ + @SerializedName("audioWeights") List audioWeights, + /** + * Weights of the BLOB video properties. Values appear in the same order as the + * corresponding property names in {@code videoFields}. + */ + @SerializedName("videoWeights") List videoWeights, + /** + * Weights of the BLOB depth properties. Values appear in the same order as the + * corresponding property names in {@code depthFields}. + */ + @SerializedName("depthWeights") List depthWeights, + /** + * Weights of the BLOB thermal properties. Values appear in the same order as + * the + * corresponding property names in {@code thermalFields}. + */ + @SerializedName("thermalWeights") List thermalWeights, + /** + * Weights of the BLOB IMU properties. Values appear in the same order as the + * corresponding property names in {@code imuFields}. + */ + @SerializedName("imuWeights") List imuWeights, + /** + * Weights of the TEXT properties. Values appear in the same order as the + * corresponding property names in {@code textFields}. + */ + @SerializedName("textWeights") List textWeights) { + } + + @Override + public VectorConfig.Kind _kind() { + return VectorConfig.Kind.MULTI2VEC_COHERE; + } + + @Override + public Object _self() { + return this; + } + + public static Multi2VecBindVectorizer of() { + return of(ObjectBuilder.identity()); + } + + public static Multi2VecBindVectorizer of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + public Multi2VecBindVectorizer( + List imageFields, + List audioFields, + List videoFields, + List depthFields, + List thermalFields, + List imuFields, + List textFields, + Weights weights, + boolean vectorizeCollectionName, + VectorIndex vectorIndex, + Quantization quantization) { + this.vectorizeCollectionName = false; + + this.imageFields = imageFields; + this.audioFields = audioFields; + this.videoFields = videoFields; + this.depthFields = depthFields; + this.thermalFields = thermalFields; + this.imuFields = imuFields; + this.textFields = textFields; + this.weights = weights; + this.vectorIndex = vectorIndex; + this.quantization = quantization; + } + + public Multi2VecBindVectorizer(Builder builder) { + this( + builder.imageFields.keySet().stream().toList(), + builder.audioFields.keySet().stream().toList(), + builder.videoFields.keySet().stream().toList(), + builder.depthFields.keySet().stream().toList(), + builder.thermalFields.keySet().stream().toList(), + builder.imuFields.keySet().stream().toList(), + builder.textFields.keySet().stream().toList(), + new Weights( + builder.imageFields.values().stream().toList(), + builder.audioFields.values().stream().toList(), + builder.videoFields.values().stream().toList(), + builder.depthFields.values().stream().toList(), + builder.thermalFields.values().stream().toList(), + builder.imuFields.values().stream().toList(), + builder.textFields.values().stream().toList()), + builder.vectorizeCollectionName, + builder.vectorIndex, + builder.quantization); + } + + public static class Builder implements ObjectBuilder { + private final boolean vectorizeCollectionName = false; + private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + private Quantization quantization; + + private Map imageFields = new LinkedHashMap<>(); + private Map audioFields = new LinkedHashMap<>(); + private Map videoFields = new LinkedHashMap<>(); + private Map depthFields = new LinkedHashMap<>(); + private Map thermalFields = new LinkedHashMap<>(); + private Map imuFields = new LinkedHashMap<>(); + private Map textFields = new LinkedHashMap<>(); + + /** Add BLOB image properties to include in the embedding. */ + public Builder imageFields(List fields) { + fields.forEach(field -> imageFields.put(field, null)); + return this; + } + + /** Add BLOB image properties to include in the embedding. */ + public Builder imageFields(String... fields) { + return imageFields(Arrays.asList(fields)); + } + + /** + * Add BLOB image property to include in the embedding. + * + * @param field Property name. + * @param weight Custom weight between 0.0 and 1.0. + */ + public Builder imageField(String field, float weight) { + imageFields.put(field, weight); + return this; + } + + /** Add BLOB audio properties to include in the embedding. */ + public Builder audioFields(List fields) { + fields.forEach(field -> audioFields.put(field, null)); + return this; + } + + /** Add BLOB audio properties to include in the embedding. */ + public Builder audioFields(String... fields) { + return audioFields(Arrays.asList(fields)); + } + + /** + * Add BLOB audio property to include in the embedding. + * + * @param field Property name. + * @param weight Custom weight between 0.0 and 1.0. + */ + public Builder audioField(String field, float weight) { + audioFields.put(field, weight); + return this; + } + + /** Add BLOB video properties to include in the embedding. */ + public Builder videoFields(List fields) { + fields.forEach(field -> videoFields.put(field, null)); + return this; + } + + /** Add BLOB video properties to include in the embedding. */ + public Builder videoFields(String... fields) { + return videoFields(Arrays.asList(fields)); + } + + /** + * Add BLOB video property to include in the embedding. + * + * @param field Property name. + * @param weight Custom weight between 0.0 and 1.0. + */ + public Builder videoField(String field, float weight) { + videoFields.put(field, weight); + return this; + } + + /** Add BLOB depth properties to include in the embedding. */ + public Builder depthFields(List fields) { + fields.forEach(field -> depthFields.put(field, null)); + return this; + } + + /** Add BLOB depth properties to include in the embedding. */ + public Builder depthFields(String... fields) { + return depthFields(Arrays.asList(fields)); + } + + /** + * Add BLOB depth property to include in the embedding. + * + * @param field Property name. + * @param weight Custom weight between 0.0 and 1.0. + */ + public Builder depthField(String field, float weight) { + depthFields.put(field, weight); + return this; + } + + /** Add BLOB thermal properties to include in the embedding. */ + public Builder thermalFields(List fields) { + fields.forEach(field -> thermalFields.put(field, null)); + return this; + } + + /** Add BLOB thermal properties to include in the embedding. */ + public Builder thermalFields(String... fields) { + return thermalFields(Arrays.asList(fields)); + } + + /** + * Add BLOB thermal property to include in the embedding. + * + * @param field Property name. + * @param weight Custom weight between 0.0 and 1.0. + */ + public Builder thermalField(String field, float weight) { + thermalFields.put(field, weight); + return this; + } + + /** Add BLOB IMU properties to include in the embedding. */ + public Builder imuFields(List fields) { + fields.forEach(field -> imuFields.put(field, null)); + return this; + } + + /** Add BLOB IMU properties to include in the embedding. */ + public Builder imuFields(String... fields) { + return imuFields(Arrays.asList(fields)); + } + + /** + * Add BLOB IMU property to include in the embedding. + * + * @param field Property name. + * @param weight Custom weight between 0.0 and 1.0. + */ + public Builder imuField(String field, float weight) { + imuFields.put(field, weight); + return this; + } + + /** Add TEXT properties to include in the embedding. */ + public Builder textFields(List fields) { + fields.forEach(field -> textFields.put(field, null)); + return this; + } + + /** Add TEXT properties to include in the embedding. */ + public Builder textFields(String... fields) { + return textFields(Arrays.asList(fields)); + } + + /** + * Add TEXT property to include in the embedding. + * + * @param field Property name. + * @param weight Custom weight between 0.0 and 1.0. + */ + public Builder textField(String field, float weight) { + textFields.put(field, weight); + return this; + } + + /** + * Override default vector index configuration. + * + * HNSW + * is the default vector index. + */ + public Builder vectorIndex(VectorIndex vectorIndex) { + this.vectorIndex = vectorIndex; + return this; + } + + public Builder quantization(Quantization quantization) { + this.quantization = quantization; + return this; + } + + @Override + public Multi2VecBindVectorizer build() { + return new Multi2VecBindVectorizer(this); + } + } +} From 4047aec3b17120833ff33ded1bad8aba2874c0d1 Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 27 Oct 2025 18:01:46 +0100 Subject: [PATCH 23/35] feat: add multi2vec-voyageai --- .../v1/api/collections/VectorConfig.java | 4 +- .../Multi2VecVoyageAiVectorizer.java | 210 ++++++++++++++++++ 2 files changed, 213 insertions(+), 1 deletion(-) create mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecVoyageAiVectorizer.java diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index efa0e46f..9d04a7a4 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -49,9 +49,11 @@ public enum Kind implements JsonEnum { IMG2VEC_NEURAL("img2vec-neural"), MULTI2VEC_AWS("multi2vec-aws"), MULTI2VEC_BIND("multi2vec-bind"), + MULTI2VEC_CLIP("multi2vec-clip"), MULTI2VEC_COHERE("multi2vec-cohere"), + MULTI2VEC_JINAAI("multi2vec-jinaai"), MULTI2VEC_NVIDIA("multi2vec-nvidia"), - MULTI2VEC_CLIP("multi2vec-clip"), + MULTI2VEC_VOYAGEAI("multi2vec-voyageai"), TEXT2MULTIVEC_JINAAI("text2multivec-jinaai"), MULTI2MULTIVEC_JINAAI("multi2multivec-jinaai"); diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecVoyageAiVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecVoyageAiVectorizer.java new file mode 100644 index 00000000..d32440dc --- /dev/null +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecVoyageAiVectorizer.java @@ -0,0 +1,210 @@ +package io.weaviate.client6.v1.api.collections.vectorizers; + +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Function; + +import com.google.gson.annotations.SerializedName; + +import io.weaviate.client6.v1.api.collections.Quantization; +import io.weaviate.client6.v1.api.collections.VectorConfig; +import io.weaviate.client6.v1.api.collections.VectorIndex; +import io.weaviate.client6.v1.internal.ObjectBuilder; + +public record Multi2VecVoyageAiVectorizer( + /** Base URL of the embedding service. */ + @SerializedName("baseURL") String baseUrl, + /** Inference model to use. */ + @SerializedName("model") String model, + @SerializedName("outputEncoding") String outputEncoding, + @SerializedName("truncate") Boolean truncate, + /** BLOB properties included in the embedding. */ + @SerializedName("imageFields") List imageFields, + /** TEXT properties included in the embedding. */ + @SerializedName("textFields") List textFields, + /** Weights of the included properties. */ + @SerializedName("weights") Weights weights, + /** + * Weaviate defaults to {@code true} if the value is not provided. + * To avoid that we send "vectorizeClassName": false all the time + * and make it impossible to enable this feature, as it is deprecated. + */ + @Deprecated @SerializedName("vectorizeClassName") boolean vectorizeCollectionName, + /** Vector index configuration. */ + VectorIndex vectorIndex, + /** Vector quantization method. */ + Quantization quantization) implements VectorConfig { + + private static record Weights( + /** + * Weights of the BLOB properties. Values appear in the same order as the + * corresponding property names in {@code imageFields}. + */ + @SerializedName("imageWeights") List imageWeights, + /** + * Weights of the TEXT properties. Values appear in the same order as the + * corresponding property names in {@code textFields}. + */ + @SerializedName("textWeights") List textWeights) { + } + + @Override + public VectorConfig.Kind _kind() { + return VectorConfig.Kind.MULTI2VEC_VOYAGEAI; + } + + @Override + public Object _self() { + return this; + } + + public static Multi2VecVoyageAiVectorizer of() { + return of(ObjectBuilder.identity()); + } + + public static Multi2VecVoyageAiVectorizer of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + public Multi2VecVoyageAiVectorizer( + String baseUrl, + String model, + String outputEncoding, + Boolean truncate, + List imageFields, + List textFields, + Weights weights, + boolean vectorizeCollectionName, + VectorIndex vectorIndex, + Quantization quantization) { + this.vectorizeCollectionName = false; + this.baseUrl = baseUrl; + this.model = model; + this.outputEncoding = outputEncoding; + this.truncate = truncate; + this.imageFields = imageFields; + this.textFields = textFields; + this.weights = weights; + this.vectorIndex = vectorIndex; + this.quantization = quantization; + } + + public Multi2VecVoyageAiVectorizer(Builder builder) { + this( + builder.baseUrl, + builder.model, + builder.outputEncoding, + builder.truncate, + builder.imageFields.keySet().stream().toList(), + builder.textFields.keySet().stream().toList(), + new Weights( + builder.imageFields.values().stream().toList(), + builder.textFields.values().stream().toList()), + builder.vectorizeCollectionName, + builder.vectorIndex, + builder.quantization); + } + + public static class Builder implements ObjectBuilder { + private final boolean vectorizeCollectionName = false; + private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + private Quantization quantization; + + private Map imageFields = new LinkedHashMap<>(); + private Map textFields = new LinkedHashMap<>(); + + private String baseUrl; + private String model; + private String outputEncoding; + private Boolean truncate; + + /** Set base URL of the embedding service. */ + public Builder baseUrl(String baseUrl) { + this.baseUrl = baseUrl; + return this; + } + + public Builder model(String model) { + this.model = model; + return this; + } + + public Builder outputEncoding(String outputEncoding) { + this.outputEncoding = outputEncoding; + return this; + } + + public Builder truncate(boolean truncate) { + this.truncate = truncate; + return this; + } + + /** Add BLOB properties to include in the embedding. */ + public Builder imageFields(List fields) { + fields.forEach(field -> imageFields.put(field, null)); + return this; + } + + /** Add BLOB properties to include in the embedding. */ + public Builder imageFields(String... fields) { + return imageFields(Arrays.asList(fields)); + } + + /** + * Add BLOB property to include in the embedding. + * + * @param field Property name. + * @param weight Custom weight between 0.0 and 1.0. + */ + public Builder imageField(String field, float weight) { + imageFields.put(field, weight); + return this; + } + + /** Add TEXT properties to include in the embedding. */ + public Builder textFields(List fields) { + fields.forEach(field -> textFields.put(field, null)); + return this; + } + + /** Add TEXT properties to include in the embedding. */ + public Builder textFields(String... fields) { + return textFields(Arrays.asList(fields)); + } + + /** + * Add TEXT property to include in the embedding. + * + * @param field Property name. + * @param weight Custom weight between 0.0 and 1.0. + */ + public Builder textField(String field, float weight) { + textFields.put(field, weight); + return this; + } + + /** + * Override default vector index configuration. + * + * HNSW + * is the default vector index. + */ + public Builder vectorIndex(VectorIndex vectorIndex) { + this.vectorIndex = vectorIndex; + return this; + } + + public Builder quantization(Quantization quantization) { + this.quantization = quantization; + return this; + } + + @Override + public Multi2VecVoyageAiVectorizer build() { + return new Multi2VecVoyageAiVectorizer(this); + } + } +} From 1471ecf03d03b8419a830c54fcabe85700d8c89e Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 27 Oct 2025 18:02:04 +0100 Subject: [PATCH 24/35] feat: add multi2vec-jinaai module --- .../Multi2VecJinaAiVectorizer.java | 200 ++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecJinaAiVectorizer.java diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecJinaAiVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecJinaAiVectorizer.java new file mode 100644 index 00000000..19de6e9a --- /dev/null +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecJinaAiVectorizer.java @@ -0,0 +1,200 @@ +package io.weaviate.client6.v1.api.collections.vectorizers; + +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Function; + +import com.google.gson.annotations.SerializedName; + +import io.weaviate.client6.v1.api.collections.Quantization; +import io.weaviate.client6.v1.api.collections.VectorConfig; +import io.weaviate.client6.v1.api.collections.VectorIndex; +import io.weaviate.client6.v1.internal.ObjectBuilder; + +public record Multi2VecJinaAiVectorizer( + /** Base URL of the embedding service. */ + @SerializedName("baseURL") String baseUrl, + /** Inference model to use. */ + @SerializedName("model") String model, + @SerializedName("dimensions") Integer dimensions, + /** BLOB properties included in the embedding. */ + @SerializedName("imageFields") List imageFields, + /** TEXT properties included in the embedding. */ + @SerializedName("textFields") List textFields, + /** Weights of the included properties. */ + @SerializedName("weights") Weights weights, + /** + * Weaviate defaults to {@code true} if the value is not provided. + * To avoid that we send "vectorizeClassName": false all the time + * and make it impossible to enable this feature, as it is deprecated. + */ + @Deprecated @SerializedName("vectorizeClassName") boolean vectorizeCollectionName, + /** Vector index configuration. */ + VectorIndex vectorIndex, + /** Vector quantization method. */ + Quantization quantization) implements VectorConfig { + + private static record Weights( + /** + * Weights of the BLOB properties. Values appear in the same order as the + * corresponding property names in {@code imageFields}. + */ + @SerializedName("imageWeights") List imageWeights, + /** + * Weights of the TEXT properties. Values appear in the same order as the + * corresponding property names in {@code textFields}. + */ + @SerializedName("textWeights") List textWeights) { + } + + @Override + public VectorConfig.Kind _kind() { + return VectorConfig.Kind.MULTI2VEC_COHERE; + } + + @Override + public Object _self() { + return this; + } + + public static Multi2VecJinaAiVectorizer of() { + return of(ObjectBuilder.identity()); + } + + public static Multi2VecJinaAiVectorizer of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + public Multi2VecJinaAiVectorizer( + String baseUrl, + String model, + Integer dimensions, + List imageFields, + List textFields, + Weights weights, + boolean vectorizeCollectionName, + VectorIndex vectorIndex, + Quantization quantization) { + this.vectorizeCollectionName = false; + this.baseUrl = baseUrl; + this.model = model; + this.dimensions = dimensions; + this.imageFields = imageFields; + this.textFields = textFields; + this.weights = weights; + this.vectorIndex = vectorIndex; + this.quantization = quantization; + } + + public Multi2VecJinaAiVectorizer(Builder builder) { + this( + builder.baseUrl, + builder.model, + builder.dimensions, + builder.imageFields.keySet().stream().toList(), + builder.textFields.keySet().stream().toList(), + new Weights( + builder.imageFields.values().stream().toList(), + builder.textFields.values().stream().toList()), + builder.vectorizeCollectionName, + builder.vectorIndex, + builder.quantization); + } + + public static class Builder implements ObjectBuilder { + private final boolean vectorizeCollectionName = false; + private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + private Quantization quantization; + + private Map imageFields = new LinkedHashMap<>(); + private Map textFields = new LinkedHashMap<>(); + + private String baseUrl; + private String model; + private Integer dimensions; + + /** Set base URL of the embedding service. */ + public Builder baseUrl(String baseUrl) { + this.baseUrl = baseUrl; + return this; + } + + public Builder model(String model) { + this.model = model; + return this; + } + + public Builder dimensions(int dimensions) { + this.dimensions = dimensions; + return this; + } + + /** Add BLOB properties to include in the embedding. */ + public Builder imageFields(List fields) { + fields.forEach(field -> imageFields.put(field, null)); + return this; + } + + /** Add BLOB properties to include in the embedding. */ + public Builder imageFields(String... fields) { + return imageFields(Arrays.asList(fields)); + } + + /** + * Add BLOB property to include in the embedding. + * + * @param field Property name. + * @param weight Custom weight between 0.0 and 1.0. + */ + public Builder imageField(String field, float weight) { + imageFields.put(field, weight); + return this; + } + + /** Add TEXT properties to include in the embedding. */ + public Builder textFields(List fields) { + fields.forEach(field -> textFields.put(field, null)); + return this; + } + + /** Add TEXT properties to include in the embedding. */ + public Builder textFields(String... fields) { + return textFields(Arrays.asList(fields)); + } + + /** + * Add TEXT property to include in the embedding. + * + * @param field Property name. + * @param weight Custom weight between 0.0 and 1.0. + */ + public Builder textField(String field, float weight) { + textFields.put(field, weight); + return this; + } + + /** + * Override default vector index configuration. + * + * HNSW + * is the default vector index. + */ + public Builder vectorIndex(VectorIndex vectorIndex) { + this.vectorIndex = vectorIndex; + return this; + } + + public Builder quantization(Quantization quantization) { + this.quantization = quantization; + return this; + } + + @Override + public Multi2VecJinaAiVectorizer build() { + return new Multi2VecJinaAiVectorizer(this); + } + } +} From 484c0ba97fa2ecb07ecf2f000586ad062e319c22 Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 27 Oct 2025 18:11:28 +0100 Subject: [PATCH 25/35] feat: add multi2vec-google vectorizer --- .../v1/api/collections/VectorConfig.java | 1 + .../Multi2VecGoogleVectorizer.java | 243 ++++++++++++++++++ 2 files changed, 244 insertions(+) create mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecGoogleVectorizer.java diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index 9d04a7a4..d7ee6a81 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -50,6 +50,7 @@ public enum Kind implements JsonEnum { MULTI2VEC_AWS("multi2vec-aws"), MULTI2VEC_BIND("multi2vec-bind"), MULTI2VEC_CLIP("multi2vec-clip"), + MULTI2VEC_GOOGLE("multi2vec-google"), MULTI2VEC_COHERE("multi2vec-cohere"), MULTI2VEC_JINAAI("multi2vec-jinaai"), MULTI2VEC_NVIDIA("multi2vec-nvidia"), diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecGoogleVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecGoogleVectorizer.java new file mode 100644 index 00000000..9b4530e6 --- /dev/null +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecGoogleVectorizer.java @@ -0,0 +1,243 @@ +package io.weaviate.client6.v1.api.collections.vectorizers; + +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Function; + +import com.google.gson.annotations.SerializedName; + +import io.weaviate.client6.v1.api.collections.Quantization; +import io.weaviate.client6.v1.api.collections.VectorConfig; +import io.weaviate.client6.v1.api.collections.VectorIndex; +import io.weaviate.client6.v1.internal.ObjectBuilder; + +public record Multi2VecGoogleVectorizer( + @SerializedName("projectId") String projectId, + @SerializedName("model") String model, + @SerializedName("dimensions") Integer dimensions, + @SerializedName("location") String location, + /** BLOB image properties included in the embedding. */ + @SerializedName("imageFields") List imageFields, + /** BLOB video properties included in the embedding. */ + @SerializedName("videoFields") List videoFields, + /** TEXT properties included in the embedding. */ + @SerializedName("textFields") List textFields, + /** Weights of the included properties. */ + @SerializedName("weights") Weights weights, + /** + * Weaviate defaults to {@code true} if the value is not provided. + * To avoid that we send "vectorizeClassName": false all the time + * and make it impossible to enable this feature, as it is deprecated. + */ + @Deprecated @SerializedName("vectorizeClassName") boolean vectorizeCollectionName, + /** Vector index configuration. */ + VectorIndex vectorIndex, + /** Vector quantization method. */ + Quantization quantization) implements VectorConfig { + + private static record Weights( + /** + * Weights of the BLOB image properties. Values appear in the same order as the + * corresponding property names in {@code imageFields}. + */ + @SerializedName("imageWeights") List imageWeights, + /** + * Weights of the BLOB video properties. Values appear in the same order as the + * corresponding property names in {@code videoFields}. + */ + @SerializedName("videoWeights") List videoWeights, + /** + * Weights of the TEXT properties. Values appear in the same order as the + * corresponding property names in {@code textFields}. + */ + @SerializedName("textWeights") List textWeights) { + } + + @Override + public VectorConfig.Kind _kind() { + return VectorConfig.Kind.MULTI2VEC_GOOGLE; + } + + @Override + public Object _self() { + return this; + } + + public static Multi2VecGoogleVectorizer of(String location) { + return of(location, ObjectBuilder.identity()); + } + + public static Multi2VecGoogleVectorizer of( + String location, + Function> fn) { + return fn.apply(new Builder(location)).build(); + } + + public Multi2VecGoogleVectorizer( + String projectId, + String model, + Integer dimensions, + String location, + List imageFields, + List videoFields, + List textFields, + Weights weights, + boolean vectorizeCollectionName, + VectorIndex vectorIndex, + Quantization quantization) { + this.vectorizeCollectionName = false; + + this.projectId = projectId; + this.model = model; + this.dimensions = dimensions; + this.location = location; + this.imageFields = imageFields; + this.videoFields = videoFields; + this.textFields = textFields; + this.weights = weights; + this.vectorIndex = vectorIndex; + this.quantization = quantization; + } + + public Multi2VecGoogleVectorizer(Builder builder) { + this( + builder.projectId, + builder.model, + builder.dimensions, + builder.location, + builder.imageFields.keySet().stream().toList(), + builder.videoFields.keySet().stream().toList(), + builder.textFields.keySet().stream().toList(), + new Weights( + builder.imageFields.values().stream().toList(), + builder.videoFields.values().stream().toList(), + builder.textFields.values().stream().toList()), + builder.vectorizeCollectionName, + builder.vectorIndex, + builder.quantization); + } + + public static class Builder implements ObjectBuilder { + private final boolean vectorizeCollectionName = false; + private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + private Quantization quantization; + + private Map imageFields = new LinkedHashMap<>(); + private Map videoFields = new LinkedHashMap<>(); + private Map textFields = new LinkedHashMap<>(); + + private final String projectId; + private String model; + private String location; + private Integer dimensions; + + public Builder(String projectId) { + this.projectId = projectId; + } + + public Builder model(String model) { + this.model = model; + return this; + } + + public Builder location(String location) { + this.location = location; + return this; + } + + public Builder dimensions(int dimensions) { + this.dimensions = dimensions; + return this; + } + + /** Add BLOB image properties to include in the embedding. */ + public Builder imageFields(List fields) { + fields.forEach(field -> imageFields.put(field, null)); + return this; + } + + /** Add BLOB image properties to include in the embedding. */ + public Builder imageFields(String... fields) { + return imageFields(Arrays.asList(fields)); + } + + /** + * Add BLOB image property to include in the embedding. + * + * @param field Property name. + * @param weight Custom weight between 0.0 and 1.0. + */ + public Builder imageField(String field, float weight) { + imageFields.put(field, weight); + return this; + } + + /** Add BLOB video properties to include in the embedding. */ + public Builder videoFields(List fields) { + fields.forEach(field -> videoFields.put(field, null)); + return this; + } + + /** Add BLOB video properties to include in the embedding. */ + public Builder videoFields(String... fields) { + return videoFields(Arrays.asList(fields)); + } + + /** + * Add BLOB video property to include in the embedding. + * + * @param field Property name. + * @param weight Custom weight between 0.0 and 1.0. + */ + public Builder videoField(String field, float weight) { + videoFields.put(field, weight); + return this; + } + + /** Add TEXT properties to include in the embedding. */ + public Builder textFields(List fields) { + fields.forEach(field -> textFields.put(field, null)); + return this; + } + + /** Add TEXT properties to include in the embedding. */ + public Builder textFields(String... fields) { + return textFields(Arrays.asList(fields)); + } + + /** + * Add TEXT property to include in the embedding. + * + * @param field Property name. + * @param weight Custom weight between 0.0 and 1.0. + */ + public Builder textField(String field, float weight) { + textFields.put(field, weight); + return this; + } + + /** + * Override default vector index configuration. + * + * HNSW + * is the default vector index. + */ + public Builder vectorIndex(VectorIndex vectorIndex) { + this.vectorIndex = vectorIndex; + return this; + } + + public Builder quantization(Quantization quantization) { + this.quantization = quantization; + return this; + } + + @Override + public Multi2VecGoogleVectorizer build() { + return new Multi2VecGoogleVectorizer(this); + } + } +} From 5ca18f9ffa3e69556cf1defa1556c291c45b8534 Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 27 Oct 2025 18:25:02 +0100 Subject: [PATCH 26/35] feat: register vectorizer adapters in the type adapter factory --- .../v1/api/collections/VectorConfig.java | 56 ++++++++++++++++++- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index d7ee6a81..c50166b9 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -16,9 +16,35 @@ import com.google.gson.stream.JsonWriter; import io.weaviate.client6.v1.api.collections.vectorizers.Img2VecNeuralVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Multi2MultiVecJinaAiVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Multi2VecAwsVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Multi2VecBindVectorizer; import io.weaviate.client6.v1.api.collections.vectorizers.Multi2VecClipVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Multi2VecCohereVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Multi2VecGoogleVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Multi2VecJinaAiVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Multi2VecNvidiaVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Multi2VecVoyageAiVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Ref2VecCentroidVectorizer; import io.weaviate.client6.v1.api.collections.vectorizers.SelfProvidedVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Text2MultiVecJinaAiVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecAwsVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecAzureOpenAiVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecCohereVectorizer; import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecContextionaryVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecDatabricksVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecGoogleAiStudioVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecGoogleVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecHuggingfaceVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecJinaAiVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecMistralVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecModel2VecVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecMorphVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecNvidiaVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecOllamaVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecOpenAiVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecTransformersVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecVoyageAiVectorizer; import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecWeaviateVectorizer; import io.weaviate.client6.v1.internal.ObjectBuilder; import io.weaviate.client6.v1.internal.TaggedUnion; @@ -271,10 +297,36 @@ private final void addAdapter(Gson gson, VectorConfig.Kind kind, Class Date: Mon, 27 Oct 2025 18:50:53 +0100 Subject: [PATCH 27/35] feat: provide separate builder for AWS sagemaker/bedrock --- .../v1/api/collections/Generative.java | 42 ++++-- .../collections/generate/DynamicProvider.java | 26 +++- .../collections/generative/AwsGenerative.java | 122 ++++++++++++++---- .../vectorizers/Text2VecAwsVectorizer.java | 19 ++- .../client6/v1/internal/json/JSONTest.java | 25 +++- 5 files changed, 176 insertions(+), 58 deletions(-) diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/Generative.java b/src/main/java/io/weaviate/client6/v1/api/collections/Generative.java index da7818c7..ef8ccc93 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/Generative.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/Generative.java @@ -94,27 +94,47 @@ public static Generative anyscale(Function> fn) { + return AwsGenerative.bedrock(region, model, fn); + } + + /** + * Configure a default {@code generative-aws} module with Sagemaker integration. * * @param region AWS region. - * @param service AWS service to use, e.g. {@code "bedrock"} or - * {@code "sagemaker"}. + * @param baseUrl Base inference URL. */ - public static Generative aws(String region, String service) { - return AwsGenerative.of(region, service); + public static Generative awsSagemaker(String region, String baseUrl) { + return AwsGenerative.sagemaker(region, baseUrl); } /** - * Configure a {@code generative-aws} module. + * Configure a {@code generative-aws} module with Sagemaker integration. * * @param region AWS region. - * @param service AWS service to use, e.g. {@code "bedrock"} or - * {@code "sagemaker"}. + * @param baseUrl Base inference URL. * @param fn Lambda expression for optional parameters. */ - public static Generative aws(String region, String service, - Function> fn) { - return AwsGenerative.of(region, service, fn); + public static Generative awsSagemaker(String region, String baseUrl, + Function> fn) { + return AwsGenerative.sagemaker(region, baseUrl, fn); } /** Configure a default {@code generative-cohere} module. */ diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/generate/DynamicProvider.java b/src/main/java/io/weaviate/client6/v1/api/collections/generate/DynamicProvider.java index 883ba5ed..43e2e308 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/generate/DynamicProvider.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/generate/DynamicProvider.java @@ -44,11 +44,29 @@ public static DynamicProvider anyscale( /** * Configure {@code generative-aws} as a dynamic provider. * - * @param fn Lambda expression for optional parameters. + * @param region AWS region. + * @param model Inference model. + * @param fn Lambda expression for optional parameters. + */ + public static DynamicProvider awsBedrock( + String region, + String model, + Function> fn) { + return AwsGenerative.Provider.bedrock(region, model, fn); + } + + /** + * Configure {@code generative-aws} as a dynamic provider. + * + * @param region AWS region. + * @param baseUrl Base inference URL. + * @param fn Lambda expression for optional parameters. */ - public static DynamicProvider aws( - Function> fn) { - return AwsGenerative.Provider.of(fn); + public static DynamicProvider awsSagemaker( + String region, + String baseUrl, + Function> fn) { + return AwsGenerative.Provider.sagemaker(region, baseUrl, fn); } /** diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/generative/AwsGenerative.java b/src/main/java/io/weaviate/client6/v1/api/collections/generative/AwsGenerative.java index 1589b15d..d49e0390 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/generative/AwsGenerative.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/generative/AwsGenerative.java @@ -9,13 +9,14 @@ import io.weaviate.client6.v1.api.collections.Generative; import io.weaviate.client6.v1.api.collections.generate.DynamicProvider; +import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecAwsVectorizer.Service; import io.weaviate.client6.v1.internal.ObjectBuilder; import io.weaviate.client6.v1.internal.grpc.protocol.WeaviateProtoBase; import io.weaviate.client6.v1.internal.grpc.protocol.WeaviateProtoGenerative; public record AwsGenerative( @SerializedName("region") String region, - @SerializedName("service") String service, + @SerializedName("service") Service service, @SerializedName("endpoint") String baseUrl, @SerializedName("model") String model) implements Generative { @@ -29,27 +30,37 @@ public Object _self() { return this; } - public static AwsGenerative of(String region, String service) { - return of(region, service, ObjectBuilder.identity()); + public static AwsGenerative bedrock(String region, String model) { + return bedrock(region, model, ObjectBuilder.identity()); } - public static AwsGenerative of(String region, String service, Function> fn) { - return fn.apply(new Builder(region, service)).build(); + public static AwsGenerative bedrock(String region, String model, + Function> fn) { + return fn.apply(new BedrockBuilder(region, model)).build(); + } + + public static AwsGenerative sagemaker(String region, String baseUrl) { + return sagemaker(region, baseUrl, ObjectBuilder.identity()); + } + + public static AwsGenerative sagemaker(String region, String baseUrl, + Function> fn) { + return fn.apply(new SagemakerBuilder(region, baseUrl)).build(); } public AwsGenerative(Builder builder) { this( - builder.service, builder.region, + builder.service, builder.baseUrl, builder.model); } public static class Builder implements ObjectBuilder { private final String region; - private final String service; + private final Service service; - public Builder(String service, String region) { + public Builder(Service service, String region) { this.service = service; this.region = region; } @@ -58,13 +69,13 @@ public Builder(String service, String region) { private String model; /** Base URL of the generative provider. */ - public Builder baseUrl(String baseUrl) { + protected Builder baseUrl(String baseUrl) { this.baseUrl = baseUrl; return this; } /** Select generative model. */ - public Builder model(String model) { + protected Builder model(String model) { this.model = model; return this; } @@ -75,12 +86,37 @@ public AwsGenerative build() { } } + public static class BedrockBuilder extends Builder { + public BedrockBuilder(String region, String model) { + super(Service.BEDROCK, region); + super.model(model); + } + + @Override + /** Required for {@link Service#BEDROCK}. */ + public Builder model(String model) { + return super.model(model); + } + } + + public static class SagemakerBuilder extends Builder { + public SagemakerBuilder(String region, String baseUrl) { + super(Service.SAGEMAKER, region); + super.baseUrl(baseUrl); + } + + /** Required for {@link Service#SAGEMAKER}. */ + public Builder baseUrl(String baseUrl) { + return super.baseUrl(baseUrl); + } + } + public static record Metadata() implements ProviderMetadata { } public static record Provider( String region, - String service, + Service service, String baseUrl, String model, String targetModel, @@ -89,9 +125,18 @@ public static record Provider( List images, List imageProperties) implements DynamicProvider { - public static Provider of( - Function> fn) { - return fn.apply(new Builder()).build(); + public static Provider bedrock( + String region, + String model, + Function> fn) { + return fn.apply(new BedrockBuilder(region, model)).build(); + } + + public static Provider sagemaker( + String region, + String baseUrl, + Function> fn) { + return fn.apply(new SagemakerBuilder(region, baseUrl)).build(); } @Override @@ -102,7 +147,10 @@ public void appendTo( provider.setRegion(region); } if (service != null) { - provider.setService(service); + provider.setService( + service == Service.BEDROCK ? "bedrock" + : service == Service.SAGEMAKER ? "sagemaker" + : "unknown"); } if (baseUrl != null) { provider.setEndpoint(baseUrl); @@ -143,9 +191,9 @@ public Provider(Builder builder) { builder.imageProperties); } - public static class Builder implements ObjectBuilder { - private String region; - private String service; + public abstract static class Builder implements ObjectBuilder { + private final Service service; + private final String region; private String baseUrl; private String model; private String targetModel; @@ -154,24 +202,19 @@ public static class Builder implements ObjectBuilder { private final List images = new ArrayList<>(); private final List imageProperties = new ArrayList<>(); - public Builder region(String region) { - this.region = region; - return this; - } - - public Builder service(String service) { + protected Builder(Service service, String region) { this.service = service; - return this; + this.region = region; } /** Base URL of the generative provider. */ - public Builder baseUrl(String baseUrl) { + protected Builder baseUrl(String baseUrl) { this.baseUrl = baseUrl; return this; } /** Select generative model. */ - public Builder model(String model) { + protected Builder model(String model) { this.model = model; return this; } @@ -218,5 +261,30 @@ public AwsGenerative.Provider build() { return new AwsGenerative.Provider(this); } } + + public static class BedrockBuilder extends Builder { + public BedrockBuilder(String region, String model) { + super(Service.BEDROCK, region); + super.model(model); + } + + @Override + /** Required for {@link Service#BEDROCK}. */ + public Builder model(String model) { + return super.model(model); + } + } + + public static class SagemakerBuilder extends Builder { + public SagemakerBuilder(String region, String baseUrl) { + super(Service.SAGEMAKER, region); + super.baseUrl(baseUrl); + } + + /** Required for {@link Service#SAGEMAKER}. */ + public Builder baseUrl(String baseUrl) { + return super.baseUrl(baseUrl); + } + } } } diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecAwsVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecAwsVectorizer.java index 0596bdd6..e1b47feb 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecAwsVectorizer.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecAwsVectorizer.java @@ -109,16 +109,20 @@ public Text2VecAwsVectorizer(Builder builder) { builder.quantization); } - private abstract static class Builder implements ObjectBuilder { + public abstract static class Builder implements ObjectBuilder { private final boolean vectorizeCollectionName = false; private Quantization quantization; private List sourceProperties = new ArrayList<>(); private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; + private final Service service; private String baseUrl; private String model; private String region; - private Service service; + + protected Builder(Service service) { + this.service = service; + } /** Required for {@link Service#SAGEMAKER}. */ protected Builder baseUrl(String baseUrl) { @@ -137,11 +141,6 @@ public Builder region(String region) { return this; } - public Builder service(Service service) { - this.service = service; - return this; - } - /** Add properties to include in the embedding. */ public Builder sourceProperties(String... properties) { return sourceProperties(Arrays.asList(properties)); @@ -177,8 +176,7 @@ public Text2VecAwsVectorizer build() { public static class BedrockBuilder extends Builder { public BedrockBuilder(String model) { - super(); - super.service(Service.BEDROCK); + super(Service.BEDROCK); super.model(model); } @@ -191,8 +189,7 @@ public Builder model(String model) { public static class SagemakerBuilder extends Builder { public SagemakerBuilder(String baseUrl) { - super(); - super.service(Service.SAGEMAKER); + super(Service.SAGEMAKER); super.baseUrl(baseUrl); } diff --git a/src/test/java/io/weaviate/client6/v1/internal/json/JSONTest.java b/src/test/java/io/weaviate/client6/v1/internal/json/JSONTest.java index f6f15e0d..d694e2e0 100644 --- a/src/test/java/io/weaviate/client6/v1/internal/json/JSONTest.java +++ b/src/test/java/io/weaviate/client6/v1/internal/json/JSONTest.java @@ -933,19 +933,34 @@ public static Object[][] testCases() { }, { Generative.class, - Generative.aws( + Generative.awsBedrock( "aws-region", - "aws-service", + "example-model", cfg -> cfg - .baseUrl("https://example.com") .model("example-model")), """ { "generative-aws": { - "endpoint": "https://example.com", "model": "example-model", "region": "aws-region", - "service": "aws-service" + "service": "bedrock" + } + } + """, + }, + { + Generative.class, + Generative.awsSagemaker( + "aws-region", + "https://example.com", + cfg -> cfg + .baseUrl("https://example.com")), + """ + { + "generative-aws": { + "endpoint": "https://example.com", + "region": "aws-region", + "service": "sagemaker" } } """, From 29d6b9b0d1e2dca47e88d64f4f53dd2c40e0dd20 Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 27 Oct 2025 19:05:33 +0100 Subject: [PATCH 28/35] chore: fix inconsistencies --- .../collections/vectorizers/Multi2VecBindVectorizer.java | 2 +- .../collections/vectorizers/Ref2VecCentroidVectorizer.java | 2 +- .../api/collections/vectorizers/Text2VecAwsVectorizer.java | 4 ++-- .../collections/vectorizers/Text2VecCohereVectorizer.java | 1 - .../java/io/weaviate/client6/v1/internal/json/JSONTest.java | 6 +++--- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecBindVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecBindVectorizer.java index 22e74962..72b13b71 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecBindVectorizer.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecBindVectorizer.java @@ -82,7 +82,7 @@ private static record Weights( @Override public VectorConfig.Kind _kind() { - return VectorConfig.Kind.MULTI2VEC_COHERE; + return VectorConfig.Kind.MULTI2VEC_BIND; } @Override diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Ref2VecCentroidVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Ref2VecCentroidVectorizer.java index 1ff22d9d..b018ca1f 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Ref2VecCentroidVectorizer.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Ref2VecCentroidVectorizer.java @@ -32,7 +32,7 @@ public Object _self() { } public enum Method { - @SerializedName("MEAN") + @SerializedName("mean") MEAN; } diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecAwsVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecAwsVectorizer.java index e1b47feb..185bc2a4 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecAwsVectorizer.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecAwsVectorizer.java @@ -42,9 +42,9 @@ public Object _self() { } public enum Service { - @SerializedName("BEDROCK") + @SerializedName("bedrock") BEDROCK, - @SerializedName("SAGEMAKER") + @SerializedName("sagemaker") SAGEMAKER; } diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecCohereVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecCohereVectorizer.java index 71418ee2..1cfc239a 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecCohereVectorizer.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecCohereVectorizer.java @@ -2,7 +2,6 @@ import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.List; import java.util.function.Function; diff --git a/src/test/java/io/weaviate/client6/v1/internal/json/JSONTest.java b/src/test/java/io/weaviate/client6/v1/internal/json/JSONTest.java index d694e2e0..fd1f0440 100644 --- a/src/test/java/io/weaviate/client6/v1/internal/json/JSONTest.java +++ b/src/test/java/io/weaviate/client6/v1/internal/json/JSONTest.java @@ -92,7 +92,7 @@ public static Object[][] testCases() { { VectorConfig.class, Multi2VecClipVectorizer.of(m2v -> m2v - .inferenceUrl("http://example.com") + .baseUrl("http://example.com") .imageField("img", 1f) .textField("txt", 2f)), """ @@ -132,7 +132,7 @@ public static Object[][] testCases() { { VectorConfig.class, Text2VecWeaviateVectorizer.of(t2v -> t2v - .inferenceUrl("http://example.com") + .baseUrl("http://example.com") .dimensions(4) .model("very-good-model")), """ @@ -141,7 +141,7 @@ public static Object[][] testCases() { "vectorIndexConfig": {}, "vectorizer": { "text2vec-weaviate": { - "baseUrl": "http://example.com", + "baseURL": "http://example.com", "dimensions": 4, "model": "very-good-model", "sourceProperties": [] From 7c552e4739fb7db81218ec23c8d89a5bed533aec Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Tue, 28 Oct 2025 14:03:51 +0100 Subject: [PATCH 29/35] feat: add static factories for vectorizer modules Drop Contextionary vectorizer --- .../io/weaviate/containers/Container.java | 2 +- .../io/weaviate/containers/Contextionary.java | 46 - .../io/weaviate/containers/Transformers.java | 42 + .../java/io/weaviate/containers/Weaviate.java | 7 +- .../io/weaviate/integration/SearchITest.java | 6 +- .../v1/api/collections/VectorConfig.java | 994 +++++++++++++++++- .../vectorizers/Text2VecAwsVectorizer.java | 4 +- .../Text2VecContextionaryVectorizer.java | 106 -- .../Text2VecHuggingfaceVectorizer.java | 19 +- .../client6/v1/internal/json/JSONTest.java | 6 +- 10 files changed, 1038 insertions(+), 194 deletions(-) delete mode 100644 src/it/java/io/weaviate/containers/Contextionary.java create mode 100644 src/it/java/io/weaviate/containers/Transformers.java delete mode 100644 src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecContextionaryVectorizer.java diff --git a/src/it/java/io/weaviate/containers/Container.java b/src/it/java/io/weaviate/containers/Container.java index 81b45038..d2713f3a 100644 --- a/src/it/java/io/weaviate/containers/Container.java +++ b/src/it/java/io/weaviate/containers/Container.java @@ -14,7 +14,7 @@ public class Container { public static final Weaviate WEAVIATE = Weaviate.createDefault(); - public static final Contextionary CONTEXTIONARY = Contextionary.createDefault(); + public static final Transformers TRANSFORMERS = Transformers.createDefault(); public static final Img2VecNeural IMG2VEC_NEURAL = Img2VecNeural.createDefault(); public static final MinIo MINIO = MinIo.createDefault(); diff --git a/src/it/java/io/weaviate/containers/Contextionary.java b/src/it/java/io/weaviate/containers/Contextionary.java deleted file mode 100644 index 69abde7d..00000000 --- a/src/it/java/io/weaviate/containers/Contextionary.java +++ /dev/null @@ -1,46 +0,0 @@ -package io.weaviate.containers; - -import org.testcontainers.containers.GenericContainer; - -public class Contextionary extends GenericContainer { - public static final String VERSION = "en0.16.0-v1.2.1"; - public static final String DOCKER_IMAGE = "semitechnologies/contextionary"; - public static final String MODULE = "text2vec-contextionary"; - - public static final String HOST_NAME = "contextionary"; - public static final String URL = HOST_NAME + ":9999"; - - static Contextionary createDefault() { - return new Builder().build(); - } - - static Contextionary.Builder custom() { - return new Builder(); - } - - public static class Builder { - private String versionTag; - - public Builder() { - this.versionTag = VERSION; - } - - public Contextionary build() { - var container = new Contextionary(DOCKER_IMAGE + ":" + versionTag); - container - .withEnv("OCCURRENCE_WEIGHT_LINEAR_FACTOR", "true") - .withEnv("PERSISTENCE_DATA_PATH", "/var/lib/weaviate") - .withEnv("OCCURRENCE_WEIGHT_LINEAR_FACTOR", "0.75") - .withEnv("EXTENSIONS_STORAGE_MODE", "weaviate") - .withEnv("EXTENSIONS_STORAGE_ORIGIN", "http://weaviate:8080") - .withEnv("NEIGHBOR_OCCURRENCE_IGNORE_PERCENTILE", "5") - .withEnv("ENABLE_COMPOUND_SPLITTING", "'false'"); - container.withCreateContainerCmdModifier(cmd -> cmd.withHostName(HOST_NAME)); - return container; - } - } - - public Contextionary(String image) { - super(image); - } -} diff --git a/src/it/java/io/weaviate/containers/Transformers.java b/src/it/java/io/weaviate/containers/Transformers.java new file mode 100644 index 00000000..ac6602fc --- /dev/null +++ b/src/it/java/io/weaviate/containers/Transformers.java @@ -0,0 +1,42 @@ +package io.weaviate.containers; + +import org.testcontainers.containers.GenericContainer; + +import io.weaviate.client6.v1.api.collections.VectorConfig; + +public class Transformers extends GenericContainer { + public static final String VERSION = "sentence-transformers-all-MiniLM-L6-v2"; + public static final String DOCKER_IMAGE = "cr.weaviate.io/semitechnologies/transformers-inference"; + public static final String MODULE = VectorConfig.Kind.TEXT2VEC_TRANSFORMERS.jsonValue(); + + public static final String HOST_NAME = "transformers"; + public static final String URL = HOST_NAME + ":8080"; + + static Transformers createDefault() { + return new Builder().build(); + } + + static Transformers.Builder custom() { + return new Builder(); + } + + public static class Builder { + private String versionTag; + + public Builder() { + this.versionTag = VERSION; + } + + public Transformers build() { + var container = new Transformers(DOCKER_IMAGE + ":" + versionTag); + container + .withEnv("ENABLE_CUDA", "0"); + container.withCreateContainerCmdModifier(cmd -> cmd.withHostName(HOST_NAME)); + return container; + } + } + + public Transformers(String image) { + super(image); + } +} diff --git a/src/it/java/io/weaviate/containers/Weaviate.java b/src/it/java/io/weaviate/containers/Weaviate.java index a89714bd..7fe5a91b 100644 --- a/src/it/java/io/weaviate/containers/Weaviate.java +++ b/src/it/java/io/weaviate/containers/Weaviate.java @@ -112,9 +112,9 @@ public Builder withDefaultVectorizer(String module) { return this; } - public Builder withContextionaryUrl(String url) { - addModules(Contextionary.MODULE); - environment.put("CONTEXTIONARY_URL", url); + public Builder withTransformersUrl(String url) { + addModules(Transformers.MODULE); + environment.put("TRANSFORMERS_INFERENCE_API", url); return this; } @@ -138,6 +138,7 @@ public Builder withFilesystemBackup(String fsPath) { environment.put("BACKUP_FILESYSTEM_PATH", fsPath); return this; } + public Builder withAdminUsers(String... admins) { adminUsers.addAll(Arrays.asList(admins)); return this; diff --git a/src/it/java/io/weaviate/integration/SearchITest.java b/src/it/java/io/weaviate/integration/SearchITest.java index 46a2ded8..e08cbdfb 100644 --- a/src/it/java/io/weaviate/integration/SearchITest.java +++ b/src/it/java/io/weaviate/integration/SearchITest.java @@ -41,19 +41,19 @@ import io.weaviate.client6.v1.api.collections.vectorindex.MultiVector; import io.weaviate.containers.Container; import io.weaviate.containers.Container.ContainerGroup; -import io.weaviate.containers.Contextionary; import io.weaviate.containers.Img2VecNeural; +import io.weaviate.containers.Transformers; import io.weaviate.containers.Weaviate; public class SearchITest extends ConcurrentTest { private static final ContainerGroup compose = Container.compose( Weaviate.custom() - .withContextionaryUrl(Contextionary.URL) + .withTransformersUrl(Transformers.URL) .withImageInference(Img2VecNeural.URL, Img2VecNeural.MODULE) .addModules("generative-dummy") .build(), Container.IMG2VEC_NEURAL, - Container.CONTEXTIONARY); + Container.TRANSFORMERS); @ClassRule // Bind containers to the lifetime of the test public static final TestRule _rule = compose.asTestRule(); private static final WeaviateClient client = compose.getClient(); diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index c50166b9..503ea36c 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -31,11 +31,10 @@ import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecAwsVectorizer; import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecAzureOpenAiVectorizer; import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecCohereVectorizer; -import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecContextionaryVectorizer; import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecDatabricksVectorizer; import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecGoogleAiStudioVectorizer; import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecGoogleVectorizer; -import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecHuggingfaceVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecHuggingFaceVectorizer; import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecJinaAiVectorizer; import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecMistralVectorizer; import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecModel2VecVectorizer; @@ -54,7 +53,6 @@ public interface VectorConfig extends TaggedUnion { public enum Kind implements JsonEnum { NONE("none"), TEXT2VEC_AWS("text2vec-aws"), - TEXT2VEC_CONTEXTIONARY("text2vec-contextionary"), TEXT2VEC_COHERE("text2vec-cohere"), TEXT2VEC_DATABRICKS("text2vec-databricks"), TEXT2VEC_GOOGLE("text2vec-google"), @@ -177,6 +175,111 @@ public static Map.Entry img2vecNeural(String vectorName, return Map.entry(vectorName, Img2VecNeuralVectorizer.of(fn)); } + /** Create a vector index with an {@code multi2multivec-jinaai} vectorizer. */ + public static Map.Entry multi2multivecJinaai() { + return multi2multivecJinaai(VectorIndex.DEFAULT_VECTOR_NAME); + } + + /** + * Create a vector index with an {@code multi2multivec-jinaai} vectorizer. + * + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry multi2multivecJinaai( + Function> fn) { + return multi2multivecJinaai(VectorIndex.DEFAULT_VECTOR_NAME, fn); + } + + /** + * Create a named vector index with an {@code multi2multivec-jinaai} vectorizer. + * + * @param vectorName Vector name. + */ + public static Map.Entry multi2multivecJinaai(String vectorName) { + return Map.entry(vectorName, Multi2MultiVecJinaAiVectorizer.of()); + } + + /** + * Create a named vector index with an {@code multi2multivec-jinaai} vectorizer. + * + * @param vectorName Vector name. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry multi2multivecJinaai(String vectorName, + Function> fn) { + return Map.entry(vectorName, Multi2MultiVecJinaAiVectorizer.of(fn)); + } + + /** Create a vector index with an {@code multi2vec-aws} vectorizer. */ + public static Map.Entry multi2vecAws() { + return multi2vecAws(VectorIndex.DEFAULT_VECTOR_NAME); + } + + /** + * Create a vector index with an {@code multi2vec-aws} vectorizer. + * + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry multi2vecAws( + Function> fn) { + return multi2vecAws(VectorIndex.DEFAULT_VECTOR_NAME, fn); + } + + /** + * Create a named vector index with an {@code multi2vec-aws} vectorizer. + * + * @param vectorName Vector name. + */ + public static Map.Entry multi2vecAws(String vectorName) { + return Map.entry(vectorName, Multi2VecAwsVectorizer.of()); + } + + /** + * Create a named vector index with an {@code multi2vec-aws} vectorizer. + * + * @param vectorName Vector name. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry multi2vecAws(String vectorName, + Function> fn) { + return Map.entry(vectorName, Multi2VecAwsVectorizer.of(fn)); + } + + /** Create a vector index with an {@code multi2vec-bind} vectorizer. */ + public static Map.Entry multi2vecBind() { + return multi2vecBind(VectorIndex.DEFAULT_VECTOR_NAME); + } + + /** + * Create a vector index with an {@code multi2vec-bind} vectorizer. + * + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry multi2vecBind( + Function> fn) { + return multi2vecBind(VectorIndex.DEFAULT_VECTOR_NAME, fn); + } + + /** + * Create a named vector index with an {@code multi2vec-bind} vectorizer. + * + * @param vectorName Vector name. + */ + public static Map.Entry multi2vecBind(String vectorName) { + return Map.entry(vectorName, Multi2VecBindVectorizer.of()); + } + + /** + * Create a named vector index with an {@code multi2vec-bind} vectorizer. + * + * @param vectorName Vector name. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry multi2vecBind(String vectorName, + Function> fn) { + return Map.entry(vectorName, Multi2VecBindVectorizer.of(fn)); + } + /** Create a vector index with an {@code multi2vec-clip} vectorizer. */ public static Map.Entry multi2vecClip() { return multi2vecClip(VectorIndex.DEFAULT_VECTOR_NAME); @@ -212,41 +315,893 @@ public static Map.Entry multi2vecClip(String vectorName, return Map.entry(vectorName, Multi2VecClipVectorizer.of(fn)); } - /** Create a vector index with an {@code text2vec-contextionary} vectorizer. */ - public static Map.Entry text2vecContextionary() { - return text2vecContextionary(VectorIndex.DEFAULT_VECTOR_NAME); + /** Create a vector index with an {@code multi2vec-cohere} vectorizer. */ + public static Map.Entry multi2vecCohere() { + return multi2vecBind(VectorIndex.DEFAULT_VECTOR_NAME); } /** - * Create a vector index with an {@code text2vec-contextionary} vectorizer. + * Create a vector index with an {@code multi2vec-cohere} vectorizer. * * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2vecContextionary( - Function> fn) { - return text2vecContextionary(VectorIndex.DEFAULT_VECTOR_NAME, fn); + public static Map.Entry multi2vecCohere( + Function> fn) { + return multi2vecCohere(VectorIndex.DEFAULT_VECTOR_NAME, fn); } /** - * Create a named vector index with an {@code text2vec-contextionary} - * vectorizer. + * Create a named vector index with an {@code multi2vec-cohere} vectorizer. * * @param vectorName Vector name. */ - public static Map.Entry text2vecContextionary(String vectorName) { - return Map.entry(vectorName, Text2VecContextionaryVectorizer.of()); + public static Map.Entry multi2vecCohere(String vectorName) { + return Map.entry(vectorName, Multi2VecCohereVectorizer.of()); } /** - * Create a named vector index with an {@code text2vec-contextionary} - * vectorizer. + * Create a named vector index with an {@code multi2vec-cohere} vectorizer. + * + * @param vectorName Vector name. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry multi2vecCohere(String vectorName, + Function> fn) { + return Map.entry(vectorName, Multi2VecCohereVectorizer.of(fn)); + } + + /** + * Create a vector index with an {@code multi2vec-google} vectorizer. + * + * @param location Geographic region the Google Cloud model runs in. + */ + public static Map.Entry multi2vecGoogle(String location) { + return multi2vecGoogle(VectorIndex.DEFAULT_VECTOR_NAME, location); + } + + /** + * Create a vector index with an {@code multi2vec-google} vectorizer. + * + * @param location Geographic region the Google Cloud model runs in. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry multi2vecGoogle( + String location, + Function> fn) { + return multi2vecGoogle(VectorIndex.DEFAULT_VECTOR_NAME, location, fn); + } + + /** + * Create a named vector index with an {@code multi2vec-google} vectorizer. + * + * @param vectorName Vector name. + * @param location Geographic region the Google Cloud model runs in. + */ + public static Map.Entry multi2vecGoogle(String vectorName, String location) { + return Map.entry(vectorName, Multi2VecGoogleVectorizer.of(location)); + } + + /** + * Create a named vector index with an {@code multi2vec-google} vectorizer. + * + * @param vectorName Vector name. + * @param location Geographic region the Google Cloud model runs in. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry multi2vecGoogle(String vectorName, + String location, + Function> fn) { + return Map.entry(vectorName, Multi2VecGoogleVectorizer.of(location, fn)); + } + + /** Create a vector index with an {@code multi2vec-jinaai} vectorizer. */ + public static Map.Entry multi2vecJinaAi() { + return multi2vecJinaAi(VectorIndex.DEFAULT_VECTOR_NAME); + } + + /** + * Create a vector index with an {@code multi2vec-jinaai} vectorizer. + * + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry multi2vecJinaAi( + Function> fn) { + return multi2vecJinaAi(VectorIndex.DEFAULT_VECTOR_NAME, fn); + } + + /** + * Create a named vector index with an {@code multi2vec-jinaai} vectorizer. + * + * @param vectorName Vector name. + */ + public static Map.Entry multi2vecJinaAi(String vectorName) { + return Map.entry(vectorName, Multi2VecJinaAiVectorizer.of()); + } + + /** + * Create a named vector index with an {@code multi2vec-jinaai} vectorizer. + * + * @param vectorName Vector name. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry multi2vecJinaAi(String vectorName, + Function> fn) { + return Map.entry(vectorName, Multi2VecJinaAiVectorizer.of(fn)); + } + + /** Create a vector index with an {@code multi2vec-nvidia} vectorizer. */ + public static Map.Entry multi2vecNvidia() { + return multi2vecNvidia(VectorIndex.DEFAULT_VECTOR_NAME); + } + + /** + * Create a vector index with an {@code multi2vec-nvidia} vectorizer. + * + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry multi2vecNvidia( + Function> fn) { + return multi2vecNvidia(VectorIndex.DEFAULT_VECTOR_NAME, fn); + } + + /** + * Create a named vector index with an {@code multi2vec-nvidia} vectorizer. + * + * @param vectorName Vector name. + */ + public static Map.Entry multi2vecNvidia(String vectorName) { + return Map.entry(vectorName, Multi2VecNvidiaVectorizer.of()); + } + + /** + * Create a named vector index with an {@code multi2vec-nvidia} vectorizer. + * + * @param vectorName Vector name. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry multi2vecNvidia(String vectorName, + Function> fn) { + return Map.entry(vectorName, Multi2VecNvidiaVectorizer.of(fn)); + } + + /** Create a vector index with an {@code multi2vec-voyageai} vectorizer. */ + public static Map.Entry multi2vecVoyageAi() { + return multi2vecVoyageAi(VectorIndex.DEFAULT_VECTOR_NAME); + } + + /** + * Create a vector index with an {@code multi2vec-voyageai} vectorizer. + * + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry multi2vecVoyageAi( + Function> fn) { + return multi2vecVoyageAi(VectorIndex.DEFAULT_VECTOR_NAME, fn); + } + + /** + * Create a named vector index with an {@code multi2vec-voyageai} vectorizer. + * + * @param vectorName Vector name. + */ + public static Map.Entry multi2vecVoyageAi(String vectorName) { + return Map.entry(vectorName, Multi2VecVoyageAiVectorizer.of()); + } + + /** + * Create a named vector index with an {@code multi2vec-voyageai} vectorizer. + * + * @param vectorName Vector name. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry multi2vecVoyageAi(String vectorName, + Function> fn) { + return Map.entry(vectorName, Multi2VecVoyageAiVectorizer.of(fn)); + } + + /** Create a vector index with an {@code ref2vec-centroid} vectorizer. */ + public static Map.Entry ref2vecCentroid() { + return ref2vecCentroid(VectorIndex.DEFAULT_VECTOR_NAME); + } + + /** + * Create a vector index with an {@code ref2vec-centroid} vectorizer. + * + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry ref2vecCentroid( + Function> fn) { + return ref2vecCentroid(VectorIndex.DEFAULT_VECTOR_NAME, fn); + } + + /** + * Create a named vector index with an {@code ref2vec-centroid} vectorizer. + * + * @param vectorName Vector name. + */ + public static Map.Entry ref2vecCentroid(String vectorName) { + return Map.entry(vectorName, Ref2VecCentroidVectorizer.of()); + } + + /** + * Create a named vector index with an {@code ref2vec-centroid} vectorizer. + * + * @param vectorName Vector name. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry ref2vecCentroid(String vectorName, + Function> fn) { + return Map.entry(vectorName, Ref2VecCentroidVectorizer.of(fn)); + } + + /** Create a vector index with an {@code text2multivec-jinaai} vectorizer. */ + public static Map.Entry text2multivecJinaAi() { + return text2multivecJinaAi(VectorIndex.DEFAULT_VECTOR_NAME); + } + + /** + * Create a vector index with an {@code text2multivec-jinaai} vectorizer. + * + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2multivecJinaAi( + Function> fn) { + return text2multivecJinaAi(VectorIndex.DEFAULT_VECTOR_NAME, fn); + } + + /** + * Create a named vector index with an {@code text2multivec-jinaai} vectorizer. + * + * @param vectorName Vector name. + */ + public static Map.Entry text2multivecJinaAi(String vectorName) { + return Map.entry(vectorName, Text2MultiVecJinaAiVectorizer.of()); + } + + /** + * Create a named vector index with an {@code text2multivec-jinaai} vectorizer. + * + * @param vectorName Vector name. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2multivecJinaAi(String vectorName, + Function> fn) { + return Map.entry(vectorName, Text2MultiVecJinaAiVectorizer.of(fn)); + } + + /** + * Create a vector index with an {@code text2vec-aws} vectorizer with Bedrock + * integration. + * + * @param model Inference model. + */ + public static Map.Entry text2vecAwsBedrock(String model) { + return text2vecAwsBedrock(VectorIndex.DEFAULT_VECTOR_NAME, model); + } + + /** + * Create a vector index with an {@code text2vec-aws} vectorizer with Bedrock + * integration. + * + * @param model Inference model. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2vecAwsBedrock( + String model, + Function> fn) { + return text2vecAwsBedrock(VectorIndex.DEFAULT_VECTOR_NAME, model, fn); + } + + /** + * Create a named vector index with an {@code text2vec-aws} + * vectorizer with Bedrock integration. + * + * @param vectorName Vector name. + * @param model Inference model. + */ + public static Map.Entry text2vecAwsBedrock(String vectorName, String model) { + return Map.entry(vectorName, Text2VecAwsVectorizer.bedrock(model)); + } + + /** + * Create a named vector index with an {@code text2vec-aws} + * vectorizer with Bedrock integration. + * + * @param vectorName Vector name. + * @param model Inference model. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2vecAwsBedrock(String vectorName, + String model, + Function> fn) { + return Map.entry(vectorName, Text2VecAwsVectorizer.bedrock(model, fn)); + } + + /** + * Create a vector index with an {@code text2vec-aws} vectorizer with Sagemaker + * integration. + * + * @param baseUrl Base URL of the inference service. + */ + public static Map.Entry text2vecAwsSagemaker(String baseUrl) { + return text2vecAwsSagemaker(VectorIndex.DEFAULT_VECTOR_NAME, baseUrl); + } + + /** + * Create a vector index with an {@code text2vec-aws} vectorizer with Sagemaker + * integration. + * + * @param baseUrl Base URL of the inference service. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2vecAwsSagemaker( + String baseUrl, + Function> fn) { + return text2vecAwsSagemaker(VectorIndex.DEFAULT_VECTOR_NAME, baseUrl, fn); + } + + /** + * Create a named vector index with an {@code text2vec-aws} + * vectorizer with Sagemaker integration. + * + * @param vectorName Vector name. + * @param baseUrl Base URL of the inference service. + */ + public static Map.Entry text2vecAwsSagemaker(String vectorName, String baseUrl) { + return Map.entry(vectorName, Text2VecAwsVectorizer.sagemaker(baseUrl)); + } + + /** + * Create a named vector index with an {@code text2vec-aws} + * vectorizer with Sagemaker integration. + * + * @param vectorName Vector name. + * @param baseUrl Base URL of the inference service. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2vecAwsSagemaker(String vectorName, + String baseUrl, + Function> fn) { + return Map.entry(vectorName, Text2VecAwsVectorizer.sagemaker(baseUrl, fn)); + } + + /** + * Create a vector index with an {@code text2vec-openai} vectorizer deployed on + * Azure. + */ + public static Map.Entry text2VecAzureOpenAi() { + return text2VecAzureOpenAi(VectorIndex.DEFAULT_VECTOR_NAME); + } + + /** + * Create a vector index with an {@code text2vec-openai} vectorizer deployed on + * Azure. + * + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecAzureOpenAi( + Function> fn) { + return text2VecAzureOpenAi(VectorIndex.DEFAULT_VECTOR_NAME, fn); + } + + /** + * Create a named vector index with an {@code text2vec-openai} vectorizer + * deployed on Azure. + * + * @param vectorName Vector name. + */ + public static Map.Entry text2VecAzureOpenAi(String vectorName) { + return Map.entry(vectorName, Text2VecAzureOpenAiVectorizer.of()); + } + + /** + * Create a named vector index with an {@code text2vec-openai} vectorizer + * deployed on Azure. + * + * @param vectorName Vector name. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecAzureOpenAi(String vectorName, + Function> fn) { + return Map.entry(vectorName, Text2VecAzureOpenAiVectorizer.of(fn)); + } + + /** Create a vector index with an {@code text2vec-cohere} vectorizer. */ + public static Map.Entry text2vecCohere() { + return text2vecCohere(VectorIndex.DEFAULT_VECTOR_NAME); + } + + /** + * Create a vector index with an {@code text2vec-cohere} vectorizer. + * + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2vecCohere( + Function> fn) { + return text2vecCohere(VectorIndex.DEFAULT_VECTOR_NAME, fn); + } + + /** + * Create a named vector index with an {@code text2vec-cohere} + * vectorizer. + * + * @param vectorName Vector name. + */ + public static Map.Entry text2vecCohere(String vectorName) { + return Map.entry(vectorName, Text2VecCohereVectorizer.of()); + } + + /** + * Create a named vector index with an {@code text2vec-cohere} + * vectorizer. + * + * @param vectorName Vector name. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2vecCohere(String vectorName, + Function> fn) { + return Map.entry(vectorName, Text2VecCohereVectorizer.of(fn)); + } + + /** Create a vector index with an {@code text2vec-databricks} vectorizer. */ + public static Map.Entry text2VecDatabricks() { + return text2VecDatabricks(VectorIndex.DEFAULT_VECTOR_NAME); + } + + /** + * Create a vector index with an {@code text2vec-databricks} vectorizer. + * + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecDatabricks( + Function> fn) { + return text2VecDatabricks(VectorIndex.DEFAULT_VECTOR_NAME, fn); + } + + /** + * Create a named vector index with an {@code text2vec-databricks} vectorizer. + * + * @param vectorName Vector name. + */ + public static Map.Entry text2VecDatabricks(String vectorName) { + return Map.entry(vectorName, Text2VecDatabricksVectorizer.of()); + } + + /** + * Create a named vector index with an {@code text2vec-databricks} vectorizer. + * + * @param vectorName Vector name. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecDatabricks(String vectorName, + Function> fn) { + return Map.entry(vectorName, Text2VecDatabricksVectorizer.of(fn)); + } + + /** + * Create a vector index with an {@code text2vec-google} vectorizer with Google + * AI Studio integration. + */ + public static Map.Entry text2VecGoogleAiStudio() { + return text2VecGoogleAiStudio(VectorIndex.DEFAULT_VECTOR_NAME); + } + + /** + * Create a vector index with an {@code text2vec-google} vectorizer with Google + * AI Studio integration. + * + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecGoogleAiStudio( + Function> fn) { + return text2VecGoogleAiStudio(VectorIndex.DEFAULT_VECTOR_NAME, fn); + } + + /** + * Create a named vector index with an {@code text2vec-google} vectorizer with + * Google AI Studio integration. + * + * @param vectorName Vector name. + */ + public static Map.Entry text2VecGoogleAiStudio(String vectorName) { + return Map.entry(vectorName, Text2VecGoogleAiStudioVectorizer.of()); + } + + /** + * Create a named vector index with an {@code text2vec-google} vectorizer with + * Google AI Studio integration. + * + * @param vectorName Vector name. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecGoogleAiStudio(String vectorName, + Function> fn) { + return Map.entry(vectorName, Text2VecGoogleAiStudioVectorizer.of(fn)); + } + + /** Create a vector index with an {@code text2vec-google} vectorizer. */ + public static Map.Entry text2VecGoogle() { + return text2VecGoogle(VectorIndex.DEFAULT_VECTOR_NAME); + } + + /** + * Create a vector index with an {@code text2vec-google} vectorizer. + * + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecGoogle( + Function> fn) { + return text2VecGoogle(VectorIndex.DEFAULT_VECTOR_NAME, fn); + } + + /** + * Create a named vector index with an {@code text2vec-google} vectorizer. + * + * @param vectorName Vector name. + */ + public static Map.Entry text2VecGoogle(String vectorName) { + return Map.entry(vectorName, Text2VecGoogleVectorizer.of()); + } + + /** + * Create a named vector index with an {@code text2vec-google} vectorizer. + * + * @param vectorName Vector name. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecGoogle(String vectorName, + Function> fn) { + return Map.entry(vectorName, Text2VecGoogleVectorizer.of(fn)); + } + + /** Create a vector index with an {@code text2vec-huggingface} vectorizer. */ + public static Map.Entry text2VecHuggingFace() { + return text2VecHuggingFace(VectorIndex.DEFAULT_VECTOR_NAME); + } + + /** + * Create a vector index with an {@code text2vec-huggingface} vectorizer. + * + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecHuggingFace( + Function> fn) { + return text2VecHuggingFace(VectorIndex.DEFAULT_VECTOR_NAME, fn); + } + + /** + * Create a named vector index with an {@code text2vec-huggingface} vectorizer. + * + * @param vectorName Vector name. + */ + public static Map.Entry text2VecHuggingFace(String vectorName) { + return Map.entry(vectorName, Text2VecHuggingFaceVectorizer.of()); + } + + /** + * Create a named vector index with an {@code text2vec-huggingface} vectorizer. + * + * @param vectorName Vector name. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecHuggingFace(String vectorName, + Function> fn) { + return Map.entry(vectorName, Text2VecHuggingFaceVectorizer.of(fn)); + } + + /** Create a vector index with an {@code text2vec-jinaai} vectorizer. */ + public static Map.Entry text2VecJinaAi() { + return text2VecJinaAi(VectorIndex.DEFAULT_VECTOR_NAME); + } + + /** + * Create a vector index with an {@code text2vec-jinaai} vectorizer. + * + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecJinaAi( + Function> fn) { + return text2VecJinaAi(VectorIndex.DEFAULT_VECTOR_NAME, fn); + } + + /** + * Create a named vector index with an {@code text2vec-jinaai} vectorizer. + * + * @param vectorName Vector name. + */ + public static Map.Entry text2VecJinaAi(String vectorName) { + return Map.entry(vectorName, Text2VecJinaAiVectorizer.of()); + } + + /** + * Create a named vector index with an {@code text2vec-jinaai} vectorizer. + * + * @param vectorName Vector name. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecJinaAi(String vectorName, + Function> fn) { + return Map.entry(vectorName, Text2VecJinaAiVectorizer.of(fn)); + } + + /** Create a vector index with an {@code text2vec-mistral} vectorizer. */ + public static Map.Entry text2VecMistral() { + return text2VecMistral(VectorIndex.DEFAULT_VECTOR_NAME); + } + + /** + * Create a vector index with an {@code text2vec-mistral} vectorizer. + * + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecMistral( + Function> fn) { + return text2VecMistral(VectorIndex.DEFAULT_VECTOR_NAME, fn); + } + + /** + * Create a named vector index with an {@code text2vec-mistral} vectorizer. + * + * @param vectorName Vector name. + */ + public static Map.Entry text2VecMistral(String vectorName) { + return Map.entry(vectorName, Text2VecMistralVectorizer.of()); + } + + /** + * Create a named vector index with an {@code text2vec-mistral} vectorizer. + * + * @param vectorName Vector name. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecMistral(String vectorName, + Function> fn) { + return Map.entry(vectorName, Text2VecMistralVectorizer.of(fn)); + } + + /** Create a vector index with an {@code text2vec-model2vec} vectorizer. */ + public static Map.Entry text2VecModel2Vec() { + return text2VecModel2Vec(VectorIndex.DEFAULT_VECTOR_NAME); + } + + /** + * Create a vector index with an {@code text2vec-model2vec} vectorizer. + * + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecModel2Vec( + Function> fn) { + return text2VecModel2Vec(VectorIndex.DEFAULT_VECTOR_NAME, fn); + } + + /** + * Create a named vector index with an {@code text2vec-model2vec} vectorizer. + * + * @param vectorName Vector name. + */ + public static Map.Entry text2VecModel2Vec(String vectorName) { + return Map.entry(vectorName, Text2VecModel2VecVectorizer.of()); + } + + /** + * Create a named vector index with an {@code text2vec-model2vec} vectorizer. + * + * @param vectorName Vector name. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecModel2Vec(String vectorName, + Function> fn) { + return Map.entry(vectorName, Text2VecModel2VecVectorizer.of(fn)); + } + + /** Create a vector index with an {@code text2vec-morph} vectorizer. */ + public static Map.Entry text2VecMorph() { + return text2VecMorph(VectorIndex.DEFAULT_VECTOR_NAME); + } + + /** + * Create a vector index with an {@code text2vec-morph} vectorizer. + * + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecMorph( + Function> fn) { + return text2VecMorph(VectorIndex.DEFAULT_VECTOR_NAME, fn); + } + + /** + * Create a named vector index with an {@code text2vec-morph} vectorizer. + * + * @param vectorName Vector name. + */ + public static Map.Entry text2VecMorph(String vectorName) { + return Map.entry(vectorName, Text2VecMorphVectorizer.of()); + } + + /** + * Create a named vector index with an {@code text2vec-morph} vectorizer. + * + * @param vectorName Vector name. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecMorph(String vectorName, + Function> fn) { + return Map.entry(vectorName, Text2VecMorphVectorizer.of(fn)); + } + + /** Create a vector index with an {@code text2vec-nvidia} vectorizer. */ + public static Map.Entry text2VecNvidia() { + return text2VecNvidia(VectorIndex.DEFAULT_VECTOR_NAME); + } + + /** + * Create a vector index with an {@code text2vec-nvidia} vectorizer. + * + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecNvidia( + Function> fn) { + return text2VecNvidia(VectorIndex.DEFAULT_VECTOR_NAME, fn); + } + + /** + * Create a named vector index with an {@code text2vec-nvidia} vectorizer. + * + * @param vectorName Vector name. + */ + public static Map.Entry text2VecNvidia(String vectorName) { + return Map.entry(vectorName, Text2VecNvidiaVectorizer.of()); + } + + /** + * Create a named vector index with an {@code text2vec-nvidia} vectorizer. + * + * @param vectorName Vector name. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecNvidia(String vectorName, + Function> fn) { + return Map.entry(vectorName, Text2VecNvidiaVectorizer.of(fn)); + } + + /** Create a vector index with an {@code text2vec-ollama} vectorizer. */ + public static Map.Entry text2VecOllama() { + return text2VecOllama(VectorIndex.DEFAULT_VECTOR_NAME); + } + + /** + * Create a vector index with an {@code text2vec-ollama} vectorizer. + * + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecOllama( + Function> fn) { + return text2VecOllama(VectorIndex.DEFAULT_VECTOR_NAME, fn); + } + + /** + * Create a named vector index with an {@code text2vec-ollama} vectorizer. + * + * @param vectorName Vector name. + */ + public static Map.Entry text2VecOllama(String vectorName) { + return Map.entry(vectorName, Text2VecOllamaVectorizer.of()); + } + + /** + * Create a named vector index with an {@code text2vec-ollama} vectorizer. + * + * @param vectorName Vector name. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecOllama(String vectorName, + Function> fn) { + return Map.entry(vectorName, Text2VecOllamaVectorizer.of(fn)); + } + + /** Create a vector index with an {@code text2vec-openai} vectorizer. */ + public static Map.Entry text2VecOpenAi() { + return text2VecOpenAi(VectorIndex.DEFAULT_VECTOR_NAME); + } + + /** + * Create a vector index with an {@code text2vec-openai} vectorizer. + * + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecOpenAi( + Function> fn) { + return text2VecOpenAi(VectorIndex.DEFAULT_VECTOR_NAME, fn); + } + + /** + * Create a named vector index with an {@code text2vec-openai} vectorizer. + * + * @param vectorName Vector name. + */ + public static Map.Entry text2VecOpenAi(String vectorName) { + return Map.entry(vectorName, Text2VecOpenAiVectorizer.of()); + } + + /** + * Create a named vector index with an {@code text2vec-openai} vectorizer. + * + * @param vectorName Vector name. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecOpenAi(String vectorName, + Function> fn) { + return Map.entry(vectorName, Text2VecOpenAiVectorizer.of(fn)); + } + + /** Create a vector index with an {@code text2vec-transformers} vectorizer. */ + public static Map.Entry text2VecTransformers() { + return text2VecTransformers(VectorIndex.DEFAULT_VECTOR_NAME); + } + + /** + * Create a vector index with an {@code text2vec-transformers} vectorizer. + * + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecTransformers( + Function> fn) { + return text2VecTransformers(VectorIndex.DEFAULT_VECTOR_NAME, fn); + } + + /** + * Create a named vector index with an {@code text2vec-transformers} vectorizer. + * + * @param vectorName Vector name. + */ + public static Map.Entry text2VecTransformers(String vectorName) { + return Map.entry(vectorName, Text2VecTransformersVectorizer.of()); + } + + /** + * Create a named vector index with an {@code text2vec-transformers} vectorizer. + * + * @param vectorName Vector name. + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecTransformers(String vectorName, + Function> fn) { + return Map.entry(vectorName, Text2VecTransformersVectorizer.of(fn)); + } + + /** Create a vector index with an {@code text2vec-voyageai} vectorizer. */ + public static Map.Entry text2VecVoyageAi() { + return text2VecVoyageAi(VectorIndex.DEFAULT_VECTOR_NAME); + } + + /** + * Create a vector index with an {@code text2vec-voyageai} vectorizer. + * + * @param fn Lambda expression for optional parameters. + */ + public static Map.Entry text2VecVoyageAi( + Function> fn) { + return text2VecVoyageAi(VectorIndex.DEFAULT_VECTOR_NAME, fn); + } + + /** + * Create a named vector index with an {@code text2vec-voyageai} vectorizer. + * + * @param vectorName Vector name. + */ + public static Map.Entry text2VecVoyageAi(String vectorName) { + return Map.entry(vectorName, Text2VecVoyageAiVectorizer.of()); + } + + /** + * Create a named vector index with an {@code text2vec-voyageai} vectorizer. * * @param vectorName Vector name. * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2vecContextionary(String vectorName, - Function> fn) { - return Map.entry(vectorName, Text2VecContextionaryVectorizer.of(fn)); + public static Map.Entry text2VecVoyageAi(String vectorName, + Function> fn) { + return Map.entry(vectorName, Text2VecVoyageAiVectorizer.of(fn)); } /** Create a vector index with an {@code text2vec-weaviate} vectorizer. */ @@ -298,7 +1253,6 @@ private final void addAdapter(Gson gson, VectorConfig.Kind kind, Class> fn) { + Function> fn) { return fn.apply(new BedrockBuilder(model)).build(); } @@ -68,7 +68,7 @@ public static Text2VecAwsVectorizer sagemaker(String baseUrl) { public static Text2VecAwsVectorizer sagemaker( String baseUrl, - Function> fn) { + Function> fn) { return fn.apply(new SagemakerBuilder(baseUrl)).build(); } diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecContextionaryVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecContextionaryVectorizer.java deleted file mode 100644 index 00a2b98e..00000000 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecContextionaryVectorizer.java +++ /dev/null @@ -1,106 +0,0 @@ -package io.weaviate.client6.v1.api.collections.vectorizers; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.function.Function; - -import com.google.gson.annotations.SerializedName; - -import io.weaviate.client6.v1.api.collections.Quantization; -import io.weaviate.client6.v1.api.collections.VectorConfig; -import io.weaviate.client6.v1.api.collections.VectorIndex; -import io.weaviate.client6.v1.internal.ObjectBuilder; - -public record Text2VecContextionaryVectorizer( - /** - * Weaviate defaults to {@code true} if the value is not provided. - * Because text2vec-contextionary cannot handle underscores in collection names, - * this quickly becomes inconvenient. - * - * To avoid that we send "vectorizeClassName": false all the time - * and make it impossible to enable this feature, as it is deprecated. - */ - @Deprecated @SerializedName("vectorizeClassName") boolean vectorizeCollectionName, - /** Properties included in the embedding. */ - @SerializedName("sourceProperties") List sourceProperties, - /** Vector index configuration. */ - VectorIndex vectorIndex, - /** Vector quantization method. */ - Quantization quantization) implements VectorConfig { - - @Override - public VectorConfig.Kind _kind() { - return VectorConfig.Kind.TEXT2VEC_CONTEXTIONARY; - } - - @Override - public Object _self() { - return this; - } - - public static Text2VecContextionaryVectorizer of() { - return of(ObjectBuilder.identity()); - } - - public static Text2VecContextionaryVectorizer of( - Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Canonical constructor always sets {@link #vectorizeCollectionName} to false. - */ - public Text2VecContextionaryVectorizer(boolean vectorizeCollectionName, List sourceProperties, - VectorIndex vectorIndex, Quantization quantization) { - this.vectorizeCollectionName = false; - this.sourceProperties = sourceProperties; - this.vectorIndex = vectorIndex; - this.quantization = quantization; - } - - public Text2VecContextionaryVectorizer(Builder builder) { - this(builder.vectorizeCollectionName, builder.sourceProperties, builder.vectorIndex, builder.quantization); - } - - public static class Builder implements ObjectBuilder { - private final boolean vectorizeCollectionName = false; - private Quantization quantization; - - private List sourceProperties = new ArrayList<>(); - private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX; - - /** Add properties to include in the embedding. */ - public Builder sourceProperties(String... properties) { - return sourceProperties(Arrays.asList(properties)); - } - - /** Add properties to include in the embedding. */ - public Builder sourceProperties(List properties) { - this.sourceProperties.addAll(properties); - return this; - } - - /** - * Override default vector index configuration. - * - * HNSW - * is the default vector index. - */ - public Builder vectorIndex(VectorIndex vectorIndex) { - this.vectorIndex = vectorIndex; - return this; - } - - public Builder quantization(Quantization quantization) { - this.quantization = quantization; - return this; - } - - public Text2VecContextionaryVectorizer build() { - return new Text2VecContextionaryVectorizer(this); - } - } -} diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecHuggingfaceVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecHuggingfaceVectorizer.java index 9b18947e..ea63e30e 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecHuggingfaceVectorizer.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecHuggingfaceVectorizer.java @@ -2,7 +2,6 @@ import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.List; import java.util.function.Function; @@ -13,7 +12,7 @@ import io.weaviate.client6.v1.api.collections.VectorIndex; import io.weaviate.client6.v1.internal.ObjectBuilder; -public record Text2VecHuggingfaceVectorizer( +public record Text2VecHuggingFaceVectorizer( @SerializedName("endpointURL") String baseUrl, @SerializedName("model") String model, @SerializedName("passageModel") String passageModel, @@ -45,19 +44,19 @@ public Object _self() { return this; } - public static Text2VecHuggingfaceVectorizer of() { + public static Text2VecHuggingFaceVectorizer of() { return of(ObjectBuilder.identity()); } - public static Text2VecHuggingfaceVectorizer of( - Function> fn) { + public static Text2VecHuggingFaceVectorizer of( + Function> fn) { return fn.apply(new Builder()).build(); } /** * Canonical constructor always sets {@link #vectorizeCollectionName} to false. */ - public Text2VecHuggingfaceVectorizer( + public Text2VecHuggingFaceVectorizer( String baseUrl, String model, String passageModel, @@ -84,7 +83,7 @@ public Text2VecHuggingfaceVectorizer( this.quantization = quantization; } - public Text2VecHuggingfaceVectorizer(Builder builder) { + public Text2VecHuggingFaceVectorizer(Builder builder) { this( builder.baseUrl, builder.model, @@ -99,7 +98,7 @@ public Text2VecHuggingfaceVectorizer(Builder builder) { builder.quantization); } - public static class Builder implements ObjectBuilder { + public static class Builder implements ObjectBuilder { private final boolean vectorizeCollectionName = false; private Quantization quantization; private List sourceProperties = new ArrayList<>(); @@ -178,8 +177,8 @@ public Builder quantization(Quantization quantization) { return this; } - public Text2VecHuggingfaceVectorizer build() { - return new Text2VecHuggingfaceVectorizer(this); + public Text2VecHuggingFaceVectorizer build() { + return new Text2VecHuggingFaceVectorizer(this); } } } diff --git a/src/test/java/io/weaviate/client6/v1/internal/json/JSONTest.java b/src/test/java/io/weaviate/client6/v1/internal/json/JSONTest.java index fd1f0440..773340a5 100644 --- a/src/test/java/io/weaviate/client6/v1/internal/json/JSONTest.java +++ b/src/test/java/io/weaviate/client6/v1/internal/json/JSONTest.java @@ -39,7 +39,7 @@ import io.weaviate.client6.v1.api.collections.vectorizers.Img2VecNeuralVectorizer; import io.weaviate.client6.v1.api.collections.vectorizers.Multi2VecClipVectorizer; import io.weaviate.client6.v1.api.collections.vectorizers.SelfProvidedVectorizer; -import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecContextionaryVectorizer; +import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecCohereVectorizer; import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecWeaviateVectorizer; import io.weaviate.client6.v1.api.rbac.AliasesPermission; import io.weaviate.client6.v1.api.rbac.BackupsPermission; @@ -115,13 +115,13 @@ public static Object[][] testCases() { }, { VectorConfig.class, - Text2VecContextionaryVectorizer.of(), + Text2VecCohereVectorizer.of(), """ { "vectorIndexType": "hnsw", "vectorIndexConfig": {}, "vectorizer": { - "text2vec-contextionary": { + "text2vec-cohere": { "vectorizeClassName": false, "sourceProperties": [] } From a12ac4584b19c4d8452aa5553ea1c0a8186cbdaa Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Tue, 28 Oct 2025 14:45:45 +0100 Subject: [PATCH 30/35] chore: fix imports --- .../io/weaviate/integration/SearchITest.java | 18 +++++++++--------- .../v1/api/collections/VectorConfig.java | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/it/java/io/weaviate/integration/SearchITest.java b/src/it/java/io/weaviate/integration/SearchITest.java index e08cbdfb..4fbac7f8 100644 --- a/src/it/java/io/weaviate/integration/SearchITest.java +++ b/src/it/java/io/weaviate/integration/SearchITest.java @@ -151,7 +151,7 @@ public void testNearText() throws IOException { client.collections.create(nsSongs, col -> col .properties(Property.text("title")) - .vectorConfig(VectorConfig.text2vecContextionary())); + .vectorConfig(VectorConfig.text2VecTransformers())); var songs = client.collections.use(nsSongs); var submarine = songs.data.insert(Map.of("title", "Yellow Submarine")); @@ -173,7 +173,7 @@ public void testNearText() throws IOException { @Test public void testNearText_groupBy() throws IOException { - var vectorizer = VectorConfig.text2vecContextionary(); + var vectorizer = VectorConfig.text2VecTransformers(); var nsArtists = ns("Artists"); client.collections.create(nsArtists, @@ -370,7 +370,7 @@ public void testNearObject() throws IOException { client.collections.create(nsAnimals, collection -> collection .properties(Property.text("kind")) - .vectorConfig(VectorConfig.text2vecContextionary())); + .vectorConfig(VectorConfig.text2VecTransformers())); var animals = client.collections.use(nsAnimals); @@ -399,7 +399,7 @@ public void testHybrid() throws IOException { client.collections.create(nsHobbies, collection -> collection .properties(Property.text("name"), Property.text("description")) - .vectorConfig(VectorConfig.text2vecContextionary())); + .vectorConfig(VectorConfig.text2VecTransformers())); var hobbies = client.collections.use(nsHobbies); @@ -432,7 +432,7 @@ public void testBadRequest() throws IOException { client.collections.create(nsThings, collection -> collection .properties(Property.text("name")) - .vectorConfig(VectorConfig.text2vecContextionary())); + .vectorConfig(VectorConfig.text2VecTransformers())); var things = client.collections.use(nsThings); var balloon = things.data.insert(Map.of("name", "balloon")); @@ -449,7 +449,7 @@ public void testBadRequest_async() throws Throwable { async.collections.create(nsThings, collection -> collection .properties(Property.text("name")) - .vectorConfig(VectorConfig.text2vecContextionary())) + .vectorConfig(VectorConfig.text2VecTransformers())) .join(); var things = async.collections.use(nsThings); @@ -470,7 +470,7 @@ public void testMetadataAll() throws IOException { client.collections.create(nsThings, c -> c .properties(Property.text("name")) - .vectorConfig(VectorConfig.text2vecContextionary( + .vectorConfig(VectorConfig.text2VecTransformers( t2v -> t2v.sourceProperties("name")))); var things = client.collections.use(nsThings); @@ -563,7 +563,7 @@ public void testGenerative_bm25() throws IOException { c -> c .properties(Property.text("title")) .generativeModule(new DummyGenerative()) - .vectorConfig(VectorConfig.text2vecContextionary( + .vectorConfig(VectorConfig.text2VecTransformers( t2v -> t2v.sourceProperties("title")))); var things = client.collections.use(nsThings); @@ -604,7 +604,7 @@ public void testGenerative_bm25_groupBy() throws IOException { c -> c .properties(Property.text("title")) .generativeModule(new DummyGenerative()) - .vectorConfig(VectorConfig.text2vecContextionary( + .vectorConfig(VectorConfig.text2VecTransformers( t2v -> t2v.sourceProperties("title")))); var things = client.collections.use(nsThings); diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index 503ea36c..44cf3c97 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -1257,7 +1257,7 @@ private final void init(Gson gson) { addAdapter(gson, VectorConfig.Kind.TEXT2VEC_DATABRICKS, Text2VecDatabricksVectorizer.class); addAdapter(gson, VectorConfig.Kind.TEXT2VEC_GOOGLE, Text2VecGoogleVectorizer.class); addAdapter(gson, VectorConfig.Kind.TEXT2VEC_GOOGLEAISTUDIO, Text2VecGoogleAiStudioVectorizer.class); - addAdapter(gson, VectorConfig.Kind.TEXT2VEC_HUGGINGFACE, Text2VecHuggingfaceVectorizer.class); + addAdapter(gson, VectorConfig.Kind.TEXT2VEC_HUGGINGFACE, Text2VecHuggingFaceVectorizer.class); addAdapter(gson, VectorConfig.Kind.REF2VEC_CENTROID, Ref2VecCentroidVectorizer.class); addAdapter(gson, VectorConfig.Kind.TEXT2VEC_JINAAI, Text2VecJinaAiVectorizer.class); addAdapter(gson, VectorConfig.Kind.TEXT2VEC_MISTRAL, Text2VecMistralVectorizer.class); From 9fb8e49f86c1624513520d293fb5234a036d614c Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Tue, 28 Oct 2025 15:11:41 +0100 Subject: [PATCH 31/35] test: fix connection to Transformers container --- src/it/java/io/weaviate/containers/MinIo.java | 3 +++ src/it/java/io/weaviate/containers/Weaviate.java | 4 ++-- src/it/java/io/weaviate/integration/SearchITest.java | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/it/java/io/weaviate/containers/MinIo.java b/src/it/java/io/weaviate/containers/MinIo.java index 451d7ac9..86d0d649 100644 --- a/src/it/java/io/weaviate/containers/MinIo.java +++ b/src/it/java/io/weaviate/containers/MinIo.java @@ -7,6 +7,9 @@ public class MinIo extends MinIOContainer { public static final String ACCESS_KEY = "minioadmin"; public static final String SECRET_KEY = "minioadmin"; + public static final String HOST_NAME = "minio"; + public static final String URL = HOST_NAME + ":9000"; + static MinIo createDefault() { return new MinIo(); } diff --git a/src/it/java/io/weaviate/containers/Weaviate.java b/src/it/java/io/weaviate/containers/Weaviate.java index 7fe5a91b..1bbf6987 100644 --- a/src/it/java/io/weaviate/containers/Weaviate.java +++ b/src/it/java/io/weaviate/containers/Weaviate.java @@ -114,7 +114,7 @@ public Builder withDefaultVectorizer(String module) { public Builder withTransformersUrl(String url) { addModules(Transformers.MODULE); - environment.put("TRANSFORMERS_INFERENCE_API", url); + environment.put("TRANSFORMERS_INFERENCE_API", "http://" + url); return this; } @@ -126,7 +126,7 @@ public Builder withImageInference(String url, String module) { public Builder withOffloadS3(String accessKey, String secretKey) { addModules("offload-s3"); - environment.put("OFFLOAD_S3_ENDPOINT", "http://minio:9000"); + environment.put("OFFLOAD_S3_ENDPOINT", "http://" + MinIo.URL); environment.put("OFFLOAD_S3_BUCKET_AUTO_CREATE", "true"); environment.put("AWS_ACCESS_KEY_ID", accessKey); environment.put("AWS_SECRET_KEY", secretKey); diff --git a/src/it/java/io/weaviate/integration/SearchITest.java b/src/it/java/io/weaviate/integration/SearchITest.java index 4fbac7f8..f319f168 100644 --- a/src/it/java/io/weaviate/integration/SearchITest.java +++ b/src/it/java/io/weaviate/integration/SearchITest.java @@ -160,7 +160,7 @@ public void testNearText() throws IOException { var result = songs.query.nearText("forest", opt -> opt - .distance(0.5f) + .distance(0.9f) .moveTo(.98f, to -> to.concepts("tropical")) .moveAway(.4f, away -> away.uuids(submarine.metadata().uuid())) .returnProperties("title")); From c8a95771a13e280b9ec354137f30beead12ae361 Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Tue, 28 Oct 2025 15:35:46 +0100 Subject: [PATCH 32/35] chore: add converters and type checkers for VectorConfig variants --- .../v1/api/collections/VectorConfig.java | 290 ++++++++++++++++++ 1 file changed, 290 insertions(+) diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index 44cf3c97..b1cef96e 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -1239,6 +1239,296 @@ public static Map.Entry text2VecWeaviate(String vectorName return Map.entry(vectorName, Text2VecWeaviateVectorizer.of(fn)); } + /** Is this an instance of {@link Img2VecNeuralVectorizer}? */ + default public boolean isImg2VecNeural() { + return _is(VectorConfig.Kind.IMG2VEC_NEURAL); + } + + /** Convert this instance to {@link Img2VecNeuralVectorizer}. */ + default public Img2VecNeuralVectorizer asImg2VecNeural() { + return _as(VectorConfig.Kind.IMG2VEC_NEURAL); + } + + /** Is this an instance of {@link Multi2MultiVecJinaAiVectorizer}? */ + default public boolean isMulti2MultiVecJinaAi() { + return _is(VectorConfig.Kind.MULTI2MULTIVEC_JINAAI); + } + + /** Convert this instance to {@link Multi2MultiVecJinaAiVectorizer}. */ + default public Multi2MultiVecJinaAiVectorizer asMulti2MultiVecJinaAi() { + return _as(VectorConfig.Kind.MULTI2MULTIVEC_JINAAI); + } + + /** Is this an instance of {@link Multi2VecAwsVectorizer}? */ + default public boolean isMulti2VecAws() { + return _is(VectorConfig.Kind.MULTI2VEC_AWS); + } + + /** Convert this instance to {@link Multi2VecAwsVectorizer}. */ + default public Multi2VecAwsVectorizer asMulti2VecAws() { + return _as(VectorConfig.Kind.MULTI2VEC_AWS); + } + + /** Is this an instance of {@link Multi2VecBindVectorizer}? */ + default public boolean isMulti2VecBind() { + return _is(VectorConfig.Kind.MULTI2VEC_BIND); + } + + /** Convert this instance to {@link Multi2VecBindVectorizer}. */ + default public Multi2VecBindVectorizer asMulti2VecBind() { + return _as(VectorConfig.Kind.MULTI2VEC_BIND); + } + + /** Is this an instance of {@link Multi2VecClipVectorizer}? */ + default public boolean isMulti2VecClip() { + return _is(VectorConfig.Kind.MULTI2VEC_CLIP); + } + + /** Convert this instance to {@link Multi2VecClipVectorizer}. */ + default public Multi2VecClipVectorizer asMulti2VecClip() { + return _as(VectorConfig.Kind.MULTI2VEC_CLIP); + } + + /** Is this an instance of {@link Multi2VecCohereVectorizer}? */ + default public boolean isMulti2VecCohere() { + return _is(VectorConfig.Kind.MULTI2VEC_COHERE); + } + + /** Convert this instance to {@link Multi2VecCohereVectorizer}. */ + default public Multi2VecCohereVectorizer asMulti2VecCohere() { + return _as(VectorConfig.Kind.MULTI2VEC_COHERE); + } + + /** Is this an instance of {@link Multi2VecGoogleVectorizer}? */ + default public boolean isMulti2VecGoogle() { + return _is(VectorConfig.Kind.MULTI2VEC_GOOGLE); + } + + /** Convert this instance to {@link Multi2VecGoogleVectorizer}. */ + default public Multi2VecGoogleVectorizer asMulti2VecGoogle() { + return _as(VectorConfig.Kind.MULTI2VEC_GOOGLE); + } + + /** Is this an instance of {@link Multi2VecJinaAiVectorizer}? */ + default public boolean isMulti2VecJinaAi() { + return _is(VectorConfig.Kind.MULTI2VEC_JINAAI); + } + + /** Convert this instance to {@link Multi2VecJinaAiVectorizer}. */ + default public Multi2VecJinaAiVectorizer asMulti2VecJinaAi() { + return _as(VectorConfig.Kind.MULTI2VEC_JINAAI); + } + + /** Is this an instance of {@link Multi2VecNvidiaVectorizer}? */ + default public boolean isMulti2VecNvidia() { + return _is(VectorConfig.Kind.MULTI2VEC_NVIDIA); + } + + /** Convert this instance to {@link Multi2VecNvidiaVectorizer}. */ + default public Multi2VecNvidiaVectorizer asMulti2VecNvidia() { + return _as(VectorConfig.Kind.MULTI2VEC_NVIDIA); + } + + /** Is this an instance of {@link Multi2VecVoyageAiVectorizer}? */ + default public boolean isMulti2VecVoyageAi() { + return _is(VectorConfig.Kind.MULTI2VEC_VOYAGEAI); + } + + /** Convert this instance to {@link Multi2VecVoyageAiVectorizer}. */ + default public Multi2VecVoyageAiVectorizer asMulti2VecVoyageAi() { + return _as(VectorConfig.Kind.MULTI2VEC_VOYAGEAI); + } + + /** Is this an instance of {@link Ref2VecCentroidVectorizer}? */ + default public boolean isRef2VecCentroid() { + return _is(VectorConfig.Kind.REF2VEC_CENTROID); + } + + /** Convert this instance to {@link Ref2VecCentroidVectorizer}. */ + default public Ref2VecCentroidVectorizer asRef2VecCentroid() { + return _as(VectorConfig.Kind.REF2VEC_CENTROID); + } + + /** Is this an instance of {@link Text2VecAwsVectorizer}? */ + default public boolean isText2VecAws() { + return _is(VectorConfig.Kind.TEXT2VEC_AWS); + } + + /** Convert this instance to {@link Text2VecAwsVectorizer}. */ + default public Text2VecAwsVectorizer asText2VecAws() { + return _as(VectorConfig.Kind.TEXT2VEC_AWS); + } + + /** Is this an instance of {@link Text2VecAzureOpenAiVectorizer}? */ + default public boolean isText2VecAzureOpenAi() { + return _is(VectorConfig.Kind.TEXT2VEC_AZURE_OPENAI); + } + + /** Convert this instance to {@link Text2VecAzureOpenAiVectorizer}. */ + default public Text2VecAzureOpenAiVectorizer asText2VecAzureOpenAi() { + return _as(VectorConfig.Kind.TEXT2VEC_AZURE_OPENAI); + } + + /** Is this an instance of {@link Text2VecCohereVectorizer}? */ + default public boolean isText2VecCohere() { + return _is(VectorConfig.Kind.TEXT2VEC_COHERE); + } + + /** Convert this instance to {@link Text2VecCohereVectorizer}. */ + default public Text2VecCohereVectorizer asText2VecCohere() { + return _as(VectorConfig.Kind.TEXT2VEC_COHERE); + } + + /** Is this an instance of {@link Text2VecDatabricksVectorizer}? */ + default public boolean isText2VecDatabricks() { + return _is(VectorConfig.Kind.TEXT2VEC_DATABRICKS); + } + + /** Convert this instance to {@link Text2VecDatabricksVectorizer}. */ + default public Text2VecDatabricksVectorizer asText2VecDatabricks() { + return _as(VectorConfig.Kind.TEXT2VEC_DATABRICKS); + } + + /** Is this an instance of {@link Text2VecGoogleAiStudioVectorizer}? */ + default public boolean isText2VecGoogleAiStudio() { + return _is(VectorConfig.Kind.TEXT2VEC_GOOGLEAISTUDIO); + } + + /** Convert this instance to {@link Text2VecGoogleAiStudioVectorizer}. */ + default public Text2VecGoogleAiStudioVectorizer asText2VecGoogleAiStudio() { + return _as(VectorConfig.Kind.TEXT2VEC_GOOGLEAISTUDIO); + } + + /** Is this an instance of {@link Text2VecGoogleVectorizer}? */ + default public boolean isText2VecGoogle() { + return _is(VectorConfig.Kind.TEXT2VEC_GOOGLE); + } + + /** Convert this instance to {@link Text2VecGoogleVectorizer}. */ + default public Text2VecGoogleVectorizer asText2VecGoogle() { + return _as(VectorConfig.Kind.TEXT2VEC_GOOGLE); + } + + /** Is this an instance of {@link Text2VecHuggingFaceVectorizer}? */ + default public boolean isText2VecHuggingFace() { + return _is(VectorConfig.Kind.TEXT2VEC_HUGGINGFACE); + } + + /** Convert this instance to {@link Text2VecHuggingFaceVectorizer}. */ + default public Text2VecHuggingFaceVectorizer asText2VecHuggingFace() { + return _as(VectorConfig.Kind.TEXT2VEC_HUGGINGFACE); + } + + /** Is this an instance of {@link Text2MultiVecJinaAiVectorizer}? */ + default public boolean isText2MultiVecJinaAi() { + return _is(VectorConfig.Kind.TEXT2MULTIVEC_JINAAI); + } + + /** Convert this instance to {@link Text2MultiVecJinaAiVectorizer}. */ + default public Text2MultiVecJinaAiVectorizer asText2MultiVecJinaAi() { + return _as(VectorConfig.Kind.TEXT2MULTIVEC_JINAAI); + } + + /** Is this an instance of {@link Text2VecJinaAiVectorizer}? */ + default public boolean isText2VecJinaAi() { + return _is(VectorConfig.Kind.TEXT2VEC_JINAAI); + } + + /** Convert this instance to {@link Text2VecJinaAiVectorizer}. */ + default public Text2VecJinaAiVectorizer asText2VecJinaAi() { + return _as(VectorConfig.Kind.TEXT2VEC_JINAAI); + } + + /** Is this an instance of {@link Text2VecMistralVectorizer}? */ + default public boolean isText2VecMistral() { + return _is(VectorConfig.Kind.TEXT2VEC_MISTRAL); + } + + /** Convert this instance to {@link Text2VecMistralVectorizer}. */ + default public Text2VecMistralVectorizer asText2VecMistral() { + return _as(VectorConfig.Kind.TEXT2VEC_MISTRAL); + } + + /** Is this an instance of {@link Text2VecModel2VecVectorizer}? */ + default public boolean isText2VecModel2Vec() { + return _is(VectorConfig.Kind.TEXT2VEC_MODEL2VEC); + } + + /** Convert this instance to {@link Text2VecModel2VecVectorizer}. */ + default public Text2VecModel2VecVectorizer asText2VecModel2Vec() { + return _as(VectorConfig.Kind.TEXT2VEC_MODEL2VEC); + } + + /** Is this an instance of {@link Text2VecMorphVectorizer}? */ + default public boolean isText2VecMorph() { + return _is(VectorConfig.Kind.TEXT2VEC_MORPH); + } + + /** Convert this instance to {@link Text2VecMorphVectorizer}. */ + default public Text2VecMorphVectorizer asText2VecMorph() { + return _as(VectorConfig.Kind.TEXT2VEC_MORPH); + } + + /** Is this an instance of {@link Text2VecNvidiaVectorizer}? */ + default public boolean isText2VecNvidia() { + return _is(VectorConfig.Kind.TEXT2VEC_NVIDIA); + } + + /** Convert this instance to {@link Text2VecNvidiaVectorizer}. */ + default public Text2VecNvidiaVectorizer asText2VecNvidia() { + return _as(VectorConfig.Kind.TEXT2VEC_NVIDIA); + } + + /** Is this an instance of {@link Text2VecOllamaVectorizer}? */ + default public boolean isText2VecOllama() { + return _is(VectorConfig.Kind.TEXT2VEC_OLLAMA); + } + + /** Convert this instance to {@link Text2VecOllamaVectorizer}. */ + default public Text2VecOllamaVectorizer asText2VecOllama() { + return _as(VectorConfig.Kind.TEXT2VEC_OLLAMA); + } + + /** Is this an instance of {@link Text2VecOpenAiVectorizer}? */ + default public boolean isText2VecOpenAi() { + return _is(VectorConfig.Kind.TEXT2VEC_OPENAI); + } + + /** Convert this instance to {@link Text2VecOpenAiVectorizer}. */ + default public Text2VecOpenAiVectorizer asText2VecOpenAi() { + return _as(VectorConfig.Kind.TEXT2VEC_OPENAI); + } + + /** Is this an instance of {@link Text2VecTransformersVectorizer}? */ + default public boolean isText2VecTransformers() { + return _is(VectorConfig.Kind.TEXT2VEC_TRANSFORMERS); + } + + /** Convert this instance to {@link Text2VecTransformersVectorizer}. */ + default public Text2VecTransformersVectorizer asText2VecTransformers() { + return _as(VectorConfig.Kind.TEXT2VEC_TRANSFORMERS); + } + + /** Is this an instance of {@link Text2VecVoyageAiVectorizer}? */ + default public boolean isText2VecVoyageAi() { + return _is(VectorConfig.Kind.TEXT2VEC_VOYAGEAI); + } + + /** Convert this instance to {@link Text2VecVoyageAiVectorizer}. */ + default public Text2VecVoyageAiVectorizer asText2VecVoyageAi() { + return _as(VectorConfig.Kind.TEXT2VEC_VOYAGEAI); + } + + /** Is this an instance of {@link Text2VecWeaviateVectorizer}? */ + default public boolean isText2VecWeaviate() { + return _is(VectorConfig.Kind.TEXT2VEC_WEAVIATE); + } + + /** Convert this instance to {@link Text2VecWeaviateVectorizer}. */ + default public Text2VecWeaviateVectorizer asText2VecWeaviate() { + return _as(VectorConfig.Kind.TEXT2VEC_WEAVIATE); + } + public static enum CustomTypeAdapterFactory implements TypeAdapterFactory { INSTANCE; From fb0556b02b9164474c603eaba0dc202d52c46744 Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Tue, 28 Oct 2025 15:55:55 +0100 Subject: [PATCH 33/35] fix: rename file --- ...gingfaceVectorizer.java => Text2VecHuggingFaceVectorizer.java} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/{Text2VecHuggingfaceVectorizer.java => Text2VecHuggingFaceVectorizer.java} (100%) diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecHuggingfaceVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecHuggingFaceVectorizer.java similarity index 100% rename from src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecHuggingfaceVectorizer.java rename to src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecHuggingFaceVectorizer.java From d4774a20b7abb42092c8457d9d9fe952d6cacc1a Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Wed, 29 Oct 2025 18:09:14 +0100 Subject: [PATCH 34/35] test: migrate to model2vec container for tests --- .../io/weaviate/containers/Container.java | 2 +- .../{Transformers.java => Model2Vec.java} | 22 ++++++++--------- .../java/io/weaviate/containers/Weaviate.java | 6 ++--- .../io/weaviate/integration/SearchITest.java | 24 +++++++++---------- .../v1/api/collections/VectorConfig.java | 2 +- .../Multi2VecJinaAiVectorizer.java | 2 +- .../Text2VecDatabricksVectorizer.java | 2 +- .../Text2VecModel2VecVectorizer.java | 2 +- .../vectorizers/Text2VecMorphVectorizer.java | 2 +- 9 files changed, 31 insertions(+), 33 deletions(-) rename src/it/java/io/weaviate/containers/{Transformers.java => Model2Vec.java} (55%) diff --git a/src/it/java/io/weaviate/containers/Container.java b/src/it/java/io/weaviate/containers/Container.java index d2713f3a..7c71ed98 100644 --- a/src/it/java/io/weaviate/containers/Container.java +++ b/src/it/java/io/weaviate/containers/Container.java @@ -14,7 +14,7 @@ public class Container { public static final Weaviate WEAVIATE = Weaviate.createDefault(); - public static final Transformers TRANSFORMERS = Transformers.createDefault(); + public static final Model2Vec MODEL2VEC = Model2Vec.createDefault(); public static final Img2VecNeural IMG2VEC_NEURAL = Img2VecNeural.createDefault(); public static final MinIo MINIO = MinIo.createDefault(); diff --git a/src/it/java/io/weaviate/containers/Transformers.java b/src/it/java/io/weaviate/containers/Model2Vec.java similarity index 55% rename from src/it/java/io/weaviate/containers/Transformers.java rename to src/it/java/io/weaviate/containers/Model2Vec.java index ac6602fc..43e69f1d 100644 --- a/src/it/java/io/weaviate/containers/Transformers.java +++ b/src/it/java/io/weaviate/containers/Model2Vec.java @@ -4,19 +4,19 @@ import io.weaviate.client6.v1.api.collections.VectorConfig; -public class Transformers extends GenericContainer { - public static final String VERSION = "sentence-transformers-all-MiniLM-L6-v2"; - public static final String DOCKER_IMAGE = "cr.weaviate.io/semitechnologies/transformers-inference"; - public static final String MODULE = VectorConfig.Kind.TEXT2VEC_TRANSFORMERS.jsonValue(); +public class Model2Vec extends GenericContainer { + public static final String VERSION = "minishlab-potion-retrieval-32M"; + public static final String DOCKER_IMAGE = "cr.weaviate.io/semitechnologies/model2vec-inference"; + public static final String MODULE = VectorConfig.Kind.TEXT2VEC_MODEL2VEC.jsonValue(); - public static final String HOST_NAME = "transformers"; + public static final String HOST_NAME = "model2vec"; public static final String URL = HOST_NAME + ":8080"; - static Transformers createDefault() { + static Model2Vec createDefault() { return new Builder().build(); } - static Transformers.Builder custom() { + static Model2Vec.Builder custom() { return new Builder(); } @@ -27,16 +27,14 @@ public Builder() { this.versionTag = VERSION; } - public Transformers build() { - var container = new Transformers(DOCKER_IMAGE + ":" + versionTag); - container - .withEnv("ENABLE_CUDA", "0"); + public Model2Vec build() { + var container = new Model2Vec(DOCKER_IMAGE + ":" + versionTag); container.withCreateContainerCmdModifier(cmd -> cmd.withHostName(HOST_NAME)); return container; } } - public Transformers(String image) { + public Model2Vec(String image) { super(image); } } diff --git a/src/it/java/io/weaviate/containers/Weaviate.java b/src/it/java/io/weaviate/containers/Weaviate.java index 1bbf6987..15490166 100644 --- a/src/it/java/io/weaviate/containers/Weaviate.java +++ b/src/it/java/io/weaviate/containers/Weaviate.java @@ -112,9 +112,9 @@ public Builder withDefaultVectorizer(String module) { return this; } - public Builder withTransformersUrl(String url) { - addModules(Transformers.MODULE); - environment.put("TRANSFORMERS_INFERENCE_API", "http://" + url); + public Builder withModel2VecUrl(String url) { + addModules(Model2Vec.MODULE); + environment.put("MODEL2VEC_INFERENCE_API", "http://" + url); return this; } diff --git a/src/it/java/io/weaviate/integration/SearchITest.java b/src/it/java/io/weaviate/integration/SearchITest.java index f319f168..875cd3b4 100644 --- a/src/it/java/io/weaviate/integration/SearchITest.java +++ b/src/it/java/io/weaviate/integration/SearchITest.java @@ -42,18 +42,18 @@ import io.weaviate.containers.Container; import io.weaviate.containers.Container.ContainerGroup; import io.weaviate.containers.Img2VecNeural; -import io.weaviate.containers.Transformers; +import io.weaviate.containers.Model2Vec; import io.weaviate.containers.Weaviate; public class SearchITest extends ConcurrentTest { private static final ContainerGroup compose = Container.compose( Weaviate.custom() - .withTransformersUrl(Transformers.URL) + .withModel2VecUrl(Model2Vec.URL) .withImageInference(Img2VecNeural.URL, Img2VecNeural.MODULE) .addModules("generative-dummy") .build(), Container.IMG2VEC_NEURAL, - Container.TRANSFORMERS); + Container.MODEL2VEC); @ClassRule // Bind containers to the lifetime of the test public static final TestRule _rule = compose.asTestRule(); private static final WeaviateClient client = compose.getClient(); @@ -151,7 +151,7 @@ public void testNearText() throws IOException { client.collections.create(nsSongs, col -> col .properties(Property.text("title")) - .vectorConfig(VectorConfig.text2VecTransformers())); + .vectorConfig(VectorConfig.text2VecModel2Vec())); var songs = client.collections.use(nsSongs); var submarine = songs.data.insert(Map.of("title", "Yellow Submarine")); @@ -173,7 +173,7 @@ public void testNearText() throws IOException { @Test public void testNearText_groupBy() throws IOException { - var vectorizer = VectorConfig.text2VecTransformers(); + var vectorizer = VectorConfig.text2VecModel2Vec(); var nsArtists = ns("Artists"); client.collections.create(nsArtists, @@ -370,7 +370,7 @@ public void testNearObject() throws IOException { client.collections.create(nsAnimals, collection -> collection .properties(Property.text("kind")) - .vectorConfig(VectorConfig.text2VecTransformers())); + .vectorConfig(VectorConfig.text2VecModel2Vec())); var animals = client.collections.use(nsAnimals); @@ -399,7 +399,7 @@ public void testHybrid() throws IOException { client.collections.create(nsHobbies, collection -> collection .properties(Property.text("name"), Property.text("description")) - .vectorConfig(VectorConfig.text2VecTransformers())); + .vectorConfig(VectorConfig.text2VecModel2Vec())); var hobbies = client.collections.use(nsHobbies); @@ -432,7 +432,7 @@ public void testBadRequest() throws IOException { client.collections.create(nsThings, collection -> collection .properties(Property.text("name")) - .vectorConfig(VectorConfig.text2VecTransformers())); + .vectorConfig(VectorConfig.text2VecModel2Vec())); var things = client.collections.use(nsThings); var balloon = things.data.insert(Map.of("name", "balloon")); @@ -449,7 +449,7 @@ public void testBadRequest_async() throws Throwable { async.collections.create(nsThings, collection -> collection .properties(Property.text("name")) - .vectorConfig(VectorConfig.text2VecTransformers())) + .vectorConfig(VectorConfig.text2VecModel2Vec())) .join(); var things = async.collections.use(nsThings); @@ -470,7 +470,7 @@ public void testMetadataAll() throws IOException { client.collections.create(nsThings, c -> c .properties(Property.text("name")) - .vectorConfig(VectorConfig.text2VecTransformers( + .vectorConfig(VectorConfig.text2VecModel2Vec( t2v -> t2v.sourceProperties("name")))); var things = client.collections.use(nsThings); @@ -563,7 +563,7 @@ public void testGenerative_bm25() throws IOException { c -> c .properties(Property.text("title")) .generativeModule(new DummyGenerative()) - .vectorConfig(VectorConfig.text2VecTransformers( + .vectorConfig(VectorConfig.text2VecModel2Vec( t2v -> t2v.sourceProperties("title")))); var things = client.collections.use(nsThings); @@ -604,7 +604,7 @@ public void testGenerative_bm25_groupBy() throws IOException { c -> c .properties(Property.text("title")) .generativeModule(new DummyGenerative()) - .vectorConfig(VectorConfig.text2VecTransformers( + .vectorConfig(VectorConfig.text2VecModel2Vec( t2v -> t2v.sourceProperties("title")))); var things = client.collections.use(nsThings); diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index b1cef96e..602e411e 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -58,7 +58,7 @@ public enum Kind implements JsonEnum { TEXT2VEC_GOOGLE("text2vec-google"), TEXT2VEC_GOOGLEAISTUDIO("text2vec-google"), TEXT2VEC_HUGGINGFACE("text2vec-huggingface"), - REF2VEC_CENTROID("text2vec-huggingface"), + REF2VEC_CENTROID("ref2vec-centroid"), TEXT2VEC_JINAAI("text2vec-jinaai"), TEXT2VEC_MISTRAL("text2vec-mistral"), TEXT2VEC_MORPH("text2vec-morph"), diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecJinaAiVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecJinaAiVectorizer.java index 19de6e9a..35bb3cc9 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecJinaAiVectorizer.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecJinaAiVectorizer.java @@ -51,7 +51,7 @@ private static record Weights( @Override public VectorConfig.Kind _kind() { - return VectorConfig.Kind.MULTI2VEC_COHERE; + return VectorConfig.Kind.MULTI2VEC_JINAAI; } @Override diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecDatabricksVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecDatabricksVectorizer.java index 960b9aa1..d10bee3e 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecDatabricksVectorizer.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecDatabricksVectorizer.java @@ -31,7 +31,7 @@ public record Text2VecDatabricksVectorizer( @Override public VectorConfig.Kind _kind() { - return VectorConfig.Kind.TEXT2VEC_MISTRAL; + return VectorConfig.Kind.TEXT2VEC_DATABRICKS; } @Override diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecModel2VecVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecModel2VecVectorizer.java index a852734c..9a3525ae 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecModel2VecVectorizer.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecModel2VecVectorizer.java @@ -30,7 +30,7 @@ public record Text2VecModel2VecVectorizer( @Override public VectorConfig.Kind _kind() { - return VectorConfig.Kind.TEXT2VEC_COHERE; + return VectorConfig.Kind.TEXT2VEC_MODEL2VEC; } @Override diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecMorphVectorizer.java b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecMorphVectorizer.java index 8fd7660d..f87b055c 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecMorphVectorizer.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecMorphVectorizer.java @@ -25,7 +25,7 @@ public record Text2VecMorphVectorizer( @Override public VectorConfig.Kind _kind() { - return VectorConfig.Kind.TEXT2VEC_HUGGINGFACE; + return VectorConfig.Kind.TEXT2VEC_MORPH; } @Override From 328493fb88aba750aa43c62f4336b1ada27b1586 Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Wed, 29 Oct 2025 18:29:32 +0100 Subject: [PATCH 35/35] chore: use consistent spelling for module names --- .../io/weaviate/integration/SearchITest.java | 18 +- .../v1/api/collections/VectorConfig.java | 180 +++++++++--------- 2 files changed, 99 insertions(+), 99 deletions(-) diff --git a/src/it/java/io/weaviate/integration/SearchITest.java b/src/it/java/io/weaviate/integration/SearchITest.java index 875cd3b4..92185a12 100644 --- a/src/it/java/io/weaviate/integration/SearchITest.java +++ b/src/it/java/io/weaviate/integration/SearchITest.java @@ -151,7 +151,7 @@ public void testNearText() throws IOException { client.collections.create(nsSongs, col -> col .properties(Property.text("title")) - .vectorConfig(VectorConfig.text2VecModel2Vec())); + .vectorConfig(VectorConfig.text2vecModel2Vec())); var songs = client.collections.use(nsSongs); var submarine = songs.data.insert(Map.of("title", "Yellow Submarine")); @@ -173,7 +173,7 @@ public void testNearText() throws IOException { @Test public void testNearText_groupBy() throws IOException { - var vectorizer = VectorConfig.text2VecModel2Vec(); + var vectorizer = VectorConfig.text2vecModel2Vec(); var nsArtists = ns("Artists"); client.collections.create(nsArtists, @@ -370,7 +370,7 @@ public void testNearObject() throws IOException { client.collections.create(nsAnimals, collection -> collection .properties(Property.text("kind")) - .vectorConfig(VectorConfig.text2VecModel2Vec())); + .vectorConfig(VectorConfig.text2vecModel2Vec())); var animals = client.collections.use(nsAnimals); @@ -399,7 +399,7 @@ public void testHybrid() throws IOException { client.collections.create(nsHobbies, collection -> collection .properties(Property.text("name"), Property.text("description")) - .vectorConfig(VectorConfig.text2VecModel2Vec())); + .vectorConfig(VectorConfig.text2vecModel2Vec())); var hobbies = client.collections.use(nsHobbies); @@ -432,7 +432,7 @@ public void testBadRequest() throws IOException { client.collections.create(nsThings, collection -> collection .properties(Property.text("name")) - .vectorConfig(VectorConfig.text2VecModel2Vec())); + .vectorConfig(VectorConfig.text2vecModel2Vec())); var things = client.collections.use(nsThings); var balloon = things.data.insert(Map.of("name", "balloon")); @@ -449,7 +449,7 @@ public void testBadRequest_async() throws Throwable { async.collections.create(nsThings, collection -> collection .properties(Property.text("name")) - .vectorConfig(VectorConfig.text2VecModel2Vec())) + .vectorConfig(VectorConfig.text2vecModel2Vec())) .join(); var things = async.collections.use(nsThings); @@ -470,7 +470,7 @@ public void testMetadataAll() throws IOException { client.collections.create(nsThings, c -> c .properties(Property.text("name")) - .vectorConfig(VectorConfig.text2VecModel2Vec( + .vectorConfig(VectorConfig.text2vecModel2Vec( t2v -> t2v.sourceProperties("name")))); var things = client.collections.use(nsThings); @@ -563,7 +563,7 @@ public void testGenerative_bm25() throws IOException { c -> c .properties(Property.text("title")) .generativeModule(new DummyGenerative()) - .vectorConfig(VectorConfig.text2VecModel2Vec( + .vectorConfig(VectorConfig.text2vecModel2Vec( t2v -> t2v.sourceProperties("title")))); var things = client.collections.use(nsThings); @@ -604,7 +604,7 @@ public void testGenerative_bm25_groupBy() throws IOException { c -> c .properties(Property.text("title")) .generativeModule(new DummyGenerative()) - .vectorConfig(VectorConfig.text2VecModel2Vec( + .vectorConfig(VectorConfig.text2vecModel2Vec( t2v -> t2v.sourceProperties("title")))); var things = client.collections.use(nsThings); diff --git a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java index 602e411e..f787d606 100644 --- a/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java +++ b/src/main/java/io/weaviate/client6/v1/api/collections/VectorConfig.java @@ -669,8 +669,8 @@ public static Map.Entry text2vecAwsSagemaker(String vector * Create a vector index with an {@code text2vec-openai} vectorizer deployed on * Azure. */ - public static Map.Entry text2VecAzureOpenAi() { - return text2VecAzureOpenAi(VectorIndex.DEFAULT_VECTOR_NAME); + public static Map.Entry text2vecAzureOpenAi() { + return text2vecAzureOpenAi(VectorIndex.DEFAULT_VECTOR_NAME); } /** @@ -679,9 +679,9 @@ public static Map.Entry text2VecAzureOpenAi() { * * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecAzureOpenAi( + public static Map.Entry text2vecAzureOpenAi( Function> fn) { - return text2VecAzureOpenAi(VectorIndex.DEFAULT_VECTOR_NAME, fn); + return text2vecAzureOpenAi(VectorIndex.DEFAULT_VECTOR_NAME, fn); } /** @@ -690,7 +690,7 @@ public static Map.Entry text2VecAzureOpenAi( * * @param vectorName Vector name. */ - public static Map.Entry text2VecAzureOpenAi(String vectorName) { + public static Map.Entry text2vecAzureOpenAi(String vectorName) { return Map.entry(vectorName, Text2VecAzureOpenAiVectorizer.of()); } @@ -701,7 +701,7 @@ public static Map.Entry text2VecAzureOpenAi(String vectorN * @param vectorName Vector name. * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecAzureOpenAi(String vectorName, + public static Map.Entry text2vecAzureOpenAi(String vectorName, Function> fn) { return Map.entry(vectorName, Text2VecAzureOpenAiVectorizer.of(fn)); } @@ -744,8 +744,8 @@ public static Map.Entry text2vecCohere(String vectorName, } /** Create a vector index with an {@code text2vec-databricks} vectorizer. */ - public static Map.Entry text2VecDatabricks() { - return text2VecDatabricks(VectorIndex.DEFAULT_VECTOR_NAME); + public static Map.Entry text2vecDatabricks() { + return text2vecDatabricks(VectorIndex.DEFAULT_VECTOR_NAME); } /** @@ -753,9 +753,9 @@ public static Map.Entry text2VecDatabricks() { * * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecDatabricks( + public static Map.Entry text2vecDatabricks( Function> fn) { - return text2VecDatabricks(VectorIndex.DEFAULT_VECTOR_NAME, fn); + return text2vecDatabricks(VectorIndex.DEFAULT_VECTOR_NAME, fn); } /** @@ -763,7 +763,7 @@ public static Map.Entry text2VecDatabricks( * * @param vectorName Vector name. */ - public static Map.Entry text2VecDatabricks(String vectorName) { + public static Map.Entry text2vecDatabricks(String vectorName) { return Map.entry(vectorName, Text2VecDatabricksVectorizer.of()); } @@ -773,7 +773,7 @@ public static Map.Entry text2VecDatabricks(String vectorNa * @param vectorName Vector name. * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecDatabricks(String vectorName, + public static Map.Entry text2vecDatabricks(String vectorName, Function> fn) { return Map.entry(vectorName, Text2VecDatabricksVectorizer.of(fn)); } @@ -782,8 +782,8 @@ public static Map.Entry text2VecDatabricks(String vectorNa * Create a vector index with an {@code text2vec-google} vectorizer with Google * AI Studio integration. */ - public static Map.Entry text2VecGoogleAiStudio() { - return text2VecGoogleAiStudio(VectorIndex.DEFAULT_VECTOR_NAME); + public static Map.Entry text2vecGoogleAiStudio() { + return text2vecGoogleAiStudio(VectorIndex.DEFAULT_VECTOR_NAME); } /** @@ -792,9 +792,9 @@ public static Map.Entry text2VecGoogleAiStudio() { * * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecGoogleAiStudio( + public static Map.Entry text2vecGoogleAiStudio( Function> fn) { - return text2VecGoogleAiStudio(VectorIndex.DEFAULT_VECTOR_NAME, fn); + return text2vecGoogleAiStudio(VectorIndex.DEFAULT_VECTOR_NAME, fn); } /** @@ -803,7 +803,7 @@ public static Map.Entry text2VecGoogleAiStudio( * * @param vectorName Vector name. */ - public static Map.Entry text2VecGoogleAiStudio(String vectorName) { + public static Map.Entry text2vecGoogleAiStudio(String vectorName) { return Map.entry(vectorName, Text2VecGoogleAiStudioVectorizer.of()); } @@ -814,14 +814,14 @@ public static Map.Entry text2VecGoogleAiStudio(String vect * @param vectorName Vector name. * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecGoogleAiStudio(String vectorName, + public static Map.Entry text2vecGoogleAiStudio(String vectorName, Function> fn) { return Map.entry(vectorName, Text2VecGoogleAiStudioVectorizer.of(fn)); } /** Create a vector index with an {@code text2vec-google} vectorizer. */ - public static Map.Entry text2VecGoogle() { - return text2VecGoogle(VectorIndex.DEFAULT_VECTOR_NAME); + public static Map.Entry text2vecGoogle() { + return text2vecGoogle(VectorIndex.DEFAULT_VECTOR_NAME); } /** @@ -829,9 +829,9 @@ public static Map.Entry text2VecGoogle() { * * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecGoogle( + public static Map.Entry text2vecGoogle( Function> fn) { - return text2VecGoogle(VectorIndex.DEFAULT_VECTOR_NAME, fn); + return text2vecGoogle(VectorIndex.DEFAULT_VECTOR_NAME, fn); } /** @@ -839,7 +839,7 @@ public static Map.Entry text2VecGoogle( * * @param vectorName Vector name. */ - public static Map.Entry text2VecGoogle(String vectorName) { + public static Map.Entry text2vecGoogle(String vectorName) { return Map.entry(vectorName, Text2VecGoogleVectorizer.of()); } @@ -849,14 +849,14 @@ public static Map.Entry text2VecGoogle(String vectorName) * @param vectorName Vector name. * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecGoogle(String vectorName, + public static Map.Entry text2vecGoogle(String vectorName, Function> fn) { return Map.entry(vectorName, Text2VecGoogleVectorizer.of(fn)); } /** Create a vector index with an {@code text2vec-huggingface} vectorizer. */ - public static Map.Entry text2VecHuggingFace() { - return text2VecHuggingFace(VectorIndex.DEFAULT_VECTOR_NAME); + public static Map.Entry text2vecHuggingFace() { + return text2vecHuggingFace(VectorIndex.DEFAULT_VECTOR_NAME); } /** @@ -864,9 +864,9 @@ public static Map.Entry text2VecHuggingFace() { * * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecHuggingFace( + public static Map.Entry text2vecHuggingFace( Function> fn) { - return text2VecHuggingFace(VectorIndex.DEFAULT_VECTOR_NAME, fn); + return text2vecHuggingFace(VectorIndex.DEFAULT_VECTOR_NAME, fn); } /** @@ -874,7 +874,7 @@ public static Map.Entry text2VecHuggingFace( * * @param vectorName Vector name. */ - public static Map.Entry text2VecHuggingFace(String vectorName) { + public static Map.Entry text2vecHuggingFace(String vectorName) { return Map.entry(vectorName, Text2VecHuggingFaceVectorizer.of()); } @@ -884,14 +884,14 @@ public static Map.Entry text2VecHuggingFace(String vectorN * @param vectorName Vector name. * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecHuggingFace(String vectorName, + public static Map.Entry text2vecHuggingFace(String vectorName, Function> fn) { return Map.entry(vectorName, Text2VecHuggingFaceVectorizer.of(fn)); } /** Create a vector index with an {@code text2vec-jinaai} vectorizer. */ - public static Map.Entry text2VecJinaAi() { - return text2VecJinaAi(VectorIndex.DEFAULT_VECTOR_NAME); + public static Map.Entry text2vecJinaAi() { + return text2vecJinaAi(VectorIndex.DEFAULT_VECTOR_NAME); } /** @@ -899,9 +899,9 @@ public static Map.Entry text2VecJinaAi() { * * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecJinaAi( + public static Map.Entry text2vecJinaAi( Function> fn) { - return text2VecJinaAi(VectorIndex.DEFAULT_VECTOR_NAME, fn); + return text2vecJinaAi(VectorIndex.DEFAULT_VECTOR_NAME, fn); } /** @@ -909,7 +909,7 @@ public static Map.Entry text2VecJinaAi( * * @param vectorName Vector name. */ - public static Map.Entry text2VecJinaAi(String vectorName) { + public static Map.Entry text2vecJinaAi(String vectorName) { return Map.entry(vectorName, Text2VecJinaAiVectorizer.of()); } @@ -919,14 +919,14 @@ public static Map.Entry text2VecJinaAi(String vectorName) * @param vectorName Vector name. * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecJinaAi(String vectorName, + public static Map.Entry text2vecJinaAi(String vectorName, Function> fn) { return Map.entry(vectorName, Text2VecJinaAiVectorizer.of(fn)); } /** Create a vector index with an {@code text2vec-mistral} vectorizer. */ - public static Map.Entry text2VecMistral() { - return text2VecMistral(VectorIndex.DEFAULT_VECTOR_NAME); + public static Map.Entry text2vecMistral() { + return text2vecMistral(VectorIndex.DEFAULT_VECTOR_NAME); } /** @@ -934,9 +934,9 @@ public static Map.Entry text2VecMistral() { * * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecMistral( + public static Map.Entry text2vecMistral( Function> fn) { - return text2VecMistral(VectorIndex.DEFAULT_VECTOR_NAME, fn); + return text2vecMistral(VectorIndex.DEFAULT_VECTOR_NAME, fn); } /** @@ -944,7 +944,7 @@ public static Map.Entry text2VecMistral( * * @param vectorName Vector name. */ - public static Map.Entry text2VecMistral(String vectorName) { + public static Map.Entry text2vecMistral(String vectorName) { return Map.entry(vectorName, Text2VecMistralVectorizer.of()); } @@ -954,14 +954,14 @@ public static Map.Entry text2VecMistral(String vectorName) * @param vectorName Vector name. * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecMistral(String vectorName, + public static Map.Entry text2vecMistral(String vectorName, Function> fn) { return Map.entry(vectorName, Text2VecMistralVectorizer.of(fn)); } /** Create a vector index with an {@code text2vec-model2vec} vectorizer. */ - public static Map.Entry text2VecModel2Vec() { - return text2VecModel2Vec(VectorIndex.DEFAULT_VECTOR_NAME); + public static Map.Entry text2vecModel2Vec() { + return text2vecModel2Vec(VectorIndex.DEFAULT_VECTOR_NAME); } /** @@ -969,9 +969,9 @@ public static Map.Entry text2VecModel2Vec() { * * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecModel2Vec( + public static Map.Entry text2vecModel2Vec( Function> fn) { - return text2VecModel2Vec(VectorIndex.DEFAULT_VECTOR_NAME, fn); + return text2vecModel2Vec(VectorIndex.DEFAULT_VECTOR_NAME, fn); } /** @@ -979,7 +979,7 @@ public static Map.Entry text2VecModel2Vec( * * @param vectorName Vector name. */ - public static Map.Entry text2VecModel2Vec(String vectorName) { + public static Map.Entry text2vecModel2Vec(String vectorName) { return Map.entry(vectorName, Text2VecModel2VecVectorizer.of()); } @@ -989,14 +989,14 @@ public static Map.Entry text2VecModel2Vec(String vectorNam * @param vectorName Vector name. * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecModel2Vec(String vectorName, + public static Map.Entry text2vecModel2Vec(String vectorName, Function> fn) { return Map.entry(vectorName, Text2VecModel2VecVectorizer.of(fn)); } /** Create a vector index with an {@code text2vec-morph} vectorizer. */ - public static Map.Entry text2VecMorph() { - return text2VecMorph(VectorIndex.DEFAULT_VECTOR_NAME); + public static Map.Entry text2vecMorph() { + return text2vecMorph(VectorIndex.DEFAULT_VECTOR_NAME); } /** @@ -1004,9 +1004,9 @@ public static Map.Entry text2VecMorph() { * * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecMorph( + public static Map.Entry text2vecMorph( Function> fn) { - return text2VecMorph(VectorIndex.DEFAULT_VECTOR_NAME, fn); + return text2vecMorph(VectorIndex.DEFAULT_VECTOR_NAME, fn); } /** @@ -1014,7 +1014,7 @@ public static Map.Entry text2VecMorph( * * @param vectorName Vector name. */ - public static Map.Entry text2VecMorph(String vectorName) { + public static Map.Entry text2vecMorph(String vectorName) { return Map.entry(vectorName, Text2VecMorphVectorizer.of()); } @@ -1024,14 +1024,14 @@ public static Map.Entry text2VecMorph(String vectorName) { * @param vectorName Vector name. * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecMorph(String vectorName, + public static Map.Entry text2vecMorph(String vectorName, Function> fn) { return Map.entry(vectorName, Text2VecMorphVectorizer.of(fn)); } /** Create a vector index with an {@code text2vec-nvidia} vectorizer. */ - public static Map.Entry text2VecNvidia() { - return text2VecNvidia(VectorIndex.DEFAULT_VECTOR_NAME); + public static Map.Entry text2vecNvidia() { + return text2vecNvidia(VectorIndex.DEFAULT_VECTOR_NAME); } /** @@ -1039,9 +1039,9 @@ public static Map.Entry text2VecNvidia() { * * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecNvidia( + public static Map.Entry text2vecNvidia( Function> fn) { - return text2VecNvidia(VectorIndex.DEFAULT_VECTOR_NAME, fn); + return text2vecNvidia(VectorIndex.DEFAULT_VECTOR_NAME, fn); } /** @@ -1049,7 +1049,7 @@ public static Map.Entry text2VecNvidia( * * @param vectorName Vector name. */ - public static Map.Entry text2VecNvidia(String vectorName) { + public static Map.Entry text2vecNvidia(String vectorName) { return Map.entry(vectorName, Text2VecNvidiaVectorizer.of()); } @@ -1059,14 +1059,14 @@ public static Map.Entry text2VecNvidia(String vectorName) * @param vectorName Vector name. * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecNvidia(String vectorName, + public static Map.Entry text2vecNvidia(String vectorName, Function> fn) { return Map.entry(vectorName, Text2VecNvidiaVectorizer.of(fn)); } /** Create a vector index with an {@code text2vec-ollama} vectorizer. */ - public static Map.Entry text2VecOllama() { - return text2VecOllama(VectorIndex.DEFAULT_VECTOR_NAME); + public static Map.Entry text2vecOllama() { + return text2vecOllama(VectorIndex.DEFAULT_VECTOR_NAME); } /** @@ -1074,9 +1074,9 @@ public static Map.Entry text2VecOllama() { * * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecOllama( + public static Map.Entry text2vecOllama( Function> fn) { - return text2VecOllama(VectorIndex.DEFAULT_VECTOR_NAME, fn); + return text2vecOllama(VectorIndex.DEFAULT_VECTOR_NAME, fn); } /** @@ -1084,7 +1084,7 @@ public static Map.Entry text2VecOllama( * * @param vectorName Vector name. */ - public static Map.Entry text2VecOllama(String vectorName) { + public static Map.Entry text2vecOllama(String vectorName) { return Map.entry(vectorName, Text2VecOllamaVectorizer.of()); } @@ -1094,14 +1094,14 @@ public static Map.Entry text2VecOllama(String vectorName) * @param vectorName Vector name. * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecOllama(String vectorName, + public static Map.Entry text2vecOllama(String vectorName, Function> fn) { return Map.entry(vectorName, Text2VecOllamaVectorizer.of(fn)); } /** Create a vector index with an {@code text2vec-openai} vectorizer. */ - public static Map.Entry text2VecOpenAi() { - return text2VecOpenAi(VectorIndex.DEFAULT_VECTOR_NAME); + public static Map.Entry text2vecOpenAi() { + return text2vecOpenAi(VectorIndex.DEFAULT_VECTOR_NAME); } /** @@ -1109,9 +1109,9 @@ public static Map.Entry text2VecOpenAi() { * * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecOpenAi( + public static Map.Entry text2vecOpenAi( Function> fn) { - return text2VecOpenAi(VectorIndex.DEFAULT_VECTOR_NAME, fn); + return text2vecOpenAi(VectorIndex.DEFAULT_VECTOR_NAME, fn); } /** @@ -1119,7 +1119,7 @@ public static Map.Entry text2VecOpenAi( * * @param vectorName Vector name. */ - public static Map.Entry text2VecOpenAi(String vectorName) { + public static Map.Entry text2vecOpenAi(String vectorName) { return Map.entry(vectorName, Text2VecOpenAiVectorizer.of()); } @@ -1129,14 +1129,14 @@ public static Map.Entry text2VecOpenAi(String vectorName) * @param vectorName Vector name. * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecOpenAi(String vectorName, + public static Map.Entry text2vecOpenAi(String vectorName, Function> fn) { return Map.entry(vectorName, Text2VecOpenAiVectorizer.of(fn)); } /** Create a vector index with an {@code text2vec-transformers} vectorizer. */ - public static Map.Entry text2VecTransformers() { - return text2VecTransformers(VectorIndex.DEFAULT_VECTOR_NAME); + public static Map.Entry text2vecTransformers() { + return text2vecTransformers(VectorIndex.DEFAULT_VECTOR_NAME); } /** @@ -1144,9 +1144,9 @@ public static Map.Entry text2VecTransformers() { * * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecTransformers( + public static Map.Entry text2vecTransformers( Function> fn) { - return text2VecTransformers(VectorIndex.DEFAULT_VECTOR_NAME, fn); + return text2vecTransformers(VectorIndex.DEFAULT_VECTOR_NAME, fn); } /** @@ -1154,7 +1154,7 @@ public static Map.Entry text2VecTransformers( * * @param vectorName Vector name. */ - public static Map.Entry text2VecTransformers(String vectorName) { + public static Map.Entry text2vecTransformers(String vectorName) { return Map.entry(vectorName, Text2VecTransformersVectorizer.of()); } @@ -1164,14 +1164,14 @@ public static Map.Entry text2VecTransformers(String vector * @param vectorName Vector name. * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecTransformers(String vectorName, + public static Map.Entry text2vecTransformers(String vectorName, Function> fn) { return Map.entry(vectorName, Text2VecTransformersVectorizer.of(fn)); } /** Create a vector index with an {@code text2vec-voyageai} vectorizer. */ - public static Map.Entry text2VecVoyageAi() { - return text2VecVoyageAi(VectorIndex.DEFAULT_VECTOR_NAME); + public static Map.Entry text2vecVoyageAi() { + return text2vecVoyageAi(VectorIndex.DEFAULT_VECTOR_NAME); } /** @@ -1179,9 +1179,9 @@ public static Map.Entry text2VecVoyageAi() { * * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecVoyageAi( + public static Map.Entry text2vecVoyageAi( Function> fn) { - return text2VecVoyageAi(VectorIndex.DEFAULT_VECTOR_NAME, fn); + return text2vecVoyageAi(VectorIndex.DEFAULT_VECTOR_NAME, fn); } /** @@ -1189,7 +1189,7 @@ public static Map.Entry text2VecVoyageAi( * * @param vectorName Vector name. */ - public static Map.Entry text2VecVoyageAi(String vectorName) { + public static Map.Entry text2vecVoyageAi(String vectorName) { return Map.entry(vectorName, Text2VecVoyageAiVectorizer.of()); } @@ -1199,14 +1199,14 @@ public static Map.Entry text2VecVoyageAi(String vectorName * @param vectorName Vector name. * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecVoyageAi(String vectorName, + public static Map.Entry text2vecVoyageAi(String vectorName, Function> fn) { return Map.entry(vectorName, Text2VecVoyageAiVectorizer.of(fn)); } /** Create a vector index with an {@code text2vec-weaviate} vectorizer. */ - public static Map.Entry text2VecWeaviate() { - return text2VecWeaviate(VectorIndex.DEFAULT_VECTOR_NAME); + public static Map.Entry text2vecWeaviate() { + return text2vecWeaviate(VectorIndex.DEFAULT_VECTOR_NAME); } /** @@ -1214,9 +1214,9 @@ public static Map.Entry text2VecWeaviate() { * * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecWeaviate( + public static Map.Entry text2vecWeaviate( Function> fn) { - return text2VecWeaviate(VectorIndex.DEFAULT_VECTOR_NAME, fn); + return text2vecWeaviate(VectorIndex.DEFAULT_VECTOR_NAME, fn); } /** @@ -1224,7 +1224,7 @@ public static Map.Entry text2VecWeaviate( * * @param vectorName Vector name. */ - public static Map.Entry text2VecWeaviate(String vectorName) { + public static Map.Entry text2vecWeaviate(String vectorName) { return Map.entry(vectorName, Text2VecWeaviateVectorizer.of()); } @@ -1234,7 +1234,7 @@ public static Map.Entry text2VecWeaviate(String vectorName * @param vectorName Vector name. * @param fn Lambda expression for optional parameters. */ - public static Map.Entry text2VecWeaviate(String vectorName, + public static Map.Entry text2vecWeaviate(String vectorName, Function> fn) { return Map.entry(vectorName, Text2VecWeaviateVectorizer.of(fn)); }