Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta/migrate classes priv to pub #713

Merged
merged 8 commits into from
Jan 12, 2024
12 changes: 6 additions & 6 deletions integration/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
PROPERTY,
REFERENCE,
)
from weaviate.collections.classes.internal import _CrossReference, Reference, _Object
from weaviate.collections.classes.internal import _CrossReference, Reference, Object
from weaviate.collections.classes.tenants import Tenant, TenantActivityStatus
from weaviate.collections.classes.types import PhoneNumber, WeaviateProperties
from weaviate.exceptions import (
Expand Down Expand Up @@ -1408,11 +1408,11 @@ class DataModel4(TypedDict):
pass

objects: Union[
List[_Object[DataModel0, None]],
List[_Object[DataModel1, None]],
List[_Object[DataModel2, None]],
List[_Object[DataModel3, None]],
List[_Object[DataModel4, None]],
List[Object[DataModel0, None]],
List[Object[DataModel1, None]],
List[Object[DataModel2, None]],
List[Object[DataModel3, None]],
List[Object[DataModel4, None]],
]
if which_case == 0:
objects = collection.query.fetch_objects(return_properties=DataModel0).objects
Expand Down
20 changes: 10 additions & 10 deletions integration/test_collection_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
PQEncoderDistribution,
StopwordsPreset,
VectorDistance,
_VectorIndexType,
VectorIndexType,
Vectorizer,
GenerativeSearches,
Reranker,
Expand Down Expand Up @@ -154,7 +154,7 @@ def test_collection_config_empty(collection_factory: CollectionFactory) -> None:
assert config.vector_index_config.skip is False
assert config.vector_index_config.vector_cache_max_objects == 1000000000000

assert config.vector_index_type == _VectorIndexType.HNSW
assert config.vector_index_type == VectorIndexType.HNSW


def test_bm25_config(collection_factory: CollectionFactory) -> None:
Expand Down Expand Up @@ -207,7 +207,7 @@ def test_collection_config_defaults(collection_factory: CollectionFactory) -> No
assert config.vector_index_config.skip is False
assert config.vector_index_config.vector_cache_max_objects == 1000000000000

assert config.vector_index_type == _VectorIndexType.HNSW
assert config.vector_index_type == VectorIndexType.HNSW


def test_collection_config_full(collection_factory: CollectionFactory) -> None:
Expand Down Expand Up @@ -334,7 +334,7 @@ def test_collection_config_full(collection_factory: CollectionFactory) -> None:
assert config.vector_index_config.skip is True
assert config.vector_index_config.vector_cache_max_objects == 100000

assert config.vector_index_type == _VectorIndexType.HNSW
assert config.vector_index_type == VectorIndexType.HNSW


def test_collection_config_update(collection_factory: CollectionFactory) -> None:
Expand Down Expand Up @@ -407,7 +407,7 @@ def test_collection_config_update(collection_factory: CollectionFactory) -> None
assert config.vector_index_config.skip is True
assert config.vector_index_config.vector_cache_max_objects == 2000000

assert config.vector_index_type == _VectorIndexType.HNSW
assert config.vector_index_type == VectorIndexType.HNSW

collection.config.update(
vector_index_config=Reconfigure.VectorIndex.hnsw(
Expand Down Expand Up @@ -439,7 +439,7 @@ def test_collection_config_update(collection_factory: CollectionFactory) -> None
assert config.vector_index_config.skip is True
assert config.vector_index_config.vector_cache_max_objects == 2000000

assert config.vector_index_type == _VectorIndexType.HNSW
assert config.vector_index_type == VectorIndexType.HNSW


def test_update_flat(collection_factory: CollectionFactory) -> None:
Expand All @@ -455,7 +455,7 @@ def test_update_flat(collection_factory: CollectionFactory) -> None:
)

config = collection.config.get()
assert config.vector_index_type == _VectorIndexType.FLAT
assert config.vector_index_type == VectorIndexType.FLAT
assert config.vector_index_config.vector_cache_max_objects == 5
assert isinstance(config.vector_index_config.quantizer, _BQConfig)
assert config.vector_index_config.quantizer.rescore_limit == 10
Expand All @@ -467,7 +467,7 @@ def test_update_flat(collection_factory: CollectionFactory) -> None:
),
)
config = collection.config.get()
assert config.vector_index_type == _VectorIndexType.FLAT
assert config.vector_index_type == VectorIndexType.FLAT
assert config.vector_index_config.vector_cache_max_objects == 10
assert isinstance(config.vector_index_config.quantizer, _BQConfig)
assert config.vector_index_config.quantizer.rescore_limit == 20
Expand Down Expand Up @@ -561,7 +561,7 @@ def test_config_vector_index_flat_and_quantizer_bq(collection_factory: Collectio
)

conf = collection.config.get()
assert conf.vector_index_type == _VectorIndexType.FLAT
assert conf.vector_index_type == VectorIndexType.FLAT
assert conf.vector_index_config.vector_cache_max_objects == 234
assert isinstance(conf.vector_index_config.quantizer, _BQConfig)
assert conf.vector_index_config.quantizer.rescore_limit == 456
Expand All @@ -577,7 +577,7 @@ def test_config_vector_index_hnsw_and_quantizer_pq(collection_factory: Collectio
)

conf = collection.config.get()
assert conf.vector_index_type == _VectorIndexType.HNSW
assert conf.vector_index_type == VectorIndexType.HNSW
assert conf.vector_index_config.vector_cache_max_objects == 234
assert isinstance(conf.vector_index_config, _VectorIndexConfigHNSW)
assert conf.vector_index_config.ef_construction == 789
Expand Down
4 changes: 2 additions & 2 deletions integration/test_collection_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import weaviate
from weaviate.collections.classes.config import (
Configure,
PropertyConfig,
_PropertyConfig,
)
from weaviate.collections.classes.internal import CrossReference, Reference
from weaviate.collections.classes.orm import BaseProperty, CollectionModelConfig
Expand Down Expand Up @@ -96,7 +96,7 @@ class ModelTypes(BaseProperty):
@pytest.mark.parametrize(
"member_type, annotation ,value,expected",
[
(str, PropertyConfig(index_filterable=False), "value", "text"),
(str, _PropertyConfig(index_filterable=False), "value", "text"),
(UUIDS, CrossReference[Group], [str(REF_TO_UUID)], "Group"),
(Optional[UUIDS], CrossReference[Group], [str(REF_TO_UUID)], "Group"),
],
Expand Down
4 changes: 2 additions & 2 deletions test/collection/test_collection_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import pytest as pytest

from weaviate.collections.classes.config import PropertyConfig
from weaviate.collections.classes.config import _PropertyConfig
from weaviate.collections.classes.orm import BaseProperty, Reference
from weaviate.types import UUIDS

Expand Down Expand Up @@ -43,7 +43,7 @@ class ModelTypes(BaseProperty):
@pytest.mark.parametrize(
"member_type, annotation ,expected",
[
(str, PropertyConfig(index_filterable=False), "text"),
(str, _PropertyConfig(index_filterable=False), "text"),
(UUIDS, Reference(Group), "Group"),
(Optional[UUIDS], Reference(Group), "Group"),
],
Expand Down
5 changes: 5 additions & 0 deletions weaviate/classes/batch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from weaviate.collections.classes.batch import Shard

__all__ = [
"Shard",
]
8 changes: 8 additions & 0 deletions weaviate/classes/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,32 @@
Configure,
Reconfigure,
DataType,
GenerativeSearches,
Multi2VecField,
Property,
ReferenceProperty,
ReferencePropertyMultiTarget,
Rerankers,
StopwordsPreset,
Tokenization,
Vectorizers,
VectorDistance,
VectorDistances,
)

__all__ = [
"Configure",
"Reconfigure",
"DataType",
"GenerativeSearches",
"Multi2VecField",
"Property",
"ReferenceProperty",
"ReferencePropertyMultiTarget",
"Rerankers",
"StopwordsPreset",
"Tokenization",
"Vectorizers",
"VectorDistance",
"VectorDistances",
]
3 changes: 3 additions & 0 deletions weaviate/classes/tenants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from weaviate.collections.classes.tenants import Tenant, TenantActivityStatus

__all__ = ["Tenant", "TenantActivityStatus"]
6 changes: 3 additions & 3 deletions weaviate/collections/batch/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from weaviate.collections.classes.batch import (
ErrorReference,
_BatchDeleteResult,
BatchDeleteReturn,
_BatchReference,
BatchReferenceReturn,
)
Expand All @@ -25,7 +25,7 @@ def __init__(

def delete(
self, collection: str, where: _Filters, verbose: bool, dry_run: bool, tenant: Optional[str]
) -> _BatchDeleteResult:
) -> BatchDeleteReturn:
payload: Dict[str, Any] = {
"match": {
"class": collection,
Expand Down Expand Up @@ -53,7 +53,7 @@ def delete(
raise RequestsConnectionError("Batch delete was not successful.") from conn_err
res = _decode_json_response_dict(response, "Delete in batch")
assert res is not None
return _BatchDeleteResult(
return BatchDeleteReturn(
failed=res["results"]["failed"],
matches=res["results"]["matches"],
objects=res["results"]["objects"],
Expand Down
4 changes: 3 additions & 1 deletion weaviate/collections/classes/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ def __add__(self, other: "BatchResult") -> "BatchResult":


@dataclass
class _BatchDeleteResult:
class BatchDeleteReturn:
"""This class contains the results of a batch `delete_many` operation."""

failed: int
matches: int
objects: Optional[List[Dict[str, Any]]]
Expand Down
Loading