|
23 | 23 | import json |
24 | 24 | import os |
25 | 25 | from chromadb.utils.embedding_functions import register_embedding_function |
26 | | -from chromadb.test.conftest import ClientFactories |
| 26 | + |
| 27 | +# from chromadb.test.conftest import ClientFactories |
27 | 28 |
|
28 | 29 |
|
29 | 30 | # Check if we are running in a mode where SPANN is disabled |
@@ -274,48 +275,48 @@ def test_hnsw_configuration_updates(client: ClientAPI) -> None: |
274 | 275 | assert hnsw_config.get("max_neighbors") == 16 |
275 | 276 |
|
276 | 277 |
|
277 | | -def test_configuration_persistence(client_factories: "ClientFactories") -> None: |
278 | | - """Test configuration persistence across client restarts""" |
279 | | - # Use the factory to create the initial client |
280 | | - client = client_factories.create_client_from_system() |
281 | | - client.reset() |
282 | | - |
283 | | - # Create collection with specific configuration |
284 | | - hnsw_config: CreateHNSWConfiguration = { |
285 | | - "space": "cosine", |
286 | | - "ef_construction": 100, |
287 | | - "max_neighbors": 10, |
288 | | - } |
289 | | - config: CreateCollectionConfiguration = { |
290 | | - "hnsw": hnsw_config, |
291 | | - "embedding_function": CustomEmbeddingFunction(dim=5), |
292 | | - } |
293 | | - |
294 | | - client.create_collection( |
295 | | - name="test_persist_config", |
296 | | - configuration=config, |
297 | | - ) |
298 | | - |
299 | | - # Simulate client restart by creating a new client from the same system |
300 | | - client2 = client_factories.create_client_from_system() |
301 | | - |
302 | | - coll = client2.get_collection( |
303 | | - name="test_persist_config", |
304 | | - ) |
305 | | - |
306 | | - loaded_config = load_collection_configuration_from_json( |
307 | | - coll._model.configuration_json |
308 | | - ) |
309 | | - if loaded_config and isinstance(loaded_config, dict): |
310 | | - hnsw_config = cast(CreateHNSWConfiguration, loaded_config.get("hnsw", {})) |
311 | | - assert hnsw_config.get("space") == "cosine" |
312 | | - assert hnsw_config.get("ef_construction") == 100 |
313 | | - assert hnsw_config.get("max_neighbors") == 10 |
314 | | - assert hnsw_config.get("ef_search") == 100 |
315 | | - |
316 | | - ef = loaded_config.get("embedding_function") |
317 | | - assert ef is not None |
318 | | - assert ef.name() == "custom_ef" |
| 278 | +# def test_configuration_persistence(client_factories: "ClientFactories") -> None: |
| 279 | +# """Test configuration persistence across client restarts""" |
| 280 | +# # Use the factory to create the initial client |
| 281 | +# client = client_factories.create_client_from_system() |
| 282 | +# client.reset() |
| 283 | + |
| 284 | +# # Create collection with specific configuration |
| 285 | +# hnsw_config: CreateHNSWConfiguration = { |
| 286 | +# "space": "cosine", |
| 287 | +# "ef_construction": 100, |
| 288 | +# "max_neighbors": 10, |
| 289 | +# } |
| 290 | +# config: CreateCollectionConfiguration = { |
| 291 | +# "hnsw": hnsw_config, |
| 292 | +# "embedding_function": CustomEmbeddingFunction(dim=5), |
| 293 | +# } |
| 294 | + |
| 295 | +# client.create_collection( |
| 296 | +# name="test_persist_config", |
| 297 | +# configuration=config, |
| 298 | +# ) |
| 299 | + |
| 300 | +# # Simulate client restart by creating a new client from the same system |
| 301 | +# client2 = client_factories.create_client_from_system() |
| 302 | + |
| 303 | +# coll = client2.get_collection( |
| 304 | +# name="test_persist_config", |
| 305 | +# ) |
| 306 | + |
| 307 | +# loaded_config = load_collection_configuration_from_json( |
| 308 | +# coll._model.configuration_json |
| 309 | +# ) |
| 310 | +# if loaded_config and isinstance(loaded_config, dict): |
| 311 | +# hnsw_config = cast(CreateHNSWConfiguration, loaded_config.get("hnsw", {})) |
| 312 | +# assert hnsw_config.get("space") == "cosine" |
| 313 | +# assert hnsw_config.get("ef_construction") == 100 |
| 314 | +# assert hnsw_config.get("max_neighbors") == 10 |
| 315 | +# assert hnsw_config.get("ef_search") == 100 |
| 316 | + |
| 317 | +# ef = loaded_config.get("embedding_function") |
| 318 | +# assert ef is not None |
| 319 | +# assert ef.name() == "custom_ef" |
319 | 320 |
|
320 | 321 |
|
321 | 322 | def test_configuration_result_format(client: ClientAPI) -> None: |
@@ -501,48 +502,48 @@ def supported_spaces(self) -> list[Space]: |
501 | 502 | assert "SPANN is still in development" in str(excinfo.value) |
502 | 503 |
|
503 | 504 |
|
504 | | -@pytest.mark.skipif(is_spann_disabled_mode, reason=skip_reason_spann_disabled) |
505 | | -def test_spann_configuration_persistence(client_factories: "ClientFactories") -> None: |
506 | | - """Test SPANN configuration persistence across client restarts""" |
507 | | - client = client_factories.create_client_from_system() |
508 | | - client.reset() |
509 | | - |
510 | | - # Create collection with specific SPANN configuration |
511 | | - spann_config: CreateSpannConfiguration = { |
512 | | - "space": "cosine", |
513 | | - "ef_construction": 100, |
514 | | - "max_neighbors": 10, |
515 | | - "search_nprobe": 5, |
516 | | - "write_nprobe": 10, |
517 | | - } |
518 | | - config: CreateCollectionConfiguration = { |
519 | | - "spann": spann_config, |
520 | | - "embedding_function": CustomEmbeddingFunction(dim=5), |
521 | | - } |
522 | | - |
523 | | - client.create_collection( |
524 | | - name="test_persist_spann_config", |
525 | | - configuration=config, |
526 | | - ) |
527 | | - |
528 | | - client2 = client_factories.create_client_from_system() |
529 | | - |
530 | | - coll = client2.get_collection( |
531 | | - name="test_persist_spann_config", |
532 | | - ) |
533 | | - |
534 | | - loaded_config = load_collection_configuration_from_json( |
535 | | - coll._model.configuration_json |
536 | | - ) |
537 | | - if loaded_config and isinstance(loaded_config, dict): |
538 | | - spann_config = cast(CreateSpannConfiguration, loaded_config.get("spann", {})) |
539 | | - ef = loaded_config.get("embedding_function") |
540 | | - assert spann_config.get("space") == "cosine" |
541 | | - assert spann_config.get("ef_construction") == 100 |
542 | | - assert spann_config.get("max_neighbors") == 10 |
543 | | - assert spann_config.get("search_nprobe") == 5 |
544 | | - assert spann_config.get("write_nprobe") == 10 |
545 | | - assert ef is not None |
| 505 | +# @pytest.mark.skipif(is_spann_disabled_mode, reason=skip_reason_spann_disabled) |
| 506 | +# def test_spann_configuration_persistence(client_factories: "ClientFactories") -> None: |
| 507 | +# """Test SPANN configuration persistence across client restarts""" |
| 508 | +# client = client_factories.create_client_from_system() |
| 509 | +# client.reset() |
| 510 | + |
| 511 | +# # Create collection with specific SPANN configuration |
| 512 | +# spann_config: CreateSpannConfiguration = { |
| 513 | +# "space": "cosine", |
| 514 | +# "ef_construction": 100, |
| 515 | +# "max_neighbors": 10, |
| 516 | +# "search_nprobe": 5, |
| 517 | +# "write_nprobe": 10, |
| 518 | +# } |
| 519 | +# config: CreateCollectionConfiguration = { |
| 520 | +# "spann": spann_config, |
| 521 | +# "embedding_function": CustomEmbeddingFunction(dim=5), |
| 522 | +# } |
| 523 | + |
| 524 | +# client.create_collection( |
| 525 | +# name="test_persist_spann_config", |
| 526 | +# configuration=config, |
| 527 | +# ) |
| 528 | + |
| 529 | +# client2 = client_factories.create_client_from_system() |
| 530 | + |
| 531 | +# coll = client2.get_collection( |
| 532 | +# name="test_persist_spann_config", |
| 533 | +# ) |
| 534 | + |
| 535 | +# loaded_config = load_collection_configuration_from_json( |
| 536 | +# coll._model.configuration_json |
| 537 | +# ) |
| 538 | +# if loaded_config and isinstance(loaded_config, dict): |
| 539 | +# spann_config = cast(CreateSpannConfiguration, loaded_config.get("spann", {})) |
| 540 | +# ef = loaded_config.get("embedding_function") |
| 541 | +# assert spann_config.get("space") == "cosine" |
| 542 | +# assert spann_config.get("ef_construction") == 100 |
| 543 | +# assert spann_config.get("max_neighbors") == 10 |
| 544 | +# assert spann_config.get("search_nprobe") == 5 |
| 545 | +# assert spann_config.get("write_nprobe") == 10 |
| 546 | +# assert ef is not None |
546 | 547 |
|
547 | 548 |
|
548 | 549 | def test_exclusive_hnsw_spann_configuration(client: ClientAPI) -> None: |
|
0 commit comments