Skip to content

Commit 3f7de11

Browse files
committed
Introducing VoyageAI's new multimodal embedding model
1 parent 2ba3f8f commit 3f7de11

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

src/collections/config/types/vectorizer.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,17 @@ export type Multi2VecGoogleConfig = {
190190
* See the [documentation](https://weaviate.io/developers/weaviate/model-providers/transformers/embeddings-multimodal) for detailed usage.
191191
*/
192192
export type Multi2VecVoyageAIConfig = {
193+
/** The image fields used when vectorizing. */
194+
imageFields?: string[];
195+
/** The text fields used when vectorizing. */
196+
textFields?: string[];
197+
/** The weights of the fields used for vectorization. */
198+
weights?: {
199+
/** The weights of the image fields. */
200+
imageFields?: number[];
201+
/** The weights of the text fields. */
202+
textFields?: number[];
203+
};
193204
};
194205

195206
/** The configuration for reference-based vectorization using the centroid method.

src/collections/configure/types/vectorizer.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ export type Multi2VecGoogleConfigCreate = {
151151
};
152152

153153
export type Multi2VecVoyageAIConfigCreate = {
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[];
156+
/** The text fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */
157+
textFields?: string[] | Multi2VecField[];
154158
};
155159

156160
export type Ref2VecCentroidConfigCreate = Ref2VecCentroidConfig;

src/collections/configure/vectorizer.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
Multi2VecClipConfig,
44
Multi2VecField,
55
Multi2VecPalmConfig,
6+
Multi2VecVoyageAIConfig,
67
VectorIndexType,
78
Vectorizer,
89
VectorizerConfigType,
@@ -275,12 +276,20 @@ export const vectorizer = {
275276
opts?: ConfigureNonTextVectorizerOptions<N, I, 'multi2vec-voyageai'>
276277
): VectorConfigCreate<never, N, I, 'multi2vec-voyageai'> => {
277278
const { name, vectorIndexConfig, ...config } = opts || {};
279+
const imageFields = config.imageFields?.map(mapMulti2VecField);
280+
const textFields = config.textFields?.map(mapMulti2VecField);
281+
let weights: Multi2VecVoyageAIConfig['weights'] = {};
282+
weights = formatMulti2VecFields(weights, 'imageFields', imageFields);
283+
weights = formatMulti2VecFields(weights, 'textFields', textFields);
278284
return makeVectorizer(name, {
279285
vectorIndexConfig,
280286
vectorizerConfig: {
281287
name: 'multi2vec-voyageai',
282288
config: {
283289
...config,
290+
imageFields: imageFields?.map((f) => f.name),
291+
textFields: textFields?.map((f) => f.name),
292+
weights: Object.keys(weights).length === 0 ? undefined : weights,
284293
},
285294
},
286295
});

0 commit comments

Comments
 (0)