Skip to content

Commit 0c98095

Browse files
committed
feat: add selfProvided as an alias to none
Add deprecation notice to none.
1 parent e668b7f commit 0c98095

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/collections/configure/unit.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,6 +1527,12 @@ describe('Unit testing of the vectorizer factory class', () => {
15271527
});
15281528
});
15291529

1530+
it('should alias "selfProvided" to "none"', () => {
1531+
expect(configure.vectors.selfProvided()).toEqual<VectorConfigCreate<never, undefined, 'hnsw', 'none'>>(
1532+
configure.vectors.none()
1533+
);
1534+
});
1535+
15301536
describe('Unit testing of the multiVectors factory class', () => {
15311537
it('should create the correct self provided type with defaults', () => {
15321538
const config = configure.multiVectors.selfProvided();

src/collections/configure/vectorizer.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,24 @@ export const legacyVectors = {
126126
*
127127
* @param {ConfigureNonTextVectorizerOptions<N, I, 'none'>} [opts] The configuration options for the `none` vectorizer.
128128
* @returns {VectorConfigCreate<PrimitiveKeys<T>[], N, I, 'none'>} The configuration object.
129+
*
130+
* @deprecated Use `selfProvided` instead.
129131
*/
130132
none: <N extends string | undefined = undefined, I extends VectorIndexType = 'hnsw'>(
131133
opts?: ConfigureNonTextVectorizerOptions<N, I, 'none'>
132134
): VectorConfigCreate<never, N, I, 'none'> => {
133135
const { name, quantizer, vectorIndexConfig } = opts || {};
134136
return makeVectorizer(name, { quantizer, vectorIndexConfig });
135137
},
138+
/**
139+
* Create a `VectorConfigCreate` object with the vectorizer set to `'none'`.
140+
*
141+
* @param {ConfigureNonTextVectorizerOptions<N, I, 'none'>} [opts] The configuration options for the `none` vectorizer.
142+
* @returns {VectorConfigCreate<PrimitiveKeys<T>[], N, I, 'none'>} The configuration object.
143+
*/
144+
selfProvided: <N extends string | undefined = undefined, I extends VectorIndexType = 'hnsw'>(
145+
opts?: ConfigureNonTextVectorizerOptions<N, I, 'none'>
146+
): VectorConfigCreate<never, N, I, 'none'> => legacyVectors.none(opts),
136147
/**
137148
* Create a `VectorConfigCreate` object with the vectorizer set to `'img2vec-neural'`.
138149
*

0 commit comments

Comments
 (0)