11package io .weaviate .client6 .v1 .api .collections .vectorizers ;
22
3+ import java .util .ArrayList ;
4+ import java .util .Arrays ;
5+ import java .util .List ;
36import java .util .function .Function ;
47
58import com .google .gson .annotations .SerializedName ;
912import io .weaviate .client6 .v1 .internal .ObjectBuilder ;
1013
1114public record Text2VecWeaviateVectorizer (
15+ /** Weaviate Embeddings Service base URL. */
1216 @ SerializedName ("baseUrl" ) String inferenceUrl ,
17+ /** Dimensionality of the generated vectors. */
1318 @ SerializedName ("dimensions" ) Integer dimensions ,
19+ /** Embedding model. */
1420 @ SerializedName ("model" ) String model ,
21+ /** Properties included in the embedding. */
22+ @ SerializedName ("sourceProperties" ) List <String > sourceProperties ,
23+ /** Vector index configuration. */
1524 VectorIndex vectorIndex ) implements Vectorizer {
1625
1726 @ Override
@@ -37,33 +46,65 @@ public Text2VecWeaviateVectorizer(Builder builder) {
3746 builder .inferenceUrl ,
3847 builder .dimensions ,
3948 builder .model ,
49+ builder .sourceProperties ,
4050 builder .vectorIndex );
4151 }
4252
43- public static final String SNOWFLAKE_ARCTIC_EMBED_L_20 = "Snowflake/snowflake-arctic-embed-l-v2.0" ;
4453 public static final String SNOWFLAKE_ARCTIC_EMBED_M_15 = "Snowflake/snowflake-arctic-embed-m-v1.5" ;
54+ public static final String SNOWFLAKE_ARCTIC_EMBED_L_20 = "Snowflake/snowflake-arctic-embed-l-v2.0" ;
4555
4656 public static class Builder implements ObjectBuilder <Text2VecWeaviateVectorizer > {
4757 private VectorIndex vectorIndex = VectorIndex .DEFAULT_VECTOR_INDEX ;
4858 private String inferenceUrl ;
4959 private Integer dimensions ;
5060 private String model ;
61+ private List <String > sourceProperties = new ArrayList <>();
5162
63+ /**
64+ * Base URL for Weaviate Embeddings Service. This can be omitted when connecting
65+ * to a Weaviate Cloud instance: the client will automatically set the necessary
66+ * headers.
67+ */
5268 public Builder inferenceUrl (String inferenceUrl ) {
5369 this .inferenceUrl = inferenceUrl ;
5470 return this ;
5571 }
5672
73+ /** Set target dimensionality for generated embeddings. */
5774 public Builder dimensions (int dimensions ) {
5875 this .dimensions = dimensions ;
5976 return this ;
6077 }
6178
79+ /**
80+ * Select the embedding model.
81+ *
82+ * @see {@link Text2VecWeaviateVectorizer#SNOWFLAKE_ARCTIC_EMBED_M_15},
83+ * {@link Text2VecWeaviateVectorizer#SNOWFLAKE_ARCTIC_EMBED_L_20}
84+ */
6285 public Builder model (String model ) {
6386 this .model = model ;
6487 return this ;
6588 }
6689
90+ /** Add properties to include in the embedding. */
91+ public Builder sourceProperties (String ... properties ) {
92+ return sourceProperties (Arrays .asList (properties ));
93+ }
94+
95+ /** Add properties to include in the embedding. */
96+ public Builder sourceProperties (List <String > properties ) {
97+ this .sourceProperties .addAll (properties );
98+ return this ;
99+ }
100+
101+ /**
102+ * Override default vector index configuration.
103+ *
104+ * <a href=
105+ * "https://docs.weaviate.io/weaviate/config-refs/indexing/vector-index#hnsw-index-parameters">HNSW</a>
106+ * is the default vector index.
107+ */
67108 public Builder vectorIndex (VectorIndex vectorIndex ) {
68109 this .vectorIndex = vectorIndex ;
69110 return this ;
0 commit comments