Skip to content

Commit c650896

Browse files
committed
test: update expectations
1 parent a5d9256 commit c650896

File tree

3 files changed

+51
-50
lines changed

3 files changed

+51
-50
lines changed

src/collections/configure/unit.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
RerankerVoyageAIConfig,
2121
VectorConfigCreate,
2222
} from '../types/index.js';
23-
import { configure, vectorizer } from './index.js';
23+
import { configure } from './index.js';
2424
import {
2525
InvertedIndexConfigCreate,
2626
MultiTenancyConfigCreate,
@@ -1007,7 +1007,7 @@ describe('Unit testing of the vectorizer factory class', () => {
10071007
},
10081008
vectorizer: {
10091009
name: 'text2vec-contextionary',
1010-
config: {},
1010+
config: undefined,
10111011
},
10121012
});
10131013
});
@@ -1069,8 +1069,8 @@ describe('Unit testing of the vectorizer factory class', () => {
10691069
});
10701070
});
10711071

1072-
it.only('should create the correct Text2VecGPT4AllConfig type with all values', () => {
1073-
const config = vectorizer.text2VecGPT4All({
1072+
it('should create the correct Text2VecGPT4AllConfig type with all values', () => {
1073+
const config = configure.vectors.text2VecGPT4All({
10741074
name: 'test',
10751075
});
10761076
expect(config).toEqual<VectorConfigCreate<never, 'test', 'hnsw', 'text2vec-gpt4all'>>({
@@ -1081,7 +1081,7 @@ describe('Unit testing of the vectorizer factory class', () => {
10811081
},
10821082
vectorizer: {
10831083
name: 'text2vec-gpt4all',
1084-
config: {},
1084+
config: undefined,
10851085
},
10861086
});
10871087
});

src/collections/configure/vectorizer.ts

Lines changed: 45 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,20 @@ const makeVectorIndex = (opts?: {
3737
}
3838
conf = conf
3939
? {
40-
...conf,
41-
multiVector: conf.multiVector
42-
? {
43-
...conf.multiVector,
44-
encoding: conf.multiVector.encoding
45-
? { ...conf.multiVector.encoding, ...opts.encoding }
46-
: opts.encoding,
47-
}
48-
: vectorIndex.multiVector.multiVector({ encoding: opts.encoding }),
49-
}
40+
...conf,
41+
multiVector: conf.multiVector
42+
? {
43+
...conf.multiVector,
44+
encoding: conf.multiVector.encoding
45+
? { ...conf.multiVector.encoding, ...opts.encoding }
46+
: opts.encoding,
47+
}
48+
: vectorIndex.multiVector.multiVector({ encoding: opts.encoding }),
49+
}
5050
: {
51-
multiVector: vectorIndex.multiVector.multiVector({ encoding: opts.encoding }),
52-
type: 'hnsw',
53-
};
51+
multiVector: vectorIndex.multiVector.multiVector({ encoding: opts.encoding }),
52+
type: 'hnsw',
53+
};
5454
}
5555
if (opts?.quantizer) {
5656
if (!conf) {
@@ -117,6 +117,8 @@ const formatMulti2VecFields = (
117117
/** Previously all text-based vectorizers accepted `vectorizeCollectionName` parameter, which was meaningless for some modules and caused others to produce confusing results (see details below). Moving forward, we want to deprecate the usage of this parameter.
118118
*
119119
* Collections with `vectorizeCollectionName: true` generate embeddings even if they have no vectorizeable properties. This means all generated embeddings would embed the collection name itself, which makes them rather meaningless.
120+
*
121+
* @deprecated Use `vectors` instead.
120122
* */
121123
export const legacyVectors = {
122124
/**
@@ -188,16 +190,16 @@ export const legacyVectors = {
188190
Object.keys(config).length === 0
189191
? undefined
190192
: {
191-
...config,
192-
audioFields: audioFields?.map((f) => f.name),
193-
depthFields: depthFields?.map((f) => f.name),
194-
imageFields: imageFields?.map((f) => f.name),
195-
IMUFields: IMUFields?.map((f) => f.name),
196-
textFields: textFields?.map((f) => f.name),
197-
thermalFields: thermalFields?.map((f) => f.name),
198-
videoFields: videoFields?.map((f) => f.name),
199-
weights: Object.keys(weights).length === 0 ? undefined : weights,
200-
},
193+
...config,
194+
audioFields: audioFields?.map((f) => f.name),
195+
depthFields: depthFields?.map((f) => f.name),
196+
imageFields: imageFields?.map((f) => f.name),
197+
IMUFields: IMUFields?.map((f) => f.name),
198+
textFields: textFields?.map((f) => f.name),
199+
thermalFields: thermalFields?.map((f) => f.name),
200+
videoFields: videoFields?.map((f) => f.name),
201+
weights: Object.keys(weights).length === 0 ? undefined : weights,
202+
},
201203
},
202204
});
203205
},
@@ -227,11 +229,11 @@ export const legacyVectors = {
227229
Object.keys(config).length === 0
228230
? undefined
229231
: {
230-
...config,
231-
imageFields: imageFields?.map((f) => f.name),
232-
textFields: textFields?.map((f) => f.name),
233-
weights: Object.keys(weights).length === 0 ? undefined : weights,
234-
},
232+
...config,
233+
imageFields: imageFields?.map((f) => f.name),
234+
textFields: textFields?.map((f) => f.name),
235+
weights: Object.keys(weights).length === 0 ? undefined : weights,
236+
},
235237
},
236238
});
237239
},
@@ -261,11 +263,11 @@ export const legacyVectors = {
261263
Object.keys(config).length === 0
262264
? undefined
263265
: {
264-
...config,
265-
imageFields: imageFields?.map((f) => f.name),
266-
textFields: textFields?.map((f) => f.name),
267-
weights: Object.keys(weights).length === 0 ? undefined : weights,
268-
},
266+
...config,
267+
imageFields: imageFields?.map((f) => f.name),
268+
textFields: textFields?.map((f) => f.name),
269+
weights: Object.keys(weights).length === 0 ? undefined : weights,
270+
},
269271
},
270272
});
271273
},
@@ -296,11 +298,11 @@ export const legacyVectors = {
296298
Object.keys(config).length === 0
297299
? undefined
298300
: {
299-
...config,
300-
imageFields: imageFields?.map((f) => f.name),
301-
textFields: textFields?.map((f) => f.name),
302-
weights: Object.keys(weights).length === 0 ? undefined : weights,
303-
},
301+
...config,
302+
imageFields: imageFields?.map((f) => f.name),
303+
textFields: textFields?.map((f) => f.name),
304+
weights: Object.keys(weights).length === 0 ? undefined : weights,
305+
},
304306
},
305307
});
306308
},
@@ -400,11 +402,11 @@ export const legacyVectors = {
400402
Object.keys(config).length === 0
401403
? undefined
402404
: {
403-
...config,
404-
imageFields: imageFields?.map((f) => f.name),
405-
textFields: textFields?.map((f) => f.name),
406-
weights: Object.keys(weights).length === 0 ? undefined : weights,
407-
},
405+
...config,
406+
imageFields: imageFields?.map((f) => f.name),
407+
textFields: textFields?.map((f) => f.name),
408+
weights: Object.keys(weights).length === 0 ? undefined : weights,
409+
},
408410
},
409411
});
410412
},

src/collections/filters/integration.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ describe('Testing of the filter class with a simple collection', () => {
5757
},
5858
],
5959
invertedIndex: weaviate.configure.invertedIndex({ indexTimestamps: true }),
60-
vectorizers: weaviate.configure.vectors.text2VecContextionary({
61-
}),
60+
vectorizers: weaviate.configure.vectors.text2VecContextionary({}),
6261
})
6362
.then(() =>
6463
collection.data.insertMany([

0 commit comments

Comments
 (0)