Skip to content

Commit 8767889

Browse files
committed
chore: lint&format
1 parent c48a278 commit 8767889

File tree

5 files changed

+49
-42
lines changed

5 files changed

+49
-42
lines changed

src/collections/config/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ const config = <T>(
4242
.withClassName(name)
4343
.withProperty(resolveProperty<any>(property, []))
4444
.do()
45-
.then(() => { }),
45+
.then(() => {}),
4646
addReference: (
4747
reference: ReferenceSingleTargetConfigCreate<any> | ReferenceMultiTargetConfigCreate<any>
4848
) =>
4949
new PropertyCreator(connection)
5050
.withClassName(name)
5151
.withProperty(resolveReference<any>(reference))
5252
.do()
53-
.then(() => { }),
53+
.then(() => {}),
5454
addVector: async (vectors: VectorizersConfigAdd<T>) => {
5555
const supportsDynamicVectorIndex = await dbVersionSupport.supportsDynamicVectorIndex();
5656
const { vectorsConfig } = makeVectorsConfig(vectors, supportsDynamicVectorIndex);
@@ -74,7 +74,7 @@ const config = <T>(
7474
})
7575
);
7676
},
77-
updateShards: async function(status: 'READY' | 'READONLY', names?: string | string[]) {
77+
updateShards: async function (status: 'READY' | 'READONLY', names?: string | string[]) {
7878
let shardNames: string[];
7979
if (names === undefined) {
8080
shardNames = await this.getShards().then((shards) => shards.map((s) => s.name));
@@ -99,7 +99,7 @@ const config = <T>(
9999
)
100100
)
101101
.then((merged) => new ClassUpdater(connection).withClass(merged).do())
102-
.then(() => { });
102+
.then(() => {});
103103
},
104104
};
105105
};

src/collections/config/types/vectorIndex.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export type RQConfig = {
7070

7171
export type UncompressedConfig = {
7272
type: 'none';
73-
}
73+
};
7474

7575
export type MultiVectorConfig = {
7676
aggregation: 'maxSim' | string;

src/collections/config/utils.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ export const parseVectorIndex = (module: ModuleConfig<VectorIndexType, VectorInd
184184
return {
185185
...conf,
186186
skipDefaultQuantization: true,
187-
}
187+
};
188188
}
189189
if (QuantizerGuards.isBQCreate(quantizer)) {
190190
const { type, ...quant } = quantizer;
@@ -246,11 +246,11 @@ export const makeVectorsConfig = (
246246
const vectorizersConfig = Array.isArray(configVectorizers)
247247
? configVectorizers
248248
: [
249-
{
250-
...configVectorizers,
251-
name: configVectorizers.name || 'default',
252-
},
253-
];
249+
{
250+
...configVectorizers,
251+
name: configVectorizers.name || 'default',
252+
},
253+
];
254254
vectorizersConfig.forEach((v) => {
255255
if (v.vectorIndex.name === 'dynamic' && !supportsDynamicVectorIndex.supports) {
256256
throw new WeaviateUnsupportedFeatureError(supportsDynamicVectorIndex.message);
@@ -373,18 +373,18 @@ class ConfigMapping {
373373
vectorizer:
374374
v.vectorizer === 'none'
375375
? {
376-
name: 'none',
377-
config: undefined,
378-
}
376+
name: 'none',
377+
config: undefined,
378+
}
379379
: {
380-
name: v.vectorizer,
381-
config: v.moduleConfig
382-
? ({
383-
...(v.moduleConfig[v.vectorizer] as any),
384-
vectorizeCollectionName: (v.moduleConfig[v.vectorizer] as any).vectorizeClassName,
385-
} as VectorizerConfig)
386-
: undefined,
387-
},
380+
name: v.vectorizer,
381+
config: v.moduleConfig
382+
? ({
383+
...(v.moduleConfig[v.vectorizer] as any),
384+
vectorizeCollectionName: (v.moduleConfig[v.vectorizer] as any).vectorizeClassName,
385+
} as VectorizerConfig)
386+
: undefined,
387+
},
388388
indexConfig: ConfigMapping.vectorIndex(v.vectorIndexConfig, v.vectorIndexType),
389389
indexType: ConfigMapping.vectorIndexType(v.vectorIndexType),
390390
},
@@ -562,9 +562,9 @@ class ConfigMapping {
562562
) {
563563
encoding = v.muvera.enabled
564564
? {
565-
type: 'muvera',
566-
...v.muvera,
567-
}
565+
type: 'muvera',
566+
...v.muvera,
567+
}
568568
: undefined;
569569
}
570570
return {

src/collections/configure/vectorIndex.ts

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ const configure = {
6969
name: 'hnsw',
7070
config: rest
7171
? {
72-
...rest,
73-
distance: distanceMetric,
74-
type: 'hnsw',
75-
}
72+
...rest,
73+
distance: distanceMetric,
74+
type: 'hnsw',
75+
}
7676
: undefined,
7777
};
7878
},
@@ -91,12 +91,12 @@ const configure = {
9191
name: 'dynamic',
9292
config: opts
9393
? {
94-
distance: opts.distanceMetric,
95-
threshold: opts.threshold,
96-
hnsw: isModuleConfig(opts.hnsw) ? opts.hnsw.config : configure.hnsw(opts.hnsw).config,
97-
flat: isModuleConfig(opts.flat) ? opts.flat.config : configure.flat(opts.flat).config,
98-
type: 'dynamic',
99-
}
94+
distance: opts.distanceMetric,
95+
threshold: opts.threshold,
96+
hnsw: isModuleConfig(opts.hnsw) ? opts.hnsw.config : configure.hnsw(opts.hnsw).config,
97+
flat: isModuleConfig(opts.flat) ? opts.flat.config : configure.flat(opts.flat).config,
98+
type: 'dynamic',
99+
}
100100
: undefined,
101101
};
102102
},
@@ -150,6 +150,11 @@ const configure = {
150150
* Define the quantizer configuration to use when creating a vector index.
151151
*/
152152
quantizer: {
153+
/**
154+
* Create an object of type `UncomplressedConfig` to skip default vector quantization.
155+
*
156+
* @returns {BQConfigCreate} The object of type `BQConfigCreate`.
157+
*/
153158
none: (): UncompressedConfig => {
154159
return { type: 'none' };
155160
},
@@ -207,9 +212,9 @@ const configure = {
207212
centroids: options?.centroids,
208213
encoder: options?.encoder
209214
? {
210-
distribution: options.encoder.distribution,
211-
type: options.encoder.type,
212-
}
215+
distribution: options.encoder.distribution,
216+
type: options.encoder.type,
217+
}
213218
: undefined,
214219
segments: options?.segments,
215220
trainingLimit: options?.trainingLimit,
@@ -344,9 +349,9 @@ const reconfigure = {
344349
encoder:
345350
pqEncoderDistribution || pqEncoderType
346351
? {
347-
distribution: pqEncoderDistribution,
348-
type: pqEncoderType,
349-
}
352+
distribution: pqEncoderDistribution,
353+
type: pqEncoderType,
354+
}
350355
: undefined,
351356
type: 'pq',
352357
};

src/collections/integration.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,9 @@ describe('Testing of the collections.create method', () => {
690690

691691
const collection = await contextionary.collections.export(collectionName);
692692

693-
expect((collection.vectorizers['custom_vec'].indexConfig as VectorIndexConfigHNSW).quantizer).toBeUndefined();
693+
expect(
694+
(collection.vectorizers.custom_vec.indexConfig as VectorIndexConfigHNSW).quantizer
695+
).toBeUndefined();
694696
});
695697
});
696698

0 commit comments

Comments
 (0)