Skip to content

Commit aac1f4d

Browse files
committed
Make changes to fix reported bugs and to close the following issues:
- #325 - #328 - #345 - #346 - #349 - #350 - #350
1 parent 6a4164d commit aac1f4d

File tree

11 files changed

+361
-63
lines changed

11 files changed

+361
-63
lines changed

src/collections/config/integration.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
ModuleConfig,
99
MultiTenancyConfig,
1010
PropertyConfig,
11+
RQConfig,
1112
RerankerCohereConfig,
1213
VectorIndexConfigDynamic,
1314
VectorIndexConfigHNSW,
@@ -877,4 +878,25 @@ describe('Testing of the collection.config namespace', () => {
877878
);
878879
});
879880
});
881+
882+
requireAtLeast(1, 32, 0).it(
883+
'should be able to create a collection with RQ quantizer bits option',
884+
async () => {
885+
const collectionName = 'TestCollectionRQQuantizerBits';
886+
const collection = await client.collections.create({
887+
name: collectionName,
888+
vectorizers: weaviate.configure.vectors.selfProvided({
889+
quantizer: weaviate.configure.vectorIndex.quantizer.rq({ bits: 1, rescoreLimit: 10 }),
890+
}),
891+
});
892+
await collection.config.get().then((config) => {
893+
console.log(JSON.stringify(config, null, 2));
894+
const indexConfig = config.vectorizers.default.indexConfig as VectorIndexConfigHNSW;
895+
expect(indexConfig.quantizer).toBeDefined();
896+
expect(indexConfig.quantizer?.type).toEqual('rq');
897+
expect((indexConfig.quantizer as RQConfig).bits).toEqual(1);
898+
expect((indexConfig.quantizer as RQConfig).rescoreLimit).toEqual(10);
899+
});
900+
}
901+
);
880902
});

src/collections/config/types/generative.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export type GenerativeAWSConfig = {
1212
service: string;
1313
model?: string;
1414
endpoint?: string;
15+
maxTokens?: number;
1516
};
1617

1718
export type GenerativeAnthropicConfig = {

src/collections/config/types/vectorizer.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@ export type Vectorizer =
4040
| 'text2vec-nvidia'
4141
| 'text2vec-mistral'
4242
| 'text2vec-model2vec'
43+
| 'text2vec-morph'
4344
| 'text2vec-ollama'
4445
| 'text2vec-openai'
4546
| Text2VecPalmVectorizer
4647
| 'text2vec-google'
48+
| 'text2vec-google-ai-studio'
4749
| 'text2vec-transformers'
4850
| 'text2vec-voyageai'
4951
| 'text2vec-weaviate'
@@ -93,6 +95,30 @@ export type Multi2VecNvidiaConfig = {
9395
};
9496
};
9597

98+
/** The configuration for multi-media vectorization using the AWS module.
99+
*
100+
* See the [documentation](https://weaviate.io/developers/weaviate/model-providers/aws/embeddings-multimodal) for detailed usage.
101+
*/
102+
export type Multi2VecAWSConfig = {
103+
/** The dimensionality of the vector once embedded. */
104+
dimensions?: number;
105+
/** The model to use. */
106+
model?: string;
107+
/** The AWS region where the model runs. */
108+
region?: string;
109+
/** The image fields used when vectorizing. */
110+
imageFields?: string[];
111+
/** The text fields used when vectorizing. */
112+
textFields?: string[];
113+
/** The weights of the fields used for vectorization. */
114+
weights?: {
115+
/** The weights of the image fields. */
116+
imageFields?: number[];
117+
/** The weights of the text fields. */
118+
textFields?: number[];
119+
};
120+
};
121+
96122
/** The configuration for multi-media vectorization using the CLIP module.
97123
*
98124
* See the [documentation](https://weaviate.io/developers/weaviate/model-providers/transformers/embeddings-multimodal) for detailed usage.
@@ -504,6 +530,8 @@ export type Text2VecPalmConfig = Text2VecGoogleConfig;
504530
export type Text2VecGoogleConfig = {
505531
/** The API endpoint to use without a leading scheme such as `http://`. */
506532
apiEndpoint?: string;
533+
/** The dimensionality of the vector once embedded. */
534+
dimensions?: number;
507535
/** The model ID to use. */
508536
model?: string;
509537
/** The model ID to use.
@@ -517,6 +545,13 @@ export type Text2VecGoogleConfig = {
517545
vectorizeCollectionName?: boolean;
518546
};
519547

548+
export type Text2VecGoogleAiStudioConfig = {
549+
/** The model ID to use. */
550+
model?: string;
551+
/** The Weaviate property name for the `gecko-002` or `gecko-003` model to use as the title. */
552+
titleProperty?: string;
553+
};
554+
520555
/**
521556
* The configuration for text vectorization using the Transformers module.
522557
*
@@ -579,10 +614,18 @@ export type Text2VecModel2Vec = {
579614
vectorizeCollectionName?: boolean;
580615
};
581616

617+
export type Text2VecMorphConfig = {
618+
/** The base URL to use where API requests should go. */
619+
baseURL?: string;
620+
/** The model to use. */
621+
model?: string;
622+
};
623+
582624
export type NoVectorizerConfig = {};
583625

584626
export type VectorizerConfig =
585627
| Img2VecNeuralConfig
628+
| Multi2VecAWSConfig
586629
| Multi2VecClipConfig
587630
| Multi2VecBindConfig
588631
| Multi2VecGoogleConfig
@@ -652,6 +695,8 @@ export type VectorizerConfigType<V> = V extends 'img2vec-neural'
652695
? Text2VecMistralConfig | undefined
653696
: V extends 'text2vec-model2vec'
654697
? Text2VecModel2Vec | undefined
698+
: V extends 'text2vec-morph'
699+
? Text2VecMorphConfig | undefined
655700
: V extends 'text2vec-ollama'
656701
? Text2VecOllamaConfig | undefined
657702
: V extends 'text2vec-openai'

src/collections/configure/types/vectorizer.ts

Lines changed: 44 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
import {
22
Img2VecNeuralConfig,
33
ModuleConfig,
4+
Multi2MultivecJinaAIConfig,
5+
Multi2VecAWSConfig,
6+
Multi2VecBindConfig,
7+
Multi2VecClipConfig,
8+
Multi2VecCohereConfig,
49
Multi2VecField,
10+
Multi2VecGoogleConfig,
11+
Multi2VecJinaAIConfig,
12+
Multi2VecNvidiaConfig,
13+
Multi2VecVoyageAIConfig,
514
Ref2VecCentroidConfig,
615
Text2MultiVecJinaAIConfig,
716
Text2VecAWSConfig,
@@ -10,11 +19,13 @@ import {
1019
Text2VecContextionaryConfig,
1120
Text2VecDatabricksConfig,
1221
Text2VecGPT4AllConfig,
22+
Text2VecGoogleAiStudioConfig,
1323
Text2VecGoogleConfig,
1424
Text2VecHuggingFaceConfig,
1525
Text2VecJinaAIConfig,
1626
Text2VecMistralConfig,
1727
Text2VecModel2Vec,
28+
Text2VecMorphConfig,
1829
Text2VecNvidiaConfig,
1930
Text2VecOllamaConfig,
2031
Text2VecOpenAIConfig,
@@ -128,36 +139,43 @@ export type Img2VecNeuralConfigCreate = Img2VecNeuralConfig;
128139
// image_fields: The image fields to use in vectorization.
129140
// text_fields: The text fields to use in vectorization.
130141

142+
type Multi2VecOmissions =
143+
| 'audioFields'
144+
| 'depthFields'
145+
| 'imageFields'
146+
| 'IMUFields'
147+
| 'thermalFields'
148+
| 'textFields'
149+
| 'videoFields'
150+
| 'weights';
151+
131152
/** The configuration for the `multi2vec-nvidia` vectorizer. */
132-
export type Multi2VecNvidiaConfigCreate = {
133-
/** The model to use. Defaults to `None`, which uses the server-defined default. */
134-
model?: string;
135-
/** The base URL where API requests should go. */
136-
baseURL?: string;
137-
/** Whether to apply truncation. */
138-
truncation?: boolean;
153+
export type Multi2VecNvidiaConfigCreate = Omit<Multi2VecNvidiaConfig, Multi2VecOmissions> & {
154+
/** The image fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */
155+
imageFields?: string[] | Multi2VecField[];
139156
/** Format in which the embeddings are encoded. Defaults to `None`, so the embeddings are represented as a list of floating-point numbers. */
140157
outputEncoding?: string;
158+
/** The text fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */
159+
textFields?: string[] | Multi2VecField[];
160+
};
161+
162+
export type Multi2VecAWSConfigCreate = Omit<Multi2VecAWSConfig, Multi2VecOmissions> & {
141163
/** The image fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */
142164
imageFields?: string[] | Multi2VecField[];
143165
/** The text fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */
144166
textFields?: string[] | Multi2VecField[];
145167
};
146168

147169
/** The configuration for the `multi2vec-clip` vectorizer. */
148-
export type Multi2VecClipConfigCreate = {
170+
export type Multi2VecClipConfigCreate = Omit<Multi2VecClipConfig, Multi2VecOmissions> & {
149171
/** The image fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */
150172
imageFields?: string[] | Multi2VecField[];
151-
/** The inference url to use where API requests should go. */
152-
inferenceUrl?: string;
153173
/** The text fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */
154174
textFields?: string[] | Multi2VecField[];
155-
/** Whether to vectorize the collection name. */
156-
vectorizeCollectionName?: boolean;
157175
};
158176

159177
/** The configuration for the `multi2vec-bind` vectorizer. */
160-
export type Multi2VecBindConfigCreate = {
178+
export type Multi2VecBindConfigCreate = Omit<Multi2VecBindConfig, Multi2VecOmissions> & {
161179
/** The audio fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */
162180
audioFields?: string[] | Multi2VecField[];
163181
/** The depth fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */
@@ -172,84 +190,43 @@ export type Multi2VecBindConfigCreate = {
172190
thermalFields?: string[] | Multi2VecField[];
173191
/** The video fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */
174192
videoFields?: string[] | Multi2VecField[];
175-
/** Whether to vectorize the collection name. */
176-
vectorizeCollectionName?: boolean;
177193
};
178194

179195
/** The configuration for the `multi2vec-cohere` vectorizer. */
180-
export type Multi2VecCohereConfigCreate = {
181-
/** The base URL to use where API requests should go. */
182-
baseURL?: string;
196+
export type Multi2VecCohereConfigCreate = Omit<Multi2VecCohereConfig, Multi2VecOmissions> & {
183197
/** The image fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */
184198
imageFields?: string[] | Multi2VecField[];
185-
/** The specific model to use. */
186-
model?: string;
187199
/** The text fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */
188200
textFields?: string[] | Multi2VecField[];
189-
/** The truncation strategy to use. */
190-
truncate?: string;
191-
/** Whether to vectorize the collection name. */
192-
vectorizeCollectionName?: boolean;
193201
};
194202

195-
export type Multi2MultivecJinaAIConfigCreate = {
196-
/** The image fields to use in vectorization. */
197-
imageFields?: string[];
198-
/** The text fields to use in vectorization. */
199-
textFields?: string[];
200-
};
203+
export type Multi2MultivecJinaAIConfigCreate = Multi2MultivecJinaAIConfig;
201204

202-
export type Multi2VecJinaAIConfigCreate = {
203-
/** The base URL to use where API requests should go. */
204-
baseURL?: string;
205-
/** The dimensionality of the vector once embedded. */
206-
dimensions?: number;
207-
/** The model to use. */
208-
model?: string;
205+
export type Multi2VecJinaAIConfigCreate = Omit<Multi2VecJinaAIConfig, Multi2VecOmissions> & {
209206
/** The image fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */
210207
imageFields?: string[] | Multi2VecField[];
211208
/** The text fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */
212209
textFields?: string[] | Multi2VecField[];
213-
/** Whether to vectorize the collection name. */
214-
vectorizeCollectionName?: boolean;
215210
};
216211

217212
/** @deprecated Use `Multi2VecGoogleConfigCreate` instead.*/
218213
export type Multi2VecPalmConfigCreate = Multi2VecGoogleConfigCreate;
219214

220215
/** The configuration for the `multi2vec-google` vectorizer. */
221-
export type Multi2VecGoogleConfigCreate = {
222-
/** The project id of the model in GCP. */
223-
projectId: string;
224-
/** Where the model runs */
225-
location: string;
216+
export type Multi2VecGoogleConfigCreate = Omit<Multi2VecGoogleConfig, Multi2VecOmissions> & {
226217
/** The image fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */
227218
imageFields?: string[] | Multi2VecField[];
228219
/** The text fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */
229220
textFields?: string[] | Multi2VecField[];
230221
/** The video fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */
231222
videoFields?: string[] | Multi2VecField[];
232-
/** The model ID to use. */
233-
modelId?: string;
234-
/** The dimensionality of the vector once embedded. */
235-
dimensions?: number;
236-
/** Whether to vectorize the collection name. */
237-
vectorizeCollectionName?: boolean;
238223
};
239224

240-
export type Multi2VecVoyageAIConfigCreate = {
241-
/** The base URL to use where API requests should go. */
242-
baseURL?: string;
225+
export type Multi2VecVoyageAIConfigCreate = Omit<Multi2VecVoyageAIConfig, Multi2VecOmissions> & {
243226
/** The image fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */
244227
imageFields?: string[] | Multi2VecField[];
245-
/** The model to use. */
246-
model?: string;
247228
/** The text fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */
248229
textFields?: string[] | Multi2VecField[];
249-
/** Whether the input should be truncated to fit the context window. */
250-
truncate?: boolean;
251-
/** Whether to vectorize the collection name. */
252-
vectorizeCollectionName?: boolean;
253230
};
254231

255232
export type Ref2VecCentroidConfigCreate = Ref2VecCentroidConfig;
@@ -276,6 +253,8 @@ export type Text2VecMistralConfigCreate = Text2VecMistralConfig;
276253

277254
export type Text2VecModel2VecConfigCreate = Text2VecModel2Vec;
278255

256+
export type Text2VecMorphConfigCreate = Text2VecMorphConfig;
257+
279258
export type Text2VecOllamaConfigCreate = Text2VecOllamaConfig;
280259

281260
export type Text2VecOpenAIConfigCreate = Text2VecOpenAIConfig;
@@ -285,6 +264,8 @@ export type Text2VecPalmConfigCreate = Text2VecGoogleConfig;
285264

286265
export type Text2VecGoogleConfigCreate = Text2VecGoogleConfig;
287266

267+
export type Text2VecGoogleAiStudioConfigCreate = Text2VecGoogleAiStudioConfig;
268+
288269
export type Text2VecTransformersConfigCreate = Text2VecTransformersConfig;
289270

290271
export type Text2VecVoyageAIConfigCreate = Text2VecVoyageAIConfig;
@@ -335,6 +316,8 @@ export type VectorizerConfigCreateType<V> = V extends 'img2vec-neural'
335316
? Text2VecMistralConfigCreate | undefined
336317
: V extends 'text2vec-model2vec'
337318
? Text2VecModel2VecConfigCreate | undefined
319+
: V extends 'text2vec-morph'
320+
? Text2VecMorphConfigCreate | undefined
338321
: V extends 'text2vec-ollama'
339322
? Text2VecOllamaConfigCreate | undefined
340323
: V extends 'text2vec-openai'
@@ -345,6 +328,8 @@ export type VectorizerConfigCreateType<V> = V extends 'img2vec-neural'
345328
? Text2VecPalmConfigCreate | undefined
346329
: V extends 'text2vec-google'
347330
? Text2VecGoogleConfigCreate | undefined
331+
: V extends 'text2vec-google-ai-studio'
332+
? Text2VecGoogleAiStudioConfigCreate | undefined
348333
: V extends 'text2vec-transformers'
349334
? Text2VecTransformersConfigCreate | undefined
350335
: V extends 'text2vec-voyageai'

0 commit comments

Comments
 (0)