Skip to content

Commit d4774a2

Browse files
committed
test: migrate to model2vec container for tests
1 parent fb0556b commit d4774a2

9 files changed

Lines changed: 31 additions & 33 deletions

File tree

src/it/java/io/weaviate/containers/Container.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
public class Container {
1616
public static final Weaviate WEAVIATE = Weaviate.createDefault();
17-
public static final Transformers TRANSFORMERS = Transformers.createDefault();
17+
public static final Model2Vec MODEL2VEC = Model2Vec.createDefault();
1818
public static final Img2VecNeural IMG2VEC_NEURAL = Img2VecNeural.createDefault();
1919
public static final MinIo MINIO = MinIo.createDefault();
2020

src/it/java/io/weaviate/containers/Transformers.java renamed to src/it/java/io/weaviate/containers/Model2Vec.java

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44

55
import io.weaviate.client6.v1.api.collections.VectorConfig;
66

7-
public class Transformers extends GenericContainer<Transformers> {
8-
public static final String VERSION = "sentence-transformers-all-MiniLM-L6-v2";
9-
public static final String DOCKER_IMAGE = "cr.weaviate.io/semitechnologies/transformers-inference";
10-
public static final String MODULE = VectorConfig.Kind.TEXT2VEC_TRANSFORMERS.jsonValue();
7+
public class Model2Vec extends GenericContainer<Model2Vec> {
8+
public static final String VERSION = "minishlab-potion-retrieval-32M";
9+
public static final String DOCKER_IMAGE = "cr.weaviate.io/semitechnologies/model2vec-inference";
10+
public static final String MODULE = VectorConfig.Kind.TEXT2VEC_MODEL2VEC.jsonValue();
1111

12-
public static final String HOST_NAME = "transformers";
12+
public static final String HOST_NAME = "model2vec";
1313
public static final String URL = HOST_NAME + ":8080";
1414

15-
static Transformers createDefault() {
15+
static Model2Vec createDefault() {
1616
return new Builder().build();
1717
}
1818

19-
static Transformers.Builder custom() {
19+
static Model2Vec.Builder custom() {
2020
return new Builder();
2121
}
2222

@@ -27,16 +27,14 @@ public Builder() {
2727
this.versionTag = VERSION;
2828
}
2929

30-
public Transformers build() {
31-
var container = new Transformers(DOCKER_IMAGE + ":" + versionTag);
32-
container
33-
.withEnv("ENABLE_CUDA", "0");
30+
public Model2Vec build() {
31+
var container = new Model2Vec(DOCKER_IMAGE + ":" + versionTag);
3432
container.withCreateContainerCmdModifier(cmd -> cmd.withHostName(HOST_NAME));
3533
return container;
3634
}
3735
}
3836

39-
public Transformers(String image) {
37+
public Model2Vec(String image) {
4038
super(image);
4139
}
4240
}

src/it/java/io/weaviate/containers/Weaviate.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ public Builder withDefaultVectorizer(String module) {
112112
return this;
113113
}
114114

115-
public Builder withTransformersUrl(String url) {
116-
addModules(Transformers.MODULE);
117-
environment.put("TRANSFORMERS_INFERENCE_API", "http://" + url);
115+
public Builder withModel2VecUrl(String url) {
116+
addModules(Model2Vec.MODULE);
117+
environment.put("MODEL2VEC_INFERENCE_API", "http://" + url);
118118
return this;
119119
}
120120

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,18 @@
4242
import io.weaviate.containers.Container;
4343
import io.weaviate.containers.Container.ContainerGroup;
4444
import io.weaviate.containers.Img2VecNeural;
45-
import io.weaviate.containers.Transformers;
45+
import io.weaviate.containers.Model2Vec;
4646
import io.weaviate.containers.Weaviate;
4747

4848
public class SearchITest extends ConcurrentTest {
4949
private static final ContainerGroup compose = Container.compose(
5050
Weaviate.custom()
51-
.withTransformersUrl(Transformers.URL)
51+
.withModel2VecUrl(Model2Vec.URL)
5252
.withImageInference(Img2VecNeural.URL, Img2VecNeural.MODULE)
5353
.addModules("generative-dummy")
5454
.build(),
5555
Container.IMG2VEC_NEURAL,
56-
Container.TRANSFORMERS);
56+
Container.MODEL2VEC);
5757
@ClassRule // Bind containers to the lifetime of the test
5858
public static final TestRule _rule = compose.asTestRule();
5959
private static final WeaviateClient client = compose.getClient();
@@ -151,7 +151,7 @@ public void testNearText() throws IOException {
151151
client.collections.create(nsSongs,
152152
col -> col
153153
.properties(Property.text("title"))
154-
.vectorConfig(VectorConfig.text2VecTransformers()));
154+
.vectorConfig(VectorConfig.text2VecModel2Vec()));
155155

156156
var songs = client.collections.use(nsSongs);
157157
var submarine = songs.data.insert(Map.of("title", "Yellow Submarine"));
@@ -173,7 +173,7 @@ public void testNearText() throws IOException {
173173

174174
@Test
175175
public void testNearText_groupBy() throws IOException {
176-
var vectorizer = VectorConfig.text2VecTransformers();
176+
var vectorizer = VectorConfig.text2VecModel2Vec();
177177

178178
var nsArtists = ns("Artists");
179179
client.collections.create(nsArtists,
@@ -370,7 +370,7 @@ public void testNearObject() throws IOException {
370370
client.collections.create(nsAnimals,
371371
collection -> collection
372372
.properties(Property.text("kind"))
373-
.vectorConfig(VectorConfig.text2VecTransformers()));
373+
.vectorConfig(VectorConfig.text2VecModel2Vec()));
374374

375375
var animals = client.collections.use(nsAnimals);
376376

@@ -399,7 +399,7 @@ public void testHybrid() throws IOException {
399399
client.collections.create(nsHobbies,
400400
collection -> collection
401401
.properties(Property.text("name"), Property.text("description"))
402-
.vectorConfig(VectorConfig.text2VecTransformers()));
402+
.vectorConfig(VectorConfig.text2VecModel2Vec()));
403403

404404
var hobbies = client.collections.use(nsHobbies);
405405

@@ -432,7 +432,7 @@ public void testBadRequest() throws IOException {
432432
client.collections.create(nsThings,
433433
collection -> collection
434434
.properties(Property.text("name"))
435-
.vectorConfig(VectorConfig.text2VecTransformers()));
435+
.vectorConfig(VectorConfig.text2VecModel2Vec()));
436436

437437
var things = client.collections.use(nsThings);
438438
var balloon = things.data.insert(Map.of("name", "balloon"));
@@ -449,7 +449,7 @@ public void testBadRequest_async() throws Throwable {
449449
async.collections.create(nsThings,
450450
collection -> collection
451451
.properties(Property.text("name"))
452-
.vectorConfig(VectorConfig.text2VecTransformers()))
452+
.vectorConfig(VectorConfig.text2VecModel2Vec()))
453453
.join();
454454

455455
var things = async.collections.use(nsThings);
@@ -470,7 +470,7 @@ public void testMetadataAll() throws IOException {
470470
client.collections.create(nsThings,
471471
c -> c
472472
.properties(Property.text("name"))
473-
.vectorConfig(VectorConfig.text2VecTransformers(
473+
.vectorConfig(VectorConfig.text2VecModel2Vec(
474474
t2v -> t2v.sourceProperties("name"))));
475475

476476
var things = client.collections.use(nsThings);
@@ -563,7 +563,7 @@ public void testGenerative_bm25() throws IOException {
563563
c -> c
564564
.properties(Property.text("title"))
565565
.generativeModule(new DummyGenerative())
566-
.vectorConfig(VectorConfig.text2VecTransformers(
566+
.vectorConfig(VectorConfig.text2VecModel2Vec(
567567
t2v -> t2v.sourceProperties("title"))));
568568

569569
var things = client.collections.use(nsThings);
@@ -604,7 +604,7 @@ public void testGenerative_bm25_groupBy() throws IOException {
604604
c -> c
605605
.properties(Property.text("title"))
606606
.generativeModule(new DummyGenerative())
607-
.vectorConfig(VectorConfig.text2VecTransformers(
607+
.vectorConfig(VectorConfig.text2VecModel2Vec(
608608
t2v -> t2v.sourceProperties("title"))));
609609

610610
var things = client.collections.use(nsThings);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public enum Kind implements JsonEnum<Kind> {
5858
TEXT2VEC_GOOGLE("text2vec-google"),
5959
TEXT2VEC_GOOGLEAISTUDIO("text2vec-google"),
6060
TEXT2VEC_HUGGINGFACE("text2vec-huggingface"),
61-
REF2VEC_CENTROID("text2vec-huggingface"),
61+
REF2VEC_CENTROID("ref2vec-centroid"),
6262
TEXT2VEC_JINAAI("text2vec-jinaai"),
6363
TEXT2VEC_MISTRAL("text2vec-mistral"),
6464
TEXT2VEC_MORPH("text2vec-morph"),

src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Multi2VecJinaAiVectorizer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private static record Weights(
5151

5252
@Override
5353
public VectorConfig.Kind _kind() {
54-
return VectorConfig.Kind.MULTI2VEC_COHERE;
54+
return VectorConfig.Kind.MULTI2VEC_JINAAI;
5555
}
5656

5757
@Override

src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecDatabricksVectorizer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public record Text2VecDatabricksVectorizer(
3131

3232
@Override
3333
public VectorConfig.Kind _kind() {
34-
return VectorConfig.Kind.TEXT2VEC_MISTRAL;
34+
return VectorConfig.Kind.TEXT2VEC_DATABRICKS;
3535
}
3636

3737
@Override

src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecModel2VecVectorizer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public record Text2VecModel2VecVectorizer(
3030

3131
@Override
3232
public VectorConfig.Kind _kind() {
33-
return VectorConfig.Kind.TEXT2VEC_COHERE;
33+
return VectorConfig.Kind.TEXT2VEC_MODEL2VEC;
3434
}
3535

3636
@Override

src/main/java/io/weaviate/client6/v1/api/collections/vectorizers/Text2VecMorphVectorizer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public record Text2VecMorphVectorizer(
2525

2626
@Override
2727
public VectorConfig.Kind _kind() {
28-
return VectorConfig.Kind.TEXT2VEC_HUGGINGFACE;
28+
return VectorConfig.Kind.TEXT2VEC_MORPH;
2929
}
3030

3131
@Override

0 commit comments

Comments
 (0)