Skip to content

Commit 77cc99e

Browse files
committed
Fix multiVectors.selfProvided behaviour
1 parent 02db8e1 commit 77cc99e

File tree

3 files changed

+61
-9
lines changed

3 files changed

+61
-9
lines changed

src/collections/configure/unit.test.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,6 +1565,54 @@ describe('Unit testing of the vectorizer factory class', () => {
15651565
});
15661566

15671567
describe('Unit testing of the multiVectors factory class', () => {
1568+
it('should create the correct self provided type with defaults', () => {
1569+
const config = configure.multiVectors.selfProvided();
1570+
expect(config).toEqual<VectorConfigCreate<never, undefined, 'hnsw', 'none'>>({
1571+
name: undefined,
1572+
vectorIndex: {
1573+
name: 'hnsw',
1574+
config: {
1575+
multiVector: {
1576+
aggregation: undefined,
1577+
encoding: undefined,
1578+
},
1579+
type: 'hnsw',
1580+
},
1581+
},
1582+
vectorizer: {
1583+
name: 'none',
1584+
config: {},
1585+
},
1586+
});
1587+
});
1588+
it('should create the correct self provided type with all values', () => {
1589+
const config = configure.multiVectors.selfProvided({
1590+
name: 'test',
1591+
encoding: configure.vectorIndex.multiVector.encoding.muvera({ ksim: 10 }),
1592+
});
1593+
expect(config).toEqual<VectorConfigCreate<never, 'test', 'hnsw', 'none'>>({
1594+
name: 'test',
1595+
vectorIndex: {
1596+
name: 'hnsw',
1597+
config: {
1598+
multiVector: {
1599+
aggregation: undefined,
1600+
encoding: {
1601+
dprojections: undefined,
1602+
ksim: 10,
1603+
repetitions: undefined,
1604+
type: 'muvera',
1605+
},
1606+
},
1607+
type: 'hnsw',
1608+
},
1609+
},
1610+
vectorizer: {
1611+
name: 'none',
1612+
config: {},
1613+
},
1614+
});
1615+
});
15681616
it('should create the correct Text2MultiVecJinaAIConfig type with defaults', () => {
15691617
const config = configure.multiVectors.text2VecJinaAI();
15701618
expect(config).toEqual<VectorConfigCreate<never, undefined, 'hnsw', 'text2multivec-jinaai'>>({

src/collections/configure/vectorizer.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -806,15 +806,19 @@ export const multiVectors = {
806806
opts?: ConfigureNonTextMultiVectorizerOptions<N, I, 'none'>
807807
): VectorConfigCreate<PrimitiveKeys<T>, N, I, 'none'> => {
808808
const { name, encoding, quantizer, vectorIndexConfig, ...config } = opts || {};
809-
return makeVectorizer(name, {
810-
encoding,
811-
quantizer,
812-
vectorIndexConfig,
813-
vectorizerConfig: {
814-
name: 'none',
815-
config: Object.keys(config).length === 0 ? {} : config,
809+
return makeVectorizer(
810+
name,
811+
{
812+
encoding,
813+
quantizer,
814+
vectorIndexConfig,
815+
vectorizerConfig: {
816+
name: 'none',
817+
config: Object.keys(config).length === 0 ? {} : config,
818+
},
816819
},
817-
});
820+
true
821+
);
818822
},
819823

820824
/**

src/collections/vectors/journey.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ requireAtLeast(1, 29, 0).describe(
4646
collection = await client.collections.create({
4747
name: collectionName,
4848
vectorizers: [
49-
weaviate.configure.multiVectors.selfProvided({
49+
weaviate.configure.vectorizer.none({
5050
name: 'regular',
5151
}),
5252
weaviate.configure.multiVectors.selfProvided({

0 commit comments

Comments
 (0)