Skip to content

Commit 9f8b52c

Browse files
committed
chore: lint & format
1 parent 81c34b8 commit 9f8b52c

File tree

2 files changed

+46
-44
lines changed

2 files changed

+46
-44
lines changed

src/collections/configure/unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ describe('Unit testing of the vectorizer factory class', () => {
10701070
});
10711071

10721072
it('should create the correct Text2VecGPT4AllConfig type with all values', () => {
1073-
const config = vectorizer.text2VecGPT4All({
1073+
const config = configure.vectors.text2VecGPT4All({
10741074
name: 'test',
10751075
});
10761076
expect(config).toEqual<VectorConfigCreate<never, 'test', 'hnsw', 'text2vec-gpt4all'>>({

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
},

0 commit comments

Comments
 (0)