|
40 | 40 | _Img2VecNeuralConfig, |
41 | 41 | _map_multi2vec_fields, |
42 | 42 | _Multi2MultiVecJinaConfig, |
| 43 | + _Multi2MultiVecWeaviateConfig, |
43 | 44 | _Multi2VecAWSConfig, |
44 | 45 | _Multi2VecBindConfig, |
45 | 46 | _Multi2VecClipConfig, |
@@ -287,6 +288,47 @@ def multi2vec_jinaai( |
287 | 288 | ), |
288 | 289 | ) |
289 | 290 |
|
| 291 | + @staticmethod |
| 292 | + def multi2vec_weaviate( |
| 293 | + *, |
| 294 | + name: Optional[str] = None, |
| 295 | + encoding: Optional[_MultiVectorEncodingConfigCreate] = None, |
| 296 | + quantizer: Optional[_QuantizerConfigCreate] = None, |
| 297 | + base_url: Optional[AnyHttpUrl] = None, |
| 298 | + image_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, |
| 299 | + model: Optional[Union[JinaMultimodalModel, str]] = None, |
| 300 | + multi_vector_config: Optional[_MultiVectorConfigCreate] = None, |
| 301 | + vector_index_config: Optional[_VectorIndexConfigCreate] = None, |
| 302 | + ) -> _VectorConfigCreate: |
| 303 | + """Create a vector using the `multi2multivec-weaviate` module. |
| 304 | +
|
| 305 | + See the [documentation](TODO) |
| 306 | + for detailed usage. |
| 307 | +
|
| 308 | + Args: |
| 309 | + name: The name of the vector. |
| 310 | + encoding: The type of multi-vector encoding to use in the vector index. Defaults to `None`, which uses the server-defined default. |
| 311 | + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. |
| 312 | + base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. |
| 313 | + image_fields: The image fields to use in vectorization. |
| 314 | + model: The model to use. Defaults to `None`, which uses the server-defined default. |
| 315 | + multi_vector_config: The configuration for the multi-vector index. Use `wvc.config.Configure.VectorIndex.MultiVector` to create a multi-vector configuration. None by default |
| 316 | + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default |
| 317 | + """ |
| 318 | + return _VectorConfigCreate( |
| 319 | + name=name, |
| 320 | + vectorizer=_Multi2MultiVecWeaviateConfig( |
| 321 | + baseURL=base_url, |
| 322 | + model=model, |
| 323 | + imageFields=_map_multi2vec_fields(image_fields), |
| 324 | + # TODO: figure out how to workaround not supporting text fields |
| 325 | + textFields=_map_multi2vec_fields(None), |
| 326 | + ), |
| 327 | + vector_index_config=_IndexWrappers.multi( |
| 328 | + vector_index_config, quantizer, multi_vector_config, encoding |
| 329 | + ), |
| 330 | + ) |
| 331 | + |
290 | 332 |
|
291 | 333 | class _Vectors: |
292 | 334 | @staticmethod |
|
0 commit comments