Skip to content

Commit 82eefa8

Browse files
authored
Merge pull request #1915 from voyage-ai/feat/embedding-model-voyage-multimodal-3.5
feat: voyage-multimodal-3.5 (video!)
2 parents aeaf1f5 + eefff6d commit 82eefa8

File tree

4 files changed

+85
-8
lines changed

4 files changed

+85
-8
lines changed

test/collection/test_config.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,61 @@ def test_basic_config():
128128
}
129129
},
130130
),
131+
(
132+
Configure.Vectorizer.multi2vec_voyageai(
133+
model="voyage-multimodal-3.5",
134+
truncation=True,
135+
output_encoding="base64",
136+
vectorize_collection_name=True,
137+
base_url="https://api.voyageai.com",
138+
),
139+
{
140+
"multi2vec-voyageai": {
141+
"model": "voyage-multimodal-3.5",
142+
"truncation": True,
143+
"baseURL": "https://api.voyageai.com/",
144+
}
145+
},
146+
),
147+
(
148+
Configure.Vectorizer.multi2vec_voyageai(
149+
model="voyage-multimodal-3.5",
150+
truncation=True,
151+
text_fields=[Multi2VecField(name="text", weight=0.2)],
152+
image_fields=[Multi2VecField(name="image", weight=0.3)],
153+
video_fields=[Multi2VecField(name="video", weight=0.5)],
154+
),
155+
{
156+
"multi2vec-voyageai": {
157+
"model": "voyage-multimodal-3.5",
158+
"truncation": True,
159+
"textFields": ["text"],
160+
"imageFields": ["image"],
161+
"videoFields": ["video"],
162+
"weights": {
163+
"textFields": [0.2],
164+
"imageFields": [0.3],
165+
"videoFields": [0.5],
166+
},
167+
}
168+
},
169+
),
170+
(
171+
Configure.Vectorizer.multi2vec_voyageai(
172+
model="voyage-multimodal-3.5",
173+
dimensions=512,
174+
text_fields=["text"],
175+
video_fields=["video"],
176+
),
177+
{
178+
"multi2vec-voyageai": {
179+
"model": "voyage-multimodal-3.5",
180+
"dimensions": 512,
181+
"textFields": ["text"],
182+
"videoFields": ["video"],
183+
}
184+
},
185+
),
131186
(
132187
Configure.Vectorizer.multi2vec_nvidia(
133188
model="nvidia/nvclip",

weaviate/collections/classes/config_named_vectors.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,9 +700,11 @@ def multi2vec_voyageai(
700700
base_url: Optional[AnyHttpUrl] = None,
701701
model: Optional[Union[VoyageMultimodalModel, str]] = None,
702702
truncation: Optional[bool] = None,
703+
dimensions: Optional[int] = None,
703704
output_encoding: Optional[str] = None,
704705
image_fields: Optional[Union[List[str], List[Multi2VecField]]] = None,
705706
text_fields: Optional[Union[List[str], List[Multi2VecField]]] = None,
707+
video_fields: Optional[Union[List[str], List[Multi2VecField]]] = None,
706708
vector_index_config: Optional[_VectorIndexConfigCreate] = None,
707709
vectorize_collection_name: bool = True,
708710
) -> _NamedVectorConfigCreate:
@@ -717,9 +719,11 @@ def multi2vec_voyageai(
717719
vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`.
718720
model: The model to use. Defaults to `None`, which uses the server-defined default.
719721
truncation: The truncation strategy to use. Defaults to `None`, which uses the server-defined default.
722+
dimensions: The number of dimensions for the output embeddings. Defaults to `None`, which uses the model's default.
720723
base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default.
721724
image_fields: The image fields to use in vectorization.
722725
text_fields: The text fields to use in vectorization.
726+
video_fields: The video fields to use in vectorization.
723727
724728
Raises:
725729
pydantic.ValidationError: If `model` is not a valid value from the `VoyageaiMultimodalModel` type.
@@ -730,8 +734,10 @@ def multi2vec_voyageai(
730734
baseURL=base_url,
731735
model=model,
732736
truncation=truncation,
737+
dimensions=dimensions,
733738
imageFields=_map_multi2vec_fields(image_fields),
734739
textFields=_map_multi2vec_fields(text_fields),
740+
videoFields=_map_multi2vec_fields(video_fields),
735741
),
736742
vector_index_config=vector_index_config,
737743
)

weaviate/collections/classes/config_vectorizers.py

Lines changed: 18 additions & 7 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",
@@ -550,6 +553,8 @@ class _Multi2VecVoyageaiConfig(_Multi2VecBase):
550553
baseURL: Optional[AnyHttpUrl]
551554
model: Optional[str]
552555
truncation: Optional[bool]
556+
dimensions: Optional[int]
557+
videoFields: Optional[List[Multi2VecField]]
553558

554559
def _to_dict(self) -> Dict[str, Any]:
555560
ret_dict = super()._to_dict()
@@ -881,37 +886,43 @@ def multi2vec_cohere(
881886
@staticmethod
882887
def multi2vec_voyageai(
883888
*,
884-
model: Optional[Union[CohereMultimodalModel, str]] = None,
889+
model: Optional[Union[VoyageMultimodalModel, str]] = None,
885890
truncation: Optional[bool] = None,
886-
output_encoding: Optional[str],
891+
dimensions: Optional[int] = None,
892+
output_encoding: Optional[str] = None,
887893
vectorize_collection_name: bool = True,
888894
base_url: Optional[AnyHttpUrl] = None,
889895
image_fields: Optional[Union[List[str], List[Multi2VecField]]] = None,
890896
text_fields: Optional[Union[List[str], List[Multi2VecField]]] = None,
897+
video_fields: Optional[Union[List[str], List[Multi2VecField]]] = None,
891898
) -> _VectorizerConfigCreate:
892-
"""Create a `_Multi2VecCohereConfig` object for use when vectorizing using the `multi2vec-cohere` model.
899+
"""Create a `_Multi2VecVoyageaiConfig` object for use when vectorizing using the `multi2vec-voyageai` model.
893900
894-
See the [documentation](https://weaviate.io/developers/weaviate/model-providers/cohere/embeddings-multimodal)
901+
See the [documentation](https://weaviate.io/developers/weaviate/model-providers/voyageai/embeddings-multimodal)
895902
for detailed usage.
896903
897904
Args:
898905
model: The model to use. Defaults to `None`, which uses the server-defined default.
899-
truncate: The truncation strategy to use. Defaults to `None`, which uses the server-defined default.
906+
truncation: The truncation strategy to use. Defaults to `None`, which uses the server-defined default.
907+
dimensions: The number of dimensions for the output embeddings. Defaults to `None`, which uses the model's default (1024 for voyage-multimodal-3.5).
900908
output_encoding: Deprecated, has no effect.
901909
vectorize_collection_name: Deprecated, has no effect.
902910
base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default.
903911
image_fields: The image fields to use in vectorization.
904912
text_fields: The text fields to use in vectorization.
913+
video_fields: The video fields to use in vectorization.
905914
906915
Raises:
907-
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.
916+
pydantic.ValidationError: If `model` is not a valid value from the `VoyageMultimodalModel` type.
908917
"""
909918
return _Multi2VecVoyageaiConfig(
910919
baseURL=base_url,
911920
model=model,
912921
truncation=truncation,
922+
dimensions=dimensions,
913923
imageFields=_map_multi2vec_fields(image_fields),
914924
textFields=_map_multi2vec_fields(text_fields),
925+
videoFields=_map_multi2vec_fields(video_fields),
915926
)
916927

917928
@staticmethod

weaviate/collections/classes/config_vectors.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,8 @@ def multi2vec_voyageai(
10751075
image_fields: Optional[Union[List[str], List[Multi2VecField]]] = None,
10761076
model: Optional[Union[VoyageMultimodalModel, str]] = None,
10771077
text_fields: Optional[Union[List[str], List[Multi2VecField]]] = None,
1078+
video_fields: Optional[Union[List[str], List[Multi2VecField]]] = None,
1079+
dimensions: Optional[int] = None,
10781080
truncation: Optional[bool] = None,
10791081
vector_index_config: Optional[_VectorIndexConfigCreate] = None,
10801082
) -> _VectorConfigCreate:
@@ -1089,8 +1091,9 @@ def multi2vec_voyageai(
10891091
base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default.
10901092
image_fields: The image fields to use in vectorization.
10911093
model: The model to use. Defaults to `None`, which uses the server-defined default.
1092-
output_encoding: The output encoding to use. Defaults to `None`, which uses the server-defined default.
10931094
text_fields: The text fields to use in vectorization.
1095+
video_fields: The video fields to use in vectorization.
1096+
dimensions: The number of dimensions for the output embeddings. Defaults to `None`, which uses the model's default.
10941097
truncation: The truncation strategy to use. Defaults to `None`, which uses the server-defined default.
10951098
vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default
10961099
@@ -1103,8 +1106,10 @@ def multi2vec_voyageai(
11031106
baseURL=base_url,
11041107
model=model,
11051108
truncation=truncation,
1109+
dimensions=dimensions,
11061110
imageFields=_map_multi2vec_fields(image_fields),
11071111
textFields=_map_multi2vec_fields(text_fields),
1112+
videoFields=_map_multi2vec_fields(video_fields),
11081113
),
11091114
vector_index_config=_IndexWrappers.single(vector_index_config, quantizer),
11101115
)

0 commit comments

Comments
 (0)