Skip to content

Commit 1c05636

Browse files
committed
chore: write javadoc
1 parent abfa495 commit 1c05636

4 files changed

Lines changed: 124 additions & 3 deletions

File tree

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

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@
1010
import io.weaviate.client6.v1.api.collections.vectorizers.Text2VecWeaviateVectorizer;
1111
import io.weaviate.client6.v1.internal.ObjectBuilder;
1212

13-
/** Static methods for creating instances of {@link Vectorizer}. */
13+
/** Static factories for creating instances of {@link Vectorizer}. */
1414
public final class Vectorizers {
15+
/** Prevent public initialization. */
16+
private Vectorizers() {
17+
}
1518

1619
public static Map.Entry<String, Vectorizer> selfProvided() {
1720
return selfProvided(VectorIndex.DEFAULT_VECTOR_NAME);
@@ -31,73 +34,143 @@ public static Map.Entry<String, Vectorizer> selfProvided(String vectorName,
3134
return Map.entry(vectorName, SelfProvidedVectorizer.of(fn));
3235
}
3336

37+
/** Create a vector index with an {@code img2vec-neural} vectorizer. */
3438
public static Map.Entry<String, Vectorizer> img2vecNeural() {
3539
return img2vecNeural(VectorIndex.DEFAULT_VECTOR_NAME);
3640
}
3741

42+
/**
43+
* Create a vector index with an {@code img2vec-neural} vectorizer.
44+
*
45+
* @param fn Lambda expression for optional parameters.
46+
*/
3847
public static Map.Entry<String, Vectorizer> img2vecNeural(
3948
Function<Img2VecNeuralVectorizer.Builder, ObjectBuilder<Img2VecNeuralVectorizer>> fn) {
4049
return img2vecNeural(VectorIndex.DEFAULT_VECTOR_NAME, fn);
4150
}
4251

52+
/**
53+
* Create a named vector index with an {@code img2vec-neural} vectorizer.
54+
*
55+
* @param vectorName Vector name.
56+
*/
4357
public static Map.Entry<String, Vectorizer> img2vecNeural(String vectorName) {
4458
return Map.entry(vectorName, Img2VecNeuralVectorizer.of());
4559
}
4660

61+
/**
62+
* Create a vector index with an {@code img2vec-neural} vectorizer.
63+
*
64+
* @param vectorName Vector name.
65+
* @param fn Lambda expression for optional parameters.
66+
*/
4767
public static Map.Entry<String, Vectorizer> img2vecNeural(String vectorName,
4868
Function<Img2VecNeuralVectorizer.Builder, ObjectBuilder<Img2VecNeuralVectorizer>> fn) {
4969
return Map.entry(vectorName, Img2VecNeuralVectorizer.of(fn));
5070
}
5171

72+
/** Create a vector index with an {@code multi2vec-clip} vectorizer. */
5273
public static Map.Entry<String, Vectorizer> multi2vecClip() {
5374
return multi2vecClip(VectorIndex.DEFAULT_VECTOR_NAME);
5475
}
5576

77+
/**
78+
* Create a vector index with an {@code multi2vec-clip} vectorizer.
79+
*
80+
* @param fn Lambda expression for optional parameters.
81+
*/
5682
public static Map.Entry<String, Vectorizer> multi2vecClip(
5783
Function<Multi2VecClipVectorizer.Builder, ObjectBuilder<Multi2VecClipVectorizer>> fn) {
5884
return multi2vecClip(VectorIndex.DEFAULT_VECTOR_NAME, fn);
5985
}
6086

87+
/**
88+
* Create a named vector index with an {@code multi2vec-clip} vectorizer.
89+
*
90+
* @param vectorName Vector name.
91+
*/
6192
public static Map.Entry<String, Vectorizer> multi2vecClip(String vectorName) {
6293
return Map.entry(vectorName, Multi2VecClipVectorizer.of());
6394
}
6495

96+
/**
97+
* Create a named vector index with an {@code multi2vec-clip} vectorizer.
98+
*
99+
* @param vectorName Vector name.
100+
* @param fn Lambda expression for optional parameters.
101+
*/
65102
public static Map.Entry<String, Vectorizer> multi2vecClip(String vectorName,
66103
Function<Multi2VecClipVectorizer.Builder, ObjectBuilder<Multi2VecClipVectorizer>> fn) {
67104
return Map.entry(vectorName, Multi2VecClipVectorizer.of(fn));
68105
}
69106

107+
/** Create a vector index with an {@code text2vec-contextionary} vectorizer. */
70108
public static Map.Entry<String, Vectorizer> text2vecContextionary() {
71109
return text2vecContextionary(VectorIndex.DEFAULT_VECTOR_NAME);
72110
}
73111

112+
/**
113+
* Create a vector index with an {@code text2vec-contextionary} vectorizer.
114+
*
115+
* @param fn Lambda expression for optional parameters.
116+
*/
74117
public static Map.Entry<String, Vectorizer> text2vecContextionary(
75118
Function<Text2VecContextionaryVectorizer.Builder, ObjectBuilder<Text2VecContextionaryVectorizer>> fn) {
76119
return text2vecContextionary(VectorIndex.DEFAULT_VECTOR_NAME, fn);
77120
}
78121

122+
/**
123+
* Create a named vector index with an {@code text2vec-contextionary}
124+
* vectorizer.
125+
*
126+
* @param vectorName Vector name.
127+
*/
79128
public static Map.Entry<String, Vectorizer> text2vecContextionary(String vectorName) {
80129
return Map.entry(vectorName, Text2VecContextionaryVectorizer.of());
81130
}
82131

132+
/**
133+
* Create a named vector index with an {@code text2vec-contextionary}
134+
* vectorizer.
135+
*
136+
* @param vectorName Vector name.
137+
* @param fn Lambda expression for optional parameters.
138+
*/
83139
public static Map.Entry<String, Vectorizer> text2vecContextionary(String vectorName,
84140
Function<Text2VecContextionaryVectorizer.Builder, ObjectBuilder<Text2VecContextionaryVectorizer>> fn) {
85141
return Map.entry(vectorName, Text2VecContextionaryVectorizer.of(fn));
86142
}
87143

144+
/** Create a vector index with an {@code text2vec-weaviate} vectorizer. */
88145
public static Map.Entry<String, Vectorizer> text2VecWeaviate() {
89146
return text2VecWeaviate(VectorIndex.DEFAULT_VECTOR_NAME);
90147
}
91148

149+
/**
150+
* Create a vector index with an {@code text2vec-weaviate} vectorizer.
151+
*
152+
* @param fn Lambda expression for optional parameters.
153+
*/
92154
public static Map.Entry<String, Vectorizer> text2VecWeaviate(
93155
Function<Text2VecWeaviateVectorizer.Builder, ObjectBuilder<Text2VecWeaviateVectorizer>> fn) {
94156
return text2VecWeaviate(VectorIndex.DEFAULT_VECTOR_NAME, fn);
95157
}
96158

159+
/**
160+
* Create a named vector index with an {@code text2vec-weaviate} vectorizer.
161+
*
162+
* @param vectorName Vector name.
163+
*/
97164
public static Map.Entry<String, Vectorizer> text2VecWeaviate(String vectorName) {
98165
return Map.entry(vectorName, Text2VecWeaviateVectorizer.of());
99166
}
100167

168+
/**
169+
* Create a named vector index with an {@code text2vec-weaviate} vectorizer.
170+
*
171+
* @param vectorName Vector name.
172+
* @param fn Lambda expression for optional parameters.
173+
*/
101174
public static Map.Entry<String, Vectorizer> text2VecWeaviate(String vectorName,
102175
Function<Text2VecWeaviateVectorizer.Builder, ObjectBuilder<Text2VecWeaviateVectorizer>> fn) {
103176
return Map.entry(vectorName, Text2VecWeaviateVectorizer.of(fn));

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
import io.weaviate.client6.v1.internal.ObjectBuilder;
1313

1414
public record Img2VecNeuralVectorizer(
15+
/** BLOB properties included in the embedding. */
1516
@SerializedName("imageFields") List<String> imageFields,
17+
/** Vector index configuration. */
1618
VectorIndex vectorIndex) implements Vectorizer {
1719

1820
@Override
@@ -41,15 +43,24 @@ public static class Builder implements ObjectBuilder<Img2VecNeuralVectorizer> {
4143
private VectorIndex vectorIndex = VectorIndex.DEFAULT_VECTOR_INDEX;
4244
private List<String> imageFields = new ArrayList<>();
4345

46+
/** Add BLOB properties to include in the embedding. */
4447
public Builder imageFields(List<String> fields) {
4548
this.imageFields = fields;
4649
return this;
4750
}
4851

52+
/** Add BLOB properties to include in the embedding. */
4953
public Builder imageFields(String... fields) {
5054
return imageFields(Arrays.asList(fields));
5155
}
5256

57+
/**
58+
* Override default vector index configuration.
59+
*
60+
* <a href=
61+
* "https://docs.weaviate.io/weaviate/config-refs/indexing/vector-index#hnsw-index-parameters">HNSW</a>
62+
* is the default vector index.
63+
*/
5364
public Builder vectorIndex(VectorIndex vectorIndex) {
5465
this.vectorIndex = vectorIndex;
5566
return this;

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

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,27 @@
1313
import io.weaviate.client6.v1.internal.ObjectBuilder;
1414

1515
public record Multi2VecClipVectorizer(
16+
/** Base URL of the embedding service. */
1617
@SerializedName("inferenceUrl") String inferenceUrl,
18+
/** BLOB properties included in the embedding. */
1719
@SerializedName("imageFields") List<String> imageFields,
20+
/** TEXT properties included in the embedding. */
1821
@SerializedName("textFields") List<String> textFields,
22+
/** Weights of the included properties. */
1923
@SerializedName("weights") Weights weights,
24+
/** Vector index configuration. */
2025
VectorIndex vectorIndex) implements Vectorizer {
2126

2227
private static record Weights(
28+
/**
29+
* Weights of the BLOB properties. Values appear in the same order as the
30+
* corresponding property names in {@code imageFields}.
31+
*/
2332
@SerializedName("imageWeights") List<Float> imageWeights,
33+
/**
34+
* Weights of the TEXT properties. Values appear in the same order as the
35+
* corresponding property names in {@code textFields}.
36+
*/
2437
@SerializedName("textWeights") List<Float> textWeights) {
2538
}
2639

@@ -59,39 +72,63 @@ public static class Builder implements ObjectBuilder<Multi2VecClipVectorizer> {
5972
private Map<String, Float> imageFields = new HashMap<>();
6073
private Map<String, Float> textFields = new HashMap<>();
6174

75+
/** Set base URL of the embedding service. */
6276
public Builder inferenceUrl(String inferenceUrl) {
6377
this.inferenceUrl = inferenceUrl;
6478
return this;
6579
}
6680

81+
/** Add BLOB properties to include in the embedding. */
6782
public Builder imageFields(List<String> fields) {
6883
fields.forEach(field -> imageFields.put(field, null));
6984
return this;
7085
}
7186

87+
/** Add BLOB properties to include in the embedding. */
7288
public Builder imageFields(String... fields) {
7389
return imageFields(Arrays.asList(fields));
7490
}
7591

92+
/**
93+
* Add BLOB property to include in the embedding.
94+
*
95+
* @param field Property name.
96+
* @param weight Custom weight between 0.0 and 1.0.
97+
*/
7698
public Builder imageField(String field, float weight) {
7799
imageFields.put(field, weight);
78100
return this;
79101
}
80102

103+
/** Add TEXT properties to include in the embedding. */
81104
public Builder textFields(List<String> fields) {
82105
fields.forEach(field -> textFields.put(field, null));
83106
return this;
84107
}
85108

109+
/** Add TEXT properties to include in the embedding. */
86110
public Builder textFields(String... fields) {
87111
return textFields(Arrays.asList(fields));
88112
}
89113

114+
/**
115+
* Add TEXT property to include in the embedding.
116+
*
117+
* @param field Property name.
118+
* @param weight Custom weight between 0.0 and 1.0.
119+
*/
90120
public Builder textField(String field, float weight) {
91121
textFields.put(field, weight);
92122
return this;
93123
}
94124

125+
/**
126+
* Override default vector index configuration.
127+
*
128+
* <a href=
129+
* "https://docs.weaviate.io/weaviate/config-refs/indexing/vector-index#hnsw-index-parameters">HNSW</a>
130+
* is the default vector index.
131+
*/
95132
public Builder vectorIndex(VectorIndex vectorIndex) {
96133
this.vectorIndex = vectorIndex;
97134
return this;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ public Builder dimensions(int dimensions) {
7979
/**
8080
* Select the embedding model.
8181
*
82-
* @see {@link Text2VecWeaviateVectorizer#SNOWFLAKE_ARCTIC_EMBED_M_15},
83-
* {@link Text2VecWeaviateVectorizer#SNOWFLAKE_ARCTIC_EMBED_L_20}
82+
* @see Text2VecWeaviateVectorizer#SNOWFLAKE_ARCTIC_EMBED_M_15
83+
* @see Text2VecWeaviateVectorizer#SNOWFLAKE_ARCTIC_EMBED_L_20
8484
*/
8585
public Builder model(String model) {
8686
this.model = model;

0 commit comments

Comments
 (0)