Skip to content

Commit 1f62379

Browse files
committed
Merge branch 'dev/1.27' of https://github.com/weaviate/typescript-client into 1.27/multi-vector-search
2 parents dac64cd + 5dec0a9 commit 1f62379

File tree

12 files changed

+341
-28
lines changed

12 files changed

+341
-28
lines changed

src/collections/config/integration.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ describe('Testing of the collection.config namespace', () => {
6161
dynamicEfMax: 500,
6262
dynamicEfFactor: 8,
6363
vectorCacheMaxObjects: 1000000000000,
64+
filterStrategy: 'sweeping',
6465
flatSearchCutoff: 40000,
6566
distance: 'cosine',
6667
quantizer: undefined,
@@ -115,6 +116,7 @@ describe('Testing of the collection.config namespace', () => {
115116
dynamicEfMax: 500,
116117
dynamicEfFactor: 8,
117118
vectorCacheMaxObjects: 1000000000000,
119+
filterStrategy: 'sweeping',
118120
flatSearchCutoff: 40000,
119121
distance: 'cosine',
120122
quantizer: undefined,
@@ -486,6 +488,7 @@ describe('Testing of the collection.config namespace', () => {
486488
dynamicEfMax: 500,
487489
dynamicEfFactor: 8,
488490
vectorCacheMaxObjects: 1000000000000,
491+
filterStrategy: 'sweeping',
489492
flatSearchCutoff: 40000,
490493
distance: 'cosine',
491494
quantizer: {
@@ -563,6 +566,7 @@ describe('Testing of the collection.config namespace', () => {
563566
dynamicEfMax: 500,
564567
dynamicEfFactor: 8,
565568
vectorCacheMaxObjects: 1000000000000,
569+
filterStrategy: 'sweeping',
566570
flatSearchCutoff: 40000,
567571
distance: 'cosine',
568572
type: 'hnsw',

src/collections/config/types/generative.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ export type GenerativeAzureOpenAIConfig = GenerativeOpenAIConfigBase & {
7979
deploymentId: string;
8080
};
8181

82-
export type GenerativePaLMConfig = {
82+
/** @deprecated Use `GenerativeGoogleConfig` instead. */
83+
export type GenerativePaLMConfig = GenerativeGoogleConfig;
84+
85+
export type GenerativeGoogleConfig = {
8386
apiEndpoint?: string;
8487
maxOutputTokens?: number;
8588
modelId?: string;
@@ -95,6 +98,9 @@ export type GenerativeConfig =
9598
| GenerativeAWSConfig
9699
| GenerativeAzureOpenAIConfig
97100
| GenerativeCohereConfig
101+
| GenerativeDatabricksConfig
102+
| GenerativeGoogleConfig
103+
| GenerativeFriendliAIConfig
98104
| GenerativeMistralConfig
99105
| GenerativeOctoAIConfig
100106
| GenerativeOllamaConfig
@@ -110,11 +116,13 @@ export type GenerativeConfigType<G> = G extends 'generative-anthropic'
110116
: G extends 'generative-aws'
111117
? GenerativeAWSConfig
112118
: G extends 'generative-azure-openai'
113-
? GenerativeOpenAIConfig
114-
: G extends 'generative-cohere'
115119
? GenerativeAzureOpenAIConfig
120+
: G extends 'generative-cohere'
121+
? GenerativeCohereConfig
116122
: G extends 'generative-databricks'
117123
? GenerativeDatabricksConfig
124+
: G extends 'generative-google'
125+
? GenerativeGoogleConfig
118126
: G extends 'generative-friendliai'
119127
? GenerativeFriendliAIConfig
120128
: G extends 'generative-mistral'
@@ -124,23 +132,29 @@ export type GenerativeConfigType<G> = G extends 'generative-anthropic'
124132
: G extends 'generative-ollama'
125133
? GenerativeOllamaConfig
126134
: G extends 'generative-openai'
135+
? GenerativeOpenAIConfig
136+
: G extends GenerativePalm
127137
? GenerativePaLMConfig
128138
: G extends 'none'
129139
? undefined
130140
: Record<string, any> | undefined;
131141

142+
/** @deprecated Use `generative-google` instead. */
143+
type GenerativePalm = 'generative-palm';
144+
132145
export type GenerativeSearch =
133146
| 'generative-anthropic'
134147
| 'generative-anyscale'
135148
| 'generative-aws'
136149
| 'generative-azure-openai'
137150
| 'generative-cohere'
138151
| 'generative-databricks'
152+
| 'generative-google'
139153
| 'generative-friendliai'
140154
| 'generative-mistral'
141155
| 'generative-octoai'
142156
| 'generative-ollama'
143157
| 'generative-openai'
144-
| 'generative-palm'
158+
| GenerativePalm
145159
| 'none'
146160
| string;

src/collections/config/types/vectorIndex.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export type VectorIndexConfigHNSW = {
66
dynamicEfFactor: number;
77
efConstruction: number;
88
ef: number;
9+
filterStrategy: VectorIndexFilterStrategy;
910
flatSearchCutoff: number;
1011
maxConnections: number;
1112
quantizer: PQConfig | BQConfig | SQConfig | undefined;
@@ -72,6 +73,8 @@ export type PQEncoderDistribution = 'log-normal' | 'normal';
7273

7374
export type VectorIndexType = 'hnsw' | 'flat' | 'dynamic' | string;
7475

76+
export type VectorIndexFilterStrategy = 'sweeping' | 'acorn';
77+
7578
export type VectorIndexConfig = VectorIndexConfigHNSW | VectorIndexConfigFlat | VectorIndexConfigDynamic;
7679

7780
export type QuantizerConfig = PQConfig | BQConfig | SQConfig;

src/collections/config/types/vectorizer.ts

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,18 @@ export type VectorConfig = Record<
1111
}
1212
>;
1313

14+
/** @deprecated Use `multi2vec-google` instead. */
15+
type Multi2VecPalmVectorizer = 'multi2vec-palm';
16+
17+
/** @deprecated Use `text2vec-google` instead. */
18+
type Text2VecPalmVectorizer = 'text2vec-palm';
19+
1420
export type Vectorizer =
1521
| 'img2vec-neural'
1622
| 'multi2vec-clip'
1723
| 'multi2vec-bind'
18-
| 'multi2vec-palm'
24+
| Multi2VecPalmVectorizer
25+
| 'multi2vec-google'
1926
| 'ref2vec-centroid'
2027
| 'text2vec-aws'
2128
| 'text2vec-azure-openai'
@@ -29,7 +36,8 @@ export type Vectorizer =
2936
| 'text2vec-octoai'
3037
| 'text2vec-ollama'
3138
| 'text2vec-openai'
32-
| 'text2vec-palm'
39+
| Text2VecPalmVectorizer
40+
| 'text2vec-google'
3341
| 'text2vec-transformers'
3442
| 'text2vec-voyageai'
3543
| 'none';
@@ -113,12 +121,15 @@ export type Multi2VecBindConfig = {
113121
};
114122
};
115123

116-
/** The configuration for multi-media vectorization using the PaLM model.
124+
/** @deprecated Use `Multi2VecGoogleConfig` instead. */
125+
export type Multi2VecPalmConfig = Multi2VecGoogleConfig;
126+
127+
/** The configuration for multi-media vectorization using the Google module.
117128
*
118129
* See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings) for detailed usage.
119130
*/
120-
export type Multi2VecPalmConfig = {
121-
/** The project ID of the Palm model. */
131+
export type Multi2VecGoogleConfig = {
132+
/** The project ID of the model in GCP. */
122133
projectId: string;
123134
/** The location where the model runs. */
124135
location: string;
@@ -327,12 +338,15 @@ export type Text2VecOpenAIConfig = {
327338
vectorizeCollectionName?: boolean;
328339
};
329340

341+
/** @deprecated Use `Text2VecGoogleConfig` instead. */
342+
export type Text2VecPalmConfig = Text2VecGoogleConfig;
343+
330344
/**
331-
* The configuration for text vectorization using the PaLM module.
345+
* The configuration for text vectorization using the Google module.
332346
*
333347
* See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings) for detailed usage.
334348
*/
335-
export type Text2VecPalmConfig = {
349+
export type Text2VecGoogleConfig = {
336350
/** The API endpoint to use without a leading scheme such as `http://`. */
337351
apiEndpoint?: string;
338352
/** The model ID to use. */
@@ -385,13 +399,15 @@ export type VectorizerConfig =
385399
| Img2VecNeuralConfig
386400
| Multi2VecClipConfig
387401
| Multi2VecBindConfig
402+
| Multi2VecGoogleConfig
388403
| Multi2VecPalmConfig
389404
| Ref2VecCentroidConfig
390405
| Text2VecAWSConfig
391406
| Text2VecAzureOpenAIConfig
392407
| Text2VecContextionaryConfig
393408
| Text2VecCohereConfig
394409
| Text2VecDatabricksConfig
410+
| Text2VecGoogleConfig
395411
| Text2VecGPT4AllConfig
396412
| Text2VecHuggingFaceConfig
397413
| Text2VecJinaConfig
@@ -407,7 +423,9 @@ export type VectorizerConfigType<V> = V extends 'img2vec-neural'
407423
? Multi2VecClipConfig | undefined
408424
: V extends 'multi2vec-bind'
409425
? Multi2VecBindConfig | undefined
410-
: V extends 'multi2vec-palm'
426+
: V extends 'multi2vec-google'
427+
? Multi2VecGoogleConfig
428+
: V extends Multi2VecPalmVectorizer
411429
? Multi2VecPalmConfig
412430
: V extends 'ref2vec-centroid'
413431
? Ref2VecCentroidConfig
@@ -419,6 +437,8 @@ export type VectorizerConfigType<V> = V extends 'img2vec-neural'
419437
? Text2VecCohereConfig | undefined
420438
: V extends 'text2vec-databricks'
421439
? Text2VecDatabricksConfig
440+
: V extends 'text2vec-google'
441+
? Text2VecGoogleConfig | undefined
422442
: V extends 'text2vec-gpt4all'
423443
? Text2VecGPT4AllConfig | undefined
424444
: V extends 'text2vec-huggingface'
@@ -435,7 +455,7 @@ export type VectorizerConfigType<V> = V extends 'img2vec-neural'
435455
? Text2VecOpenAIConfig | undefined
436456
: V extends 'text2vec-azure-openai'
437457
? Text2VecAzureOpenAIConfig
438-
: V extends 'text2vec-palm'
458+
: V extends Text2VecPalmVectorizer
439459
? Text2VecPalmConfig | undefined
440460
: V extends 'text2vec-transformers'
441461
? Text2VecTransformersConfig | undefined

src/collections/config/utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import {
4545
VectorIndexConfigFlat,
4646
VectorIndexConfigHNSW,
4747
VectorIndexConfigType,
48+
VectorIndexFilterStrategy,
4849
VectorizerConfig,
4950
} from './types/index.js';
5051

@@ -376,6 +377,7 @@ class ConfigMapping {
376377
dynamicEfFactor: v.dynamicEfFactor,
377378
ef: v.ef,
378379
efConstruction: v.efConstruction,
380+
filterStrategy: exists<VectorIndexFilterStrategy>(v.filterStrategy) ? v.filterStrategy : 'sweeping',
379381
flatSearchCutoff: v.flatSearchCutoff,
380382
maxConnections: v.maxConnections,
381383
quantizer: quantizer,

src/collections/configure/generative.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
GenerativeCohereConfig,
77
GenerativeDatabricksConfig,
88
GenerativeFriendliAIConfig,
9+
GenerativeGoogleConfig,
910
GenerativeMistralConfig,
1011
GenerativeOctoAIConfig,
1112
GenerativeOllamaConfig,
@@ -235,13 +236,31 @@ export default {
235236
*
236237
* @param {GenerativePaLMConfigCreate} [config] The configuration for the `generative-palm` module.
237238
* @returns {ModuleConfig<'generative-palm', GenerativePaLMConfig>} The configuration object.
239+
* @deprecated Use `google` instead.
238240
*/
239241
palm: (
240242
config?: GenerativePaLMConfigCreate
241243
): ModuleConfig<'generative-palm', GenerativePaLMConfig | undefined> => {
244+
console.warn('The `generative-palm` module is deprecated. Use `generative-google` instead.');
242245
return {
243246
name: 'generative-palm',
244247
config,
245248
};
246249
},
250+
/**
251+
* Create a `ModuleConfig<'generative-google', GenerativeGoogleConfig>` object for use when performing AI generation using the `generative-google` module.
252+
*
253+
* See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/generative) for detailed usage.
254+
*
255+
* @param {GenerativePaLMConfigCreate} [config] The configuration for the `generative-palm` module.
256+
* @returns {ModuleConfig<'generative-palm', GenerativePaLMConfig>} The configuration object.
257+
*/
258+
google: (
259+
config?: GenerativePaLMConfigCreate
260+
): ModuleConfig<'generative-google', GenerativeGoogleConfig | undefined> => {
261+
return {
262+
name: 'generative-google',
263+
config,
264+
};
265+
},
247266
};

src/collections/configure/types/vectorIndex.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
VectorIndexConfigDynamic,
1010
VectorIndexConfigFlat,
1111
VectorIndexConfigHNSW,
12+
VectorIndexFilterStrategy,
1213
} from '../../config/types/index.js';
1314
import { RecursivePartial } from './base.js';
1415

@@ -56,6 +57,7 @@ export type VectorIndexConfigHNSWUpdate = {
5657
dynamicEfMax?: number;
5758
dynamicEfFactor?: number;
5859
ef?: number;
60+
filterStrategy?: VectorIndexFilterStrategy;
5961
flatSearchCutoff?: number;
6062
quantizer?: PQConfigUpdate | BQConfigUpdate | SQConfigUpdate;
6163
vectorCacheMaxObjects?: number;

src/collections/configure/types/vectorizer.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import {
99
Text2VecContextionaryConfig,
1010
Text2VecDatabricksConfig,
1111
Text2VecGPT4AllConfig,
12+
Text2VecGoogleConfig,
1213
Text2VecHuggingFaceConfig,
1314
Text2VecJinaConfig,
1415
Text2VecMistralConfig,
1516
Text2VecOctoAIConfig,
1617
Text2VecOllamaConfig,
1718
Text2VecOpenAIConfig,
18-
Text2VecPalmConfig,
1919
Text2VecTransformersConfig,
2020
Text2VecVoyageAIConfig,
2121
VectorIndexType,
@@ -111,9 +111,12 @@ export type Multi2VecBindConfigCreate = {
111111
vectorizeCollectionName?: boolean;
112112
};
113113

114-
/** The configuration for the `multi2vec-palm` vectorizer. */
115-
export type Multi2VecPalmConfigCreate = {
116-
/** The project id of the palm model. */
114+
/** @deprecated Use `Multi2VecGoogleConfigCreate` instead.*/
115+
export type Multi2VecPalmConfigCreate = Multi2VecGoogleConfigCreate;
116+
117+
/** The configuration for the `multi2vec-google` vectorizer. */
118+
export type Multi2VecGoogleConfigCreate = {
119+
/** The project id of the model in GCP. */
117120
projectId: string;
118121
/** Where the model runs */
119122
location: string;
@@ -157,7 +160,10 @@ export type Text2VecOllamaConfigCreate = Text2VecOllamaConfig;
157160

158161
export type Text2VecOpenAIConfigCreate = Text2VecOpenAIConfig;
159162

160-
export type Text2VecPalmConfigCreate = Text2VecPalmConfig;
163+
/** @deprecated Use `Text2VecGoogleConfigCreate` instead. */
164+
export type Text2VecPalmConfigCreate = Text2VecGoogleConfig;
165+
166+
export type Text2VecGoogleConfigCreate = Text2VecGoogleConfig;
161167

162168
export type Text2VecTransformersConfigCreate = Text2VecTransformersConfig;
163169

@@ -171,6 +177,8 @@ export type VectorizerConfigCreateType<V> = V extends 'img2vec-neural'
171177
? Multi2VecBindConfigCreate | undefined
172178
: V extends 'multi2vec-palm'
173179
? Multi2VecPalmConfigCreate
180+
: V extends 'multi2vec-google'
181+
? Multi2VecGoogleConfigCreate
174182
: V extends 'ref2vec-centroid'
175183
? Ref2VecCentroidConfigCreate
176184
: V extends 'text2vec-aws'
@@ -199,6 +207,8 @@ export type VectorizerConfigCreateType<V> = V extends 'img2vec-neural'
199207
? Text2VecAzureOpenAIConfigCreate
200208
: V extends 'text2vec-palm'
201209
? Text2VecPalmConfigCreate | undefined
210+
: V extends 'text2vec-google'
211+
? Text2VecGoogleConfigCreate | undefined
202212
: V extends 'text2vec-transformers'
203213
? Text2VecTransformersConfigCreate | undefined
204214
: V extends 'text2vec-voyageai'

0 commit comments

Comments
 (0)