Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/collections/config/types/vectorizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,15 +295,17 @@ export type Multi2VecJinaAIConfig = {

/** The configuration for multi-media vectorization using the VoyageAI module.
*
* See the [documentation](https://weaviate.io/developers/weaviate/model-providers/transformers/embeddings-multimodal) for detailed usage.
* See the [documentation](https://weaviate.io/developers/weaviate/model-providers/voyageai/embeddings-multimodal) for detailed usage.
*/
export type Multi2VecVoyageAIConfig = {
/** The base URL to use where API requests should go. */
baseURL?: string;
/** The dimensionality of the vector once embedded. Supported values: 256, 512, 1024 (default), 2048. */
dimensions?: number;
/** The image fields used when vectorizing. */
imageFields?: string[];
/** The model to use. */
model?: string;
model?: 'voyage-multimodal-3' | 'voyage-multimodal-3.5' | string;
/** How the output from the model should be encoded on return. */
outputEncoding?: string;
/** The text fields used when vectorizing. */
Expand All @@ -312,12 +314,16 @@ export type Multi2VecVoyageAIConfig = {
truncate?: boolean;
/** Whether the collection name is vectorized. */
vectorizeCollectionName?: boolean;
/** The video fields used when vectorizing. */
videoFields?: string[];
/** The weights of the fields used for vectorization. */
weights?: {
/** The weights of the image fields. */
imageFields?: number[];
/** The weights of the text fields. */
textFields?: number[];
/** The weights of the video fields. */
videoFields?: number[];
};
};

Expand Down
2 changes: 2 additions & 0 deletions src/collections/configure/types/vectorizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ export type Multi2VecVoyageAIConfigCreate = Omit<Multi2VecVoyageAIConfig, Multi2
imageFields?: string[] | Multi2VecField[];
/** The text fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */
textFields?: string[] | Multi2VecField[];
/** The video fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */
videoFields?: string[] | Multi2VecField[];
};

export type Ref2VecCentroidConfigCreate = Ref2VecCentroidConfig;
Expand Down
28 changes: 28 additions & 0 deletions src/collections/configure/unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,34 @@ describe('Unit testing of the vectorizer factory class', () => {
});
});

it('should create the correct Multi2VecVoyageAIConfig type with voyage-multimodal-3.5 model', () => {
const config = configure.vectors.multi2VecVoyageAI({
name: 'test',
model: 'voyage-multimodal-3.5',
dimensions: 1024,
imageFields: ['image'],
textFields: ['text'],
videoFields: ['video'],
});
expect(config).toEqual<VectorConfigCreate<never, 'test', 'hnsw', 'multi2vec-voyageai'>>({
name: 'test',
vectorIndex: {
name: 'hnsw',
config: undefined,
},
vectorizer: {
name: 'multi2vec-voyageai',
config: {
model: 'voyage-multimodal-3.5',
dimensions: 1024,
imageFields: ['image'],
textFields: ['text'],
videoFields: ['video'],
},
},
});
});

it('should create the correct Text2VecAWSConfig type with defaults', () => {
const config = configure.vectors.text2VecAWS({
region: 'region',
Expand Down
3 changes: 3 additions & 0 deletions src/collections/configure/vectorizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,11 @@ const legacyVectors = {
const { name, quantizer, vectorIndexConfig, ...config } = opts || {};
const imageFields = config.imageFields?.map(mapMulti2VecField);
const textFields = config.textFields?.map(mapMulti2VecField);
const videoFields = config.videoFields?.map(mapMulti2VecField);
let weights: Multi2VecVoyageAIConfig['weights'] = {};
weights = formatMulti2VecFields(weights, 'imageFields', imageFields);
weights = formatMulti2VecFields(weights, 'textFields', textFields);
weights = formatMulti2VecFields(weights, 'videoFields', videoFields);
return makeVectorizer(name, {
quantizer,
vectorIndexConfig,
Expand All @@ -415,6 +417,7 @@ const legacyVectors = {
...config,
imageFields: imageFields?.map((f) => f.name),
textFields: textFields?.map((f) => f.name),
videoFields: videoFields?.map((f) => f.name),
weights: Object.keys(weights).length === 0 ? undefined : weights,
},
},
Expand Down
Loading