|
21 | 21 | from weaviate.types import INCLUDE_VECTOR |
22 | 22 |
|
23 | 23 |
|
24 | | -def test_create_named_vectors_throws_error_in_old_version( |
25 | | - collection_factory: CollectionFactory, |
26 | | -) -> None: |
27 | | - collection = collection_factory("dummy") |
28 | | - if not collection._connection._weaviate_version.is_lower_than(1, 24, 0): |
29 | | - pytest.skip("Named vectors are supported in versions higher than 1.24.0") |
30 | | - |
31 | | - with pytest.raises(WeaviateInvalidInputError): |
32 | | - collection_factory( |
33 | | - properties=[ |
34 | | - wvc.config.Property(name="title", data_type=wvc.config.DataType.TEXT), |
35 | | - wvc.config.Property(name="content", data_type=wvc.config.DataType.TEXT), |
36 | | - ], |
37 | | - vectorizer_config=[ |
38 | | - wvc.config.Configure.NamedVectors.text2vec_contextionary( |
39 | | - "title", source_properties=["title"], vectorize_collection_name=False |
40 | | - ), |
41 | | - wvc.config.Configure.NamedVectors.text2vec_contextionary( |
42 | | - name="content", source_properties=["content"], vectorize_collection_name=False |
43 | | - ), |
44 | | - ], |
45 | | - ) |
46 | | - |
47 | | - |
48 | 24 | @pytest.mark.parametrize( |
49 | 25 | "include_vector", |
50 | 26 | [["title", "content", "All", "AllExplicit", "bringYourOwn", "bringYourOwn2"], True], |
51 | 27 | ) |
52 | 28 | def test_create_named_vectors( |
53 | 29 | collection_factory: CollectionFactory, include_vector: Union[List[str], bool] |
54 | 30 | ) -> None: |
55 | | - collection = collection_factory("dummy") |
56 | | - if collection._connection._weaviate_version.is_lower_than(1, 24, 0): |
57 | | - pytest.skip("Named vectors are not supported in versions lower than 1.24.0") |
| 31 | + |
58 | 32 | collection = collection_factory( |
59 | 33 | properties=[ |
60 | 34 | wvc.config.Property(name="title", data_type=wvc.config.DataType.TEXT), |
@@ -107,9 +81,7 @@ def test_create_named_vectors( |
107 | 81 |
|
108 | 82 |
|
109 | 83 | def test_insert_many_add(collection_factory: CollectionFactory) -> None: |
110 | | - collection = collection_factory("dummy") |
111 | | - if collection._connection._weaviate_version.is_lower_than(1, 24, 0): |
112 | | - pytest.skip("Named vectors are not supported in versions lower than 1.24.0") |
| 84 | + |
113 | 85 | collection = collection_factory( |
114 | 86 | properties=[ |
115 | 87 | wvc.config.Property(name="title", data_type=wvc.config.DataType.TEXT), |
@@ -139,9 +111,6 @@ def test_insert_many_add(collection_factory: CollectionFactory) -> None: |
139 | 111 |
|
140 | 112 |
|
141 | 113 | def test_update(collection_factory: CollectionFactory) -> None: |
142 | | - collection = collection_factory("dummy") |
143 | | - if collection._connection._weaviate_version.is_lower_than(1, 24, 0): |
144 | | - pytest.skip("Named vectors are not supported in versions lower than 1.24.0") |
145 | 114 |
|
146 | 115 | collection = collection_factory( |
147 | 116 | properties=[ |
@@ -174,9 +143,6 @@ def test_update(collection_factory: CollectionFactory) -> None: |
174 | 143 |
|
175 | 144 |
|
176 | 145 | def test_replace(collection_factory: CollectionFactory) -> None: |
177 | | - collection = collection_factory("dummy") |
178 | | - if collection._connection._weaviate_version.is_lower_than(1, 24, 0): |
179 | | - pytest.skip("Named vectors are not supported in versions lower than 1.24.0") |
180 | 146 |
|
181 | 147 | collection = collection_factory( |
182 | 148 | properties=[ |
@@ -210,9 +176,7 @@ def test_replace(collection_factory: CollectionFactory) -> None: |
210 | 176 |
|
211 | 177 |
|
212 | 178 | def test_query(collection_factory: CollectionFactory) -> None: |
213 | | - collection = collection_factory("dummy") |
214 | | - if collection._connection._weaviate_version.is_lower_than(1, 24, 0): |
215 | | - pytest.skip("Named vectors are not supported in versions lower than 1.24.0") |
| 179 | + |
216 | 180 | collection = collection_factory( |
217 | 181 | properties=[ |
218 | 182 | wvc.config.Property(name="title", data_type=wvc.config.DataType.TEXT), |
@@ -288,9 +252,7 @@ def test_generate(openai_collection: OpenAICollection) -> None: |
288 | 252 |
|
289 | 253 |
|
290 | 254 | def test_batch_add(collection_factory: CollectionFactory) -> None: |
291 | | - collection = collection_factory("dummy") |
292 | | - if collection._connection._weaviate_version.is_lower_than(1, 24, 0): |
293 | | - pytest.skip("Named vectors are not supported in versions lower than 1.24.0") |
| 255 | + |
294 | 256 | collection = collection_factory( |
295 | 257 | properties=[ |
296 | 258 | wvc.config.Property(name="title", data_type=wvc.config.DataType.TEXT), |
@@ -318,9 +280,7 @@ def test_batch_add(collection_factory: CollectionFactory) -> None: |
318 | 280 |
|
319 | 281 |
|
320 | 282 | def test_named_vector_with_index_config(collection_factory: CollectionFactory) -> None: |
321 | | - collection = collection_factory("dummy") |
322 | | - if collection._connection._weaviate_version.is_lower_than(1, 24, 0): |
323 | | - pytest.skip("Named vectors are not supported in versions lower than 1.24.0") |
| 283 | + |
324 | 284 | collection = collection_factory( |
325 | 285 | properties=[ |
326 | 286 | wvc.config.Property(name="title", data_type=wvc.config.DataType.TEXT), |
@@ -375,9 +335,7 @@ def test_named_vector_with_index_config(collection_factory: CollectionFactory) - |
375 | 335 |
|
376 | 336 |
|
377 | 337 | def test_aggregation(collection_factory: CollectionFactory) -> None: |
378 | | - collection = collection_factory("dummy") |
379 | | - if collection._connection._weaviate_version.is_lower_than(1, 24, 0): |
380 | | - pytest.skip("Named vectors are not supported in versions lower than 1.24.0") |
| 338 | + |
381 | 339 | collection = collection_factory( |
382 | 340 | properties=[ |
383 | 341 | wvc.config.Property(name="first", data_type=wvc.config.DataType.TEXT), |
@@ -453,9 +411,7 @@ def test_aggregation(collection_factory: CollectionFactory) -> None: |
453 | 411 | def test_update_to_enable_quantizer_on_specific_named_vector( |
454 | 412 | collection_factory: CollectionFactory, |
455 | 413 | ) -> None: |
456 | | - collection = collection_factory("dummy") |
457 | | - if collection._connection._weaviate_version.is_lower_than(1, 24, 0): |
458 | | - pytest.skip("Named vectors are not supported in versions lower than 1.24.0") |
| 414 | + |
459 | 415 | collection = collection_factory( |
460 | 416 | properties=[ |
461 | 417 | wvc.config.Property(name="first", data_type=wvc.config.DataType.TEXT), |
@@ -548,9 +504,7 @@ def test_update_to_enable_quantizer_on_specific_named_vector( |
548 | 504 |
|
549 | 505 |
|
550 | 506 | def test_duplicate_named_vectors(collection_factory: CollectionFactory) -> None: |
551 | | - collection = collection_factory("dummy") |
552 | | - if collection._connection._weaviate_version.is_lower_than(1, 24, 0): |
553 | | - pytest.skip("Named vectors are not supported in versions lower than 1.24.0") |
| 507 | + |
554 | 508 | with pytest.raises(WeaviateInvalidInputError) as e: |
555 | 509 | collection_factory( |
556 | 510 | vectorizer_config=[ |
|
0 commit comments