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 index 240e6b4a7..ce08af701 100644 --- 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 @@ -23,6 +23,8 @@ public record Multi2VecGoogleVectorizer( @SerializedName("imageFields") List imageFields, /** BLOB video properties included in the embedding. */ @SerializedName("videoFields") List videoFields, + /** BLOB audio properties included in the embedding. */ + @SerializedName("audioFields") List audioFields, /** TEXT properties included in the embedding. */ @SerializedName("textFields") List textFields, /** Weights of the included properties. */ @@ -43,6 +45,11 @@ private static record Weights( * corresponding property names in {@code videoFields}. */ @SerializedName("videoWeights") List videoWeights, + /** + * 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 TEXT properties. Values appear in the same order as the * corresponding property names in {@code textFields}. @@ -101,6 +108,7 @@ public Multi2VecGoogleVectorizer( Integer videoIntervalSeconds, List imageFields, List videoFields, + List audioFields, List textFields, Weights weights, VectorIndex vectorIndex, @@ -114,6 +122,7 @@ public Multi2VecGoogleVectorizer( this.videoIntervalSeconds = videoIntervalSeconds; this.imageFields = imageFields; this.videoFields = videoFields; + this.audioFields = audioFields; this.textFields = textFields; this.weights = weights; this.vectorIndex = vectorIndex; @@ -130,6 +139,7 @@ public Multi2VecGoogleVectorizer(Builder builder) { builder.videoIntervalSeconds, builder.imageFields, builder.videoFields, + builder.audioFields, builder.textFields, builder.getWeights(), builder.vectorIndex, @@ -143,7 +153,9 @@ public static class Builder implements ObjectBuilder private List imageFields; private List imageWeights; private List videoFields; + private List audioFields; private List videoWeights; + private List audioWeights; private List textFields; private List textWeights; @@ -242,6 +254,35 @@ public Builder videoField(String field, float weight) { return this; } + /** Add BLOB audio properties to include in the embedding. */ + public Builder audioFields(List fields) { + this.audioFields = fields; + 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) { + if (this.audioFields == null) { + this.audioFields = new ArrayList<>(); + } + if (this.audioWeights == null) { + this.audioWeights = new ArrayList<>(); + } + this.audioFields.add(field); + this.audioWeights.add(weight); + return this; + } + /** Add TEXT properties to include in the embedding. */ public Builder textFields(List fields) { this.textFields = fields; @@ -272,8 +313,9 @@ public Builder textField(String field, float weight) { } protected Weights getWeights() { - if (this.textWeights != null || this.imageWeights != null || this.videoWeights != null) { - return new Weights(this.imageWeights, this.videoWeights, this.textWeights); + if (this.textWeights != null || this.imageWeights != null || this.videoWeights != null + || this.audioWeights != null) { + return new Weights(this.imageWeights, this.videoWeights, this.audioWeights, this.textWeights); } return null; } 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 368760f8a..ffb39f6cd 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 @@ -792,7 +792,8 @@ public static Object[][] testCases() { .apiEndpoint("example.com") .imageFields("a", "b") .textFields("c") - .videoFields("d")), + .videoFields("d") + .audioFields("f")), """ { "vectorIndexType": "hnsw", @@ -804,7 +805,8 @@ public static Object[][] testCases() { "location": "location", "imageFields": ["a", "b"], "textFields": ["c"], - "videoFields": ["d"] + "videoFields": ["d"], + "audioFields": ["f"] } } }