Skip to content

Commit f940647

Browse files
fzowldatabyjp
authored andcommitted
Adding VoyageAI's voyage-multimodal-3.5
1 parent bb5a496 commit f940647

4 files changed

Lines changed: 81 additions & 7 deletions

File tree

test/collection/test_config.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,61 @@ def test_basic_config():
127127
}
128128
},
129129
),
130+
(
131+
Configure.Vectorizer.multi2vec_voyageai(
132+
model="voyage-multimodal-3.5",
133+
truncation=True,
134+
output_encoding="base64",
135+
vectorize_collection_name=True,
136+
base_url="https://api.voyageai.com",
137+
),
138+
{
139+
"multi2vec-voyageai": {
140+
"model": "voyage-multimodal-3.5",
141+
"truncation": True,
142+
"baseURL": "https://api.voyageai.com/",
143+
}
144+
},
145+
),
146+
(
147+
Configure.Vectorizer.multi2vec_voyageai(
148+
model="voyage-multimodal-3.5",
149+
truncation=True,
150+
text_fields=[Multi2VecField(name="text", weight=0.2)],
151+
image_fields=[Multi2VecField(name="image", weight=0.3)],
152+
video_fields=[Multi2VecField(name="video", weight=0.5)],
153+
),
154+
{
155+
"multi2vec-voyageai": {
156+
"model": "voyage-multimodal-3.5",
157+
"truncation": True,
158+
"textFields": ["text"],
159+
"imageFields": ["image"],
160+
"videoFields": ["video"],
161+
"weights": {
162+
"textFields": [0.2],
163+
"imageFields": [0.3],
164+
"videoFields": [0.5],
165+
},
166+
}
167+
},
168+
),
169+
(
170+
Configure.Vectorizer.multi2vec_voyageai(
171+
model="voyage-multimodal-3.5",
172+
dimensions=512,
173+
text_fields=["text"],
174+
video_fields=["video"],
175+
),
176+
{
177+
"multi2vec-voyageai": {
178+
"model": "voyage-multimodal-3.5",
179+
"dimensions": 512,
180+
"textFields": ["text"],
181+
"videoFields": ["video"],
182+
}
183+
},
184+
),
130185
(
131186
Configure.Vectorizer.multi2vec_nvidia(
132187
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: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,8 @@ class _Multi2VecVoyageaiConfig(_Multi2VecBase):
569569
baseURL: Optional[AnyHttpUrl]
570570
model: Optional[str]
571571
truncation: Optional[bool]
572+
dimensions: Optional[int]
573+
videoFields: Optional[List[Multi2VecField]]
572574

573575
def _to_dict(self) -> Dict[str, Any]:
574576
ret_dict = super()._to_dict()
@@ -900,37 +902,43 @@ def multi2vec_cohere(
900902
@staticmethod
901903
def multi2vec_voyageai(
902904
*,
903-
model: Optional[Union[CohereMultimodalModel, str]] = None,
905+
model: Optional[Union[VoyageMultimodalModel, str]] = None,
904906
truncation: Optional[bool] = None,
905-
output_encoding: Optional[str],
907+
dimensions: Optional[int] = None,
908+
output_encoding: Optional[str] = None,
906909
vectorize_collection_name: bool = True,
907910
base_url: Optional[AnyHttpUrl] = None,
908911
image_fields: Optional[Union[List[str], List[Multi2VecField]]] = None,
909912
text_fields: Optional[Union[List[str], List[Multi2VecField]]] = None,
913+
video_fields: Optional[Union[List[str], List[Multi2VecField]]] = None,
910914
) -> _VectorizerConfigCreate:
911-
"""Create a `_Multi2VecCohereConfig` object for use when vectorizing using the `multi2vec-cohere` model.
915+
"""Create a `_Multi2VecVoyageaiConfig` object for use when vectorizing using the `multi2vec-voyageai` model.
912916
913-
See the [documentation](https://weaviate.io/developers/weaviate/model-providers/cohere/embeddings-multimodal)
917+
See the [documentation](https://weaviate.io/developers/weaviate/model-providers/voyageai/embeddings-multimodal)
914918
for detailed usage.
915919
916920
Args:
917921
model: The model to use. Defaults to `None`, which uses the server-defined default.
918-
truncate: The truncation strategy to use. Defaults to `None`, which uses the server-defined default.
922+
truncation: The truncation strategy to use. Defaults to `None`, which uses the server-defined default.
923+
dimensions: The number of dimensions for the output embeddings. Defaults to `None`, which uses the model's default (1024 for voyage-multimodal-3.5).
919924
output_encoding: Deprecated, has no effect.
920925
vectorize_collection_name: Deprecated, has no effect.
921926
base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default.
922927
image_fields: The image fields to use in vectorization.
923928
text_fields: The text fields to use in vectorization.
929+
video_fields: The video fields to use in vectorization.
924930
925931
Raises:
926-
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.
932+
pydantic.ValidationError: If `model` is not a valid value from the `VoyageMultimodalModel` type.
927933
"""
928934
return _Multi2VecVoyageaiConfig(
929935
baseURL=base_url,
930936
model=model,
931937
truncation=truncation,
938+
dimensions=dimensions,
932939
imageFields=_map_multi2vec_fields(image_fields),
933940
textFields=_map_multi2vec_fields(text_fields),
941+
videoFields=_map_multi2vec_fields(video_fields),
934942
)
935943

936944
@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)