Skip to content

Commit 60c76dc

Browse files
authored
Deprecate configure.vectorizer in favour of configure.vectors (#318)
* Deprecate `configure.vectorizer` in favour of `configure.vectors` to align with Python client * Update `reconfigure.vectorizer` to be deprecated too
1 parent d13502f commit 60c76dc

File tree

12 files changed

+133
-110
lines changed

12 files changed

+133
-110
lines changed

src/collections/aggregate/integration.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ describe('Testing of the collection.aggregate methods', () => {
8989
// dataType: [collectionName],
9090
// },
9191
],
92-
vectorizers: weaviate.configure.vectorizer.text2VecContextionary({
92+
vectorizers: weaviate.configure.vectors.text2VecContextionary({
9393
vectorizeCollectionName: false,
9494
vectorIndexConfig: weaviate.configure.vectorIndex.hnsw({ maxConnections: 64 }),
9595
}),
@@ -318,7 +318,7 @@ describe('Testing of the collection.aggregate methods with named vectors', () =>
318318
},
319319
],
320320
vectorizers: [
321-
weaviate.configure.vectorizer.text2VecContextionary({
321+
weaviate.configure.vectors.text2VecContextionary({
322322
name: 'text',
323323
sourceProperties: ['text'],
324324
vectorIndexConfig: weaviate.configure.vectorIndex.hnsw(),
@@ -417,7 +417,7 @@ describe('Testing of collection.aggregate search methods', () => {
417417
dataType: 'text',
418418
},
419419
],
420-
vectorizers: weaviate.configure.vectorizer.text2VecContextionary(),
420+
vectorizers: weaviate.configure.vectors.text2VecContextionary(),
421421
})
422422
.then(() => {
423423
const data: Array<any> = [];

src/collections/config/integration.test.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('Testing of the collection.config namespace', () => {
3434
dataType: 'text',
3535
},
3636
],
37-
vectorizers: weaviate.configure.vectorizer.none(),
37+
vectorizers: weaviate.configure.vectors.none(),
3838
});
3939
const collection = client.collections.get<TestCollectionConfigGet>(collectionName);
4040
const config = await collection.config.get();
@@ -89,7 +89,7 @@ describe('Testing of the collection.config namespace', () => {
8989
dataType: 'text',
9090
},
9191
],
92-
vectorizers: weaviate.configure.vectorizer.none(),
92+
vectorizers: weaviate.configure.vectors.none(),
9393
});
9494
const collection = client.collections.get<TestCollectionConfigGet>(collectionName);
9595
const config = await collection.config.get();
@@ -149,11 +149,11 @@ describe('Testing of the collection.config namespace', () => {
149149
},
150150
],
151151
vectorizers: [
152-
weaviate.configure.vectorizer.text2VecContextionary({
152+
weaviate.configure.vectors.text2VecContextionary({
153153
name: 'title',
154154
sourceProperties: ['title'],
155155
}),
156-
weaviate.configure.vectorizer.text2VecContextionary({
156+
weaviate.configure.vectors.text2VecContextionary({
157157
name: 'age',
158158
sourceProperties: ['age'],
159159
}),
@@ -186,7 +186,7 @@ describe('Testing of the collection.config namespace', () => {
186186
const collectionName = 'TestCollectionConfigGetHNSWPlusPQ';
187187
const collection = await client.collections.create({
188188
name: collectionName,
189-
vectorizers: weaviate.configure.vectorizer.none({
189+
vectorizers: weaviate.configure.vectors.none({
190190
vectorIndexConfig: weaviate.configure.vectorIndex.hnsw({
191191
quantizer: weaviate.configure.vectorIndex.quantizer.pq(),
192192
}),
@@ -235,7 +235,7 @@ describe('Testing of the collection.config namespace', () => {
235235
const query = () =>
236236
client.collections.create({
237237
name: collectionName,
238-
vectorizers: weaviate.configure.vectorizer.none({
238+
vectorizers: weaviate.configure.vectors.none({
239239
vectorIndexConfig: weaviate.configure.vectorIndex.hnsw({
240240
quantizer: weaviate.configure.vectorIndex.quantizer.bq(),
241241
}),
@@ -263,7 +263,7 @@ describe('Testing of the collection.config namespace', () => {
263263
const collectionName = 'TestCollectionConfigGetHNSWPlusSQ';
264264
const collection = await client.collections.create({
265265
name: collectionName,
266-
vectorizers: weaviate.configure.vectorizer.none({
266+
vectorizers: weaviate.configure.vectors.none({
267267
vectorIndexConfig: weaviate.configure.vectorIndex.hnsw({
268268
quantizer: weaviate.configure.vectorIndex.quantizer.sq(),
269269
}),
@@ -287,7 +287,7 @@ describe('Testing of the collection.config namespace', () => {
287287
const collectionName = 'TestCollectionConfigGetFlatPlusBQ';
288288
const collection = await client.collections.create({
289289
name: collectionName,
290-
vectorizers: weaviate.configure.vectorizer.none({
290+
vectorizers: weaviate.configure.vectors.none({
291291
vectorIndexConfig: weaviate.configure.vectorIndex.flat({
292292
quantizer: weaviate.configure.vectorIndex.quantizer.bq(),
293293
}),
@@ -314,7 +314,7 @@ describe('Testing of the collection.config namespace', () => {
314314
const query = () =>
315315
asyncIndexing.collections.create({
316316
name: collectionName,
317-
vectorizers: weaviate.configure.vectorizer.none({
317+
vectorizers: weaviate.configure.vectors.none({
318318
vectorIndexConfig: weaviate.configure.vectorIndex.dynamic({
319319
hnsw: weaviate.configure.vectorIndex.hnsw({
320320
quantizer: weaviate.configure.vectorIndex.quantizer.pq(),
@@ -355,7 +355,7 @@ describe('Testing of the collection.config namespace', () => {
355355
const query = () =>
356356
asyncIndexing.collections.create({
357357
name: collectionName,
358-
vectorizers: weaviate.configure.vectorizer.none({
358+
vectorizers: weaviate.configure.vectors.none({
359359
vectorIndexConfig: weaviate.configure.vectorIndex.dynamic({
360360
hnsw: weaviate.configure.vectorIndex.hnsw({
361361
quantizer: weaviate.configure.vectorIndex.quantizer.pq(),
@@ -393,7 +393,7 @@ describe('Testing of the collection.config namespace', () => {
393393
const collectionName = 'TestCollectionConfigAddProperty';
394394
const collection = await client.collections.create({
395395
name: collectionName,
396-
vectorizers: weaviate.configure.vectorizer.none(),
396+
vectorizers: weaviate.configure.vectors.none(),
397397
});
398398
const config = await collection.config
399399
.addProperty({
@@ -421,7 +421,7 @@ describe('Testing of the collection.config namespace', () => {
421421
const collectionName = 'TestCollectionConfigAddReference' as const;
422422
const collection = await client.collections.create({
423423
name: collectionName,
424-
vectorizers: weaviate.configure.vectorizer.none(),
424+
vectorizers: weaviate.configure.vectors.none(),
425425
});
426426
const config = await collection.config
427427
.addReference({
@@ -443,20 +443,20 @@ describe('Testing of the collection.config namespace', () => {
443443
const collectionName = 'TestCollectionConfigAddVector' as const;
444444
const collection = await client.collections.create({
445445
name: collectionName,
446-
vectorizers: weaviate.configure.vectorizer.none(),
446+
vectorizers: weaviate.configure.vectors.none(),
447447
});
448448
// Add a single named vector
449-
await collection.config.addVector(weaviate.configure.vectorizer.none({ name: 'vector-a' }));
449+
await collection.config.addVector(weaviate.configure.vectors.none({ name: 'vector-a' }));
450450

451451
// Add several named vectors
452452
await collection.config.addVector([
453-
weaviate.configure.vectorizer.none({ name: 'vector-b' }),
454-
weaviate.configure.vectorizer.none({ name: 'vector-c' }),
453+
weaviate.configure.vectors.none({ name: 'vector-b' }),
454+
weaviate.configure.vectors.none({ name: 'vector-c' }),
455455
]);
456456

457457
// Trying to update 'default' vector -- should be omitted from request.
458458
await collection.config.addVector(
459-
weaviate.configure.vectorizer.none({
459+
weaviate.configure.vectors.none({
460460
name: 'default',
461461
vectorIndexConfig: weaviate.configure.vectorIndex.flat(),
462462
})
@@ -545,7 +545,7 @@ describe('Testing of the collection.config namespace', () => {
545545
dataType: 'text',
546546
},
547547
],
548-
vectorizers: weaviate.configure.vectorizer.none(),
548+
vectorizers: weaviate.configure.vectors.none(),
549549
});
550550
const supportsUpdatingPropertyDescriptions = await client
551551
.getWeaviateVersion()
@@ -557,7 +557,7 @@ describe('Testing of the collection.config namespace', () => {
557557
testProp: 'This is a test property',
558558
}
559559
: undefined,
560-
vectorizers: weaviate.reconfigure.vectorizer.update({
560+
vectorizers: weaviate.reconfigure.vectors.update({
561561
vectorIndexConfig: weaviate.reconfigure.vectorIndex.hnsw({
562562
quantizer: weaviate.reconfigure.vectorIndex.quantizer.pq(),
563563
ef: 4,
@@ -692,7 +692,7 @@ describe('Testing of the collection.config namespace', () => {
692692
const collection = client.collections.use(collectionName);
693693
const config = await collection.config
694694
.update({
695-
vectorizers: weaviate.reconfigure.vectorizer.update({
695+
vectorizers: weaviate.reconfigure.vectors.update({
696696
vectorIndexConfig: weaviate.reconfigure.vectorIndex.hnsw({
697697
quantizer: weaviate.reconfigure.vectorIndex.quantizer.pq(),
698698
ef: 4,
@@ -743,7 +743,7 @@ describe('Testing of the collection.config namespace', () => {
743743
const collection = client.collections.use(collectionName);
744744
await client.collections.create({
745745
name: collectionName,
746-
vectorizers: weaviate.configure.vectorizer.none(),
746+
vectorizers: weaviate.configure.vectors.none(),
747747
});
748748
let config = await collection.config.get();
749749
expect(config.generative).toBeUndefined();

src/collections/configure/index.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ const vectorDistances = {
5959
const configure = {
6060
generative,
6161
reranker,
62+
/**
63+
* @deprecated Use `vectors` instead.
64+
*/
6265
vectorizer,
66+
vectors: vectorizer,
6367
vectorIndex: configureVectorIndex,
6468
dataType,
6569
tokenization,
@@ -219,6 +223,9 @@ const reconfigure = {
219223
: undefined,
220224
};
221225
},
226+
/**
227+
* @deprecated Use `vectors` instead.
228+
*/
222229
vectorizer: {
223230
/**
224231
* Create a `VectorConfigUpdate` object to be used when updating the named vector configuration of Weaviate.
@@ -235,6 +242,22 @@ const reconfigure = {
235242
};
236243
},
237244
},
245+
vectors: {
246+
/**
247+
* Create a `VectorConfigUpdate` object to be used when updating the named vector configuration of Weaviate.
248+
*
249+
* @param {string} name The name of the vector.
250+
* @param {VectorizerOptions} options The options for the named vector.
251+
*/
252+
update: <N extends string | undefined, I extends VectorIndexType>(
253+
options: VectorizerUpdateOptions<N, I>
254+
): VectorConfigUpdate<N, I> => {
255+
return {
256+
name: options?.name as N,
257+
vectorIndex: options.vectorIndexConfig,
258+
};
259+
},
260+
},
238261
/**
239262
* Create a `ReplicationConfigUpdate` object to be used when updating the replication configuration of Weaviate.
240263
*

0 commit comments

Comments
 (0)