Skip to content

Commit 3fc8075

Browse files
authored
Merge pull request #1919 from weaviate/feat/recreate-embedding-model-voyage-multimodal-3.5
Recreate #1915 (feat: voyage-multimodal-3.5 (video!))
2 parents 4c33d9a + b783e08 commit 3fc8075

4 files changed

Lines changed: 98 additions & 7 deletions

File tree

test/collection/test_config.py

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2426,6 +2426,83 @@ def test_config_with_named_vectors(
24262426
}
24272427
},
24282428
),
2429+
(
2430+
[
2431+
Configure.Vectors.multi2vec_voyageai(
2432+
name="test",
2433+
model="voyage-multimodal-3.5",
2434+
truncation=True,
2435+
base_url="https://api.voyageai.com",
2436+
),
2437+
],
2438+
{
2439+
"test": {
2440+
"vectorizer": {
2441+
"multi2vec-voyageai": {
2442+
"model": "voyage-multimodal-3.5",
2443+
"truncation": True,
2444+
"baseURL": "https://api.voyageai.com/",
2445+
}
2446+
},
2447+
"vectorIndexType": "hnsw",
2448+
}
2449+
},
2450+
),
2451+
(
2452+
[
2453+
Configure.Vectors.multi2vec_voyageai(
2454+
name="test",
2455+
model="voyage-multimodal-3.5",
2456+
truncation=True,
2457+
text_fields=[Multi2VecField(name="text", weight=0.2)],
2458+
image_fields=[Multi2VecField(name="image", weight=0.3)],
2459+
video_fields=[Multi2VecField(name="video", weight=0.5)],
2460+
)
2461+
],
2462+
{
2463+
"test": {
2464+
"vectorizer": {
2465+
"multi2vec-voyageai": {
2466+
"model": "voyage-multimodal-3.5",
2467+
"truncation": True,
2468+
"textFields": ["text"],
2469+
"imageFields": ["image"],
2470+
"videoFields": ["video"],
2471+
"weights": {
2472+
"textFields": [0.2],
2473+
"imageFields": [0.3],
2474+
"videoFields": [0.5],
2475+
},
2476+
}
2477+
},
2478+
"vectorIndexType": "hnsw",
2479+
},
2480+
},
2481+
),
2482+
(
2483+
[
2484+
Configure.Vectors.multi2vec_voyageai(
2485+
name="test",
2486+
model="voyage-multimodal-3.5",
2487+
dimensions=512,
2488+
text_fields=["text"],
2489+
video_fields=["video"],
2490+
)
2491+
],
2492+
{
2493+
"test": {
2494+
"vectorizer": {
2495+
"multi2vec-voyageai": {
2496+
"model": "voyage-multimodal-3.5",
2497+
"dimensions": 512,
2498+
"textFields": ["text"],
2499+
"videoFields": ["video"],
2500+
}
2501+
},
2502+
"vectorIndexType": "hnsw",
2503+
}
2504+
},
2505+
),
24292506
(
24302507
[
24312508
Configure.Vectors.multi2vec_clip(

weaviate/collections/classes/config_named_vectors.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,8 +730,10 @@ def multi2vec_voyageai(
730730
baseURL=base_url,
731731
model=model,
732732
truncation=truncation,
733+
dimensions=None,
733734
imageFields=_map_multi2vec_fields(image_fields),
734735
textFields=_map_multi2vec_fields(text_fields),
736+
videoFields=None,
735737
),
736738
vector_index_config=vector_index_config,
737739
)

weaviate/collections/classes/config_vectorizers.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@
6262
"voyage-finance-2",
6363
"voyage-multilingual-2",
6464
]
65-
VoyageMultimodalModel: TypeAlias = Literal["voyage-multimodal-3",]
65+
VoyageMultimodalModel: TypeAlias = Literal[
66+
"voyage-multimodal-3",
67+
"voyage-multimodal-3.5",
68+
]
6669
AWSModel: TypeAlias = Literal[
6770
"amazon.titan-embed-text-v1",
6871
"cohere.embed-english-v3",
@@ -566,6 +569,8 @@ class _Multi2VecVoyageaiConfig(_Multi2VecBase):
566569
baseURL: Optional[AnyHttpUrl]
567570
model: Optional[str]
568571
truncation: Optional[bool]
572+
dimensions: Optional[int]
573+
videoFields: Optional[List[Multi2VecField]]
569574

570575
def _to_dict(self) -> Dict[str, Any]:
571576
ret_dict = super()._to_dict()
@@ -897,37 +902,39 @@ def multi2vec_cohere(
897902
@staticmethod
898903
def multi2vec_voyageai(
899904
*,
900-
model: Optional[Union[CohereMultimodalModel, str]] = None,
905+
model: Optional[Union[VoyageMultimodalModel, str]] = None,
901906
truncation: Optional[bool] = None,
902907
output_encoding: Optional[str],
903908
vectorize_collection_name: bool = True,
904909
base_url: Optional[AnyHttpUrl] = None,
905910
image_fields: Optional[Union[List[str], List[Multi2VecField]]] = None,
906911
text_fields: Optional[Union[List[str], List[Multi2VecField]]] = None,
907912
) -> _VectorizerConfigCreate:
908-
"""Create a `_Multi2VecCohereConfig` object for use when vectorizing using the `multi2vec-cohere` model.
913+
"""Create a `_Multi2VecVoyageaiConfig` object for use when vectorizing using the `multi2vec-voyageai` model.
909914
910-
See the [documentation](https://weaviate.io/developers/weaviate/model-providers/cohere/embeddings-multimodal)
915+
See the [documentation](https://weaviate.io/developers/weaviate/model-providers/voyageai/embeddings-multimodal)
911916
for detailed usage.
912917
913918
Args:
914919
model: The model to use. Defaults to `None`, which uses the server-defined default.
915-
truncate: The truncation strategy to use. Defaults to `None`, which uses the server-defined default.
920+
truncation: The truncation strategy to use. Defaults to `None`, which uses the server-defined default.
916921
output_encoding: Deprecated, has no effect.
917922
vectorize_collection_name: Deprecated, has no effect.
918923
base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default.
919924
image_fields: The image fields to use in vectorization.
920925
text_fields: The text fields to use in vectorization.
921926
922927
Raises:
923-
pydantic.ValidationError: If `model` is not a valid value from the `CohereMultimodalModel` type or if `truncate` is not a valid value from the `CohereTruncation` type.
928+
pydantic.ValidationError: If `model` is not a valid value from the `VoyageMultimodalModel` type.
924929
"""
925930
return _Multi2VecVoyageaiConfig(
926931
baseURL=base_url,
927932
model=model,
928933
truncation=truncation,
934+
dimensions=None,
929935
imageFields=_map_multi2vec_fields(image_fields),
930936
textFields=_map_multi2vec_fields(text_fields),
937+
videoFields=None,
931938
)
932939

933940
@staticmethod

weaviate/collections/classes/config_vectors.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,8 @@ def multi2vec_voyageai(
11141114
image_fields: Optional[Union[List[str], List[Multi2VecField]]] = None,
11151115
model: Optional[Union[VoyageMultimodalModel, str]] = None,
11161116
text_fields: Optional[Union[List[str], List[Multi2VecField]]] = None,
1117+
video_fields: Optional[Union[List[str], List[Multi2VecField]]] = None,
1118+
dimensions: Optional[int] = None,
11171119
truncation: Optional[bool] = None,
11181120
vector_index_config: Optional[_VectorIndexConfigCreate] = None,
11191121
) -> _VectorConfigCreate:
@@ -1128,8 +1130,9 @@ def multi2vec_voyageai(
11281130
base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default.
11291131
image_fields: The image fields to use in vectorization.
11301132
model: The model to use. Defaults to `None`, which uses the server-defined default.
1131-
output_encoding: The output encoding to use. Defaults to `None`, which uses the server-defined default.
11321133
text_fields: The text fields to use in vectorization.
1134+
video_fields: The video fields to use in vectorization.
1135+
dimensions: The number of dimensions for the output embeddings. Defaults to `None`, which uses the model's default.
11331136
truncation: The truncation strategy to use. Defaults to `None`, which uses the server-defined default.
11341137
vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default
11351138
@@ -1142,8 +1145,10 @@ def multi2vec_voyageai(
11421145
baseURL=base_url,
11431146
model=model,
11441147
truncation=truncation,
1148+
dimensions=dimensions,
11451149
imageFields=_map_multi2vec_fields(image_fields),
11461150
textFields=_map_multi2vec_fields(text_fields),
1151+
videoFields=_map_multi2vec_fields(video_fields),
11471152
),
11481153
vector_index_config=_IndexWrappers.single(vector_index_config, quantizer),
11491154
)

0 commit comments

Comments
 (0)