Skip to content

Commit fa79431

Browse files
authored
Merge branch 'main' into feat/boost
2 parents 5f1feaf + f5f5762 commit fa79431

29 files changed

Lines changed: 12146 additions & 8104 deletions

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<maven.compiler.release>17</maven.compiler.release>
5555
<lombok.version>1.18.42</lombok.version>
5656
<gson.version>2.13.2</gson.version>
57-
<httpclient.version>5.6</httpclient.version>
57+
<httpclient.version>5.6.1</httpclient.version>
5858
<lang3.version>3.20.0</lang3.version>
5959
<junit.version>4.13.2</junit.version>
6060
<testcontainers.version>2.0.3</testcontainers.version>

src/it/java/io/weaviate/integration/BackupITest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ public void test_lifecycle_async() throws ExecutionException, InterruptedExcepti
245245
@Test(expected = IllegalStateException.class)
246246
public void test_waitForCompletion_unknown() throws IOException, TimeoutException {
247247
var backup = new Backup("#1", "/tmp/bak/#1", "filesystem", List.of("Things"), BackupStatus.STARTED,
248-
null, null, null, null, null);
248+
null, null, null, null, null, null);
249249
backup.waitForCompletion(client);
250250
}
251251

src/it/java/io/weaviate/integration/CollectionsITest.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.weaviate.integration;
22

33
import java.io.IOException;
4+
import java.util.ArrayList;
45

56
import org.assertj.core.api.Assertions;
67
import org.assertj.core.api.InstanceOfAssertFactories;
@@ -510,4 +511,39 @@ public void test_asyncReplicationConfig() throws IOException {
510511
.returns(13, AsyncReplicationConfig::propagationConcurrency)
511512
.returns(14, AsyncReplicationConfig::propagationBatchSize);
512513
}
514+
515+
@Test
516+
public void test_properties() {
517+
Assertions.assertThatCode(() -> {
518+
var properties = new ArrayList<Property>() {
519+
{
520+
add(Property.textArray("prop_textArray"));
521+
add(Property.integer("prop_integer"));
522+
add(Property.integerArray("prop_integerArray"));
523+
add(Property.number("prop_number"));
524+
add(Property.numberArray("prop_numberArray"));
525+
add(Property.bool("prop_bool"));
526+
add(Property.boolArray("prop_boolArray"));
527+
add(Property.blob("prop_blob"));
528+
add(Property.date("prop_date"));
529+
add(Property.dateArray("prop_dateArray"));
530+
add(Property.uuid("prop_uuid"));
531+
add(Property.uuidArray("prop_uuidArray"));
532+
add(Property.object("prop_object",
533+
p -> p.nestedProperties(Property.text("foo"))));
534+
add(Property.objectArray("prop_objectArray",
535+
p -> p.nestedProperties(Property.text("foo"))));
536+
add(Property.phoneNumber("prop_phoneNumber"));
537+
add(Property.geoCoordinates("prop_geoCoordinates"));
538+
}
539+
};
540+
541+
requireAtLeast(Weaviate.Version.V137, () -> {
542+
properties.add(Property.blobHash("prop_blobHash"));
543+
});
544+
545+
client.collections.create(
546+
ns("Things"), col -> col.properties(properties));
547+
}).doesNotThrowAnyException();
548+
}
513549
}

src/it/java/io/weaviate/integration/SearchITest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import io.weaviate.client6.v1.api.collections.generate.TaskOutput;
3939
import io.weaviate.client6.v1.api.collections.generative.DummyGenerative;
4040
import io.weaviate.client6.v1.api.collections.query.Boost;
41+
import io.weaviate.client6.v1.api.collections.query.Diversity;
4142
import io.weaviate.client6.v1.api.collections.query.FetchObjectById;
4243
import io.weaviate.client6.v1.api.collections.query.Filter;
4344
import io.weaviate.client6.v1.api.collections.query.GroupBy;
@@ -952,4 +953,17 @@ public void testBoost(String __, Object boost) throws Exception {
952953
Assertions.assertThat(got).hasSameSizeAs(baseline);
953954
Assertions.assertThat(got).doesNotContainSequence(baseline);
954955
}
956+
957+
@Test
958+
public void testDiversity() throws Exception {
959+
Version.V137.orSkip();
960+
961+
var things = client.collections.use(COLLECTION);
962+
var resp = things.query.nearVector(searchVector,
963+
opt -> opt.diversity(Diversity.mmr(div -> div.limit(3))));
964+
965+
Assertions.assertThat(resp)
966+
.extracting(QueryResponse::objects, InstanceOfAssertFactories.LIST)
967+
.hasSize(3);
968+
}
955969
}

src/main/java/io/weaviate/client6/v1/api/backup/Backup.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ public record Backup(
3535
@SerializedName("completedAt") OffsetDateTime completedAt,
3636
/** Backup size in GiB. */
3737
@SerializedName("size") Float sizeGiB,
38+
/** Prefix for the incremental backup IDs. */
39+
@SerializedName("incremental_base_backup_id") String prefixIncremental,
3840
/**
3941
* This value indicates if a backup is being created or restored from.
4042
* For operations like LIST this value is null.
@@ -55,6 +57,7 @@ Backup withOperation(Operation operation) {
5557
startedAt,
5658
completedAt,
5759
sizeGiB,
60+
prefixIncremental,
5861
operation);
5962
}
6063

src/main/java/io/weaviate/client6/v1/api/backup/CreateBackupRequest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public static record BackupCreate(
2626
@SerializedName("id") String id,
2727
@SerializedName("include") List<String> includeCollections,
2828
@SerializedName("exclude") List<String> excludeCollections,
29+
@SerializedName("incremental_base_backup_id") String prefixIncremental,
2930
@SerializedName("config") Config config) {
3031

3132
private static record Config(
@@ -48,6 +49,7 @@ public BackupCreate(Builder builder) {
4849
builder.backupId,
4950
builder.includeCollections,
5051
builder.excludeCollections,
52+
builder.prefixIncremental,
5153
new Config(
5254
builder.cpuPercentage,
5355
builder.compressionLevel,
@@ -58,6 +60,7 @@ public BackupCreate(Builder builder) {
5860
public static class Builder implements ObjectBuilder<BackupCreate> {
5961
private final String backupId;
6062

63+
private String prefixIncremental;
6164
private Integer cpuPercentage;
6265
private CompressionLevel compressionLevel;
6366
private String bucket;
@@ -69,6 +72,12 @@ public Builder(String backupId) {
6972
this.backupId = backupId;
7073
}
7174

75+
/** Prefix for incremental backup IDs. */
76+
public Builder prefixIncremental(String prefixIncremental) {
77+
this.prefixIncremental = prefixIncremental;
78+
return this;
79+
}
80+
7281
/** Collection that should be included in the backup. */
7382
public Builder includeCollections(String... includeCollections) {
7483
return includeCollections(Arrays.asList(includeCollections));

src/main/java/io/weaviate/client6/v1/api/collections/DataType.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public interface DataType {
1414
public static final String BOOL = "boolean";
1515
public static final String BOOL_ARRAY = "boolean[]";
1616
public static final String BLOB = "blob";
17+
public static final String BLOB_HASH = "blobHash";
1718
public static final String DATE = "date";
1819
public static final String DATE_ARRAY = "date[]";
1920
public static final String UUID = "uuid";

src/main/java/io/weaviate/client6/v1/api/collections/Generative.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import io.weaviate.client6.v1.api.collections.generative.AzureOpenAiGenerative;
2020
import io.weaviate.client6.v1.api.collections.generative.CohereGenerative;
2121
import io.weaviate.client6.v1.api.collections.generative.DatabricksGenerative;
22+
import io.weaviate.client6.v1.api.collections.generative.DeepseekGenerative;
2223
import io.weaviate.client6.v1.api.collections.generative.DummyGenerative;
2324
import io.weaviate.client6.v1.api.collections.generative.FriendliaiGenerative;
2425
import io.weaviate.client6.v1.api.collections.generative.GoogleGenerative;
@@ -38,6 +39,7 @@ public enum Kind implements JsonEnum<Kind> {
3839
ANTHROPIC("generative-anthropic"),
3940
COHERE("generative-cohere"),
4041
DATABRICKS("generative-databricks"),
42+
DEEPSEEK("generative-deepseek"),
4143
FRIENDLIAI("generative-friendliai"),
4244
GOOGLE("generative-google"),
4345
MISTRAL("generative-mistral"),
@@ -171,6 +173,22 @@ public static Generative databricks(String endpoint,
171173
return DatabricksGenerative.of(endpoint, fn);
172174
}
173175

176+
/**
177+
* Configure a default {@code generative-deepseek} module.
178+
*/
179+
public static Generative deepseek() {
180+
return DeepseekGenerative.of();
181+
}
182+
183+
/**
184+
* Configure a {@code generative-deepseek} module.
185+
*
186+
* @param fn Lambda expression for optional parameters.
187+
*/
188+
public static Generative deepseek(Function<DeepseekGenerative.Builder, ObjectBuilder<DeepseekGenerative>> fn) {
189+
return DeepseekGenerative.of(fn);
190+
}
191+
174192
/** Configure a default {@code generative-frienliai} module. */
175193
public static Generative frienliai() {
176194
return FriendliaiGenerative.of();
@@ -384,6 +402,21 @@ default DatabricksGenerative asDatabricks() {
384402
return _as(Generative.Kind.DATABRICKS);
385403
}
386404

405+
/** Is this a {@code generative-deepseek} provider? */
406+
default boolean isDeepseek() {
407+
return _is(Generative.Kind.DEEPSEEK);
408+
}
409+
410+
/**
411+
* Get as {@link DeepseekGenerative} instance.
412+
*
413+
* @throws IllegalStateException if the current kind is not
414+
* {@code generative-deepseek}.
415+
*/
416+
default DeepseekGenerative asDeepseek() {
417+
return _as(Generative.Kind.DEEPSEEK);
418+
}
419+
387420
/** Is this a {@code generative-friendliai} provider? */
388421
default boolean isFriendliai() {
389422
return _is(Generative.Kind.FRIENDLIAI);
@@ -520,6 +553,7 @@ private final void init(Gson gson) {
520553
addAdapter(gson, Generative.Kind.AWS, AwsGenerative.class);
521554
addAdapter(gson, Generative.Kind.COHERE, CohereGenerative.class);
522555
addAdapter(gson, Generative.Kind.DATABRICKS, DatabricksGenerative.class);
556+
addAdapter(gson, Generative.Kind.DEEPSEEK, DeepseekGenerative.class);
523557
addAdapter(gson, Generative.Kind.GOOGLE, GoogleGenerative.class);
524558
addAdapter(gson, Generative.Kind.FRIENDLIAI, FriendliaiGenerative.class);
525559
addAdapter(gson, Generative.Kind.MISTRAL, MistralGenerative.class);

src/main/java/io/weaviate/client6/v1/api/collections/Property.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,25 @@ public static Property blob(String name, Function<Builder, ObjectBuilder<Propert
118118
return newProperty(name, DataType.BLOB, fn);
119119
}
120120

121+
/**
122+
* Create a {@code blobHash} property.
123+
*
124+
* @param name Property name.
125+
*/
126+
public static Property blobHash(String name) {
127+
return blobHash(name, ObjectBuilder.identity());
128+
}
129+
130+
/**
131+
* Create a {@code blobHash} property with additional configuration.
132+
*
133+
* @param name Property name.
134+
* @param fn Lambda expression for optional parameters.
135+
*/
136+
public static Property blobHash(String name, Function<Builder, ObjectBuilder<Property>> fn) {
137+
return newProperty(name, DataType.BLOB_HASH, fn);
138+
}
139+
121140
/**
122141
* Create a {@code bool} property.
123142
*

src/main/java/io/weaviate/client6/v1/api/collections/Replication.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ public Builder hashTreeHeight(int hashTreeHeight) {
9898
*
9999
* @deprecated This paramter should be controled server-side.
100100
*/
101+
@Deprecated
101102
public Builder maxWorkers(int maxWorkers) {
102103
this.maxWorkers = maxWorkers;
103104
return this;
@@ -126,6 +127,7 @@ public Builder frequencyMillisWhilePropagating(int frequencyMillisWhilePropagati
126127
*
127128
* @deprecated This parameter should be controled server-side.
128129
*/
130+
@Deprecated
129131
public Builder aliveNodesCheckingFrequencyMillis(int aliveNodesCheckingFrequencyMillis) {
130132
this.aliveNodesCheckingFrequencyMillis = aliveNodesCheckingFrequencyMillis;
131133
return this;

0 commit comments

Comments
 (0)