From 7ca29b96b313732e7a9843a90fbc73af4403ed4d Mon Sep 17 00:00:00 2001 From: Tommy Smith Date: Fri, 25 Apr 2025 13:52:51 +0100 Subject: [PATCH 01/16] Introduce `Configure.Vectors` and `vector_config` in `.create`/`.update` --- .github/workflows/main.yaml | 8 +- .pre-commit-config.yaml | 2 +- docs/conf.py | 1 - integration/conftest.py | 43 +- integration/test_backup_v4.py | 4 +- integration/test_batch_v4.py | 6 +- integration/test_client.py | 7 +- integration/test_client_debug.py | 2 +- integration/test_collection.py | 187 ++- integration/test_collection_aggregate.py | 17 +- integration/test_collection_batch.py | 5 +- integration/test_collection_batch_delete.py | 4 +- integration/test_collection_config.py | 87 +- integration/test_collection_filter.py | 2 +- integration/test_collection_get.py | 4 +- integration/test_collection_hybrid.py | 2 +- integration/test_collection_multi_node.py | 2 +- integration/test_collection_references.py | 4 +- integration/test_collection_rerank.py | 1 + integration/test_collections_sorting.py | 1 + integration/test_iterator.py | 2 +- integration/test_rbac.py | 10 +- integration/test_tenants.py | 7 +- integration/test_users.py | 6 +- ...{test_named_vectors.py => test_vectors.py} | 190 +-- integration_embedded/test_client.py | 3 +- journey_tests/gunicorn/asgi.py | 1 - journey_tests/journeys.py | 7 +- mock_tests/conftest.py | 11 +- mock_tests/test_auth.py | 2 +- mock_tests/test_collection.py | 18 +- mock_tests/test_timeouts.py | 3 +- profiling/conftest.py | 9 +- profiling/pyspy.py | 2 +- profiling/test_import_and_query.py | 1 + profiling/test_profiling.py | 2 +- profiling/test_refs.py | 2 +- profiling/test_sphere.py | 3 +- test/collection/conftest.py | 3 +- test/collection/test_aggregates.py | 6 +- test/collection/test_batch.py | 3 +- test/collection/test_classes.py | 7 +- test/collection/test_classes_generative.py | 5 +- test/collection/test_client.py | 2 +- test/collection/test_collections_sorting.py | 1 + test/collection/test_config.py | 15 +- test/collection/test_config_update.py | 2 +- test/collection/test_queries.py | 6 +- test/collection/test_validator.py | 2 +- test/test_auth.py | 1 + test/test_client.py | 1 + test/test_get_vector_v4.py | 1 + test/test_util.py | 18 +- test/util.py | 2 +- tools/stubs_regen.sh | 1 + weaviate/auth.py | 2 +- weaviate/backup/async_.py | 2 +- weaviate/backup/async_.pyi | 18 +- weaviate/backup/backup.py | 2 + weaviate/backup/backup_location.py | 2 +- weaviate/backup/executor.py | 23 +- weaviate/backup/sync.py | 2 +- weaviate/backup/sync.pyi | 18 +- weaviate/classes/__init__.py | 4 +- weaviate/classes/backup.py | 1 - weaviate/classes/config.py | 4 +- weaviate/classes/generate.py | 5 +- weaviate/classes/generics.py | 2 +- weaviate/classes/query.py | 6 +- weaviate/classes/rbac.py | 2 +- weaviate/classes/tenants.py | 4 +- weaviate/client.py | 10 +- weaviate/client.pyi | 6 +- weaviate/client_executor.py | 8 +- weaviate/collections/__init__.py | 5 +- weaviate/collections/aggregate.py | 12 +- .../collections/aggregations/base_executor.py | 20 +- .../collections/aggregations/hybrid/async_.py | 2 +- .../aggregations/hybrid/async_.pyi | 4 +- .../aggregations/hybrid/executor.py | 4 +- .../collections/aggregations/hybrid/sync.py | 2 +- .../collections/aggregations/hybrid/sync.pyi | 4 +- .../aggregations/near_image/async_.py | 2 +- .../aggregations/near_image/async_.pyi | 4 +- .../aggregations/near_image/executor.py | 4 +- .../aggregations/near_image/sync.py | 2 +- .../aggregations/near_image/sync.pyi | 4 +- .../aggregations/near_object/async_.py | 2 +- .../aggregations/near_object/async_.pyi | 4 +- .../aggregations/near_object/executor.py | 4 +- .../aggregations/near_object/sync.py | 2 +- .../aggregations/near_object/sync.pyi | 4 +- .../aggregations/near_text/async_.py | 2 +- .../aggregations/near_text/async_.pyi | 4 +- .../aggregations/near_text/executor.py | 4 +- .../aggregations/near_text/sync.py | 2 +- .../aggregations/near_text/sync.pyi | 4 +- .../aggregations/near_vector/async_.pyi | 6 +- .../aggregations/near_vector/executor.py | 6 +- .../aggregations/near_vector/sync.pyi | 6 +- .../aggregations/over_all/async_.py | 2 +- .../aggregations/over_all/async_.pyi | 4 +- .../aggregations/over_all/executor.py | 4 +- .../collections/aggregations/over_all/sync.py | 2 +- .../aggregations/over_all/sync.pyi | 4 +- weaviate/collections/backups/async_.py | 2 +- weaviate/collections/backups/async_.pyi | 2 +- weaviate/collections/backups/executor.py | 2 +- weaviate/collections/backups/sync.py | 2 +- weaviate/collections/backups/sync.pyi | 2 +- weaviate/collections/batch/base.py | 15 +- weaviate/collections/batch/batch_wrapper.py | 11 +- weaviate/collections/batch/client.py | 9 +- weaviate/collections/batch/collection.py | 7 +- .../collections/batch/grpc_batch_objects.py | 12 +- weaviate/collections/batch/rest.py | 4 +- weaviate/collections/classes/aggregate.py | 4 +- weaviate/collections/classes/batch.py | 2 +- weaviate/collections/classes/cluster.py | 3 +- weaviate/collections/classes/config.py | 104 +- .../collections/classes/config_methods.py | 50 +- .../classes/config_named_vectors.py | 65 +- .../collections/classes/config_vectorizers.py | 1 + .../collections/classes/config_vectors.py | 1267 +++++++++++++++++ weaviate/collections/classes/data.py | 7 +- weaviate/collections/classes/filters.py | 12 +- weaviate/collections/classes/generative.py | 8 +- weaviate/collections/classes/grpc.py | 6 +- weaviate/collections/classes/internal.py | 33 +- weaviate/collections/classes/types.py | 3 +- weaviate/collections/cluster/async_.py | 2 +- weaviate/collections/cluster/async_.pyi | 4 +- weaviate/collections/cluster/executor.py | 7 +- weaviate/collections/cluster/sync.py | 2 +- weaviate/collections/cluster/sync.pyi | 4 +- weaviate/collections/collection/async_.py | 4 +- weaviate/collections/collection/base.py | 1 + weaviate/collections/collections/async_.pyi | 64 +- weaviate/collections/collections/base.py | 2 +- weaviate/collections/collections/executor.py | 20 +- weaviate/collections/collections/sync.py | 5 +- weaviate/collections/collections/sync.pyi | 64 +- weaviate/collections/config/async_.py | 2 +- weaviate/collections/config/async_.pyi | 28 +- weaviate/collections/config/executor.py | 67 +- weaviate/collections/config/sync.py | 2 +- weaviate/collections/config/sync.pyi | 28 +- weaviate/collections/data/async_.py | 5 +- weaviate/collections/data/async_.pyi | 26 +- weaviate/collections/data/executor.py | 27 +- weaviate/collections/data/sync.py | 3 +- weaviate/collections/data/sync.pyi | 26 +- weaviate/collections/filters.py | 10 +- weaviate/collections/generate.py | 36 +- weaviate/collections/grpc/aggregate.py | 6 +- weaviate/collections/grpc/query.py | 20 +- weaviate/collections/grpc/shared.py | 28 +- weaviate/collections/iterator.py | 23 +- weaviate/collections/queries/base_executor.py | 49 +- weaviate/collections/queries/bm25/__init__.py | 4 +- .../queries/bm25/generate/async_.py | 2 +- .../queries/bm25/generate/async_.pyi | 15 +- .../queries/bm25/generate/executor.py | 26 +- .../collections/queries/bm25/generate/sync.py | 2 +- .../queries/bm25/generate/sync.pyi | 15 +- .../collections/queries/bm25/query/async_.py | 2 +- .../collections/queries/bm25/query/async_.pyi | 11 +- .../queries/bm25/query/executor.py | 22 +- .../collections/queries/bm25/query/sync.py | 2 +- .../collections/queries/bm25/query/sync.pyi | 11 +- .../queries/fetch_object_by_id/async_.py | 6 +- .../queries/fetch_object_by_id/async_.pyi | 6 +- .../queries/fetch_object_by_id/executor.py | 11 +- .../queries/fetch_object_by_id/sync.py | 6 +- .../queries/fetch_object_by_id/sync.pyi | 6 +- .../queries/fetch_objects/__init__.py | 4 +- .../queries/fetch_objects/generate/async_.py | 2 +- .../queries/fetch_objects/generate/async_.pyi | 17 +- .../fetch_objects/generate/executor.py | 22 +- .../queries/fetch_objects/generate/sync.py | 2 +- .../queries/fetch_objects/generate/sync.pyi | 17 +- .../queries/fetch_objects/query/async_.py | 6 +- .../queries/fetch_objects/query/async_.pyi | 13 +- .../queries/fetch_objects/query/executor.py | 18 +- .../queries/fetch_objects/query/sync.py | 6 +- .../queries/fetch_objects/query/sync.pyi | 13 +- .../queries/fetch_objects_by_ids/__init__.py | 4 +- .../fetch_objects_by_ids/generate/async_.py | 2 +- .../fetch_objects_by_ids/generate/async_.pyi | 16 +- .../fetch_objects_by_ids/generate/executor.py | 33 +- .../fetch_objects_by_ids/generate/sync.py | 2 +- .../fetch_objects_by_ids/generate/sync.pyi | 16 +- .../fetch_objects_by_ids/query/async_.py | 2 +- .../fetch_objects_by_ids/query/async_.pyi | 12 +- .../fetch_objects_by_ids/query/executor.py | 28 +- .../fetch_objects_by_ids/query/sync.py | 2 +- .../fetch_objects_by_ids/query/sync.pyi | 12 +- .../collections/queries/hybrid/__init__.py | 4 +- .../queries/hybrid/generate/async_.py | 6 +- .../queries/hybrid/generate/async_.pyi | 24 +- .../queries/hybrid/generate/executor.py | 29 +- .../queries/hybrid/generate/sync.py | 6 +- .../queries/hybrid/generate/sync.pyi | 24 +- .../queries/hybrid/query/async_.py | 2 +- .../queries/hybrid/query/async_.pyi | 14 +- .../queries/hybrid/query/executor.py | 19 +- .../collections/queries/hybrid/query/sync.py | 2 +- .../collections/queries/hybrid/query/sync.pyi | 14 +- .../queries/near_image/__init__.py | 5 +- .../queries/near_image/generate/async_.py | 6 +- .../queries/near_image/generate/async_.pyi | 20 +- .../queries/near_image/generate/executor.py | 25 +- .../queries/near_image/generate/sync.py | 6 +- .../queries/near_image/generate/sync.pyi | 20 +- .../queries/near_image/query/async_.py | 6 +- .../queries/near_image/query/async_.pyi | 12 +- .../queries/near_image/query/executor.py | 17 +- .../queries/near_image/query/sync.py | 6 +- .../queries/near_image/query/sync.pyi | 12 +- .../queries/near_media/__init__.py | 4 +- .../queries/near_media/generate/async_.py | 6 +- .../queries/near_media/generate/async_.pyi | 20 +- .../queries/near_media/generate/executor.py | 25 +- .../queries/near_media/generate/sync.py | 6 +- .../queries/near_media/generate/sync.pyi | 20 +- .../queries/near_media/query/async_.py | 6 +- .../queries/near_media/query/async_.pyi | 12 +- .../queries/near_media/query/executor.py | 17 +- .../queries/near_media/query/sync.py | 6 +- .../queries/near_media/query/sync.pyi | 12 +- .../queries/near_object/__init__.py | 4 +- .../queries/near_object/generate/async_.py | 6 +- .../queries/near_object/generate/async_.pyi | 18 +- .../queries/near_object/generate/executor.py | 23 +- .../queries/near_object/generate/sync.py | 6 +- .../queries/near_object/generate/sync.pyi | 18 +- .../queries/near_object/query/async_.py | 6 +- .../queries/near_object/query/async_.pyi | 12 +- .../queries/near_object/query/executor.py | 17 +- .../queries/near_object/query/sync.py | 6 +- .../queries/near_object/query/sync.pyi | 12 +- .../collections/queries/near_text/__init__.py | 4 +- .../queries/near_text/generate/async_.py | 6 +- .../queries/near_text/generate/async_.pyi | 18 +- .../queries/near_text/generate/executor.py | 23 +- .../queries/near_text/generate/sync.py | 6 +- .../queries/near_text/generate/sync.pyi | 18 +- .../queries/near_text/query/async_.py | 2 +- .../queries/near_text/query/async_.pyi | 10 +- .../queries/near_text/query/executor.py | 15 +- .../queries/near_text/query/sync.py | 2 +- .../queries/near_text/query/sync.pyi | 10 +- .../queries/near_vector/__init__.py | 4 +- .../queries/near_vector/generate/async_.py | 6 +- .../queries/near_vector/generate/async_.pyi | 20 +- .../queries/near_vector/generate/executor.py | 25 +- .../queries/near_vector/generate/sync.py | 6 +- .../queries/near_vector/generate/sync.pyi | 20 +- .../queries/near_vector/query/async_.py | 6 +- .../queries/near_vector/query/async_.pyi | 14 +- .../queries/near_vector/query/executor.py | 19 +- .../queries/near_vector/query/sync.py | 6 +- .../queries/near_vector/query/sync.pyi | 14 +- weaviate/collections/query.py | 38 +- weaviate/collections/tenants/async_.py | 2 +- weaviate/collections/tenants/async_.pyi | 10 +- weaviate/collections/tenants/executor.py | 11 +- weaviate/collections/tenants/sync.py | 2 +- weaviate/collections/tenants/sync.pyi | 10 +- weaviate/collections/tenants/types.py | 1 + weaviate/connect/authentication.py | 14 +- weaviate/connect/base.py | 4 +- weaviate/connect/executor.py | 14 +- weaviate/connect/helpers.py | 7 +- weaviate/connect/v4.py | 31 +- weaviate/debug/async_.pyi | 2 +- weaviate/debug/executor.py | 2 +- weaviate/debug/sync.pyi | 2 +- weaviate/gql/aggregate.py | 9 +- weaviate/gql/filter.py | 2 +- weaviate/integrations.py | 2 +- weaviate/outputs/backup.py | 7 +- weaviate/outputs/config.py | 8 +- weaviate/outputs/data.py | 3 +- weaviate/outputs/query.py | 28 +- weaviate/outputs/rbac.py | 6 +- weaviate/outputs/users.py | 2 +- weaviate/rbac/async_.pyi | 8 +- weaviate/rbac/executor.py | 8 +- weaviate/rbac/models.py | 14 +- weaviate/rbac/sync.pyi | 8 +- weaviate/retry.py | 4 +- weaviate/str_enum.py | 2 +- weaviate/types.py | 2 +- weaviate/users/async_.py | 2 +- weaviate/users/async_.pyi | 8 +- weaviate/users/executor.py | 10 +- weaviate/users/sync.py | 2 +- weaviate/users/sync.pyi | 8 +- weaviate/util.py | 6 +- weaviate/warnings.py | 14 +- 301 files changed, 3265 insertions(+), 1437 deletions(-) rename integration/{test_named_vectors.py => test_vectors.py} (85%) create mode 100644 weaviate/collections/classes/config_vectors.py diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 3488f0260..4b642e9cc 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -21,10 +21,10 @@ env: WEAVIATE_124: 1.24.26 WEAVIATE_125: 1.25.34 WEAVIATE_126: 1.26.17 - WEAVIATE_127: 1.27.14 - WEAVIATE_128: 1.28.8 - WEAVIATE_129: 1.29.1 - WEAVIATE_130: 1.30.0-rc.0-c1830a7-amd64 + WEAVIATE_127: 1.27.18-00f6a84.amd64 + WEAVIATE_128: 1.28.13 + WEAVIATE_129: 1.29.4 + WEAVIATE_130: 1.30.1 jobs: lint-and-format: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5d37d5f4a..5c49b719e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -51,4 +51,4 @@ repos: language: node pass_filenames: false types: [python] - additional_dependencies: [pyright@1.1.398] + additional_dependencies: [pyright@1.1.400] diff --git a/docs/conf.py b/docs/conf.py index eb81fa56c..1bb1c52cb 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -6,7 +6,6 @@ import contextlib import os import sys - from importlib.metadata import PackageNotFoundError from importlib.metadata import version as version_func diff --git a/integration/conftest.py b/integration/conftest.py index 98f57f528..e31d42b31 100644 --- a/integration/conftest.py +++ b/integration/conftest.py @@ -2,13 +2,13 @@ from typing import ( Any, AsyncGenerator, - Optional, - List, + Dict, Generator, + List, + Optional, Protocol, - Type, - Dict, Tuple, + Type, Union, ) @@ -19,17 +19,18 @@ import weaviate from weaviate.collections import Collection, CollectionAsync from weaviate.collections.classes.config import ( + Configure, + DataType, Property, - _VectorizerConfigCreate, + _GenerativeProvider, _InvertedIndexConfigCreate, + _MultiTenancyConfigCreate, _ReferencePropertyBase, - Configure, - _GenerativeProvider, _ReplicationConfigCreate, - DataType, - _MultiTenancyConfigCreate, - _VectorIndexConfigCreate, _RerankerProvider, + _VectorConfigCreate, + _VectorIndexConfigCreate, + _VectorizerConfigCreate, ) from weaviate.collections.classes.config_named_vectors import _NamedVectorConfigCreate from weaviate.collections.classes.types import Properties @@ -58,6 +59,9 @@ def __call__( vector_index_config: Optional[_VectorIndexConfigCreate] = None, description: Optional[str] = None, reranker_config: Optional[_RerankerProvider] = None, + vector_config: Optional[ + Optional[Union[_VectorConfigCreate, List[_VectorConfigCreate]]] + ] = None, ) -> Collection[Any, Any]: """Typing for fixture.""" ... @@ -129,6 +133,9 @@ def _factory( vector_index_config: Optional[_VectorIndexConfigCreate] = None, description: Optional[str] = None, reranker_config: Optional[_RerankerProvider] = None, + vector_config: Optional[ + Optional[Union[_VectorConfigCreate, List[_VectorConfigCreate]]] + ] = None, ) -> Collection[Any, Any]: try: nonlocal client_fixture, name_fixtures, call_counter # noqa: F824 @@ -148,7 +155,8 @@ def _factory( collection: Collection[Any, Any] = client_fixture.collections.create( name=name_fixture, description=description, - vectorizer_config=vectorizer_config or Configure.Vectorizer.none(), + vectorizer_config=vectorizer_config + or (Configure.Vectorizer.none() if vector_config is None else None), properties=properties, references=references, inverted_index_config=inverted_index_config, @@ -159,6 +167,7 @@ def _factory( replication_config=replication_config, vector_index_config=vector_index_config, reranker_config=reranker_config, + vector_config=vector_config, ) return collection except Exception as e: @@ -315,6 +324,9 @@ def __call__( vectorizer_config: Optional[ Union[_VectorizerConfigCreate, List[_NamedVectorConfigCreate]] ] = None, + vector_config: Optional[ + Optional[Union[_VectorConfigCreate, List[_VectorConfigCreate]]] + ] = None, ) -> Collection[Any, Any]: """Typing for fixture.""" ... @@ -329,17 +341,18 @@ def _factory( vectorizer_config: Optional[ Union[_VectorizerConfigCreate, List[_NamedVectorConfigCreate]] ] = None, + vector_config: Optional[ + Optional[Union[_VectorConfigCreate, List[_VectorConfigCreate]]] + ] = None, ) -> Collection[Any, Any]: api_key = os.environ.get("OPENAI_APIKEY") if api_key is None: pytest.skip("No OpenAI API key found.") - if vectorizer_config is None: - vectorizer_config = Configure.Vectorizer.none() - collection = collection_factory( name=name, - vectorizer_config=vectorizer_config or Configure.Vectorizer.none(), + vectorizer_config=vectorizer_config, + vector_config=vector_config or Configure.Vectors.none(), properties=[ Property(name="text", data_type=DataType.TEXT), Property(name="content", data_type=DataType.TEXT), diff --git a/integration/test_backup_v4.py b/integration/test_backup_v4.py index 58eae1a03..251ada563 100644 --- a/integration/test_backup_v4.py +++ b/integration/test_backup_v4.py @@ -1,7 +1,7 @@ import datetime import pathlib import time -from typing import Generator, List, Union, Optional +from typing import Generator, List, Optional, Union import pytest @@ -16,8 +16,8 @@ ) from weaviate.collections.classes.config import DataType, Property, ReferenceProperty from weaviate.exceptions import ( - UnexpectedStatusCodeException, BackupFailedException, + UnexpectedStatusCodeException, ) pytestmark = pytest.mark.xdist_group(name="backup") diff --git a/integration/test_batch_v4.py b/integration/test_batch_v4.py index 6b114a6cf..345879240 100644 --- a/integration/test_batch_v4.py +++ b/integration/test_batch_v4.py @@ -1,15 +1,15 @@ import concurrent.futures import uuid from dataclasses import dataclass -from typing import Generator, List, Optional, Protocol, Tuple, Callable +from typing import Callable, Generator, List, Optional, Protocol, Tuple import pytest from _pytest.fixtures import SubRequest import weaviate -from weaviate import BatchClient, ClientBatchingContextManager import weaviate.classes as wvc from integration.conftest import _sanitize_collection_name +from weaviate import BatchClient, ClientBatchingContextManager from weaviate.collections.classes.batch import Shard from weaviate.collections.classes.config import ( Configure, @@ -19,8 +19,8 @@ ) from weaviate.collections.classes.grpc import QueryReference from weaviate.collections.classes.internal import ( - _CrossReference, ReferenceToMulti, + _CrossReference, ) from weaviate.collections.classes.tenants import Tenant from weaviate.types import UUID, VECTORS diff --git a/integration/test_client.py b/integration/test_client.py index b7eb17d42..cb9bda516 100644 --- a/integration/test_client.py +++ b/integration/test_client.py @@ -4,20 +4,19 @@ from _pytest.fixtures import SubRequest import weaviate +import weaviate.classes as wvc from weaviate.collections import Collection from weaviate.collections.classes.config import ( Configure, - _CollectionConfig, DataType, GenerativeSearches, Property, ReferenceProperty, Vectorizers, + _CollectionConfig, ) -from weaviate.exceptions import WeaviateClosedClientError, WeaviateStartUpError -import weaviate.classes as wvc - from weaviate.config import Timeout +from weaviate.exceptions import WeaviateClosedClientError, WeaviateStartUpError WCS_HOST = "piblpmmdsiknacjnm1ltla.c1.europe-west3.gcp.weaviate.cloud" WCS_URL = f"https://{WCS_HOST}" diff --git a/integration/test_client_debug.py b/integration/test_client_debug.py index b9c2b4840..d9b2777c2 100644 --- a/integration/test_client_debug.py +++ b/integration/test_client_debug.py @@ -1,11 +1,11 @@ import pytest + from integration.conftest import ( AsyncClientFactory, AsyncCollectionFactory, ClientFactory, CollectionFactory, ) - from weaviate.classes.config import DataType, Property from weaviate.classes.debug import DebugRESTObject diff --git a/integration/test_collection.py b/integration/test_collection.py index 658b4d01c..958baa54d 100644 --- a/integration/test_collection.py +++ b/integration/test_collection.py @@ -7,46 +7,54 @@ import pytest -from integration.conftest import CollectionFactory, CollectionFactoryGet, _sanitize_collection_name -from integration.constants import WEAVIATE_LOGO_OLD_ENCODED, WEAVIATE_LOGO_NEW_ENCODED +from integration.conftest import ( + CollectionFactory, + CollectionFactoryGet, + _sanitize_collection_name, +) +from integration.constants import WEAVIATE_LOGO_NEW_ENCODED, WEAVIATE_LOGO_OLD_ENCODED from weaviate.collections.classes.batch import ErrorObject from weaviate.collections.classes.config import ( Configure, + ConsistencyLevel, DataType, Property, ReferenceProperty, Tokenization, Vectorizers, - ConsistencyLevel, ) from weaviate.collections.classes.data import ( DataObject, ) from weaviate.collections.classes.grpc import ( - QueryReference, - HybridFusion, + PROPERTIES, + PROPERTY, + REFERENCE, GroupBy, + HybridFusion, MetadataQuery, Move, + NearMediaType, + QueryReference, Sort, _Sorting, - PROPERTIES, - PROPERTY, - REFERENCE, - NearMediaType, ) from weaviate.collections.classes.internal import ( - _CrossReference, Object, ReferenceToMulti, + _CrossReference, +) +from weaviate.collections.classes.types import ( + PhoneNumber, + WeaviateProperties, + _PhoneNumber, ) -from weaviate.collections.classes.types import PhoneNumber, _PhoneNumber, WeaviateProperties from weaviate.exceptions import ( UnexpectedStatusCodeError, - WeaviateInvalidInputError, - WeaviateQueryError, WeaviateInsertInvalidPropertyError, WeaviateInsertManyAllFailedError, + WeaviateInvalidInputError, + WeaviateQueryError, WeaviateUnsupportedFeatureError, ) from weaviate.types import UUID, UUIDS @@ -69,7 +77,7 @@ class TestInsert(TypedDict): dummy = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ) collection = collection_factory_get(dummy.name, TestInsert) uuid = collection.data.insert(properties=TestInsert(name="some name")) @@ -85,7 +93,7 @@ def test_insert_with_dict_generic( ) -> None: dummy = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ) collection = collection_factory_get(dummy.name, Dict[str, str]) uuid = collection.data.insert(properties={"name": "some name"}) @@ -98,7 +106,7 @@ def test_insert_with_dict_generic( def test_insert_with_no_generic(collection_factory: CollectionFactory) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ) uuid = collection.data.insert(properties={"name": "some name"}) objects = collection.query.fetch_objects() @@ -110,7 +118,7 @@ def test_insert_with_no_generic(collection_factory: CollectionFactory) -> None: def test_insert_with_consistency_level(collection_factory: CollectionFactory) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ).with_consistency_level(ConsistencyLevel.ALL) uuid = collection.data.insert(properties={"name": "some name"}) objects = collection.query.fetch_objects() @@ -132,7 +140,7 @@ def __init__(self) -> None: def test_delete_by_id(collection_factory: CollectionFactory) -> None: collection = collection_factory( - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ) uuid = collection.data.insert(properties={}) @@ -143,7 +151,7 @@ def test_delete_by_id(collection_factory: CollectionFactory) -> None: def test_delete_by_id_consistency_level(collection_factory: CollectionFactory) -> None: collection = collection_factory( - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ).with_consistency_level(ConsistencyLevel.ALL) uuid = collection.data.insert(properties={}) @@ -222,7 +230,7 @@ def test_insert_many( ) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ) if not should_error: ret = collection.data.insert_many(objects) @@ -256,7 +264,7 @@ def test_insert_many_all_error( ) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), multi_tenancy_config=Configure.multi_tenancy(True), ) with pytest.raises(WeaviateInsertManyAllFailedError) as e: @@ -276,7 +284,7 @@ class TestInsertManyWithTypedDict(TypedDict): dummy = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ) collection = collection_factory_get(dummy.name, TestInsertManyWithTypedDict) ret = collection.data.insert_many( @@ -294,9 +302,7 @@ class TestInsertManyWithTypedDict(TypedDict): def test_insert_many_with_refs(collection_factory: CollectionFactory) -> None: - ref_collection = collection_factory( - name="target", vectorizer_config=Configure.Vectorizer.none() - ) + ref_collection = collection_factory(name="target", vector_config=Configure.Vectors.none()) uuid_to1 = ref_collection.data.insert(properties={}) uuid_to2 = ref_collection.data.insert(properties={}) @@ -304,7 +310,7 @@ def test_insert_many_with_refs(collection_factory: CollectionFactory) -> None: name="source", properties=[Property(name="Name", data_type=DataType.TEXT)], references=[ReferenceProperty(name="ref_single", target_collection=ref_collection.name)], - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ) collection.config.add_reference( ReferenceProperty.MultiTarget( @@ -375,7 +381,7 @@ def test_insert_many_with_refs(collection_factory: CollectionFactory) -> None: def test_insert_many_error(collection_factory: CollectionFactory) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ) ret = collection.data.insert_many( [ @@ -401,7 +407,7 @@ def test_insert_many_error(collection_factory: CollectionFactory) -> None: def test_replace(collection_factory: CollectionFactory) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ) uuid = collection.data.insert(properties={"name": "some name"}) collection.data.replace(properties={"name": "other name"}, uuid=uuid) @@ -410,9 +416,7 @@ def test_replace(collection_factory: CollectionFactory) -> None: @pytest.mark.parametrize("to_uuids", [UUID3, [UUID3]]) def test_replace_with_refs(collection_factory: CollectionFactory, to_uuids: UUIDS) -> None: - ref_collection = collection_factory( - name="target", vectorizer_config=Configure.Vectorizer.none() - ) + ref_collection = collection_factory(name="target", vector_config=Configure.Vectors.none()) ref_collection.data.insert(properties={}, uuid=UUID1) ref_collection.data.insert(properties={}, uuid=UUID2) ref_collection.data.insert(properties={}, uuid=UUID3) @@ -421,7 +425,7 @@ def test_replace_with_refs(collection_factory: CollectionFactory, to_uuids: UUID name="source", properties=[Property(name="Name", data_type=DataType.TEXT)], references=[ReferenceProperty(name="ref", target_collection=ref_collection.name)], - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ) uuid = collection.data.insert( properties={"name": "some name"}, @@ -451,7 +455,7 @@ def test_replace_with_refs(collection_factory: CollectionFactory, to_uuids: UUID def test_replace_overwrites_vector(collection_factory: CollectionFactory) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ) uuid = collection.data.insert(properties={"name": "some name"}, vector=[1, 2, 3]) obj = collection.query.fetch_object_by_id(uuid, include_vector=True) @@ -471,9 +475,7 @@ def test_replace_overwrites_vector(collection_factory: CollectionFactory) -> Non @pytest.mark.parametrize("to_uuids", [UUID3, [UUID3]]) def test_update_with_refs(collection_factory: CollectionFactory, to_uuids: UUIDS) -> None: - ref_collection = collection_factory( - name="target", vectorizer_config=Configure.Vectorizer.none() - ) + ref_collection = collection_factory(name="target", vector_config=Configure.Vectors.none()) ref_collection.data.insert(properties={}, uuid=UUID1) ref_collection.data.insert(properties={}, uuid=UUID2) ref_collection.data.insert(properties={}, uuid=UUID3) @@ -482,7 +484,7 @@ def test_update_with_refs(collection_factory: CollectionFactory, to_uuids: UUIDS name="source", properties=[Property(name="Name", data_type=DataType.TEXT)], references=[ReferenceProperty(name="ref", target_collection=ref_collection.name)], - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ) uuid = collection.data.insert( properties={"name": "some name"}, @@ -526,7 +528,7 @@ def test_types(collection_factory: CollectionFactory, data_type: DataType, value name = "name" collection = collection_factory( properties=[Property(name=name, data_type=data_type)], - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ) uuid_object = collection.data.insert(properties={name: value}) @@ -543,7 +545,7 @@ def test_types(collection_factory: CollectionFactory, data_type: DataType, value def test_bm25(collection_factory: CollectionFactory) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ) res = collection.data.insert_many( @@ -560,7 +562,7 @@ def test_bm25(collection_factory: CollectionFactory) -> None: def test_bm25_group_by(collection_factory: CollectionFactory) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ) res = collection.data.insert_many( @@ -588,7 +590,7 @@ def test_bm25_group_by(collection_factory: CollectionFactory) -> None: def test_bm25_limit(collection_factory: CollectionFactory, limit: int) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT, tokenization=Tokenization.WORD)], - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ) res = collection.data.insert_many( @@ -606,7 +608,7 @@ def test_bm25_limit(collection_factory: CollectionFactory, limit: int) -> None: def test_bm25_offset(collection_factory: CollectionFactory, offset: int, expected: int) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT, tokenization=Tokenization.WORD)], - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ) res = collection.data.insert_many( @@ -625,7 +627,7 @@ def test_bm25_offset(collection_factory: CollectionFactory, offset: int, expecte def test_fetch_objects_offset(collection_factory: CollectionFactory, offset: int) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ) nr_objects = 5 @@ -640,7 +642,7 @@ def test_fetch_objects_offset(collection_factory: CollectionFactory, offset: int def test_fetch_objects_limit(collection_factory: CollectionFactory, limit: int) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ) for i in range(5): collection.data.insert({"Name": str(i)}) @@ -651,7 +653,7 @@ def test_fetch_objects_limit(collection_factory: CollectionFactory, limit: int) def test_search_after(collection_factory: CollectionFactory) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ) nr_objects = 10 @@ -667,7 +669,7 @@ def test_search_after(collection_factory: CollectionFactory) -> None: def test_auto_limit(collection_factory: CollectionFactory) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), inverted_index_config=Configure.inverted_index(), ) for _ in range(4): @@ -700,7 +702,7 @@ def test_query_properties(collection_factory: CollectionFactory) -> None: Property(name="Name", data_type=DataType.TEXT), Property(name="Age", data_type=DataType.INT), ], - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ) collection.data.insert({"Name": "rain", "Age": 1}) collection.data.insert({"Name": "sun", "Age": 2}) @@ -726,9 +728,7 @@ def test_query_properties(collection_factory: CollectionFactory) -> None: def test_near_object(collection_factory: CollectionFactory) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vectorizer_config=Configure.Vectorizer.text2vec_contextionary( - vectorize_collection_name=False - ), + vector_config=Configure.Vectors.text2vec_contextionary(vectorize_collection_name=False), ) uuid_banana = collection.data.insert({"Name": "Banana"}) collection.data.insert({"Name": "Fruit"}) @@ -754,9 +754,7 @@ def test_near_object(collection_factory: CollectionFactory) -> None: def test_near_object_limit(collection_factory: CollectionFactory) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vectorizer_config=Configure.Vectorizer.text2vec_contextionary( - vectorize_collection_name=False - ), + vector_config=Configure.Vectors.text2vec_contextionary(vectorize_collection_name=False), ) uuid_banana = collection.data.insert({"Name": "Banana"}) uuid_fruit = collection.data.insert({"Name": "Fruit"}) @@ -774,9 +772,7 @@ def test_near_object_limit(collection_factory: CollectionFactory) -> None: def test_near_object_offset(collection_factory: CollectionFactory) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vectorizer_config=Configure.Vectorizer.text2vec_contextionary( - vectorize_collection_name=False - ), + vector_config=Configure.Vectors.text2vec_contextionary(vectorize_collection_name=False), ) uuid_banana = collection.data.insert({"Name": "Banana"}) uuid_fruit = collection.data.insert({"Name": "Fruit"}) @@ -796,9 +792,7 @@ def test_near_object_group_by_argument(collection_factory: CollectionFactory) -> Property(name="Name", data_type=DataType.TEXT), Property(name="Count", data_type=DataType.INT), ], - vectorizer_config=Configure.Vectorizer.text2vec_contextionary( - vectorize_collection_name=False - ), + vector_config=Configure.Vectors.text2vec_contextionary(vectorize_collection_name=False), ) uuid_banana1 = collection.data.insert({"Name": "Banana", "Count": 51}) collection.data.insert({"Name": "Banana", "Count": 72}) @@ -818,14 +812,14 @@ def test_near_object_group_by_argument(collection_factory: CollectionFactory) -> assert len(ret.objects) == 4 assert ret.objects[0].belongs_to_group == "Banana" assert ret.objects[1].belongs_to_group == "Banana" - assert ret.objects[2].belongs_to_group == "car" - assert ret.objects[3].belongs_to_group == "Mountain" + assert ret.objects[2].belongs_to_group == "Mountain" + assert ret.objects[3].belongs_to_group == "car" def test_multi_searches(collection_factory: CollectionFactory) -> None: collection = collection_factory( properties=[Property(name="name", data_type=DataType.TEXT)], - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ) collection.data.insert(properties={"name": "word"}) @@ -852,7 +846,7 @@ def test_multi_searches(collection_factory: CollectionFactory) -> None: def test_fetch_objects_with_limit(collection_factory: CollectionFactory) -> None: collection = collection_factory( - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), properties=[Property(name="name", data_type=DataType.TEXT)], ) @@ -865,7 +859,7 @@ def test_fetch_objects_with_limit(collection_factory: CollectionFactory) -> None def test_add_property(collection_factory: CollectionFactory) -> None: collection = collection_factory( - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), properties=[Property(name="name", data_type=DataType.TEXT)], ) uuid1 = collection.data.insert({"name": "first"}) @@ -880,9 +874,7 @@ def test_add_property(collection_factory: CollectionFactory) -> None: def test_add_property_with_vectorizer(collection_factory: CollectionFactory) -> None: collection = collection_factory( - vectorizer_config=Configure.Vectorizer.text2vec_contextionary( - vectorize_collection_name=False - ), + vector_config=Configure.Vectors.text2vec_contextionary(vectorize_collection_name=False), properties=[Property(name="name", data_type=DataType.TEXT)], ) collection.config.add_property( @@ -922,7 +914,7 @@ def test_add_property_with_vectorizer(collection_factory: CollectionFactory) -> def test_add_reference(collection_factory: CollectionFactory) -> None: collection = collection_factory( - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), properties=[Property(name="name", data_type=DataType.TEXT)], ) uuid1 = collection.data.insert({"name": "first"}) @@ -944,7 +936,7 @@ def test_add_reference(collection_factory: CollectionFactory) -> None: def test_collection_config_get(collection_factory: CollectionFactory) -> None: collection = collection_factory( - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), properties=[ Property(name="name", data_type=DataType.TEXT), Property(name="age", data_type=DataType.INT), @@ -957,7 +949,9 @@ def test_collection_config_get(collection_factory: CollectionFactory) -> None: assert config.properties[0].data_type == DataType.TEXT assert config.properties[1].name == "age" assert config.properties[1].data_type == DataType.INT - assert config.vectorizer == Vectorizers.NONE + assert config.vectorizer is None + assert config.vector_config is not None + assert config.vector_config["default"].vectorizer.vectorizer == Vectorizers.NONE @pytest.mark.parametrize("return_properties", [None, [], ["name"], False, True]) @@ -989,7 +983,7 @@ def test_return_properties_metadata_references_combos( include_vector: bool, ) -> None: collection = collection_factory( - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), properties=[ Property(name="name", data_type=DataType.TEXT), Property(name="age", data_type=DataType.INT), @@ -1065,7 +1059,7 @@ def test_insert_date_property( collection_factory: CollectionFactory, hours: int, minutes: int, sign: int ) -> None: collection = collection_factory( - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), properties=[Property(name="date", data_type=DataType.DATE)], ) @@ -1086,7 +1080,7 @@ def test_insert_date_property( def test_exist(collection_factory: CollectionFactory) -> None: collection = collection_factory( - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ) uuid1 = collection.data.insert({}) @@ -1099,7 +1093,7 @@ def test_return_list_properties(collection_factory: CollectionFactory) -> None: name_small = "TestReturnList" collection = collection_factory( name=name_small, - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), properties=[ Property(name="ints", data_type=DataType.INT_ARRAY), Property(name="floats", data_type=DataType.NUMBER_ARRAY), @@ -1141,9 +1135,7 @@ def test_near_text( return_properties: Optional[PROPERTIES], ) -> None: collection = collection_factory( - vectorizer_config=Configure.Vectorizer.text2vec_contextionary( - vectorize_collection_name=False - ), + vector_config=Configure.Vectors.text2vec_contextionary(vectorize_collection_name=False), properties=[Property(name="value", data_type=DataType.TEXT)], ) @@ -1174,7 +1166,7 @@ def test_near_text( def test_near_text_error(collection_factory: CollectionFactory) -> None: collection = collection_factory( - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ) with pytest.raises(ValueError): @@ -1183,11 +1175,12 @@ def test_near_text_error(collection_factory: CollectionFactory) -> None: def test_near_text_group_by_argument(collection_factory: CollectionFactory) -> None: collection = collection_factory( - vectorizer_config=Configure.Vectorizer.text2vec_contextionary( - vectorize_collection_name=False - ), + vector_config=Configure.Vectors.text2vec_contextionary(vectorize_collection_name=False), properties=[Property(name="value", data_type=DataType.TEXT)], ) + import json + + print(json.dumps(collection.config.get().to_dict(), indent=2)) batch_return = collection.data.insert_many( [ @@ -1220,9 +1213,7 @@ def test_near_text_group_by_argument(collection_factory: CollectionFactory) -> N def test_near_text_limit(collection_factory: CollectionFactory) -> None: collection = collection_factory( - vectorizer_config=Configure.Vectorizer.text2vec_contextionary( - vectorize_collection_name=False - ), + vector_config=Configure.Vectors.text2vec_contextionary(vectorize_collection_name=False), properties=[Property(name="value", data_type=DataType.TEXT)], ) @@ -1250,9 +1241,7 @@ def test_near_text_limit(collection_factory: CollectionFactory) -> None: def test_near_text_offset(collection_factory: CollectionFactory) -> None: collection = collection_factory( - vectorizer_config=Configure.Vectorizer.text2vec_contextionary( - vectorize_collection_name=False - ), + vector_config=Configure.Vectors.text2vec_contextionary(vectorize_collection_name=False), properties=[Property(name="value", data_type=DataType.TEXT)], ) @@ -1300,7 +1289,7 @@ def test_near_image( certainty: Optional[float], ) -> None: collection = collection_factory( - vectorizer_config=Configure.Vectorizer.img2vec_neural(image_fields=["imageProp"]), + vector_config=Configure.Vectors.img2vec_neural(image_fields=["imageProp"]), properties=[ Property(name="imageProp", data_type=DataType.BLOB), ], @@ -1357,7 +1346,7 @@ def test_near_media( certainty: Optional[float], ) -> None: collection = collection_factory( - vectorizer_config=Configure.Vectorizer.img2vec_neural(image_fields=["imageProp"]), + vector_config=Configure.Vectors.img2vec_neural(image_fields=["imageProp"]), properties=[ Property(name="imageProp", data_type=DataType.BLOB), ], @@ -1405,7 +1394,7 @@ def test_return_properties_with_query_specific_typed_dict( collection_factory: CollectionFactory, which_case: int ) -> None: collection = collection_factory( - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), properties=[ Property(name="int_", data_type=DataType.INT), Property(name="ints", data_type=DataType.INT_ARRAY), @@ -1467,7 +1456,7 @@ class _Data(TypedDict): ints: List[int] collection = collection_factory( - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), properties=[ Property(name="int_", data_type=DataType.INT), Property(name="ints", data_type=DataType.INT_ARRAY), @@ -1492,7 +1481,7 @@ class _Data(TypedDict): int_: int collection = collection_factory( - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), properties=[ Property(name="int_", data_type=DataType.INT), Property(name="ints", data_type=DataType.INT_ARRAY), @@ -1513,7 +1502,7 @@ class _Data(TypedDict): def test_batch_with_arrays(collection_factory: CollectionFactory) -> None: collection = collection_factory( - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), properties=[ Property(name="texts", data_type=DataType.TEXT_ARRAY), Property(name="ints", data_type=DataType.INT_ARRAY), @@ -1579,7 +1568,7 @@ def test_sort( expected: List[int], ) -> None: collection = collection_factory( - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), properties=[ Property(name="age", data_type=DataType.INT), Property(name="name", data_type=DataType.TEXT), @@ -1605,7 +1594,7 @@ def test_sort( def test_optional_ref_returns(collection_factory: CollectionFactory) -> None: ref_collection = collection_factory( name="target", - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), properties=[Property(name="text", data_type=DataType.TEXT)], ) uuid_to1 = ref_collection.data.insert(properties={"text": "ref text"}) @@ -1615,7 +1604,7 @@ def test_optional_ref_returns(collection_factory: CollectionFactory) -> None: references=[ ReferenceProperty(name="ref", target_collection=ref_collection.name), ], - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), ) collection.data.insert({}, references={"ref": uuid_to1}) @@ -1634,7 +1623,7 @@ def test_return_properties_with_type_hint_generic( value: str, ) -> None: dummy = collection_factory( - vectorizer_config=Configure.Vectorizer.none(), + vector_config=Configure.Vectors.none(), properties=[ Property(name="name", data_type=DataType.TEXT), ], @@ -1736,9 +1725,7 @@ def test_none_query_hybrid_bm25(collection_factory: CollectionFactory) -> None: properties=[ Property(name="text", data_type=DataType.TEXT), ], - vectorizer_config=Configure.Vectorizer.text2vec_contextionary( - vectorize_collection_name=False - ), + vector_config=Configure.Vectors.text2vec_contextionary(vectorize_collection_name=False), ) collection.data.insert({"text": "banana"}) diff --git a/integration/test_collection_aggregate.py b/integration/test_collection_aggregate.py index e1fade0be..069586393 100644 --- a/integration/test_collection_aggregate.py +++ b/integration/test_collection_aggregate.py @@ -12,13 +12,20 @@ AggregateDate, AggregateInteger, AggregateNumber, - AggregateText, AggregateReturn, - Metrics, + AggregateText, GroupByAggregate, + Metrics, +) +from weaviate.collections.classes.config import ( + Configure, + DataType, + Property, + ReferenceProperty, ) -from weaviate.collections.classes.config import DataType, Property, ReferenceProperty, Configure from weaviate.collections.classes.filters import Filter, _Filters +from weaviate.collections.classes.grpc import Move +from weaviate.collections.classes.tenants import Tenant from weaviate.exceptions import ( WeaviateInvalidInputError, WeaviateQueryError, @@ -26,10 +33,6 @@ ) from weaviate.util import file_encoder_b64 -from weaviate.collections.classes.grpc import Move - -from weaviate.collections.classes.tenants import Tenant - UUID1 = uuid.UUID("8ad0d33c-8db1-4437-87f3-72161ca2a51a") UUID2 = uuid.UUID("577887c1-4c6b-5594-aa62-f0c17883d9cf") diff --git a/integration/test_collection_batch.py b/integration/test_collection_batch.py index ee9e490bf..72b3b7c53 100644 --- a/integration/test_collection_batch.py +++ b/integration/test_collection_batch.py @@ -1,6 +1,6 @@ import uuid from dataclasses import dataclass -from typing import Generator, Optional, Union, Any, Protocol +from typing import Any, Generator, Optional, Protocol, Union import pytest @@ -13,9 +13,8 @@ ReferenceProperty, ) from weaviate.collections.classes.grpc import QueryReference -from weaviate.collections.classes.internal import _CrossReference, ReferenceToMulti +from weaviate.collections.classes.internal import ReferenceToMulti, _CrossReference from weaviate.collections.classes.tenants import Tenant - from weaviate.types import VECTORS UUID = Union[str, uuid.UUID] diff --git a/integration/test_collection_batch_delete.py b/integration/test_collection_batch_delete.py index 8f47bbe13..38c187751 100644 --- a/integration/test_collection_batch_delete.py +++ b/integration/test_collection_batch_delete.py @@ -5,10 +5,11 @@ import pytest as pytest from integration.conftest import CollectionFactory +from weaviate.classes.config import ConsistencyLevel from weaviate.collections.classes.config import ( Configure, - Property, DataType, + Property, ReferenceProperty, Tokenization, ) @@ -19,7 +20,6 @@ ) from weaviate.collections.classes.internal import ReferenceToMulti from weaviate.collections.classes.tenants import Tenant -from weaviate.classes.config import ConsistencyLevel from weaviate.exceptions import ( WeaviateQueryException, ) diff --git a/integration/test_collection_config.py b/integration/test_collection_config.py index 4a1ab1e02..814f8e976 100644 --- a/integration/test_collection_config.py +++ b/integration/test_collection_config.py @@ -5,33 +5,36 @@ import weaviate import weaviate.classes as wvc -from integration.conftest import OpenAICollection, CollectionFactory -from integration.conftest import _sanitize_collection_name +from integration.conftest import ( + CollectionFactory, + OpenAICollection, + _sanitize_collection_name, +) from weaviate.collections.classes.config import ( - _BQConfig, - _SQConfig, - _CollectionConfig, - _CollectionConfigSimple, - _PQConfig, - _VectorIndexConfigDynamic, - _VectorIndexConfigFlat, - _VectorIndexConfigHNSW, - _VectorIndexConfigHNSWUpdate, Configure, - Reconfigure, - Property, - ReferenceProperty, DataType, - PQEncoderType, + GenerativeSearches, PQEncoderDistribution, + PQEncoderType, + Property, + Reconfigure, + ReferenceProperty, + Rerankers, StopwordsPreset, + Tokenization, VectorDistances, VectorIndexType, Vectorizers, - GenerativeSearches, - Rerankers, + _BQConfig, + _CollectionConfig, + _CollectionConfigSimple, + _PQConfig, _RerankerProvider, - Tokenization, + _SQConfig, + _VectorIndexConfigDynamic, + _VectorIndexConfigFlat, + _VectorIndexConfigHNSW, + _VectorIndexConfigHNSWUpdate, ) from weaviate.collections.classes.tenants import Tenant from weaviate.exceptions import UnexpectedStatusCodeError, WeaviateInvalidInputError @@ -1248,6 +1251,30 @@ def test_named_vectors_export_and_import( client.collections.delete(name) +@pytest.mark.parametrize("source_properties", [None, ["text"]]) +def test_vectors_export_and_import( + collection_factory: CollectionFactory, source_properties: Optional[List[str]] +) -> None: + collection = collection_factory( + properties=[Property(name="text", data_type=DataType.TEXT)], + vector_config=Configure.Vectors.text2vec_contextionary( + vectorize_collection_name=False, + source_properties=source_properties, + ), + ) + config = collection.config.get() + + name = f"TestCollectionConfigExportAndRecreate_{collection.name}" + config.name = name + with weaviate.connect_to_local() as client: + client.collections.delete(name) + client.collections.create_from_config(config) + new = client.collections.use(name).config.get() + assert config == new + assert config.to_dict() == new.to_dict() + client.collections.delete(name) + + @pytest.mark.parametrize("source_properties", [None, ["text"]]) def test_named_vectors_export_and_import_dict( collection_factory: CollectionFactory, source_properties: Optional[List[str]] @@ -1275,6 +1302,30 @@ def test_named_vectors_export_and_import_dict( client.collections.delete(name) +@pytest.mark.parametrize("source_properties", [None, ["text"]]) +def test_vectors_export_and_import_dict( + collection_factory: CollectionFactory, source_properties: Optional[List[str]] +) -> None: + collection = collection_factory( + properties=[Property(name="text", data_type=DataType.TEXT)], + vector_config=Configure.Vectors.text2vec_contextionary( + vectorize_collection_name=False, + source_properties=source_properties, + ), + ) + config = collection.config.get() + + name = f"TestCollectionConfigExportAndRecreateDict_{collection.name}" + config.name = name + with weaviate.connect_to_local() as client: + client.collections.delete(name) + client.collections.create_from_dict(config.to_dict()) + new = client.collections.use(name).config.get() + assert config == new + assert config.to_dict() == new.to_dict() + client.collections.delete(name) + + @pytest.mark.parametrize("index_range_filters", [True, False]) def test_range_filters(collection_factory: CollectionFactory, index_range_filters: bool) -> None: collection_dummy = collection_factory("dummy") diff --git a/integration/test_collection_filter.py b/integration/test_collection_filter.py index 01fc7fe9f..025fa4279 100644 --- a/integration/test_collection_filter.py +++ b/integration/test_collection_filter.py @@ -9,8 +9,8 @@ from integration.conftest import CollectionFactory from weaviate.collections.classes.config import ( Configure, - Property, DataType, + Property, ReferenceProperty, ) from weaviate.collections.classes.data import DataObject diff --git a/integration/test_collection_get.py b/integration/test_collection_get.py index ae4e0016b..b1f962716 100644 --- a/integration/test_collection_get.py +++ b/integration/test_collection_get.py @@ -1,12 +1,12 @@ from dataclasses import dataclass -from typing import Any, TypedDict, Dict +from typing import Any, Dict, TypedDict import pytest from _pytest.fixtures import SubRequest from pydantic import BaseModel from pydantic.dataclasses import dataclass as pydantic_dataclass -from integration.conftest import CollectionFactoryGet, CollectionFactory +from integration.conftest import CollectionFactory, CollectionFactoryGet from weaviate.collections import Collection from weaviate.collections.data import _DataCollection from weaviate.exceptions import InvalidDataModelException diff --git a/integration/test_collection_hybrid.py b/integration/test_collection_hybrid.py index b799fc9c2..c06a7be47 100644 --- a/integration/test_collection_hybrid.py +++ b/integration/test_collection_hybrid.py @@ -14,8 +14,8 @@ Property, ) from weaviate.collections.classes.grpc import ( - HybridFusion, GroupBy, + HybridFusion, MetadataQuery, NearVectorInputType, _HybridNearVector, diff --git a/integration/test_collection_multi_node.py b/integration/test_collection_multi_node.py index 6765f0809..355936f96 100644 --- a/integration/test_collection_multi_node.py +++ b/integration/test_collection_multi_node.py @@ -3,9 +3,9 @@ from integration.conftest import CollectionFactory from weaviate.collections.classes.config import ( Configure, - Property, ConsistencyLevel, DataType, + Property, ) from weaviate.collections.classes.data import DataObject from weaviate.collections.classes.grpc import MetadataQuery diff --git a/integration/test_collection_references.py b/integration/test_collection_references.py index 445b62fd6..e5446a959 100644 --- a/integration/test_collection_references.py +++ b/integration/test_collection_references.py @@ -7,8 +7,8 @@ from integration.conftest import CollectionFactory, CollectionFactoryGet from weaviate.collections.classes.config import ( Configure, - Property, DataType, + Property, ReferenceProperty, ) from weaviate.collections.classes.data import DataObject, DataReference @@ -18,9 +18,9 @@ ) from weaviate.collections.classes.internal import ( CrossReference, - ReferenceToMulti, CrossReferenceAnnotation, ReferenceInput, + ReferenceToMulti, SingleReferenceInput, ) from weaviate.exceptions import WeaviateInvalidInputError diff --git a/integration/test_collection_rerank.py b/integration/test_collection_rerank.py index dc4f362d0..9c15111cd 100644 --- a/integration/test_collection_rerank.py +++ b/integration/test_collection_rerank.py @@ -3,6 +3,7 @@ import pytest import weaviate.classes as wvc + from .conftest import CollectionFactory diff --git a/integration/test_collections_sorting.py b/integration/test_collections_sorting.py index 343a47412..d5541ebc3 100644 --- a/integration/test_collections_sorting.py +++ b/integration/test_collections_sorting.py @@ -1,4 +1,5 @@ import pytest + from integration.conftest import ClientFactory diff --git a/integration/test_iterator.py b/integration/test_iterator.py index eee811f3b..033c6d73b 100644 --- a/integration/test_iterator.py +++ b/integration/test_iterator.py @@ -14,9 +14,9 @@ DataObject, ) from weaviate.collections.classes.grpc import ( - MetadataQuery, METADATA, PROPERTIES, + MetadataQuery, ) from weaviate.collections.iterator import ITERATOR_CACHE_SIZE from weaviate.exceptions import WeaviateInvalidInputError diff --git a/integration/test_rbac.py b/integration/test_rbac.py index 29273f104..19984f988 100644 --- a/integration/test_rbac.py +++ b/integration/test_rbac.py @@ -1,24 +1,24 @@ from typing import List import pytest +from _pytest.fixtures import SubRequest from integration.conftest import ClientFactory, _sanitize_collection_name from weaviate.auth import Auth -from weaviate.classes.rbac import Permissions, Actions, RoleScope +from weaviate.classes.rbac import Actions, Permissions, RoleScope from weaviate.rbac.models import ( - _Permission, - Role, BackupsPermissionOutput, ClusterPermissionOutput, CollectionsPermissionOutput, DataPermissionOutput, - RolesPermissionOutput, NodesPermissionOutput, + Role, + RolesPermissionOutput, TenantsPermissionOutput, UsersPermissionOutput, UserTypes, + _Permission, ) -from _pytest.fixtures import SubRequest RBAC_PORTS = (8092, 50063) RBAC_AUTH_CREDS = Auth.api_key("admin-key") diff --git a/integration/test_tenants.py b/integration/test_tenants.py index 5bfd04016..7665517e6 100644 --- a/integration/test_tenants.py +++ b/integration/test_tenants.py @@ -15,11 +15,14 @@ ) from weaviate.collections.classes.tenants import ( Tenant, - TenantCreate, TenantActivityStatus, + TenantCreate, ) from weaviate.collections.tenants import TenantCreateInputType -from weaviate.exceptions import WeaviateInvalidInputError, WeaviateUnsupportedFeatureError +from weaviate.exceptions import ( + WeaviateInvalidInputError, + WeaviateUnsupportedFeatureError, +) def test_shards_on_tenants( diff --git a/integration/test_users.py b/integration/test_users.py index 6cecf43e6..5ac417cdd 100644 --- a/integration/test_users.py +++ b/integration/test_users.py @@ -1,14 +1,12 @@ import random + import pytest +import weaviate from integration.conftest import ClientFactory from weaviate.auth import Auth - -import weaviate - from weaviate.rbac.models import Role, RoleBase, UserTypes - RBAC_PORTS = (8092, 50063) RBAC_AUTH_CREDS = Auth.api_key("admin-key") diff --git a/integration/test_named_vectors.py b/integration/test_vectors.py similarity index 85% rename from integration/test_named_vectors.py rename to integration/test_vectors.py index b60f4354a..229f7531e 100644 --- a/integration/test_named_vectors.py +++ b/integration/test_vectors.py @@ -1,6 +1,6 @@ import os import uuid -from typing import List, Union, Dict, Sequence +from typing import Dict, List, Sequence, Union import pytest @@ -9,14 +9,17 @@ from weaviate.collections.classes.aggregate import AggregateInteger from weaviate.collections.classes.config import ( PQConfig, - _VectorIndexConfigHNSW, - _VectorIndexConfigFlat, - _MultiVectorConfig, - Vectorizers, ReferenceProperty, + Vectorizers, + _MultiVectorConfig, + _VectorIndexConfigFlat, + _VectorIndexConfigHNSW, ) from weaviate.collections.classes.data import DataObject -from weaviate.collections.classes.grpc import _MultiTargetVectorJoin, _ListOfVectorsQuery +from weaviate.collections.classes.grpc import ( + _ListOfVectorsQuery, + _MultiTargetVectorJoin, +) from weaviate.exceptions import WeaviateInvalidInputError, WeaviateQueryError from weaviate.types import INCLUDE_VECTOR @@ -34,23 +37,23 @@ def test_create_named_vectors( wvc.config.Property(name="title", data_type=wvc.config.DataType.TEXT), wvc.config.Property(name="content", data_type=wvc.config.DataType.TEXT), ], - vectorizer_config=[ - wvc.config.Configure.NamedVectors.text2vec_contextionary( - "title", source_properties=["title"], vectorize_collection_name=False + vector_config=[ + wvc.config.Configure.Vectors.text2vec_contextionary( + name="title", source_properties=["title"], vectorize_collection_name=False ), - wvc.config.Configure.NamedVectors.text2vec_contextionary( + wvc.config.Configure.Vectors.text2vec_contextionary( name="content", source_properties=["content"], vectorize_collection_name=False ), - wvc.config.Configure.NamedVectors.text2vec_contextionary( + wvc.config.Configure.Vectors.text2vec_contextionary( name="All", vectorize_collection_name=False ), - wvc.config.Configure.NamedVectors.text2vec_contextionary( + wvc.config.Configure.Vectors.text2vec_contextionary( name="AllExplicit", source_properties=["title", "content"], vectorize_collection_name=False, ), - wvc.config.Configure.NamedVectors.none(name="bringYourOwn"), - wvc.config.Configure.NamedVectors.none(name="bringYourOwn2"), + wvc.config.Configure.Vectors.none(name="bringYourOwn"), + wvc.config.Configure.Vectors.none(name="bringYourOwn2"), ], ) @@ -87,11 +90,11 @@ def test_insert_many_add(collection_factory: CollectionFactory) -> None: wvc.config.Property(name="title", data_type=wvc.config.DataType.TEXT), wvc.config.Property(name="content", data_type=wvc.config.DataType.TEXT), ], - vectorizer_config=[ - wvc.config.Configure.NamedVectors.text2vec_contextionary( - "title", source_properties=["title"], vectorize_collection_name=False + vector_config=[ + wvc.config.Configure.Vectors.text2vec_contextionary( + name="title", source_properties=["title"], vectorize_collection_name=False ), - wvc.config.Configure.NamedVectors.none(name="bringYourOwn"), + wvc.config.Configure.Vectors.none(name="bringYourOwn"), ], ) @@ -117,8 +120,8 @@ def test_update(collection_factory: CollectionFactory) -> None: wvc.config.Property(name="title", data_type=wvc.config.DataType.TEXT), wvc.config.Property(name="content", data_type=wvc.config.DataType.TEXT), ], - vectorizer_config=[ - wvc.config.Configure.NamedVectors.none(name="bringYourOwn"), + vector_config=[ + wvc.config.Configure.Vectors.none(name="bringYourOwn"), ], ) @@ -149,8 +152,8 @@ def test_replace(collection_factory: CollectionFactory) -> None: wvc.config.Property(name="title", data_type=wvc.config.DataType.TEXT), wvc.config.Property(name="content", data_type=wvc.config.DataType.TEXT), ], - vectorizer_config=[ - wvc.config.Configure.NamedVectors.none(name="bringYourOwn"), + vector_config=[ + wvc.config.Configure.Vectors.none(name="bringYourOwn"), ], ) @@ -182,11 +185,11 @@ def test_query(collection_factory: CollectionFactory) -> None: wvc.config.Property(name="title", data_type=wvc.config.DataType.TEXT), wvc.config.Property(name="content", data_type=wvc.config.DataType.TEXT), ], - vectorizer_config=[ - wvc.config.Configure.NamedVectors.text2vec_contextionary( - "title", source_properties=["title"], vectorize_collection_name=False + vector_config=[ + wvc.config.Configure.Vectors.text2vec_contextionary( + name="title", source_properties=["title"], vectorize_collection_name=False ), - wvc.config.Configure.NamedVectors.text2vec_contextionary( + wvc.config.Configure.Vectors.text2vec_contextionary( name="content", source_properties=["content"], vectorize_collection_name=False ), ], @@ -212,11 +215,11 @@ def test_generate(openai_collection: OpenAICollection) -> None: if collection._connection._weaviate_version.is_lower_than(1, 24, 0): pytest.skip("Named vectors are not supported in versions lower than 1.24.0") collection = openai_collection( - vectorizer_config=[ - wvc.config.Configure.NamedVectors.text2vec_openai( - "text", source_properties=["text"], vectorize_collection_name=False + vector_config=[ + wvc.config.Configure.Vectors.text2vec_openai( + name="text", source_properties=["text"], vectorize_collection_name=False ), - wvc.config.Configure.NamedVectors.text2vec_openai( + wvc.config.Configure.Vectors.text2vec_openai( name="content", source_properties=["content"], vectorize_collection_name=False ), ], @@ -258,11 +261,11 @@ def test_batch_add(collection_factory: CollectionFactory) -> None: wvc.config.Property(name="title", data_type=wvc.config.DataType.TEXT), wvc.config.Property(name="content", data_type=wvc.config.DataType.TEXT), ], - vectorizer_config=[ - wvc.config.Configure.NamedVectors.text2vec_contextionary( - "title", source_properties=["title"], vectorize_collection_name=False + vector_config=[ + wvc.config.Configure.Vectors.text2vec_contextionary( + name="title", source_properties=["title"], vectorize_collection_name=False ), - wvc.config.Configure.NamedVectors.none(name="bringYourOwn"), + wvc.config.Configure.Vectors.none(name="bringYourOwn"), ], ) uuid1 = uuid.uuid4() @@ -286,9 +289,9 @@ def test_named_vector_with_index_config(collection_factory: CollectionFactory) - wvc.config.Property(name="title", data_type=wvc.config.DataType.TEXT), wvc.config.Property(name="second", data_type=wvc.config.DataType.TEXT), ], - vectorizer_config=[ - wvc.config.Configure.NamedVectors.text2vec_contextionary( - "title", + vector_config=[ + wvc.config.Configure.Vectors.text2vec_contextionary( + name="title", source_properties=["title"], vectorize_collection_name=False, vector_index_config=wvc.config.Configure.VectorIndex.flat( @@ -296,11 +299,11 @@ def test_named_vector_with_index_config(collection_factory: CollectionFactory) - quantizer=wvc.config.Configure.VectorIndex.Quantizer.bq(rescore_limit=10), ), ), - wvc.config.Configure.NamedVectors.none( - "custom", + wvc.config.Configure.Vectors.none( + name="custom", ), - wvc.config.Configure.NamedVectors.text2vec_contextionary( - "default", + wvc.config.Configure.Vectors.text2vec_contextionary( + name="default", vectorize_collection_name=False, # needed as contextionary cant handle "_" in collection names ), ], @@ -342,15 +345,15 @@ def test_aggregation(collection_factory: CollectionFactory) -> None: wvc.config.Property(name="second", data_type=wvc.config.DataType.TEXT), wvc.config.Property(name="number", data_type=wvc.config.DataType.INT), ], - # vectorizer_config=wvc.config.Configure.Vectorizer.text2vec_contextionary(vectorize_collection_name=False), - vectorizer_config=[ - wvc.config.Configure.NamedVectors.text2vec_contextionary( - "first", + # vector_config=wvc.config.Configure.Vectorizer.text2vec_contextionary(vectorize_collection_name=False), + vector_config=[ + wvc.config.Configure.Vectors.text2vec_contextionary( + name="first", source_properties=["first"], vectorize_collection_name=False, ), - wvc.config.Configure.NamedVectors.text2vec_contextionary( - "second", + wvc.config.Configure.Vectors.text2vec_contextionary( + name="second", source_properties=["second"], vectorize_collection_name=False, ), @@ -417,14 +420,14 @@ def test_update_to_enable_quantizer_on_specific_named_vector( wvc.config.Property(name="first", data_type=wvc.config.DataType.TEXT), wvc.config.Property(name="second", data_type=wvc.config.DataType.TEXT), ], - vectorizer_config=[ - wvc.config.Configure.NamedVectors.text2vec_contextionary( - "first", + vector_config=[ + wvc.config.Configure.Vectors.text2vec_contextionary( + name="first", source_properties=["first"], vectorize_collection_name=False, ), - wvc.config.Configure.NamedVectors.text2vec_contextionary( - "second", + wvc.config.Configure.Vectors.text2vec_contextionary( + name="second", source_properties=["second"], vectorize_collection_name=False, ), @@ -438,8 +441,8 @@ def test_update_to_enable_quantizer_on_specific_named_vector( assert config.vector_config["second"].vector_index_config.quantizer is None collection.config.update( - vectorizer_config=[ - wvc.config.Reconfigure.NamedVectors.update( + vector_config=[ + wvc.config.Reconfigure.Vectors.update( name="second", vector_index_config=wvc.config.Reconfigure.VectorIndex.hnsw( quantizer=wvc.config.Reconfigure.VectorIndex.Quantizer.pq() @@ -467,13 +470,13 @@ def test_update_to_enable_quantizer_on_specific_named_vector( # wvc.config.Property(name="first", data_type=wvc.config.DataType.TEXT), # wvc.config.Property(name="second", data_type=wvc.config.DataType.TEXT), # ], -# vectorizer_config=[ -# wvc.config.Configure.NamedVectors.text2vec_contextionary( +# vector_config=[ +# wvc.config.Configure.Vectors.text2vec_contextionary( # "first", # source_properties=["first"], # vectorize_collection_name=False, # ), -# wvc.config.Configure.NamedVectors.text2vec_contextionary( +# wvc.config.Configure.Vectors.text2vec_contextionary( # "second", # source_properties=["second"], # vectorize_collection_name=False, @@ -492,8 +495,8 @@ def test_update_to_enable_quantizer_on_specific_named_vector( # with pytest.raises(WeaviateInvalidInputError): # collection.config.update( -# vectorizer_config=[ -# wvc.config.Reconfigure.NamedVectors.update( +# vector_config=[ +# wvc.config.ReConfigure.Vectors.update( # name="second", # vector_index_config=wvc.config.Reconfigure.VectorIndex.hnsw( # quantizer=wvc.config.Reconfigure.VectorIndex.Quantizer.bq() @@ -507,12 +510,12 @@ def test_duplicate_named_vectors(collection_factory: CollectionFactory) -> None: with pytest.raises(WeaviateInvalidInputError) as e: collection_factory( - vectorizer_config=[ - wvc.config.Configure.NamedVectors.text2vec_contextionary( - "title", source_properties=["title"], vectorize_collection_name=False + vector_config=[ + wvc.config.Configure.Vectors.text2vec_contextionary( + name="title", source_properties=["title"], vectorize_collection_name=False ), - wvc.config.Configure.NamedVectors.text2vec_contextionary( - "title", source_properties=["content"], vectorize_collection_name=False + wvc.config.Configure.Vectors.text2vec_contextionary( + name="title", source_properties=["content"], vectorize_collection_name=False ), ], ) @@ -539,9 +542,9 @@ def test_named_vector_multi_target( collection = collection_factory( properties=[], - vectorizer_config=[ - wvc.config.Configure.NamedVectors.none("first"), - wvc.config.Configure.NamedVectors.none("second"), + vector_config=[ + wvc.config.Configure.Vectors.none(name="first"), + wvc.config.Configure.Vectors.none(name="second"), ], ) @@ -559,9 +562,9 @@ def test_named_vector_multi_target_vector_per_target(collection_factory: Collect collection = collection_factory( properties=[], - vectorizer_config=[ - wvc.config.Configure.NamedVectors.none("first"), - wvc.config.Configure.NamedVectors.none("second"), + vector_config=[ + wvc.config.Configure.Vectors.none(name="first"), + wvc.config.Configure.Vectors.none(name="second"), ], ) @@ -581,9 +584,9 @@ def test_multi_query_error_no_target_vector(collection_factory: CollectionFactor collection = collection_factory( properties=[], - vectorizer_config=[ - wvc.config.Configure.NamedVectors.none("first"), - wvc.config.Configure.NamedVectors.none("second"), + vector_config=[ + wvc.config.Configure.Vectors.none(name="first"), + wvc.config.Configure.Vectors.none(name="second"), ], ) @@ -592,7 +595,7 @@ def test_multi_query_error_no_target_vector(collection_factory: CollectionFactor with pytest.raises(WeaviateInvalidInputError): collection.query.near_vector([[1.0, 0.0], [1.0, 0.0, 0.0]]) with pytest.raises(WeaviateInvalidInputError): - collection.query.near_vector([[[1.0, 0.0], [1.0, 0.0]], [1.0, 0.0, 0.0]]) + collection.query.near_vector([[[1.0, 0.0], [1.0, 0.0]], [1.0, 0.0, 0.0]]) # type: ignore else: # throws an error in the server instead as implicit multi vector is understood now as using multi-vectors with pytest.raises(WeaviateQueryError): @@ -628,9 +631,9 @@ def test_same_target_vector_multiple_input( collection = collection_factory( properties=[], - vectorizer_config=[ - wvc.config.Configure.NamedVectors.none("first"), - wvc.config.Configure.NamedVectors.none("second"), + vector_config=[ + wvc.config.Configure.Vectors.none(name="first"), + wvc.config.Configure.Vectors.none(name="second"), ], ) @@ -680,9 +683,9 @@ def test_same_target_vector_multiple_input_combinations( collection = collection_factory( properties=[], - vectorizer_config=[ - wvc.config.Configure.NamedVectors.none("first"), - wvc.config.Configure.NamedVectors.none("second"), + vector_config=[ + wvc.config.Configure.Vectors.none(name="first"), + wvc.config.Configure.Vectors.none(name="second"), ], ) @@ -706,9 +709,9 @@ def test_deprecated_syntax(collection_factory: CollectionFactory): collection = collection_factory( properties=[], - vectorizer_config=[ - wvc.config.Configure.NamedVectors.none("first"), - wvc.config.Configure.NamedVectors.none("second"), + vector_config=[ + wvc.config.Configure.Vectors.none(name="first"), + wvc.config.Configure.Vectors.none(name="second"), ], ) @@ -717,7 +720,7 @@ def test_deprecated_syntax(collection_factory: CollectionFactory): with pytest.raises(WeaviateInvalidInputError) as e: collection.query.near_vector( - [[0.0, 1.0], [[1.0, 0.0, 0.0], [0.0, 0.0, 1.0]]], + [[0.0, 1.0], [[1.0, 0.0, 0.0], [0.0, 0.0, 1.0]]], # # type: ignore target_vector=["first", "second", "second"], return_metadata=wvc.query.MetadataQuery.full(), ) @@ -737,8 +740,7 @@ def test_deprecated_syntax(collection_factory: CollectionFactory): [ (False, {}), (["bringYourOwn1"], {"bringYourOwn1": [0, 1, 2]}), - # TODO: to be uncommented when https://github.com/weaviate/weaviate/issues/6279 is resolved - # (True, {"bringYourOwn1": [0, 1, 2], "bringYourOwn2": [3, 4, 5]}) + (True, {"bringYourOwn1": [0, 1, 2], "bringYourOwn2": [3, 4, 5]}), ], ) def test_include_vector_on_references( @@ -751,9 +753,9 @@ def test_include_vector_on_references( ref_collection = collection_factory( name="Target", - vectorizer_config=[ - wvc.config.Configure.NamedVectors.none(name="bringYourOwn1"), - wvc.config.Configure.NamedVectors.none(name="bringYourOwn2"), + vector_config=[ + wvc.config.Configure.Vectors.none(name="bringYourOwn1"), + wvc.config.Configure.Vectors.none(name="bringYourOwn2"), ], ) @@ -787,8 +789,8 @@ def test_colbert_vectors_byov(collection_factory: CollectionFactory) -> None: data_type=wvc.config.DataType.TEXT, ) ], - vectorizer_config=[ - wvc.config.Configure.NamedVectors.none( + vector_config=[ + wvc.config.Configure.Vectors.none( name="colbert", vector_index_config=wvc.config.Configure.VectorIndex.hnsw( multi_vector=wvc.config.Configure.VectorIndex.MultiVector.multi_vector( @@ -796,7 +798,7 @@ def test_colbert_vectors_byov(collection_factory: CollectionFactory) -> None: ) ), ), - wvc.config.Configure.NamedVectors.none( + wvc.config.Configure.Vectors.none( name="regular", ), ], @@ -876,8 +878,8 @@ def test_colbert_vectors_jinaai(collection_factory: CollectionFactory) -> None: data_type=wvc.config.DataType.TEXT, ) ], - vectorizer_config=[ - wvc.config.Configure.NamedVectors.text2colbert_jinaai( + vector_config=[ + wvc.config.Configure.Vectors.text2colbert_jinaai( name="colbert", ) ], diff --git a/integration_embedded/test_client.py b/integration_embedded/test_client.py index 86f591930..1539276af 100644 --- a/integration_embedded/test_client.py +++ b/integration_embedded/test_client.py @@ -1,6 +1,7 @@ -import pytest from typing import Tuple, Union +import pytest + import weaviate from weaviate.classes.init import AdditionalConfig, Timeout from weaviate.embedded import WEAVIATE_VERSION diff --git a/journey_tests/gunicorn/asgi.py b/journey_tests/gunicorn/asgi.py index 3363c9954..fa2de8bbd 100644 --- a/journey_tests/gunicorn/asgi.py +++ b/journey_tests/gunicorn/asgi.py @@ -5,7 +5,6 @@ from fastapi.responses import JSONResponse import weaviate - from journey_tests.journeys import AsyncJourneys, SyncJourneys # some dependency instantiate a sync client on import/file root diff --git a/journey_tests/journeys.py b/journey_tests/journeys.py index 87152db40..9777c67a1 100644 --- a/journey_tests/journeys.py +++ b/journey_tests/journeys.py @@ -1,6 +1,11 @@ from typing import List, cast -from weaviate import WeaviateAsyncClient, WeaviateClient, connect_to_local, use_async_with_local +from weaviate import ( + WeaviateAsyncClient, + WeaviateClient, + connect_to_local, + use_async_with_local, +) from weaviate.classes.config import DataType, Property diff --git a/mock_tests/conftest.py b/mock_tests/conftest.py index c1a57bbe1..f8f535357 100644 --- a/mock_tests/conftest.py +++ b/mock_tests/conftest.py @@ -6,24 +6,23 @@ import grpc import pytest from grpc import ServicerContext -from grpc_health.v1.health_pb2 import HealthCheckResponse, HealthCheckRequest +from grpc_health.v1.health_pb2 import HealthCheckRequest, HealthCheckResponse from grpc_health.v1.health_pb2_grpc import HealthServicer, add_HealthServicer_to_server -from pytest_httpserver import HTTPServer, HeaderValueMatcher +from pytest_httpserver import HeaderValueMatcher, HTTPServer from werkzeug.wrappers import Request, Response import weaviate +from mock_tests.mock_data import mock_class from weaviate.connect.base import ConnectionParams, ProtocolParams from weaviate.proto.v1 import ( - batch_pb2, batch_delete_pb2, + batch_pb2, properties_pb2, - tenants_pb2, search_get_pb2, + tenants_pb2, weaviate_pb2_grpc, ) -from mock_tests.mock_data import mock_class - MOCK_IP = "127.0.0.1" MOCK_PORT = 23536 MOCK_PORT_GRPC = 23537 diff --git a/mock_tests/test_auth.py b/mock_tests/test_auth.py index 899a0507e..ab876d06d 100644 --- a/mock_tests/test_auth.py +++ b/mock_tests/test_auth.py @@ -9,7 +9,7 @@ from werkzeug import Request, Response import weaviate -from mock_tests.conftest import MOCK_IP, MOCK_PORT, MOCK_PORT_GRPC, CLIENT_ID +from mock_tests.conftest import CLIENT_ID, MOCK_IP, MOCK_PORT, MOCK_PORT_GRPC from weaviate.exceptions import MissingScopeException ACCESS_TOKEN = "HELLO!IamAnAccessToken" diff --git a/mock_tests/test_collection.py b/mock_tests/test_collection.py index a12c73570..8567310b5 100644 --- a/mock_tests/test_collection.py +++ b/mock_tests/test_collection.py @@ -8,34 +8,34 @@ import weaviate import weaviate.classes as wvc from mock_tests.conftest import ( - MOCK_PORT, MOCK_IP, + MOCK_PORT, MOCK_PORT_GRPC, MockRetriesWeaviateService, ) from weaviate.backup.backup import BackupStorage from weaviate.collections.classes.config import ( + BM25Config, CollectionConfig, - VectorIndexConfigFlat, - VectorDistances, InvertedIndexConfig, MultiTenancyConfig, - BM25Config, + ReplicationConfig, + ReplicationDeletionStrategy, + ShardingConfig, StopwordsConfig, StopwordsPreset, - ReplicationConfig, - Vectorizers, + VectorDistances, + VectorIndexConfigFlat, VectorIndexType, - ShardingConfig, - ReplicationDeletionStrategy, + Vectorizers, ) from weaviate.connect.base import ConnectionParams, ProtocolParams from weaviate.connect.integrations import _IntegrationConfig from weaviate.exceptions import ( - WeaviateStartUpError, BackupCanceledError, InsufficientPermissionsError, UnexpectedStatusCodeError, + WeaviateStartUpError, ) ACCESS_TOKEN = "HELLO!IamAnAccessToken" diff --git a/mock_tests/test_timeouts.py b/mock_tests/test_timeouts.py index 094c1094d..5f5a51b57 100644 --- a/mock_tests/test_timeouts.py +++ b/mock_tests/test_timeouts.py @@ -1,6 +1,7 @@ import pytest + import weaviate -from weaviate.exceptions import WeaviateTimeoutError, WeaviateQueryError +from weaviate.exceptions import WeaviateQueryError, WeaviateTimeoutError def test_timeout_rest_query(timeouts_collection: weaviate.collections.Collection): diff --git a/profiling/conftest.py b/profiling/conftest.py index df30155a3..aac8f3048 100644 --- a/profiling/conftest.py +++ b/profiling/conftest.py @@ -1,21 +1,18 @@ import os +from typing import Any, Dict, Generator, List, Optional, Protocol, Union import pytest -from typing import Any, Optional, List, Generator, Protocol, Dict, Union - from _pytest.fixtures import SubRequest import weaviate from weaviate.collections import Collection from weaviate.collections.classes.config import ( - _InvertedIndexConfigCreate, Property, + _InvertedIndexConfigCreate, _VectorizerConfigCreate, ) -from weaviate.config import AdditionalConfig - from weaviate.collections.classes.config_named_vectors import _NamedVectorConfigCreate - +from weaviate.config import AdditionalConfig from weaviate.connect.integrations import _IntegrationConfig diff --git a/profiling/pyspy.py b/profiling/pyspy.py index be51ce329..9ef169e4a 100644 --- a/profiling/pyspy.py +++ b/profiling/pyspy.py @@ -3,7 +3,7 @@ from typing import List import weaviate -from weaviate.classes.config import Configure, Property, DataType +from weaviate.classes.config import Configure, DataType, Property from weaviate.classes.data import DataObject from weaviate.classes.query import MetadataQuery diff --git a/profiling/test_import_and_query.py b/profiling/test_import_and_query.py index e80939006..8611e18cc 100644 --- a/profiling/test_import_and_query.py +++ b/profiling/test_import_and_query.py @@ -8,6 +8,7 @@ import weaviate import weaviate.classes as wvc from weaviate.collections.collection import Collection + from .conftest import get_file_path # The following code is used to test the performance of the weaviate client. diff --git a/profiling/test_profiling.py b/profiling/test_profiling.py index efc997852..4c4d7cb9e 100644 --- a/profiling/test_profiling.py +++ b/profiling/test_profiling.py @@ -3,8 +3,8 @@ # - benchmark: pytest profiling/test_profiling.py --benchmark-only --benchmark-disable-gc import concurrent.futures import math -from typing import Any, List import uuid +from typing import Any, List import pytest diff --git a/profiling/test_refs.py b/profiling/test_refs.py index 1fd4509b9..8753807f5 100644 --- a/profiling/test_refs.py +++ b/profiling/test_refs.py @@ -2,7 +2,7 @@ import random import uuid as uuid_lib from dataclasses import dataclass, field -from typing import List, Dict, Optional, Any +from typing import Any, Dict, List, Optional import weaviate import weaviate.classes as wvc diff --git a/profiling/test_sphere.py b/profiling/test_sphere.py index a0614a498..a2c225954 100644 --- a/profiling/test_sphere.py +++ b/profiling/test_sphere.py @@ -2,7 +2,8 @@ import time import weaviate.classes as wvc -from .conftest import get_file_path, CollectionFactory + +from .conftest import CollectionFactory, get_file_path # download sphere dataset from https://weaviate.io/blog/sphere-dataset-in-weaviate#importing-sphere-with-python # place file in profiling folder diff --git a/test/collection/conftest.py b/test/collection/conftest.py index 4915da9ec..e7ce2f737 100644 --- a/test/collection/conftest.py +++ b/test/collection/conftest.py @@ -1,6 +1,7 @@ import pytest + from weaviate.config import ConnectionConfig -from weaviate.connect import ConnectionV4, ConnectionParams +from weaviate.connect import ConnectionParams, ConnectionV4 @pytest.fixture diff --git a/test/collection/test_aggregates.py b/test/collection/test_aggregates.py index c2881de9b..76bdb9568 100644 --- a/test/collection/test_aggregates.py +++ b/test/collection/test_aggregates.py @@ -1,7 +1,9 @@ -import pytest from typing import Awaitable, Callable -from weaviate.connect import ConnectionV4 + +import pytest + from weaviate.collections.aggregate import _AggregateCollectionAsync +from weaviate.connect import ConnectionV4 from weaviate.exceptions import WeaviateInvalidInputError diff --git a/test/collection/test_batch.py b/test/collection/test_batch.py index 1adad951b..420452a26 100644 --- a/test/collection/test_batch.py +++ b/test/collection/test_batch.py @@ -1,5 +1,6 @@ import uuid -from weaviate.collections.classes.batch import BatchObjectReturn, MAX_STORED_RESULTS + +from weaviate.collections.classes.batch import MAX_STORED_RESULTS, BatchObjectReturn def test_batch_object_return_add() -> None: diff --git a/test/collection/test_classes.py b/test/collection/test_classes.py index 652406125..074599e94 100644 --- a/test/collection/test_classes.py +++ b/test/collection/test_classes.py @@ -1,15 +1,14 @@ import pytest from pydantic import ValidationError +from weaviate.collections.classes.filters import Filter from weaviate.collections.classes.grpc import ( QueryReference, - _QueryReferenceMultiTarget, - _QueryReference, Sort, + _QueryReference, + _QueryReferenceMultiTarget, ) -from weaviate.collections.classes.filters import Filter - def test_link_to_errors_on_extra_variable() -> None: with pytest.raises(ValidationError): diff --git a/test/collection/test_classes_generative.py b/test/collection/test_classes_generative.py index 9aa5b75a9..4e32ff6df 100644 --- a/test/collection/test_classes_generative.py +++ b/test/collection/test_classes_generative.py @@ -6,9 +6,9 @@ from weaviate.collections.classes.generative import ( GenerativeConfig, GenerativeParameters, + _GenerativeConfigRuntimeOptions, _GroupedTask, _SinglePrompt, - _GenerativeConfigRuntimeOptions, ) from weaviate.proto.v1.base_pb2 import TextArray from weaviate.proto.v1.generative_pb2 import ( @@ -24,12 +24,11 @@ GenerativeNvidia, GenerativeOllama, GenerativeOpenAI, - GenerativeXAI, GenerativeProvider, + GenerativeXAI, ) from weaviate.types import BLOB_INPUT - LOGO = "test/collection/weaviate-logo.png" LOGO_ENCODED = "iVBORw0KGgoAAAANSUhEUgAAAZAAAAE5CAYAAAC+rHbqAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6Rjc3MkEzQzdGM0QxMTFFODlBRTRBNjMyNUE2MTk3NzgiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6Rjc3MkEzQzhGM0QxMTFFODlBRTRBNjMyNUE2MTk3NzgiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpGNzcyQTNDNUYzRDExMUU4OUFFNEE2MzI1QTYxOTc3OCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpGNzcyQTNDNkYzRDExMUU4OUFFNEE2MzI1QTYxOTc3OCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PnOiDKoAABWzSURBVHja7N3feRNJugfgWj9zfzgRrJwBngjk+7mACEZOYMARYEdgmASsjQAu5h6dBAYysE4GnAg4/Vkl0BjbyJJaqqp+3+fRss/sLJjqVv3qX3/9r69fvyYAeKojTQDAJn7RBAD3+/W3P551v1x1n8u///pzrkXMQH52w7zoPs+1BNB5030m3eem6xcucqCQ/cseyLfgGHW/XHefcff53I02TrQKDL5PuLnzj790n/Ouf5hqIQGynKLGKOP1nf8pbpK3bhEYbN/wMQ8o7zNLi2WtmQAZ7g3yOofHfdPSGGkcdzfIF18lGFzfEMHxcY1/dZoGvD9yNNSbo/vE1PTqgfBI+Z+/8VWCQbpe89+bdJ9PsT9iBtJ+cIxyaLx4wv/t2OkLGNQA82LDwWP0E7H0/UGAtHVDxGzi9YY3xay7IU59rWAQ4RF9RaxObHPaapaD5HPr7XU0gBtikm+ITZejxnk9FGjf1ZbhcdtnpMWy1nXrx36bnYHkTj9uhl080zHvRhPHvlvQ9GAz+opPO/5t4xDOZasnOpsLkLzPsXz4Z5fiJrjwNYNmA+SxY7tbD0K7z1lrx36bCZCVfY5XO5iCPjSScKwX2gyPGHBe7+GPmuUgmbfQbkeNXPwXeer5pqfwSPn3vfJVg+bCY59H9mOGE2VRrlrYHzmq/MI/z9PO991ntIc/cqJOFjTn9Z76j7t/5k2e+VSryiWslQqZh2h8x3qhndlHBMen1N/KxTriuO95jfsjRxVe8Iu0OJZ7qOQe5yUzoH59LnuvK1Y1Pnb9yvscaGYgPQTHOC02uUpo4Hn3ObGhDlXPPqJP+VjYjxV9yrvu87aG/uWogos8yvscHwsJj5R/jte+glC1Eg/FLDf0P9WwP1LsDOSRMusljRRO1MmCKmcf0TlfV/CjzlLBZeOPCr24tycUCh/lq9YL9arlCO04LfZHiiyLUtQMZMflR/YyC+lGBv/tuwhVzkJG6ftbSKvob7rPu5IqYhQRIBuWWT+0y1TJRhfw04FrKQd01jFPhZSNP2iAbFlm/VBmqaFSBMC3/uixN5SW2hcdtGz8wQIkb2JdVXSx5qnBYmjAD4PaQz2kvKmo9Ht5iNWQvQdIni5Gyo8ruThNl2MG7u2nnucg0U+VECA9llnv0zRPEe1zwDCD5EUOklElP/I87XGlZC8BksuP9FVmvQ+zNJBXUgI/7b/6flVEHz7kPmxebYBUmt4xDZz62gB3+rNRclq0/wCpdP2wmvozwEGDZJwqe14tz0Z2PjDeaYBUeoJhL1M9oLkgmaS6TpLuvGz8zgKkwjPU1dbgB4oJkdJr9t0nZiKXuxg0bx0gFT7F6VgusOsgGaUKy6KkLZftNw6QChssHOyBG2AQQVLbgDpmIRuXRXlygFQ6ZZsl5UeA/QXJRRrAowtPCpBKy48UUXQMGFyI1HioaJqe8PD0WgFS6bG1osoeA4MNkiofa1in/3w0QCp9cCYS9NJyFVBYkMRMJJb/R5X8yNGHPloW5cEAyWt4NZVZdywXKD1Ean2Fxcv7lrV+CJD8F7yuaNbR21OWAD0FScxCalrdiX729O4m+30B8r6iv5S3AgI1B8k41bO//EOI/CNAKlq2iimVY7lAK0FSSyWPz12/e/JDgOQp1afC/wLz5K2AQJshUsszdmfLLYOjlX84KTg8luVHjoUH0KJYiu8+591/PU6LVZZSvblvBnKTyjxeFknnrYDA0GYkJb9P6ST2Qm4DJC9f3RT2A86StwICguQilVcWJVaELpZLWCUl3Dwt1thOhQcwdPmJ8FjWmhb0Y/07/uOosLa6zFOjqdsG4FuIxP7IWfdfT1MZ+yO3k45fCmkfbwUE+HmQRHjMSilse+gZSCxRxVLVS+EBsHaQTNNiWevykD/HoWYg3goIsF2IRD960c1GpulAZVEOMQOJ0DgWHgA7CZJ5rOKkxf7IvNUZyCw5lgvQV5BEH3u8z7Io+5iBRCK+dCwXYC9BcrvKkxarPVXPQP5ReAuAvYTI7WsuutnI/6UeC+T2PQNRfgSgUUeaAAABAoAAAUCAACBAAECAACBAABAgAAgQAAQIAAgQAAQIAAIEAAECgAABAAECgAABQIAAIEAAECAAIEAAECAACBAABAgAAgQABAgAAgQAAQKAAAFAgACAAAFAgAAgQAAQIAAIEAAQIAAIEAAECAACBAAECAACBAABAoAAAUCAAIAAAUCAACBAABAgAAgQABAgAAgQAAQIAAIEAAECAAIEAAECgAABQIAAIEAAQIAAIEAAECAACBDa9utvf7zuPs+1xGCu9/O45lqCn/lFE/BIRzLufrnuPqPuc6pFBuNZ97nqrv+r7tezv//6c6ZJECCsGxyjHBxjrTFocR987O6HWQ6SuSZBgPBQcMTIM5Yu3mgNVsRA4qa7Py67X992QfJFkxDsgbAMj0l0EsKDR7zJQTLRFJiBsNznuOo+NslZR8xSr/P+yLn9EQHCMINjlIPjhdZgAzHgiP2RDzlI5ppEgNB+cCz3OV7l0SRsIwYg4+6+epfsjwyOPZBhhcek++VTWqxlCw925Vm+pz7ZHzEDob3giOWGWK4aaw16NEqL/ZHf02JZ67MmESDUGxzPcnAYFbJP4zwbmeYgsazVKEtY7YbHRVocyxUeHErcezf5XsQMhAqCI0Z/y/IjcGi3+yMry1ofNIkAobzgGCXlRyhX3J/vlUURIJQVHMsTMKqnUoMY4MSy1tvu10v7I3WzB1J3eERo3AgPKvQ6B4l71wyEPQdHjOKUH6F2y7Lxy/2RmSYRIPQXHKOk/AjtURZFgNBjcCizzhDEwOiFsvH1sAdSfnhM0vfyIzAEyqKYgbBlcIzzF2msNRigUfpeFuXS/ogAYb3gGOXgMPqCxQBqnMuiXNofKYslrLLC4yItlquEB/xTfCc+KYtiBsKPwRGbh1dJ+RF4jLIoAoSV4FBmHZ4uBlrLsijKxguQwQWH8iOwvRh4fVIW5XDsgew/PJQfgd1SFsUMpPngiNGSMuvQj2VZlFdpUe13pkkESAvBMUrKrMO+xPfto7LxAqT24FB+BA4nBmw3yqL0yx5IP+ExSYt9DuEBh/UmB8lEU5iBlB4cMepRZh3KEqsB13l/RNl4AVJccIyS8iNQumXZ+GlSFkWAFBAcy32OV3mUA5QvBnpRNv5dsj+yFXsgm4dHlB9ZllkXHlCX5cO8ysabgew1OJQfgXaM0vey8cqiCJDeCY9hDBTG+VqnZON1CJbX+1RTCBDYNDhG6cf3zntfNwgQeDA4fnYgIgJlbOMVvrOJjvD453vnHzsQYeMVzEBgq/fOj5L3dYMAYZDBcVu5NW3/4GcEz/J93eeWtRgaS1gMLTwu0qJO2WSHv238Xjfe140ZCLQZHH2/d977uhEg0FhwRGDs830s8ee99z4KBAjUGxyHfu98BNaN93XTMnsgtBgeJb133vu6MQOBCoIjRv0lvnfe+7oRIFBocERg3C0/UqL4OZVFQYBAAcFR63vnI+heeF83tbMHQq3hMUn1v3fe+7oxA4E9Bsc4tfXeee/rRoBAz8ExSm2/d977uhEgsOPgGNp75yMgva+bKtgDoeTwGOp751fLxr9wJ2AGAusHh/fOL4zS97Io3teNAIFHgmNXZdZbM86zkWlSNp6CWMKilPC4SLsvs96aaBtl4zEDgRwcMbousfxIqVbLxiuLggBhkMExSvsts96aaL+PysYjQBhScBy6zHprIoCVjecg7IGwz/Aoqcx6a5SNxwyEJoMjRsktlR8p1bJs/PK1ujNNggCh1uAYpTrKrLdmWRZF2XgECNUFR61l1lujbDy9sgfCrsNjkuovs96aZVmUiabADIQSg2OcO6qx1ijSKC3Kxsf+yKX9EQQIJQTHKLVdZr01EfBjZePZBUtYbBMeF2lRLVd41Ceu2SdlUTADYd/BEZuzcbpqpDWqtloWJU5rfdAkCBD6Cg5l1tsUA4FvZeM1BwKEXbNB3r64vrEkOdMUrMMeCE/pXHCtQYAAIEAAECAACBAABAgACBAABAgAAgQAAQKAAAEAAQKAAAFAgAAgQAAQIAAgQAAQIAAIEAAECAACBAAECAACBAABAoAAAUCAAIAAAUCAACBAABAgAAgQABAgAAgQAAQIAAIEAATIhuaaYDC+5A++2wiQ7f39159n3S9nbrbmve0+x/nzVnM0Hxxn+buNAOk9RKbdLyfd51JrNGcWodFd4/Pu8yV/znOQzDRPc+I7fJK/0zzRL5pg4xCJpY2LX3/7I268q+7zQqtUPwqN0PjwwPWO//20u94v8vUeabKqfcjX20qCADlokMQN+LLrWMa5Y3muVaoSA4F33XW8WPN6R8fzobve8e+/6j7PNGFVPufgMJvcAUtYuwuSWfeJZa2zZOO1FjF7PF43PO5c7/j/HOffgzoGChEcJ8JDgJQcJNNk47V00YGcxqZpXorc9Fp/yRuvp8n+SMne5oGC7+SOWcLqJ0RuRzu//vbHu+7X6+4z1ipFmHefy11vmOYR7ay73pPu1zfJ/khJA4Uz+xxmILUGybz7nOYRqpv4cCLQez9tc+d0nmXMww4UYoZ5KjzMQFoIkhgJHdt4PYi9nrZxOu/gA4V3m+xpYQZSQ5DEjW3jdT8+51Hoy0OMQvPs82WefX52OXoX36lj4WEG0nqIxCjpLO+PxAh1rFV2Pgo9L+XBsDz7PMn7I1dmnzs3y9dbSJuBDCpIPuf9kRilzrXITlzmUei0wOs9zbNP1Qt2I74zL/M+h/AQIIMNklijt/G6/Sj0dvlim2O5+5h9rixjzly2jWeYywMRHzTHYVnCKqRjSd83XuMY6ESrrD0KPavtwbCVsijjtDjmPXIp1xLfj0snqwQID3cssT/ynxwkY63y8Ci09gfDVk7nvc7X2/7I/ZQfKZQlrEI7lrw/oizKj5p7qjj/XZzOu3+gcKb8iABhs45lmmy8LkUHcrIss97gtV6WRTlJ9kdSKvhABN9ZwqqgY0nDfjBtnh4ps97g9b59fmXAZeOVWRcg9NCxxBfq5YA2Xgf9VPEAy8bH/X1mqaoulrDq61hifySWtc5Tu/sjMds68VTxt+oFJ6nd/ZHlg5/HwkOAsL+OZbnx2lKJ6uhAlmXW567y99lno2XjlVmvnCWsujuWVsrGR1hc2jD9+ewztVE2Pv4eBglmIBQ0Qq21LErvZdYbvN7RVsvqBbUNFF4qs24GQpkdS00br07bbD/7rOV0njLrZiBU1LnEF7XUB9MOWma90dlnyWXj4x5UZt0MhApHqCWVjS+qzHqD13uWyiobP0vKrJuBUH3H8nmlLMqhRvzL0zbCo//rPU2HPZ0X99iZMusChPY6ln2XjZ/l4Giy/EjJs89o87TfsvF7ee88ZbGENbCOJe2nbPxyFDrT6ge93nEd9lE23oEIAcLAOpZl2fhYL3++w1Go0zblXe/bmWAPp/OUWR84S1gD71iiVHbaTdn4mNU4bVP29Y5rs4vTecqsI0D41rFM0+Zl46MDOcnlR+xzlH+tty0br8x6Xf6rz9/8X1+/fk15jfRjT3/GLClbUI3uXhil9cqixPU8917q6q/3umXjfY/ruq7P8nWd9NWvx0m7fcxAoiO66f5CV/kvRdkj1GVZlNN0/7Hf1dM2wqP+6/0hPX46L+6BU+VHqgqPi+hzewyPvc5Afuh8VN+s6mZcfV/3NF8/HUm7s8/l6Tzf1XZnkzubgew7QFZHNY551jUdHnkwbDDXO07lze1pVRX8+67GfdAAWXJ+HGDzgV3MGF8f4I/f2x7IY2LKFfsjF/ZHANYOjwiNmwOFxzelHON9k4Nk4tYAeDA4xt3nUyqjYGZRT6JHY1x3jfN7WmzezdwuAN/2OUp678t8NUDmBbXVOD65XpMTP8CQgyMG1suTkCX53/iP2030/IPGetqosB/ytrZS93nrRAgwsPCY5OAYFfjjxXNgn1f3QP5T4A+5PGXwKZ9xBmg9OGIFJk7F9llBeRvz5ZH+1T2QaSr3PdrRiO+7Rp0lbzkD2gyOUer3NQu78q1m3rclrPwXuEjlrbXdZ5qDxLIW0EJ4XBQ8gF/1OVfw/jFA8l/kfSpnp/8x3j0B1B4c+yw/sos+9x+vKr4vQG6P01YSImGelEUB6gqO5zk4xpX8yD+Ex70BUuGUammWlJsGyg6OQ5Yf2aZvfXnflsGDAZL/sqNU1sMr64jqoZf2R4DCwmO1snUN5uknqzuPBsjKX3ycdvvu7H1Mt5SiBkoIjug/Sz2S+1D/udb+8loBUnGCxnrduf0R4ADBMUr1reBM0xNOuD4pQHKj1LiGp2w8sK/gKLX8yGNmaYNn7J4cIHfSdd8vMdlWPACjLArQV3hMUiGVctc0z8Gx0eupNw6QlQar6RzzssFif2Tqdgd2FBzjPOOoZUC9k+fotg6QlQaMH6S2Y7/KxgPb9HujVEf5kVXTtKNK5zsLkNyYz/JsZJCNCQwmOJb7HIMeNO80QIY+nQMGER6W7fsMkJWGnqRy69k/1NAbbygBTQdHjeVHen2fUq8Bcmeq1/yRNqDJ4KhxaX4vjy70HiArF2GUGn+oBmguPDw8XUKArFyQcVIWBSg7OKKfqq38yPm+H0/Ye4BUnOwxFVQ2HtoOjlHygHT5AZIvVq2ljZWNh7aCo8a92oOXaDpogFSe+ueWtaCJ8Jik+sqPFLEa8ksJrZET9LSy89VmIFB/eHxMdR3LLWo/9qik1onnL7rPcVqs6ZV88mnmWRFowv9U8nNGaByXtupRxBLWAyODks9eH9sDgWZmITep3FWPWSp4z7XYAFm5uDG9LKksSpx2OPe1g2YCJJbO3xf2Y81TBac+iw+QlYs8SYff6PqSZx8eLIS2QqSUvZCqnjs7quUC5wdklvsjh+KpdGhTCasK01TgPkcTM5A7o4VR2n9ZlNg4P/U9g2ZnIdGnHOKZtFmqtPZelQGycsFjyrmvcgOnnkKHpgMklsdjQ31fy+TzVHn176oDZOXC910WZdpd5DNfMWg+RKIvuer5j2nm/UNHLVz0vGYY+yNve7rYTl3BAOS+ZN7jHzFNi32Oixbaq4kZyJ0RxK5f+nLpTYUwqFlI9B0fd/zbztKOXycrQPq9CXZRFmWen4wHhhUiuzrWO089vU62BEet3gA7Koti3wOGadvv/pfc95y0Gh5Nz0DujCZiFhKb7JOnTDkd24VBz0Iu0mbl3ad51jFvvY0GESArN8Q4rV8WRb0rGHaAPPVY715fJytADndjxEzksbIoNs6BZV9x/ZN/7SCvky3B0RBvip+URYlZhxdFAcu+4rEnxKMPOR5ieAx2BnJnhDFK/yyLcjbUmwG4t48Ypx+P9R78dbICpLyb5HdPnAP39A+xjDVJA9znECAA2wXIqPtlbHVCgACwA0eaAIBN/L8AAwBLF+9LrWiboAAAAABJRU5ErkJggg==" diff --git a/test/collection/test_client.py b/test/collection/test_client.py index 521a07f7a..15b86f64d 100644 --- a/test/collection/test_client.py +++ b/test/collection/test_client.py @@ -1,6 +1,6 @@ import pytest -import weaviate +import weaviate from weaviate.exceptions import WeaviateInvalidInputError diff --git a/test/collection/test_collections_sorting.py b/test/collection/test_collections_sorting.py index e3563ce78..2d4a1070b 100644 --- a/test/collection/test_collections_sorting.py +++ b/test/collection/test_collections_sorting.py @@ -1,4 +1,5 @@ from unittest.mock import MagicMock, patch + from weaviate.collections.classes.config_methods import ( _collection_configs_from_json, _collection_configs_simple_from_json, diff --git a/test/collection/test_config.py b/test/collection/test_config.py index 8f4cada22..360acdd06 100644 --- a/test/collection/test_config.py +++ b/test/collection/test_config.py @@ -4,18 +4,21 @@ from pydantic import ValidationError from weaviate.collections.classes.config import ( - _CollectionConfigCreate, - DataType, - _GenerativeProvider, - _RerankerProvider, - _VectorizerConfigCreate, Configure, + DataType, Property, ReferenceProperty, Vectorizers, + _CollectionConfigCreate, + _GenerativeProvider, + _RerankerProvider, + _VectorizerConfigCreate, ) from weaviate.collections.classes.config_named_vectors import _NamedVectorConfigCreate -from weaviate.collections.classes.config_vectorizers import Multi2VecField, VectorDistances +from weaviate.collections.classes.config_vectorizers import ( + Multi2VecField, + VectorDistances, +) DEFAULTS = { "vectorizer": "none", diff --git a/test/collection/test_config_update.py b/test/collection/test_config_update.py index bc903bd89..8875f3368 100644 --- a/test/collection/test_config_update.py +++ b/test/collection/test_config_update.py @@ -1,7 +1,7 @@ import pytest from test.collection.schema import multi_vector_schema -from weaviate.collections.classes.config import _CollectionConfigUpdate, Reconfigure +from weaviate.collections.classes.config import Reconfigure, _CollectionConfigUpdate from weaviate.exceptions import WeaviateInvalidInputError diff --git a/test/collection/test_queries.py b/test/collection/test_queries.py index 5a1917564..513764a17 100644 --- a/test/collection/test_queries.py +++ b/test/collection/test_queries.py @@ -1,7 +1,9 @@ -import pytest from typing import Awaitable -from weaviate.connect import ConnectionV4 + +import pytest + from weaviate.collections.query import _QueryCollectionAsync +from weaviate.connect import ConnectionV4 from weaviate.exceptions import WeaviateInvalidInputError # TODO: re-enable tests once string syntax is re-enabled in the API diff --git a/test/collection/test_validator.py b/test/collection/test_validator.py index 66cfaafef..1f97548b1 100644 --- a/test/collection/test_validator.py +++ b/test/collection/test_validator.py @@ -6,7 +6,7 @@ import pytest from weaviate.exceptions import WeaviateInvalidInputError -from weaviate.validator import _validate_input, _ValidateArgument, _ExtraTypes +from weaviate.validator import _ExtraTypes, _validate_input, _ValidateArgument @pytest.mark.parametrize( diff --git a/test/test_auth.py b/test/test_auth.py index 42405eb2e..7e6011e50 100644 --- a/test/test_auth.py +++ b/test/test_auth.py @@ -1,4 +1,5 @@ import pytest + import weaviate.classes as wvc diff --git a/test/test_client.py b/test/test_client.py index 1d16c34bd..e9a7c22c0 100644 --- a/test/test_client.py +++ b/test/test_client.py @@ -1,4 +1,5 @@ import pytest + import weaviate diff --git a/test/test_get_vector_v4.py b/test/test_get_vector_v4.py index 792cc3282..f7cdbd7a8 100644 --- a/test/test_get_vector_v4.py +++ b/test/test_get_vector_v4.py @@ -1,6 +1,7 @@ import numpy as np import pandas as pd import polars as pl + from weaviate.util import _get_vector_v4 # Don't need to test `tf` or `torch` tensors since `_get_vector_v4`` converts them to `np` first diff --git a/test/test_util.py b/test/test_util.py index 92383d9d2..5eb5d4327 100644 --- a/test/test_util.py +++ b/test/test_util.py @@ -1,27 +1,27 @@ import unittest import uuid as uuid_lib from copy import deepcopy -from unittest.mock import patch, Mock +from unittest.mock import Mock, patch import pytest from test.util import check_error_message from weaviate.exceptions import SchemaValidationException from weaviate.util import ( + MINIMUM_NO_WARNING_VERSION, + _is_sub_schema, + _sanitize_str, generate_uuid5, + get_domain_from_weaviate_url, + get_valid_uuid, + get_vector, image_decoder_b64, image_encoder_b64, is_object_url, + is_weaviate_client_too_old, is_weaviate_object_url, - get_vector, - get_valid_uuid, - get_domain_from_weaviate_url, - _is_sub_schema, - parse_version_string, is_weaviate_too_old, - is_weaviate_client_too_old, - MINIMUM_NO_WARNING_VERSION, - _sanitize_str, + parse_version_string, ) schema_set = { diff --git a/test/util.py b/test/util.py index c5d3fe5b6..a4fbf9456 100644 --- a/test/util.py +++ b/test/util.py @@ -1,4 +1,4 @@ -from typing import Union, Callable, Optional +from typing import Callable, Optional, Union from unittest.mock import Mock diff --git a/tools/stubs_regen.sh b/tools/stubs_regen.sh index 65e01c2f4..c02eebf85 100755 --- a/tools/stubs_regen.sh +++ b/tools/stubs_regen.sh @@ -3,6 +3,7 @@ echo "Regenerating stubs..." python3 -m tools.stubs +# ruff check . --select F401 --select I --fix --exclude weaviate/proto black ./weaviate echo "done" \ No newline at end of file diff --git a/weaviate/auth.py b/weaviate/auth.py index 75adbd27c..298aff96d 100644 --- a/weaviate/auth.py +++ b/weaviate/auth.py @@ -1,7 +1,7 @@ """Authentication class definitions.""" from dataclasses import dataclass -from typing import Optional, Union, List +from typing import List, Optional, Union from weaviate.warnings import _Warnings diff --git a/weaviate/backup/async_.py b/weaviate/backup/async_.py index fc8d5bf63..b9bafa174 100644 --- a/weaviate/backup/async_.py +++ b/weaviate/backup/async_.py @@ -1,6 +1,6 @@ +from weaviate.backup.executor import _BackupExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync -from weaviate.backup.executor import _BackupExecutor @executor.wrap("async") diff --git a/weaviate/backup/async_.pyi b/weaviate/backup/async_.pyi index 4cf7bd05e..90e2a8cce 100644 --- a/weaviate/backup/async_.pyi +++ b/weaviate/backup/async_.pyi @@ -1,25 +1,25 @@ import asyncio import time -from typing import Generic, Optional, Union, List, Tuple, Dict +from typing import Dict, Generic, List, Optional, Tuple, Union from httpx import Response from weaviate.backup.backup import ( - BackupStorage, - BackupReturn, - BackupStatusReturn, STORAGE_NAMES, BackupConfigCreate, - BackupStatus, BackupConfigRestore, + BackupReturn, + BackupStatus, + BackupStatusReturn, + BackupStorage, ) from weaviate.backup.backup_location import BackupLocationType from weaviate.connect import executor -from weaviate.connect.v4 import _ExpectedStatusCodes, Connection, ConnectionAsync, ConnectionType +from weaviate.connect.v4 import Connection, ConnectionAsync, ConnectionType, _ExpectedStatusCodes from weaviate.exceptions import ( - WeaviateInvalidInputError, - WeaviateUnsupportedFeatureError, + BackupCanceledError, BackupFailedException, EmptyResponseException, - BackupCanceledError, + WeaviateInvalidInputError, + WeaviateUnsupportedFeatureError, ) from weaviate.util import _capitalize_first_letter, _decode_json_response_dict from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/backup/backup.py b/weaviate/backup/backup.py index adbc59cf4..35d129cec 100644 --- a/weaviate/backup/backup.py +++ b/weaviate/backup/backup.py @@ -1,6 +1,8 @@ from enum import Enum from typing import Any, Dict, List, Optional, cast + from pydantic import BaseModel, Field + from weaviate.backup.backup_location import _BackupLocationConfig STORAGE_NAMES = { diff --git a/weaviate/backup/backup_location.py b/weaviate/backup/backup_location.py index 5bf392687..dfe5df9fc 100644 --- a/weaviate/backup/backup_location.py +++ b/weaviate/backup/backup_location.py @@ -1,4 +1,4 @@ -from typing import Dict, Any, cast, Union +from typing import Any, Dict, Union, cast from pydantic import BaseModel diff --git a/weaviate/backup/executor.py b/weaviate/backup/executor.py index c404c1c08..d781e448b 100644 --- a/weaviate/backup/executor.py +++ b/weaviate/backup/executor.py @@ -2,28 +2,33 @@ import asyncio import time -from typing import Generic, Optional, Union, List, Tuple, Dict +from typing import Dict, Generic, List, Optional, Tuple, Union from httpx import Response from weaviate.backup.backup import ( - BackupStorage, - BackupReturn, - BackupStatusReturn, STORAGE_NAMES, BackupConfigCreate, - BackupStatus, BackupConfigRestore, + BackupReturn, + BackupStatus, + BackupStatusReturn, + BackupStorage, ) from weaviate.backup.backup_location import BackupLocationType from weaviate.connect import executor -from weaviate.connect.v4 import _ExpectedStatusCodes, Connection, ConnectionAsync, ConnectionType +from weaviate.connect.v4 import ( + Connection, + ConnectionAsync, + ConnectionType, + _ExpectedStatusCodes, +) from weaviate.exceptions import ( - WeaviateInvalidInputError, - WeaviateUnsupportedFeatureError, + BackupCanceledError, BackupFailedException, EmptyResponseException, - BackupCanceledError, + WeaviateInvalidInputError, + WeaviateUnsupportedFeatureError, ) from weaviate.util import ( _capitalize_first_letter, diff --git a/weaviate/backup/sync.py b/weaviate/backup/sync.py index 672f2af16..cc9949664 100644 --- a/weaviate/backup/sync.py +++ b/weaviate/backup/sync.py @@ -1,6 +1,6 @@ +from weaviate.backup.executor import _BackupExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync -from weaviate.backup.executor import _BackupExecutor @executor.wrap("sync") diff --git a/weaviate/backup/sync.pyi b/weaviate/backup/sync.pyi index d8e704f45..eb7304f3d 100644 --- a/weaviate/backup/sync.pyi +++ b/weaviate/backup/sync.pyi @@ -1,25 +1,25 @@ import asyncio import time -from typing import Generic, Optional, Union, List, Tuple, Dict +from typing import Dict, Generic, List, Optional, Tuple, Union from httpx import Response from weaviate.backup.backup import ( - BackupStorage, - BackupReturn, - BackupStatusReturn, STORAGE_NAMES, BackupConfigCreate, - BackupStatus, BackupConfigRestore, + BackupReturn, + BackupStatus, + BackupStatusReturn, + BackupStorage, ) from weaviate.backup.backup_location import BackupLocationType from weaviate.connect import executor -from weaviate.connect.v4 import _ExpectedStatusCodes, Connection, ConnectionAsync, ConnectionType +from weaviate.connect.v4 import Connection, ConnectionAsync, ConnectionType, _ExpectedStatusCodes from weaviate.exceptions import ( - WeaviateInvalidInputError, - WeaviateUnsupportedFeatureError, + BackupCanceledError, BackupFailedException, EmptyResponseException, - BackupCanceledError, + WeaviateInvalidInputError, + WeaviateUnsupportedFeatureError, ) from weaviate.util import _capitalize_first_letter, _decode_json_response_dict from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/classes/__init__.py b/weaviate/classes/__init__.py index 54ff9335f..0f009a308 100644 --- a/weaviate/classes/__init__.py +++ b/weaviate/classes/__init__.py @@ -5,12 +5,12 @@ batch, config, data, - generics, generate, + generics, init, query, - tenants, rbac, + tenants, ) # noqa: F401 from .config import ConsistencyLevel diff --git a/weaviate/classes/backup.py b/weaviate/classes/backup.py index 116bce7ea..83c9637f4 100644 --- a/weaviate/classes/backup.py +++ b/weaviate/classes/backup.py @@ -6,7 +6,6 @@ ) from weaviate.backup.backup_location import BackupLocation, BackupLocationType - __all__ = [ "BackupCompressionLevel", "BackupConfigCreate", diff --git a/weaviate/classes/config.py b/weaviate/classes/config.py index 0e8c87069..f6d0dcc04 100644 --- a/weaviate/classes/config.py +++ b/weaviate/classes/config.py @@ -1,15 +1,15 @@ from weaviate.collections.classes.config import ( Configure, ConsistencyLevel, - Reconfigure, DataType, GenerativeSearches, MultiVectorAggregation, - ReplicationDeletionStrategy, PQEncoderDistribution, PQEncoderType, Property, + Reconfigure, ReferenceProperty, + ReplicationDeletionStrategy, Rerankers, StopwordsPreset, Tokenization, diff --git a/weaviate/classes/generate.py b/weaviate/classes/generate.py index 2a5fda3eb..37fce39d3 100644 --- a/weaviate/classes/generate.py +++ b/weaviate/classes/generate.py @@ -1,4 +1,7 @@ -from weaviate.collections.classes.generative import GenerativeConfig, GenerativeParameters +from weaviate.collections.classes.generative import ( + GenerativeConfig, + GenerativeParameters, +) __all__ = [ "GenerativeParameters", diff --git a/weaviate/classes/generics.py b/weaviate/classes/generics.py index f4b50cd2e..f707b1632 100644 --- a/weaviate/classes/generics.py +++ b/weaviate/classes/generics.py @@ -1,7 +1,7 @@ from weaviate.collections.classes.internal import ( - Nested, CrossReference, CrossReferenceAnnotation, + Nested, ) __all__ = ["CrossReference", "Nested", "CrossReferenceAnnotation"] diff --git a/weaviate/classes/query.py b/weaviate/classes/query.py index effc8df15..3aeaf06f1 100644 --- a/weaviate/classes/query.py +++ b/weaviate/classes/query.py @@ -2,18 +2,18 @@ from weaviate.collections.classes.filters import Filter from weaviate.collections.classes.generative import GenerativeConfig from weaviate.collections.classes.grpc import ( - HybridFusion, GroupBy, + HybridFusion, HybridVector, MetadataQuery, Move, - TargetVectors, NearMediaType, + NearVector, QueryNested, QueryReference, - NearVector, Rerank, Sort, + TargetVectors, ) from weaviate.collections.classes.types import GeoCoordinate diff --git a/weaviate/classes/rbac.py b/weaviate/classes/rbac.py index 757715506..b1e37269c 100644 --- a/weaviate/classes/rbac.py +++ b/weaviate/classes/rbac.py @@ -1,3 +1,3 @@ -from weaviate.rbac.models import Permissions, Actions, PermissionsInputType, RoleScope +from weaviate.rbac.models import Actions, Permissions, PermissionsInputType, RoleScope __all__ = ["Actions", "Permissions", "PermissionsInputType", "RoleScope"] diff --git a/weaviate/classes/tenants.py b/weaviate/classes/tenants.py index 884a07124..d4d04d49a 100644 --- a/weaviate/classes/tenants.py +++ b/weaviate/classes/tenants.py @@ -1,9 +1,9 @@ from weaviate.collections.classes.tenants import ( Tenant, - TenantCreate, - TenantUpdate, TenantActivityStatus, + TenantCreate, TenantCreateActivityStatus, + TenantUpdate, TenantUpdateActivityStatus, ) from weaviate.collections.tenants import TenantCreateInputType, TenantUpdateInputType diff --git a/weaviate/client.py b/weaviate/client.py index 310f10fec..d07e5bf42 100644 --- a/weaviate/client.py +++ b/weaviate/client.py @@ -1,13 +1,13 @@ """Client class definition.""" -from typing import Optional, Tuple, Union, Any +from typing import Any, Optional, Tuple, Union from typing_extensions import deprecated +from weaviate.client_executor import _WeaviateClientExecutor from .auth import AuthCredentials -from .backup import _BackupAsync, _Backup -from weaviate.client_executor import _WeaviateClientExecutor +from .backup import _Backup, _BackupAsync from .collections.batch.client import _BatchClientWrapper from .collections.cluster import _Cluster, _ClusterAsync from .collections.collections import _Collections, _CollectionsAsync @@ -19,9 +19,9 @@ from .connect.v4 import ConnectionAsync, ConnectionSync from .debug import _Debug, _DebugAsync from .embedded import EmbeddedOptions -from .rbac import _RolesAsync, _Roles +from .rbac import _Roles, _RolesAsync from .types import NUMBER -from .users import _UsersAsync, _Users +from .users import _Users, _UsersAsync TIMEOUT_TYPE = Union[Tuple[NUMBER, NUMBER], NUMBER] diff --git a/weaviate/client.pyi b/weaviate/client.pyi index ecc5fbe84..8502e61aa 100644 --- a/weaviate/client.pyi +++ b/weaviate/client.pyi @@ -2,19 +2,17 @@ Client class definition. """ -from typing import Optional, Tuple, Union, Dict, Any +from typing import Any, Dict, Optional, Tuple, Union from weaviate.collections.classes.internal import _RawGQLReturn from weaviate.collections.collections.async_ import _CollectionsAsync from weaviate.collections.collections.sync import _Collections - from weaviate.users.async_ import _UsersAsync - from weaviate.users.sync import _Users + from .backup import _Backup, _BackupAsync from .collections.batch.client import _BatchClientWrapper from .collections.cluster import _Cluster, _ClusterAsync -from .connect.v4 import ConnectionV4 from .debug import _Debug, _DebugAsync from .rbac import _Roles, _RolesAsync from .types import NUMBER diff --git a/weaviate/client_executor.py b/weaviate/client_executor.py index 0ea971191..30df515bc 100644 --- a/weaviate/client_executor.py +++ b/weaviate/client_executor.py @@ -2,29 +2,27 @@ from typing import ( Any, + Dict, Generic, Optional, Tuple, - Union, - Dict, Type, + Union, ) from httpx import Response from weaviate.collections.classes.internal import _GQLEntryReturnType, _RawGQLReturn - from weaviate.integrations import _Integrations from .auth import AuthCredentials from .config import AdditionalConfig from .connect import executor -from .connect.v4 import ConnectionAsync from .connect.base import ( ConnectionParams, ProtocolParams, ) -from .connect.v4 import _ExpectedStatusCodes, ConnectionType +from .connect.v4 import ConnectionAsync, ConnectionType, _ExpectedStatusCodes from .embedded import EmbeddedOptions, EmbeddedV4 from .types import NUMBER from .util import _decode_json_response_dict diff --git a/weaviate/collections/__init__.py b/weaviate/collections/__init__.py index e5339aefc..54657db1f 100644 --- a/weaviate/collections/__init__.py +++ b/weaviate/collections/__init__.py @@ -1,4 +1,7 @@ -from weaviate.collections.batch.collection import BatchCollection, CollectionBatchingContextManager +from weaviate.collections.batch.collection import ( + BatchCollection, + CollectionBatchingContextManager, +) from weaviate.collections.collection import Collection, CollectionAsync __all__ = ["BatchCollection", "Collection", "CollectionAsync", "CollectionBatchingContextManager"] diff --git a/weaviate/collections/aggregate.py b/weaviate/collections/aggregate.py index cd21de83a..6697541c0 100644 --- a/weaviate/collections/aggregate.py +++ b/weaviate/collections/aggregate.py @@ -1,9 +1,9 @@ -from weaviate.collections.aggregations.hybrid import _HybridAsync, _Hybrid -from weaviate.collections.aggregations.near_image import _NearImageAsync, _NearImage -from weaviate.collections.aggregations.near_object import _NearObjectAsync, _NearObject -from weaviate.collections.aggregations.near_text import _NearTextAsync, _NearText -from weaviate.collections.aggregations.near_vector import _NearVectorAsync, _NearVector -from weaviate.collections.aggregations.over_all import _OverAllAsync, _OverAll +from weaviate.collections.aggregations.hybrid import _Hybrid, _HybridAsync +from weaviate.collections.aggregations.near_image import _NearImage, _NearImageAsync +from weaviate.collections.aggregations.near_object import _NearObject, _NearObjectAsync +from weaviate.collections.aggregations.near_text import _NearText, _NearTextAsync +from weaviate.collections.aggregations.near_vector import _NearVector, _NearVectorAsync +from weaviate.collections.aggregations.over_all import _OverAll, _OverAllAsync class _AggregateCollectionAsync( diff --git a/weaviate/collections/aggregations/base_executor.py b/weaviate/collections/aggregations/base_executor.py index b1df82c7f..6f6c32ccb 100644 --- a/weaviate/collections/aggregations/base_executor.py +++ b/weaviate/collections/aggregations/base_executor.py @@ -7,27 +7,27 @@ from typing_extensions import ParamSpec from weaviate.collections.classes.aggregate import ( - AProperties, - AggregateResult, AggregateBoolean, AggregateDate, + AggregateGroup, + AggregateGroupByReturn, AggregateInteger, AggregateNumber, AggregateReference, - AggregateText, - AggregateGroup, - AggregateGroupByReturn, + AggregateResult, AggregateReturn, + AggregateText, + AProperties, GroupByAggregate, + GroupedBy, + TopOccurrence, _Metrics, _MetricsBoolean, _MetricsDate, - _MetricsNumber, _MetricsInteger, + _MetricsNumber, _MetricsReference, _MetricsText, - GroupedBy, - TopOccurrence, ) from weaviate.collections.classes.config import ConsistencyLevel from weaviate.collections.classes.filters import _Filters @@ -41,8 +41,8 @@ from weaviate.gql.aggregate import AggregateBuilder from weaviate.proto.v1 import aggregate_pb2 from weaviate.types import NUMBER, UUID -from weaviate.util import parse_blob, _decode_json_response_dict -from weaviate.validator import _ValidateArgument, _validate_input +from weaviate.util import _decode_json_response_dict, parse_blob +from weaviate.validator import _validate_input, _ValidateArgument from weaviate.warnings import _Warnings P = ParamSpec("P") diff --git a/weaviate/collections/aggregations/hybrid/async_.py b/weaviate/collections/aggregations/hybrid/async_.py index 84dab723b..0332d4dfa 100644 --- a/weaviate/collections/aggregations/hybrid/async_.py +++ b/weaviate/collections/aggregations/hybrid/async_.py @@ -1,5 +1,5 @@ -from weaviate.connect import executor from weaviate.collections.aggregations.hybrid.executor import _HybridExecutor +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/aggregations/hybrid/async_.pyi b/weaviate/collections/aggregations/hybrid/async_.pyi index 920bcbc30..6acdf1444 100644 --- a/weaviate/collections/aggregations/hybrid/async_.pyi +++ b/weaviate/collections/aggregations/hybrid/async_.pyi @@ -1,10 +1,10 @@ from typing import Generic, List, Literal, Optional, Union, overload from weaviate.collections.aggregations.base_executor import _BaseExecutor from weaviate.collections.classes.aggregate import ( - PropertiesMetrics, - AggregateReturn, AggregateGroupByReturn, + AggregateReturn, GroupByAggregate, + PropertiesMetrics, ) from weaviate.collections.classes.filters import _Filters from weaviate.collections.filters import _FilterToGRPC diff --git a/weaviate/collections/aggregations/hybrid/executor.py b/weaviate/collections/aggregations/hybrid/executor.py index 46ebda205..500b6212d 100644 --- a/weaviate/collections/aggregations/hybrid/executor.py +++ b/weaviate/collections/aggregations/hybrid/executor.py @@ -2,10 +2,10 @@ from weaviate.collections.aggregations.base_executor import _BaseExecutor from weaviate.collections.classes.aggregate import ( - PropertiesMetrics, - AggregateReturn, AggregateGroupByReturn, + AggregateReturn, GroupByAggregate, + PropertiesMetrics, ) from weaviate.collections.classes.filters import _Filters from weaviate.collections.filters import _FilterToGRPC diff --git a/weaviate/collections/aggregations/hybrid/sync.py b/weaviate/collections/aggregations/hybrid/sync.py index e5e573e4a..61aaad1ba 100644 --- a/weaviate/collections/aggregations/hybrid/sync.py +++ b/weaviate/collections/aggregations/hybrid/sync.py @@ -1,5 +1,5 @@ -from weaviate.connect import executor from weaviate.collections.aggregations.hybrid.executor import _HybridExecutor +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/aggregations/hybrid/sync.pyi b/weaviate/collections/aggregations/hybrid/sync.pyi index 6ebcfbb1b..fb0725de2 100644 --- a/weaviate/collections/aggregations/hybrid/sync.pyi +++ b/weaviate/collections/aggregations/hybrid/sync.pyi @@ -1,10 +1,10 @@ from typing import Generic, List, Literal, Optional, Union, overload from weaviate.collections.aggregations.base_executor import _BaseExecutor from weaviate.collections.classes.aggregate import ( - PropertiesMetrics, - AggregateReturn, AggregateGroupByReturn, + AggregateReturn, GroupByAggregate, + PropertiesMetrics, ) from weaviate.collections.classes.filters import _Filters from weaviate.collections.filters import _FilterToGRPC diff --git a/weaviate/collections/aggregations/near_image/async_.py b/weaviate/collections/aggregations/near_image/async_.py index cdc2bb481..78ee25425 100644 --- a/weaviate/collections/aggregations/near_image/async_.py +++ b/weaviate/collections/aggregations/near_image/async_.py @@ -1,5 +1,5 @@ -from weaviate.connect import executor from weaviate.collections.aggregations.near_image.executor import _NearImageExecutor +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/aggregations/near_image/async_.pyi b/weaviate/collections/aggregations/near_image/async_.pyi index 8cfa4fbe7..ffaf8a666 100644 --- a/weaviate/collections/aggregations/near_image/async_.pyi +++ b/weaviate/collections/aggregations/near_image/async_.pyi @@ -1,10 +1,10 @@ from typing import Generic, Literal, Optional, Union, overload from weaviate.collections.aggregations.base_executor import _BaseExecutor from weaviate.collections.classes.aggregate import ( - PropertiesMetrics, - AggregateReturn, AggregateGroupByReturn, + AggregateReturn, GroupByAggregate, + PropertiesMetrics, ) from weaviate.collections.classes.filters import _Filters from weaviate.collections.filters import _FilterToGRPC diff --git a/weaviate/collections/aggregations/near_image/executor.py b/weaviate/collections/aggregations/near_image/executor.py index 5f58da84e..1b7e988b0 100644 --- a/weaviate/collections/aggregations/near_image/executor.py +++ b/weaviate/collections/aggregations/near_image/executor.py @@ -2,10 +2,10 @@ from weaviate.collections.aggregations.base_executor import _BaseExecutor from weaviate.collections.classes.aggregate import ( - PropertiesMetrics, - AggregateReturn, AggregateGroupByReturn, + AggregateReturn, GroupByAggregate, + PropertiesMetrics, ) from weaviate.collections.classes.filters import _Filters from weaviate.collections.filters import _FilterToGRPC diff --git a/weaviate/collections/aggregations/near_image/sync.py b/weaviate/collections/aggregations/near_image/sync.py index 58d76f850..636a32b82 100644 --- a/weaviate/collections/aggregations/near_image/sync.py +++ b/weaviate/collections/aggregations/near_image/sync.py @@ -1,5 +1,5 @@ -from weaviate.connect import executor from weaviate.collections.aggregations.near_image.executor import _NearImageExecutor +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/aggregations/near_image/sync.pyi b/weaviate/collections/aggregations/near_image/sync.pyi index 3488f7703..d92bfb9c6 100644 --- a/weaviate/collections/aggregations/near_image/sync.pyi +++ b/weaviate/collections/aggregations/near_image/sync.pyi @@ -1,10 +1,10 @@ from typing import Generic, Literal, Optional, Union, overload from weaviate.collections.aggregations.base_executor import _BaseExecutor from weaviate.collections.classes.aggregate import ( - PropertiesMetrics, - AggregateReturn, AggregateGroupByReturn, + AggregateReturn, GroupByAggregate, + PropertiesMetrics, ) from weaviate.collections.classes.filters import _Filters from weaviate.collections.filters import _FilterToGRPC diff --git a/weaviate/collections/aggregations/near_object/async_.py b/weaviate/collections/aggregations/near_object/async_.py index 3369bff19..a41927e3f 100644 --- a/weaviate/collections/aggregations/near_object/async_.py +++ b/weaviate/collections/aggregations/near_object/async_.py @@ -1,5 +1,5 @@ -from weaviate.connect import executor from weaviate.collections.aggregations.near_object.executor import _NearObjectExecutor +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/aggregations/near_object/async_.pyi b/weaviate/collections/aggregations/near_object/async_.pyi index 610d69120..0140c851f 100644 --- a/weaviate/collections/aggregations/near_object/async_.pyi +++ b/weaviate/collections/aggregations/near_object/async_.pyi @@ -1,10 +1,10 @@ from typing import Generic, Literal, Optional, Union, overload from weaviate.collections.aggregations.base_executor import _BaseExecutor from weaviate.collections.classes.aggregate import ( - PropertiesMetrics, - AggregateReturn, AggregateGroupByReturn, + AggregateReturn, GroupByAggregate, + PropertiesMetrics, ) from weaviate.collections.classes.filters import _Filters from weaviate.collections.filters import _FilterToGRPC diff --git a/weaviate/collections/aggregations/near_object/executor.py b/weaviate/collections/aggregations/near_object/executor.py index 72239c61d..c9283809d 100644 --- a/weaviate/collections/aggregations/near_object/executor.py +++ b/weaviate/collections/aggregations/near_object/executor.py @@ -2,10 +2,10 @@ from weaviate.collections.aggregations.base_executor import _BaseExecutor from weaviate.collections.classes.aggregate import ( - PropertiesMetrics, - AggregateReturn, AggregateGroupByReturn, + AggregateReturn, GroupByAggregate, + PropertiesMetrics, ) from weaviate.collections.classes.filters import _Filters from weaviate.collections.filters import _FilterToGRPC diff --git a/weaviate/collections/aggregations/near_object/sync.py b/weaviate/collections/aggregations/near_object/sync.py index 4ee9c9ce5..e17737133 100644 --- a/weaviate/collections/aggregations/near_object/sync.py +++ b/weaviate/collections/aggregations/near_object/sync.py @@ -1,5 +1,5 @@ -from weaviate.connect import executor from weaviate.collections.aggregations.near_object.executor import _NearObjectExecutor +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/aggregations/near_object/sync.pyi b/weaviate/collections/aggregations/near_object/sync.pyi index 4d6f05527..dc3e70870 100644 --- a/weaviate/collections/aggregations/near_object/sync.pyi +++ b/weaviate/collections/aggregations/near_object/sync.pyi @@ -1,10 +1,10 @@ from typing import Generic, Literal, Optional, Union, overload from weaviate.collections.aggregations.base_executor import _BaseExecutor from weaviate.collections.classes.aggregate import ( - PropertiesMetrics, - AggregateReturn, AggregateGroupByReturn, + AggregateReturn, GroupByAggregate, + PropertiesMetrics, ) from weaviate.collections.classes.filters import _Filters from weaviate.collections.filters import _FilterToGRPC diff --git a/weaviate/collections/aggregations/near_text/async_.py b/weaviate/collections/aggregations/near_text/async_.py index 7172c6325..6fdcf9954 100644 --- a/weaviate/collections/aggregations/near_text/async_.py +++ b/weaviate/collections/aggregations/near_text/async_.py @@ -1,5 +1,5 @@ -from weaviate.connect import executor from weaviate.collections.aggregations.near_text.executor import _NearTextExecutor +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/aggregations/near_text/async_.pyi b/weaviate/collections/aggregations/near_text/async_.pyi index 57996dcc1..adc91562a 100644 --- a/weaviate/collections/aggregations/near_text/async_.pyi +++ b/weaviate/collections/aggregations/near_text/async_.pyi @@ -1,10 +1,10 @@ from typing import Generic, List, Literal, Optional, Union, overload from weaviate.collections.aggregations.base_executor import _BaseExecutor from weaviate.collections.classes.aggregate import ( - PropertiesMetrics, - AggregateReturn, AggregateGroupByReturn, + AggregateReturn, GroupByAggregate, + PropertiesMetrics, ) from weaviate.collections.classes.filters import _Filters from weaviate.collections.classes.grpc import Move diff --git a/weaviate/collections/aggregations/near_text/executor.py b/weaviate/collections/aggregations/near_text/executor.py index b6b22e46b..754a8e203 100644 --- a/weaviate/collections/aggregations/near_text/executor.py +++ b/weaviate/collections/aggregations/near_text/executor.py @@ -2,10 +2,10 @@ from weaviate.collections.aggregations.base_executor import _BaseExecutor from weaviate.collections.classes.aggregate import ( - PropertiesMetrics, - AggregateReturn, AggregateGroupByReturn, + AggregateReturn, GroupByAggregate, + PropertiesMetrics, ) from weaviate.collections.classes.filters import _Filters from weaviate.collections.classes.grpc import Move diff --git a/weaviate/collections/aggregations/near_text/sync.py b/weaviate/collections/aggregations/near_text/sync.py index ff878f1eb..4b274f3db 100644 --- a/weaviate/collections/aggregations/near_text/sync.py +++ b/weaviate/collections/aggregations/near_text/sync.py @@ -1,5 +1,5 @@ -from weaviate.connect import executor from weaviate.collections.aggregations.near_text.executor import _NearTextExecutor +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/aggregations/near_text/sync.pyi b/weaviate/collections/aggregations/near_text/sync.pyi index 975dc0334..fbfc25297 100644 --- a/weaviate/collections/aggregations/near_text/sync.pyi +++ b/weaviate/collections/aggregations/near_text/sync.pyi @@ -1,10 +1,10 @@ from typing import Generic, List, Literal, Optional, Union, overload from weaviate.collections.aggregations.base_executor import _BaseExecutor from weaviate.collections.classes.aggregate import ( - PropertiesMetrics, - AggregateReturn, AggregateGroupByReturn, + AggregateReturn, GroupByAggregate, + PropertiesMetrics, ) from weaviate.collections.classes.filters import _Filters from weaviate.collections.classes.grpc import Move diff --git a/weaviate/collections/aggregations/near_vector/async_.pyi b/weaviate/collections/aggregations/near_vector/async_.pyi index 4f07a8aef..ecac3485f 100644 --- a/weaviate/collections/aggregations/near_vector/async_.pyi +++ b/weaviate/collections/aggregations/near_vector/async_.pyi @@ -1,13 +1,13 @@ from typing import Generic, List, Literal, Optional, Union, cast, overload from weaviate.collections.aggregations.base_executor import _BaseExecutor from weaviate.collections.classes.aggregate import ( - PropertiesMetrics, - AggregateReturn, AggregateGroupByReturn, + AggregateReturn, GroupByAggregate, + PropertiesMetrics, ) from weaviate.collections.classes.filters import _Filters -from weaviate.collections.classes.grpc import TargetVectorJoinType, NearVectorInputType +from weaviate.collections.classes.grpc import NearVectorInputType, TargetVectorJoinType from weaviate.collections.filters import _FilterToGRPC from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType diff --git a/weaviate/collections/aggregations/near_vector/executor.py b/weaviate/collections/aggregations/near_vector/executor.py index 959e92c36..fd1548f43 100644 --- a/weaviate/collections/aggregations/near_vector/executor.py +++ b/weaviate/collections/aggregations/near_vector/executor.py @@ -2,15 +2,15 @@ from weaviate.collections.aggregations.base_executor import _BaseExecutor from weaviate.collections.classes.aggregate import ( - PropertiesMetrics, - AggregateReturn, AggregateGroupByReturn, + AggregateReturn, GroupByAggregate, + PropertiesMetrics, ) from weaviate.collections.classes.filters import _Filters from weaviate.collections.classes.grpc import ( - TargetVectorJoinType, NearVectorInputType, + TargetVectorJoinType, ) from weaviate.collections.filters import _FilterToGRPC from weaviate.connect import executor diff --git a/weaviate/collections/aggregations/near_vector/sync.pyi b/weaviate/collections/aggregations/near_vector/sync.pyi index fb2988736..844960f61 100644 --- a/weaviate/collections/aggregations/near_vector/sync.pyi +++ b/weaviate/collections/aggregations/near_vector/sync.pyi @@ -1,13 +1,13 @@ from typing import Generic, List, Literal, Optional, Union, cast, overload from weaviate.collections.aggregations.base_executor import _BaseExecutor from weaviate.collections.classes.aggregate import ( - PropertiesMetrics, - AggregateReturn, AggregateGroupByReturn, + AggregateReturn, GroupByAggregate, + PropertiesMetrics, ) from weaviate.collections.classes.filters import _Filters -from weaviate.collections.classes.grpc import TargetVectorJoinType, NearVectorInputType +from weaviate.collections.classes.grpc import NearVectorInputType, TargetVectorJoinType from weaviate.collections.filters import _FilterToGRPC from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType diff --git a/weaviate/collections/aggregations/over_all/async_.py b/weaviate/collections/aggregations/over_all/async_.py index 50bd72e49..34cdd4b6a 100644 --- a/weaviate/collections/aggregations/over_all/async_.py +++ b/weaviate/collections/aggregations/over_all/async_.py @@ -1,5 +1,5 @@ -from weaviate.connect import executor from weaviate.collections.aggregations.over_all.executor import _OverAllExecutor +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/aggregations/over_all/async_.pyi b/weaviate/collections/aggregations/over_all/async_.pyi index 316c40b2f..94df75695 100644 --- a/weaviate/collections/aggregations/over_all/async_.pyi +++ b/weaviate/collections/aggregations/over_all/async_.pyi @@ -1,10 +1,10 @@ from typing import Generic, Literal, Optional, Union, overload from weaviate.collections.aggregations.base_executor import _BaseExecutor from weaviate.collections.classes.aggregate import ( - PropertiesMetrics, - AggregateReturn, AggregateGroupByReturn, + AggregateReturn, GroupByAggregate, + PropertiesMetrics, ) from weaviate.collections.classes.filters import _Filters from weaviate.collections.filters import _FilterToGRPC diff --git a/weaviate/collections/aggregations/over_all/executor.py b/weaviate/collections/aggregations/over_all/executor.py index 8213c3c7e..8ddb2fd63 100644 --- a/weaviate/collections/aggregations/over_all/executor.py +++ b/weaviate/collections/aggregations/over_all/executor.py @@ -2,10 +2,10 @@ from weaviate.collections.aggregations.base_executor import _BaseExecutor from weaviate.collections.classes.aggregate import ( - PropertiesMetrics, - AggregateReturn, AggregateGroupByReturn, + AggregateReturn, GroupByAggregate, + PropertiesMetrics, ) from weaviate.collections.classes.filters import _Filters from weaviate.collections.filters import _FilterToGRPC diff --git a/weaviate/collections/aggregations/over_all/sync.py b/weaviate/collections/aggregations/over_all/sync.py index b163dda0c..199b78669 100644 --- a/weaviate/collections/aggregations/over_all/sync.py +++ b/weaviate/collections/aggregations/over_all/sync.py @@ -1,5 +1,5 @@ -from weaviate.connect import executor from weaviate.collections.aggregations.over_all.executor import _OverAllExecutor +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/aggregations/over_all/sync.pyi b/weaviate/collections/aggregations/over_all/sync.pyi index f001a1747..a1ebcd7ac 100644 --- a/weaviate/collections/aggregations/over_all/sync.pyi +++ b/weaviate/collections/aggregations/over_all/sync.pyi @@ -1,10 +1,10 @@ from typing import Generic, Literal, Optional, Union, overload from weaviate.collections.aggregations.base_executor import _BaseExecutor from weaviate.collections.classes.aggregate import ( - PropertiesMetrics, - AggregateReturn, AggregateGroupByReturn, + AggregateReturn, GroupByAggregate, + PropertiesMetrics, ) from weaviate.collections.classes.filters import _Filters from weaviate.collections.filters import _FilterToGRPC diff --git a/weaviate/collections/backups/async_.py b/weaviate/collections/backups/async_.py index f5aa1e571..4e1841369 100644 --- a/weaviate/collections/backups/async_.py +++ b/weaviate/collections/backups/async_.py @@ -1,5 +1,5 @@ -from weaviate.connect import executor from weaviate.collections.backups.executor import _CollectionBackupExecutor +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/backups/async_.pyi b/weaviate/collections/backups/async_.pyi index 1f40815f9..a099929d5 100644 --- a/weaviate/collections/backups/async_.pyi +++ b/weaviate/collections/backups/async_.pyi @@ -1,4 +1,5 @@ from typing import Generic, Optional +from weaviate.backup.backup_location import BackupLocationType from weaviate.backup.executor import ( BackupConfigCreate, BackupConfigRestore, @@ -7,7 +8,6 @@ from weaviate.backup.executor import ( BackupStorage, _BackupExecutor, ) -from weaviate.backup.backup_location import BackupLocationType from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/backups/executor.py b/weaviate/collections/backups/executor.py index ce3f352b5..8d34fa5e3 100644 --- a/weaviate/collections/backups/executor.py +++ b/weaviate/collections/backups/executor.py @@ -1,5 +1,6 @@ from typing import Generic, Optional +from weaviate.backup.backup_location import BackupLocationType from weaviate.backup.executor import ( BackupConfigCreate, BackupConfigRestore, @@ -8,7 +9,6 @@ BackupStorage, _BackupExecutor, ) -from weaviate.backup.backup_location import BackupLocationType from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType diff --git a/weaviate/collections/backups/sync.py b/weaviate/collections/backups/sync.py index c43260191..f358ccc68 100644 --- a/weaviate/collections/backups/sync.py +++ b/weaviate/collections/backups/sync.py @@ -1,5 +1,5 @@ -from weaviate.connect import executor from weaviate.collections.backups.executor import _CollectionBackupExecutor +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/backups/sync.pyi b/weaviate/collections/backups/sync.pyi index 06f329436..185b98b19 100644 --- a/weaviate/collections/backups/sync.pyi +++ b/weaviate/collections/backups/sync.pyi @@ -1,4 +1,5 @@ from typing import Generic, Optional +from weaviate.backup.backup_location import BackupLocationType from weaviate.backup.executor import ( BackupConfigCreate, BackupConfigRestore, @@ -7,7 +8,6 @@ from weaviate.backup.executor import ( BackupStorage, _BackupExecutor, ) -from weaviate.backup.backup_location import BackupLocationType from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/batch/base.py b/weaviate/collections/batch/base.py index fa4f4e35c..0c01bd672 100644 --- a/weaviate/collections/batch/base.py +++ b/weaviate/collections/batch/base.py @@ -10,36 +10,35 @@ from dataclasses import dataclass, field from typing import Any, Dict, Generic, List, Optional, Set, TypeVar, Union, cast +from httpx import ConnectError from pydantic import ValidationError from typing_extensions import TypeAlias -from httpx import ConnectError - from weaviate.cluster.types import Node from weaviate.collections.batch.grpc_batch_objects import _BatchGRPC from weaviate.collections.batch.rest import _BatchREST from weaviate.collections.classes.batch import ( - _BatchReference, BatchObject, + BatchObjectReturn, BatchReference, + BatchReferenceReturn, BatchResult, ErrorObject, ErrorReference, - _BatchObject, - BatchObjectReturn, - BatchReferenceReturn, Shard, + _BatchObject, + _BatchReference, ) from weaviate.collections.classes.config import ConsistencyLevel from weaviate.collections.classes.internal import ( - ReferenceToMulti, ReferenceInput, ReferenceInputs, + ReferenceToMulti, ) from weaviate.collections.classes.types import WeaviateProperties from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync -from weaviate.exceptions import WeaviateBatchValidationError, EmptyResponseException +from weaviate.exceptions import EmptyResponseException, WeaviateBatchValidationError from weaviate.logger import logger from weaviate.types import UUID, VECTORS from weaviate.util import _decode_json_response_dict diff --git a/weaviate/collections/batch/batch_wrapper.py b/weaviate/collections/batch/batch_wrapper.py index cb9c72c2a..19d97ba75 100644 --- a/weaviate/collections/batch/batch_wrapper.py +++ b/weaviate/collections/batch/batch_wrapper.py @@ -1,13 +1,18 @@ import time -from typing import Generic, List, Optional, Any, TypeVar, cast +from typing import Any, Generic, List, Optional, TypeVar, cast from weaviate.collections.batch.base import ( _BatchBase, _BatchDataWrapper, - _DynamicBatching, _BatchMode, + _DynamicBatching, +) +from weaviate.collections.classes.batch import ( + BatchResult, + ErrorObject, + ErrorReference, + Shard, ) -from weaviate.collections.classes.batch import BatchResult, ErrorObject, ErrorReference, Shard from weaviate.collections.classes.config import ConsistencyLevel from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/batch/client.py b/weaviate/collections/batch/client.py index 18a09ca06..2ee570d8f 100644 --- a/weaviate/collections/batch/client.py +++ b/weaviate/collections/batch/client.py @@ -1,5 +1,5 @@ from concurrent.futures import ThreadPoolExecutor -from typing import Optional, Union +from typing import TYPE_CHECKING, Optional, Union from weaviate.collections.batch.base import ( _BatchBase, @@ -9,21 +9,18 @@ _RateLimitedBatching, ) from weaviate.collections.batch.batch_wrapper import ( - _BatchWrapper, _BatchMode, + _BatchWrapper, _ContextManagerWrapper, ) from weaviate.collections.classes.config import ConsistencyLevel, Vectorizers from weaviate.collections.classes.internal import ReferenceInput, ReferenceInputs from weaviate.collections.classes.tenants import Tenant from weaviate.collections.classes.types import WeaviateProperties +from weaviate.connect.v4 import ConnectionSync from weaviate.exceptions import UnexpectedStatusCodeError from weaviate.types import UUID, VECTORS -from weaviate.connect.v4 import ConnectionSync - -from typing import TYPE_CHECKING - if TYPE_CHECKING: from weaviate.collections.collections.sync import _Collections diff --git a/weaviate/collections/batch/collection.py b/weaviate/collections/batch/collection.py index f1c3f550f..d99b1cb03 100644 --- a/weaviate/collections/batch/collection.py +++ b/weaviate/collections/batch/collection.py @@ -9,9 +9,12 @@ _FixedSizeBatching, _RateLimitedBatching, ) -from weaviate.collections.batch.batch_wrapper import _BatchWrapper, _ContextManagerWrapper +from weaviate.collections.batch.batch_wrapper import ( + _BatchWrapper, + _ContextManagerWrapper, +) from weaviate.collections.classes.config import ConsistencyLevel, Vectorizers -from weaviate.collections.classes.internal import ReferenceInputs, ReferenceInput +from weaviate.collections.classes.internal import ReferenceInput, ReferenceInputs from weaviate.collections.classes.types import Properties from weaviate.connect.v4 import ConnectionSync from weaviate.exceptions import UnexpectedStatusCodeError diff --git a/weaviate/collections/batch/grpc_batch_objects.py b/weaviate/collections/batch/grpc_batch_objects.py index 3cdbac7e3..8e206a8ca 100644 --- a/weaviate/collections/batch/grpc_batch_objects.py +++ b/weaviate/collections/batch/grpc_batch_objects.py @@ -7,23 +7,23 @@ from google.protobuf.struct_pb2 import Struct from weaviate.collections.classes.batch import ( - ErrorObject, - _BatchObject, BatchObject, BatchObjectReturn, + ErrorObject, + _BatchObject, ) from weaviate.collections.classes.config import ConsistencyLevel -from weaviate.collections.classes.internal import ReferenceToMulti, ReferenceInputs +from weaviate.collections.classes.internal import ReferenceInputs, ReferenceToMulti from weaviate.collections.classes.types import GeoCoordinate, PhoneNumber -from weaviate.collections.grpc.shared import _BaseGRPC, _Pack, _is_1d_vector +from weaviate.collections.grpc.shared import _BaseGRPC, _is_1d_vector, _Pack from weaviate.connect import executor from weaviate.connect.v4 import Connection from weaviate.exceptions import ( WeaviateInsertInvalidPropertyError, - WeaviateInvalidInputError, WeaviateInsertManyAllFailedError, + WeaviateInvalidInputError, ) -from weaviate.proto.v1 import batch_pb2, base_pb2 +from weaviate.proto.v1 import base_pb2, batch_pb2 from weaviate.types import VECTORS from weaviate.util import _datetime_to_string, _ServerVersion diff --git a/weaviate/collections/batch/rest.py b/weaviate/collections/batch/rest.py index cf0ddc8b7..40f1d66f3 100644 --- a/weaviate/collections/batch/rest.py +++ b/weaviate/collections/batch/rest.py @@ -3,10 +3,10 @@ from httpx import Response from weaviate.collections.classes.batch import ( - ErrorReference, BatchReference, - _BatchReference, BatchReferenceReturn, + ErrorReference, + _BatchReference, ) from weaviate.collections.classes.config import ConsistencyLevel from weaviate.connect import executor diff --git a/weaviate/collections/classes/aggregate.py b/weaviate/collections/classes/aggregate.py index 141926d35..514e3538a 100644 --- a/weaviate/collections/classes/aggregate.py +++ b/weaviate/collections/classes/aggregate.py @@ -5,11 +5,11 @@ Optional, Union, ) -from typing_extensions import TypeVar from pydantic import BaseModel, Field +from typing_extensions import TypeVar -from weaviate.collections.classes.types import _WeaviateInput, GeoCoordinate +from weaviate.collections.classes.types import GeoCoordinate, _WeaviateInput from weaviate.proto.v1 import aggregate_pb2 N = TypeVar("N", int, float) diff --git a/weaviate/collections/classes/batch.py b/weaviate/collections/classes/batch.py index 63c0670a7..5883bcb26 100644 --- a/weaviate/collections/classes/batch.py +++ b/weaviate/collections/classes/batch.py @@ -7,7 +7,7 @@ from weaviate.collections.classes.internal import ReferenceInputs from weaviate.collections.classes.types import WeaviateField from weaviate.types import BEACON, UUID, VECTORS -from weaviate.util import _capitalize_first_letter, get_valid_uuid, _get_vector_v4 +from weaviate.util import _capitalize_first_letter, _get_vector_v4, get_valid_uuid from weaviate.warnings import _Warnings MAX_STORED_RESULTS = 100000 diff --git a/weaviate/collections/classes/cluster.py b/weaviate/collections/classes/cluster.py index 71ec2e4a9..3bcdde7ea 100644 --- a/weaviate/collections/classes/cluster.py +++ b/weaviate/collections/classes/cluster.py @@ -1,7 +1,8 @@ from dataclasses import dataclass from typing import Generic, List, Literal, Optional, TypeVar, cast -from weaviate.cluster.types import Node as NodeREST, Shard as ShardREST +from weaviate.cluster.types import Node as NodeREST +from weaviate.cluster.types import Shard as ShardREST @dataclass diff --git a/weaviate/collections/classes/config.py b/weaviate/collections/classes/config.py index 0d5a14bad..57872327f 100644 --- a/weaviate/collections/classes/config.py +++ b/weaviate/collections/classes/config.py @@ -22,8 +22,8 @@ _ConfigBase, _ConfigCreateModel, _ConfigUpdateModel, - _QuantizerConfigUpdate, _EnumLikeStr, + _QuantizerConfigUpdate, ) from weaviate.collections.classes.config_named_vectors import ( _NamedVectorConfigCreate, @@ -32,11 +32,8 @@ _NamedVectorsUpdate, ) from weaviate.collections.classes.config_vector_index import ( - _MultiVectorConfigCreate, - VectorIndexType as VectorIndexTypeAlias, VectorFilterStrategy, -) -from weaviate.collections.classes.config_vector_index import ( + _MultiVectorConfigCreate, _QuantizerConfigCreate, _VectorIndexConfigCreate, _VectorIndexConfigDynamicCreate, @@ -48,10 +45,26 @@ _VectorIndexConfigSkipCreate, _VectorIndexConfigUpdate, ) -from weaviate.collections.classes.config_vectorizers import CohereModel -from weaviate.collections.classes.config_vectorizers import VectorDistances as VectorDistancesAlias -from weaviate.collections.classes.config_vectorizers import Vectorizers as VectorizersAlias -from weaviate.collections.classes.config_vectorizers import _Vectorizer, _VectorizerConfigCreate +from weaviate.collections.classes.config_vector_index import ( + VectorIndexType as VectorIndexTypeAlias, +) +from weaviate.collections.classes.config_vectorizers import ( + CohereModel, + _Vectorizer, + _VectorizerConfigCreate, +) +from weaviate.collections.classes.config_vectorizers import ( + VectorDistances as VectorDistancesAlias, +) +from weaviate.collections.classes.config_vectorizers import ( + Vectorizers as VectorizersAlias, +) +from weaviate.collections.classes.config_vectors import ( + _VectorConfigCreate, + _VectorConfigUpdate, + _Vectors, + _VectorsUpdate, +) from weaviate.exceptions import WeaviateInvalidInputError from weaviate.str_enum import BaseEnum from weaviate.util import _capitalize_first_letter @@ -1203,12 +1216,33 @@ class _CollectionConfigUpdate(_ConfigUpdateModel): vectorizerConfig: Optional[Union[_VectorIndexConfigUpdate, List[_NamedVectorConfigUpdate]]] = ( Field(default=None, alias="vectorizer_config") ) + vectorConfig: Optional[Union[_VectorConfigUpdate, List[_VectorConfigUpdate]]] = Field( + default=None, alias="vector_config" + ) multiTenancyConfig: Optional[_MultiTenancyConfigUpdate] = Field( default=None, alias="multi_tenancy_config" ) generativeConfig: Optional[_GenerativeProvider] = Field(default=None, alias="generative_config") rerankerConfig: Optional[_RerankerProvider] = Field(default=None, alias="reranker_config") + @field_validator("vectorConfig", mode="before") + def mutual_exclusivity( + cls, + v: Optional[Union[_VectorConfigUpdate, List[_VectorConfigUpdate]]], + info: ValidationInfo, + ): + if v is None: + return v + if info.data["vectorizerConfig"] is not None: + raise ValueError( + "Cannot specify vectorizerConfig when also specifying vectorConfig. Please use one or the other." + ) + if info.data["vectorIndexConfig"] is not None: + raise ValueError( + "Cannot specify vectorIndexConfig when also specifying vectorConfig. Please use one or the other." + ) + return v + def __check_quantizers( self, quantizer: Optional[_QuantizerConfigUpdate], @@ -1318,6 +1352,29 @@ def merge_with_existing(self, schema: Dict[str, Any]) -> Dict[str, Any]: schema["vectorConfig"][vc.name][ "vectorIndexType" ] = vc.vectorIndexConfig.vector_index_type() + if self.vectorConfig is not None: + vcs = ( + [self.vectorConfig] + if isinstance(self.vectorConfig, _VectorConfigUpdate) + else self.vectorConfig + ) + for vc in vcs: + if vc.name not in schema["vectorConfig"]: + raise WeaviateInvalidInputError( + f"Vector config with name {vc.name} does not exist in the existing vector config" + ) + self.__check_quantizers( + vc.vectorIndexConfig.quantizer, + schema["vectorConfig"][vc.name]["vectorIndexConfig"], + ) + schema["vectorConfig"][vc.name]["vectorIndexConfig"] = ( + vc.vectorIndexConfig.merge_with_existing( + schema["vectorConfig"][vc.name]["vectorIndexConfig"] + ) + ) + schema["vectorConfig"][vc.name][ + "vectorIndexType" + ] = vc.vectorIndexConfig.vector_index_type() return schema @staticmethod @@ -1917,17 +1974,22 @@ class _CollectionConfigCreate(_ConfigCreateModel): vectorizerConfig: Optional[Union[_VectorizerConfigCreate, List[_NamedVectorConfigCreate]]] = ( Field(default=_Vectorizer.none(), alias="vectorizer_config") ) + vectorConfig: Optional[Union[_VectorConfigCreate, List[_VectorConfigCreate]]] = Field( + default=_Vectors.none(), alias="vector_config" + ) generativeSearch: Optional[_GenerativeProvider] = Field(default=None, alias="generative_config") rerankerConfig: Optional[_RerankerProvider] = Field(default=None, alias="reranker_config") def model_post_init(self, __context: Any) -> None: self.name = _capitalize_first_letter(self.name) - @field_validator("vectorizerConfig", mode="after") + @field_validator("vectorizerConfig", "vectorConfig", mode="after") @classmethod def validate_vector_names( - cls, v: Union[_VectorizerConfigCreate, List[_NamedVectorConfigCreate]], info: ValidationInfo - ) -> Union[_VectorizerConfigCreate, List[_NamedVectorConfigCreate]]: + cls, + v: Union[_VectorizerConfigCreate, _NamedVectorConfigCreate, List[_NamedVectorConfigCreate]], + info: ValidationInfo, + ) -> Union[_VectorizerConfigCreate, _NamedVectorConfigCreate, List[_NamedVectorConfigCreate]]: if isinstance(v, list): names = [vc.name for vc in v] if len(names) != len(set(names)): @@ -1964,6 +2026,8 @@ def _to_dict(self) -> Dict[str, Any]: elif isinstance(val, _VectorIndexConfigCreate): ret_dict["vectorIndexType"] = val.vector_index_type().value ret_dict[cls_field] = val._to_dict() + elif isinstance(val, _VectorConfigCreate): + ret_dict["vectorConfig"] = {"default": val._to_dict()} elif ( isinstance(val, list) and len(val) > 0 @@ -1971,7 +2035,19 @@ def _to_dict(self) -> Dict[str, Any]: ): val = cast(List[_NamedVectorConfigCreate], val) ret_dict["vectorConfig"] = {item.name: item._to_dict() for item in val} - + elif ( + isinstance(val, list) + and len(val) > 0 + and all(isinstance(item, _VectorConfigCreate) for item in val) + ): + val = cast(List[_VectorConfigCreate], val) + ret_dict["vectorConfig"] = {} + for item in val: + if item.name is None: + raise WeaviateInvalidInputError( + "Vector config name must be set when specifying multiple vectors" + ) + ret_dict["vectorConfig"][item.name] = item._to_dict() else: assert isinstance(val, _ConfigCreateModel) ret_dict[cls_field] = val._to_dict() @@ -2199,6 +2275,7 @@ class Configure: Vectorizer = _Vectorizer VectorIndex = _VectorIndex NamedVectors = _NamedVectors + Vectors = _Vectors @staticmethod def inverted_index( @@ -2455,6 +2532,7 @@ class Reconfigure: """ NamedVectors = _NamedVectorsUpdate + Vectors = _VectorsUpdate VectorIndex = _VectorIndexUpdate Generative = _Generative # config is the same for create and update Reranker = _Reranker # config is the same for create and update diff --git a/weaviate/collections/classes/config_methods.py b/weaviate/collections/classes/config_methods.py index fc1f47901..23e351eeb 100644 --- a/weaviate/collections/classes/config_methods.py +++ b/weaviate/collections/classes/config_methods.py @@ -1,43 +1,43 @@ from typing import Any, Dict, List, Optional, Union, cast from weaviate.collections.classes.config import ( + DataType, + GenerativeSearches, + PQEncoderDistribution, + PQEncoderType, + ReplicationDeletionStrategy, + Rerankers, + StopwordsPreset, + Tokenization, + VectorDistances, + VectorFilterStrategy, + VectorIndexType, + Vectorizers, + _BM25Config, _BQConfig, - _SQConfig, _CollectionConfig, _CollectionConfigSimple, + _GenerativeConfig, + _InvertedIndexConfig, + _MultiTenancyConfig, + _MultiVectorConfig, _NamedVectorConfig, _NamedVectorizerConfig, - _MultiVectorConfig, + _NestedProperty, _PQConfig, - _VectorIndexConfigFlat, - _VectorIndexConfigDynamic, - _InvertedIndexConfig, - _BM25Config, - _StopwordsConfig, - _MultiTenancyConfig, + _PQEncoderConfig, _Property, + _PropertyVectorizerConfig, _ReferenceProperty, _ReplicationConfig, + _RerankerConfig, _ShardingConfig, + _SQConfig, + _StopwordsConfig, + _VectorIndexConfigDynamic, + _VectorIndexConfigFlat, _VectorIndexConfigHNSW, - StopwordsPreset, - VectorDistances, - PQEncoderType, - PQEncoderDistribution, - VectorIndexType, - Vectorizers, - Tokenization, - _PQEncoderConfig, - _PropertyVectorizerConfig, _VectorizerConfig, - _GenerativeConfig, - GenerativeSearches, - DataType, - _RerankerConfig, - Rerankers, - _NestedProperty, - ReplicationDeletionStrategy, - VectorFilterStrategy, ) diff --git a/weaviate/collections/classes/config_named_vectors.py b/weaviate/collections/classes/config_named_vectors.py index b12e59ca1..bde540818 100644 --- a/weaviate/collections/classes/config_named_vectors.py +++ b/weaviate/collections/classes/config_named_vectors.py @@ -10,26 +10,45 @@ _EnumLikeStr, ) from weaviate.collections.classes.config_vector_index import ( + VectorIndexType, _VectorIndexConfigCreate, - _VectorIndexConfigHNSWUpdate, - _VectorIndexConfigFlatUpdate, _VectorIndexConfigDynamicUpdate, + _VectorIndexConfigFlatUpdate, + _VectorIndexConfigHNSWUpdate, _VectorIndexConfigUpdate, - VectorIndexType, ) from weaviate.collections.classes.config_vectorizers import ( + AWSModel, + AWSService, + CohereModel, + CohereMultimodalModel, + CohereTruncation, + JinaModel, + JinaMultimodalModel, + Multi2VecField, + OpenAIModel, + OpenAIType, + Vectorizers, + VoyageModel, + VoyageMultimodalModel, + WeaviateModel, _Img2VecNeuralConfig, + _map_multi2vec_fields, _Multi2VecBindConfig, _Multi2VecClipConfig, - _Multi2VecVoyageaiConfig, - _Multi2VecNvidiaConfig, + _Multi2VecCohereConfig, _Multi2VecGoogleConfig, + _Multi2VecJinaConfig, + _Multi2VecNvidiaConfig, + _Multi2VecVoyageaiConfig, _Ref2VecCentroidConfig, _Text2ColbertJinaAIConfig, _Text2VecAWSConfig, _Text2VecAzureOpenAIConfig, _Text2VecCohereConfig, _Text2VecContextionaryConfig, + _Text2VecDatabricksConfig, + _Text2VecGoogleConfig, _Text2VecGPT4AllConfig, _Text2VecHuggingFaceConfig, _Text2VecJinaConfig, @@ -37,44 +56,14 @@ _Text2VecNvidiaConfig, _Text2VecOllamaConfig, _Text2VecOpenAIConfig, - _Text2VecGoogleConfig, _Text2VecTransformersConfig, - _VectorizerConfigCreate, - AWSModel, - AWSService, - CohereModel, - CohereMultimodalModel, - CohereTruncation, - JinaModel, - JinaMultimodalModel, - Multi2VecField, - OpenAIModel, - OpenAIType, - Vectorizers, - VoyageModel, - VoyageMultimodalModel, - _map_multi2vec_fields, - _VectorizerCustomConfig, - _Text2VecDatabricksConfig, _Text2VecVoyageConfig, - _Multi2VecCohereConfig, - _Multi2VecJinaConfig, _Text2VecWeaviateConfig, - WeaviateModel, + _VectorizerConfigCreate, + _VectorizerCustomConfig, ) -from ...warnings import _Warnings - -class _NamedVectorizerConfigCreate(_ConfigCreateModel): - vectorizer: Vectorizers - properties: Optional[List[str]] = Field(default=None, min_length=1, alias="source_properties") - - def _to_dict(self) -> Dict[str, Any]: - return self._to_vectorizer_dict(self.vectorizer, super()._to_dict()) - - @staticmethod - def _to_vectorizer_dict(vectorizer: Vectorizers, values: Dict[str, Any]) -> Dict[str, Any]: - return {str(vectorizer.value): values} +from ...warnings import _Warnings class _NamedVectorConfigCreate(_ConfigCreateModel): diff --git a/weaviate/collections/classes/config_vectorizers.py b/weaviate/collections/classes/config_vectorizers.py index a6410e668..f95b228b9 100644 --- a/weaviate/collections/classes/config_vectorizers.py +++ b/weaviate/collections/classes/config_vectorizers.py @@ -8,6 +8,7 @@ from typing_extensions import deprecated as typing_deprecated from weaviate.collections.classes.config_base import _ConfigCreateModel, _EnumLikeStr + from ...warnings import _Warnings # See https://docs.cohere.com/docs/cohere-embed for reference diff --git a/weaviate/collections/classes/config_vectors.py b/weaviate/collections/classes/config_vectors.py new file mode 100644 index 000000000..fcc66cb2a --- /dev/null +++ b/weaviate/collections/classes/config_vectors.py @@ -0,0 +1,1267 @@ +from typing import Any, Dict, List, Literal, Optional, Union + +from deprecation import deprecated as docstring_deprecated +from pydantic import AnyHttpUrl, Field +from typing_extensions import deprecated as typing_deprecated + +from weaviate.collections.classes.config_base import ( + _ConfigCreateModel, + _ConfigUpdateModel, + _EnumLikeStr, +) +from weaviate.collections.classes.config_vector_index import ( + VectorIndexType, + _VectorIndexConfigCreate, + _VectorIndexConfigDynamicUpdate, + _VectorIndexConfigFlatUpdate, + _VectorIndexConfigHNSWUpdate, + _VectorIndexConfigUpdate, +) +from weaviate.collections.classes.config_vectorizers import ( + AWSModel, + AWSService, + CohereModel, + CohereMultimodalModel, + CohereTruncation, + JinaModel, + JinaMultimodalModel, + Multi2VecField, + OpenAIModel, + OpenAIType, + Vectorizers, + VoyageModel, + VoyageMultimodalModel, + WeaviateModel, + _Img2VecNeuralConfig, + _map_multi2vec_fields, + _Multi2VecBindConfig, + _Multi2VecClipConfig, + _Multi2VecCohereConfig, + _Multi2VecGoogleConfig, + _Multi2VecJinaConfig, + _Multi2VecNvidiaConfig, + _Multi2VecVoyageaiConfig, + _Ref2VecCentroidConfig, + _Text2ColbertJinaAIConfig, + _Text2VecAWSConfig, + _Text2VecAzureOpenAIConfig, + _Text2VecCohereConfig, + _Text2VecContextionaryConfig, + _Text2VecDatabricksConfig, + _Text2VecGoogleConfig, + _Text2VecGPT4AllConfig, + _Text2VecHuggingFaceConfig, + _Text2VecJinaConfig, + _Text2VecMistralConfig, + _Text2VecNvidiaConfig, + _Text2VecOllamaConfig, + _Text2VecOpenAIConfig, + _Text2VecTransformersConfig, + _Text2VecVoyageConfig, + _Text2VecWeaviateConfig, + _VectorizerConfigCreate, + _VectorizerCustomConfig, +) + +from ...warnings import _Warnings + + +class _VectorConfigCreate(_ConfigCreateModel): + name: Optional[str] + properties: Optional[List[str]] = Field(default=None, min_length=1, alias="source_properties") + vectorizer: _VectorizerConfigCreate + vectorIndexType: VectorIndexType = Field(default=VectorIndexType.HNSW, exclude=True) + vectorIndexConfig: Optional[_VectorIndexConfigCreate] = Field( + default=None, alias="vector_index_config" + ) + + def _to_dict(self) -> Dict[str, Any]: + ret_dict: Dict[str, Any] = self.__parse_vectorizer() + if self.vectorIndexConfig is not None: + ret_dict["vectorIndexType"] = self.vectorIndexConfig.vector_index_type().value + ret_dict["vectorIndexConfig"] = self.vectorIndexConfig._to_dict() + else: + ret_dict["vectorIndexType"] = self.vectorIndexType.value + return ret_dict + + def __parse_vectorizer(self) -> Dict[str, Any]: + vectorizer_options = self.vectorizer._to_dict() + if self.properties is not None: + vectorizer_options["properties"] = self.properties + return {"vectorizer": {self.vectorizer.vectorizer.value: vectorizer_options}} + + +class _VectorConfigUpdate(_ConfigUpdateModel): + name: str + vectorIndexConfig: _VectorIndexConfigUpdate = Field(..., alias="vector_index_config") + + +class _Vectors: + @staticmethod + def none( + *, + name: Optional[str] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + ): + """Create a named vector using no vectorizer. You will need to provide the vectors yourself. + + Args: + name: The name of the named vector. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + """ + return _VectorConfigCreate( + name=name, + vectorizer=_VectorizerConfigCreate(vectorizer=Vectorizers.NONE), + vector_index_config=vector_index_config, + ) + + @staticmethod + def custom( + *, + name: Optional[str] = None, + module_name: str, + module_config: Optional[Dict[str, Any]] = None, + source_properties: Optional[List[str]] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + ) -> _VectorConfigCreate: + """Create a named vector using no vectorizer. You will need to provide the vectors yourself. + + Args: + name: The name of the named vector. + module_name: The name of the custom module to use. + module_config: The configuration of the custom module to use. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + """ + return _VectorConfigCreate( + name=name, + source_properties=source_properties, + vectorizer=_VectorizerCustomConfig( + vectorizer=_EnumLikeStr(module_name), module_config=module_config + ), + vector_index_config=vector_index_config, + ) + + @staticmethod + def text2colbert_jinaai( + *, + name: Optional[str] = None, + dimensions: Optional[int] = None, + model: Optional[str] = None, + source_properties: Optional[List[str]] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorize_collection_name: bool = True, + ) -> _VectorConfigCreate: + """Create a named vector using the `text2colbert_jinaai` module. + + See the [documentation](https://weaviate.io/developers/weaviate/model-providers/jinaai/colbert) + for detailed usage. + + Args: + name: The name of the named vector. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + model: The model to use. Defaults to `None`, which uses the server-defined default. + dimensions: Number of dimensions. Applicable to v3 OpenAI models only. Defaults to `None`, which uses the server-defined default. + """ + return _VectorConfigCreate( + name=name, + source_properties=source_properties, + vector_index_config=vector_index_config, + vectorizer=_Text2ColbertJinaAIConfig( + model=model, dimensions=dimensions, vectorizeClassName=vectorize_collection_name + ), + ) + + @staticmethod + def text2vec_cohere( + *, + name: Optional[str] = None, + base_url: Optional[AnyHttpUrl] = None, + model: Optional[Union[CohereModel, str]] = None, + truncate: Optional[CohereTruncation] = None, + source_properties: Optional[List[str]] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorize_collection_name: bool = True, + ) -> _VectorConfigCreate: + """Create a named vector using the `text2vec_cohere` model. + + See the [documentation](https://weaviate.io/developers/weaviate/model-providers/cohere/embeddings) + for detailed usage. + + Args: + name: The name of the named vector. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + model: The model to use. Defaults to `None`, which uses the server-defined default. + truncate: The truncation strategy to use. Defaults to `None`, which uses the server-defined default. + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. + + Raises: + pydantic.ValidationError: If `model` is not a valid value from the `CohereModel` type or if `truncate` is not a valid value from the `CohereTruncation` type. + """ + return _VectorConfigCreate( + name=name, + source_properties=source_properties, + vectorizer=_Text2VecCohereConfig( + baseURL=base_url, + model=model, + truncate=truncate, + vectorizeClassName=vectorize_collection_name, + ), + vector_index_config=vector_index_config, + ) + + @staticmethod + def multi2vec_cohere( + *, + name: Optional[str] = None, + base_url: Optional[AnyHttpUrl] = None, + image_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, + model: Optional[Union[CohereMultimodalModel, str]] = None, + text_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, + truncate: Optional[CohereTruncation] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorize_collection_name: bool = True, + ) -> _VectorConfigCreate: + """Create a named vector using the `multi2vec_cohere` model. + + See the [documentation](https://weaviate.io/developers/weaviate/model-providers/cohere/embeddings-multimodal) + for detailed usage. + + Args: + name: The name of the named vector. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + model: The model to use. Defaults to `None`, which uses the server-defined default. + truncate: The truncation strategy to use. Defaults to `None`, which uses the server-defined default. + base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. + image_fields: The image fields to use in vectorization. + text_fields: The text fields to use in vectorization. + + Raises: + 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. + """ + return _VectorConfigCreate( + name=name, + vectorizer=_Multi2VecCohereConfig( + baseURL=base_url, + model=model, + truncate=truncate, + vectorizeClassName=vectorize_collection_name, + imageFields=_map_multi2vec_fields(image_fields), + textFields=_map_multi2vec_fields(text_fields), + ), + vector_index_config=vector_index_config, + ) + + @staticmethod + def text2vec_contextionary( + *, + name: Optional[str] = None, + source_properties: Optional[List[str]] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorize_collection_name: bool = True, + ) -> _VectorConfigCreate: + """Create a named vector using the `text2vec_contextionary` model. + + See the [documentation](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/text2vec-contextionary) + for detailed usage. + + Args: + name: The name of the named vector. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + """ + return _VectorConfigCreate( + name=name, + source_properties=source_properties, + vectorizer=_Text2VecContextionaryConfig( + vectorizeClassName=vectorize_collection_name, + ), + vector_index_config=vector_index_config, + ) + + @staticmethod + def text2vec_databricks( + *, + name: Optional[str] = None, + endpoint: str, + instruction: Optional[str] = None, + source_properties: Optional[List[str]] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorize_collection_name: bool = True, + ) -> _VectorConfigCreate: + """Create a named vector using the `text2vec-databricks` model. + + See the [documentation](https://weaviate.io/developers/weaviate/model-providers/databricks/embeddings) + for detailed usage. + + Args: + name: The name of the named vector. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + endpoint: The endpoint to use. + instruction: The instruction strategy to use. Defaults to `None`, which uses the server-defined default. + """ + return _VectorConfigCreate( + name=name, + source_properties=source_properties, + vectorizer=_Text2VecDatabricksConfig( + endpoint=endpoint, + instruction=instruction, + vectorizeClassName=vectorize_collection_name, + ), + vector_index_config=vector_index_config, + ) + + @staticmethod + def text2vec_mistral( + *, + name: Optional[str] = None, + base_url: Optional[AnyHttpUrl] = None, + model: Optional[str] = None, + source_properties: Optional[List[str]] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorize_collection_name: bool = True, + ) -> _VectorConfigCreate: + """Create a named vector using the `text2vec-mistral` model. + + See the [documentation](https://weaviate.io/developers/weaviate/model-providers/mistral/embeddings) + for detailed usage. + + Args: + name: The name of the named vector. + base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. + model: The model to use. Defaults to `None`, which uses the server-defined default. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + """ + return _VectorConfigCreate( + name=name, + source_properties=source_properties, + vectorizer=_Text2VecMistralConfig( + baseURL=base_url, + model=model, + vectorizeClassName=vectorize_collection_name, + ), + vector_index_config=vector_index_config, + ) + + @staticmethod + def text2vec_ollama( + *, + name: Optional[str] = None, + api_endpoint: Optional[str] = None, + model: Optional[str] = None, + source_properties: Optional[List[str]] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorize_collection_name: bool = True, + ) -> _VectorConfigCreate: + """Create a named vector using the `text2vec-ollama` model. + + See the [documentation](https://weaviate.io/developers/weaviate/model-providers/ollama/embeddings) + for detailed usage. + + Args: + name: The name of the named vector. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + model: The model to use. Defaults to `None`, which uses the server-defined default. + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + api_endpoint: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. + Docker users may need to specify an alias, such as `http://host.docker.internal:11434` so that the container can access the host machine. + + """ + return _VectorConfigCreate( + name=name, + source_properties=source_properties, + vectorizer=_Text2VecOllamaConfig( + apiEndpoint=api_endpoint, + model=model, + vectorizeClassName=vectorize_collection_name, + ), + vector_index_config=vector_index_config, + ) + + @staticmethod + def text2vec_openai( + *, + name: Optional[str] = None, + base_url: Optional[AnyHttpUrl] = None, + dimensions: Optional[int] = None, + model: Optional[Union[OpenAIModel, str]] = None, + model_version: Optional[str] = None, + type_: Optional[OpenAIType] = None, + source_properties: Optional[List[str]] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorize_collection_name: bool = True, + ) -> _VectorConfigCreate: + """Create a named vector using the `text2vec_openai` model. + + See the [documentation](https://weaviate.io/developers/weaviate/model-providers/openai/embeddings) + for detailed usage. + + Args: + name: The name of the named vector. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + model: The model to use. Defaults to `None`, which uses the server-defined default. + model_version: The model version to use. Defaults to `None`, which uses the server-defined default. + type_: The type of model to use. Defaults to `None`, which uses the server-defined default. + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. + dimensions: Number of dimensions. Applicable to v3 OpenAI models only. Defaults to `None`, which uses the server-defined default. + + Raises: + pydantic.ValidationError: If `type_` is not a valid value from the `OpenAIType` type. + """ + return _VectorConfigCreate( + name=name, + source_properties=source_properties, + vectorizer=_Text2VecOpenAIConfig( + baseURL=base_url, + model=model, + modelVersion=model_version, + type_=type_, + vectorizeClassName=vectorize_collection_name, + dimensions=dimensions, + ), + vector_index_config=vector_index_config, + ) + + @staticmethod + def text2vec_aws( + *, + region: str, + name: Optional[str] = None, + endpoint: Optional[str] = None, + model: Optional[Union[AWSModel, str]] = None, + service: Union[AWSService, str] = "bedrock", + source_properties: Optional[List[str]] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorize_collection_name: bool = True, + ) -> _VectorConfigCreate: + """Create a named vector using the `text2vec_aws` model. + + See the [documentation](https://weaviate.io/developers/weaviate/model-providers/aws/embeddings) + for detailed usage. + + Args: + name: The name of the named vector. + region: The AWS region to run the model from, REQUIRED. + endpoint: The endpoint to use. Defaults to `None`, which uses the server-defined default. + model: The model to use. + service: The AWS service to use. Defaults to `bedrock`. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + """ + return _VectorConfigCreate( + name=name, + source_properties=source_properties, + vectorizer=_Text2VecAWSConfig( + model=model, + endpoint=endpoint, + region=region, + service=service, + vectorizeClassName=vectorize_collection_name, + ), + vector_index_config=vector_index_config, + ) + + @staticmethod + def img2vec_neural( + *, + name: Optional[str] = None, + image_fields: List[str], + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + ) -> _VectorConfigCreate: + """Create a `Img2VecNeuralConfig` object for use when vectorizing using the `img2vec-neural` model. + + See the [documentation](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/img2vec-neural) + for detailed usage. + + Args: + name: The name of the named vector. + image_fields: The image fields to use. This is a required field and must match the property fields of the collection that are defined as `DataType.BLOB`. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + + Raises: + pydantic.ValidationError: If `image_fields` is not a `list`. + """ + return _VectorConfigCreate( + name=name, + vectorizer=_Img2VecNeuralConfig(imageFields=image_fields), + vector_index_config=vector_index_config, + ) + + @staticmethod + def multi2vec_clip( + *, + name: Optional[str] = None, + inference_url: Optional[str] = None, + image_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, + text_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorize_collection_name: bool = True, + ) -> _VectorConfigCreate: + """Create a named vector using the `multi2vec_clip` model. + + See the [documentation](https://weaviate.io/developers/weaviate/model-providers/transformers/embeddings-multimodal) + for detailed usage. + + Args: + name: The name of the named vector. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + image_fields: The image fields to use in vectorization. + text_fields: The text fields to use in vectorization. + inference_url: The inference url to use where API requests should go. Defaults to `None`, which uses the server-defined default. + """ + return _VectorConfigCreate( + name=name, + vectorizer=_Multi2VecClipConfig( + imageFields=_map_multi2vec_fields(image_fields), + textFields=_map_multi2vec_fields(text_fields), + vectorizeClassName=vectorize_collection_name, + inferenceUrl=inference_url, + ), + vector_index_config=vector_index_config, + ) + + @staticmethod + @docstring_deprecated( + deprecated_in="4.9.0", + details=""" +This method is deprecated and will be removed in Q2 '25. Please use :meth:`~weaviate.collections.classes.config._NamedVectors.multi2vec_google` instead. +""", + ) + @typing_deprecated( + "This method is deprecated and will be removed in Q2 '25. Please use `multi2vec_google` instead." + ) + def multi2vec_palm( + *, + name: Optional[str] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorize_collection_name: bool = True, + location: str, + project_id: str, + image_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, + text_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, + video_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, + dimensions: Optional[int] = None, + video_interval_seconds: Optional[int] = None, + model_id: Optional[str] = None, + ) -> _VectorConfigCreate: + """Create a named vector using the `multi2vec_palm` model. + + See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings-multimodal) + for detailed usage. + + Args: + name: The name of the named vector. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + location: Where the model runs. REQUIRED. + project_id: The project ID to use, REQUIRED. + image_fields: The image fields to use in vectorization. + text_fields: The text fields to use in vectorization. + video_fields: The video fields to use in vectorization. + dimensions: The number of dimensions to use. Defaults to `None`, which uses the server-defined default. + video_interval_seconds: Length of a video interval. Defaults to `None`, which uses the server-defined default. + model_id: The model ID to use. Defaults to `None`, which uses the server-defined default. + """ + _Warnings.palm_to_google_m2v() + return _VectorConfigCreate( + name=name, + vectorizer=_Multi2VecGoogleConfig( + projectId=project_id, + location=location, + imageFields=_map_multi2vec_fields(image_fields), + textFields=_map_multi2vec_fields(text_fields), + videoFields=_map_multi2vec_fields(video_fields), + dimensions=dimensions, + modelId=model_id, + videoIntervalSeconds=video_interval_seconds, + vectorizeClassName=vectorize_collection_name, + ), + vector_index_config=vector_index_config, + ) + + @staticmethod + def multi2vec_google( + *, + name: Optional[str] = None, + location: str, + project_id: str, + image_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, + text_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, + video_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, + dimensions: Optional[int] = None, + video_interval_seconds: Optional[int] = None, + model_id: Optional[str] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorize_collection_name: bool = True, + ) -> _VectorConfigCreate: + """Create a named vector using the `multi2vec_google` model. + + See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings-multimodal) + for detailed usage. + + Args: + name: The name of the named vector. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + location: Where the model runs. REQUIRED. + project_id: The project ID to use, REQUIRED. + image_fields: The image fields to use in vectorization. + text_fields: The text fields to use in vectorization. + video_fields: The video fields to use in vectorization. + dimensions: The number of dimensions to use. Defaults to `None`, which uses the server-defined default. + video_interval_seconds: Length of a video interval. Defaults to `None`, which uses the server-defined default. + model_id: The model ID to use. Defaults to `None`, which uses the server-defined default. + """ + return _VectorConfigCreate( + name=name, + vectorizer=_Multi2VecGoogleConfig( + projectId=project_id, + location=location, + imageFields=_map_multi2vec_fields(image_fields), + textFields=_map_multi2vec_fields(text_fields), + videoFields=_map_multi2vec_fields(video_fields), + dimensions=dimensions, + modelId=model_id, + videoIntervalSeconds=video_interval_seconds, + vectorizeClassName=vectorize_collection_name, + ), + vector_index_config=vector_index_config, + ) + + @staticmethod + def multi2vec_bind( + *, + name: Optional[str] = None, + audio_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, + depth_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, + image_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, + imu_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, + text_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, + thermal_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, + video_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorize_collection_name: bool = True, + ) -> _VectorConfigCreate: + """Create a named vector using the `multi2vec_bind` model. + + See the [documentation](https://weaviate.io/developers/weaviate/model-providers/imagebind/embeddings-multimodal) + for detailed usage. + + Args: + name: The name of the named vector. + audio_fields: The audio fields to use in vectorization. + depth_fields: The depth fields to use in vectorization. + image_fields: The image fields to use in vectorization. + imu_fields: The IMU fields to use in vectorization. + text_fields: The text fields to use in vectorization. + thermal_fields: The thermal fields to use in vectorization. + video_fields: The video fields to use in vectorization. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + """ + return _VectorConfigCreate( + name=name, + vectorizer=_Multi2VecBindConfig( + audioFields=_map_multi2vec_fields(audio_fields), + depthFields=_map_multi2vec_fields(depth_fields), + imageFields=_map_multi2vec_fields(image_fields), + IMUFields=_map_multi2vec_fields(imu_fields), + textFields=_map_multi2vec_fields(text_fields), + thermalFields=_map_multi2vec_fields(thermal_fields), + videoFields=_map_multi2vec_fields(video_fields), + vectorizeClassName=vectorize_collection_name, + ), + vector_index_config=vector_index_config, + ) + + @staticmethod + def multi2vec_voyageai( + *, + name: Optional[str] = None, + base_url: Optional[AnyHttpUrl] = None, + model: Optional[Union[VoyageMultimodalModel, str]] = None, + truncation: Optional[bool] = None, + output_encoding: Optional[str] = None, + image_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, + text_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorize_collection_name: bool = True, + ) -> _VectorConfigCreate: + """Create a named vector using the `multi2vec_voyageai` model. + + See the [documentation](https://weaviate.io/developers/weaviate/model-providers/voyageai/embeddings-multimodal) + for detailed usage. + + Args: + name: The name of the named vector. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + model: The model to use. Defaults to `None`, which uses the server-defined default. + truncation: The truncation strategy to use. Defaults to `None`, which uses the server-defined default. + base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. + image_fields: The image fields to use in vectorization. + text_fields: The text fields to use in vectorization. + + Raises: + pydantic.ValidationError: If `model` is not a valid value from the `VoyageaiMultimodalModel` type. + """ + return _VectorConfigCreate( + name=name, + vectorizer=_Multi2VecVoyageaiConfig( + baseURL=base_url, + model=model, + truncation=truncation, + output_encoding=output_encoding, + vectorizeClassName=vectorize_collection_name, + imageFields=_map_multi2vec_fields(image_fields), + textFields=_map_multi2vec_fields(text_fields), + ), + vector_index_config=vector_index_config, + ) + + @staticmethod + def multi2vec_nvidia( + *, + name: Optional[str] = None, + base_url: Optional[AnyHttpUrl] = None, + model: Optional[str] = None, + truncation: Optional[bool] = None, + output_encoding: Optional[str] = None, + image_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, + text_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorize_collection_name: bool = True, + ) -> _VectorConfigCreate: + """Create a named vector using the `multi2vec_nvidia` model. + + See the [documentation](https://weaviate.io/developers/weaviate/model-providers/nvidia/embeddings-multimodal) + for detailed usage. + + Args: + name: The name of the named vector. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + model: The model to use. Defaults to `None`, which uses the server-defined default. + truncation: The truncation strategy to use. Defaults to `None`, which uses the server-defined default. + base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. + image_fields: The image fields to use in vectorization. + text_fields: The text fields to use in vectorization. + + Raises: + pydantic.ValidationError: If `model` is not a valid value from the `NvidiaMultimodalModel` type. + """ + return _VectorConfigCreate( + name=name, + vectorizer=_Multi2VecNvidiaConfig( + baseURL=base_url, + model=model, + truncation=truncation, + output_encoding=output_encoding, + vectorizeClassName=vectorize_collection_name, + imageFields=_map_multi2vec_fields(image_fields), + textFields=_map_multi2vec_fields(text_fields), + ), + vector_index_config=vector_index_config, + ) + + @staticmethod + def ref2vec_centroid( + *, + name: Optional[str] = None, + reference_properties: List[str], + method: Literal["mean"] = "mean", + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + ) -> _VectorConfigCreate: + """Create a named vector using the `ref2vec_centroid` model. + + See the [documentation](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/text2vec-gpt4all) + for detailed usage. + + Args: + name: The name of the named vector. + reference_properties: The reference properties to use in vectorization, REQUIRED. + method: The method to use. Defaults to `mean`. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + """ + return _VectorConfigCreate( + name=name, + vectorizer=_Ref2VecCentroidConfig( + referenceProperties=reference_properties, + method=method, + ), + vector_index_config=vector_index_config, + ) + + @staticmethod + def text2vec_azure_openai( + *, + name: Optional[str] = None, + resource_name: str, + deployment_id: str, + base_url: Optional[AnyHttpUrl] = None, + dimensions: Optional[int] = None, + model: Optional[str] = None, + source_properties: Optional[List[str]] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorize_collection_name: bool = True, + ) -> _VectorConfigCreate: + """Create a named vector using the `text2vec_azure_openai` model. + + See the [documentation](https://weaviate.io/developers/weaviate/model-providers/openai-azure/embeddings) + for detailed usage. + + Args: + name: The name of the named vector. + resource_name: The resource name to use, REQUIRED. + deployment_id: The deployment ID to use, REQUIRED. + base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. + dimensions: The dimensionality of the vectors. Defaults to `None`, which uses the server-defined default. + model: The model to use. Defaults to `None`, which uses the server-defined default. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + """ + return _VectorConfigCreate( + name=name, + source_properties=source_properties, + vectorizer=_Text2VecAzureOpenAIConfig( + baseURL=base_url, + dimensions=dimensions, + model=model, + resourceName=resource_name, + deploymentId=deployment_id, + vectorizeClassName=vectorize_collection_name, + ), + vector_index_config=vector_index_config, + ) + + @staticmethod + def text2vec_gpt4all( + *, + name: Optional[str] = None, + source_properties: Optional[List[str]] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorize_collection_name: bool = True, + ) -> _VectorConfigCreate: + """Create a named vector using the `text2vec_gpt4all` model. + + See the [documentation](https://weaviate.io/developers/weaviate/model-providers/gpt4all/embeddings) + for detailed usage. + + Args: + name: The name of the named vector. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + """ + return _VectorConfigCreate( + name=name, + source_properties=source_properties, + vectorizer=_Text2VecGPT4AllConfig( + vectorizeClassName=vectorize_collection_name, + ), + vector_index_config=vector_index_config, + ) + + @staticmethod + def text2vec_huggingface( + *, + name: Optional[str] = None, + model: Optional[str] = None, + passage_model: Optional[str] = None, + query_model: Optional[str] = None, + endpoint_url: Optional[AnyHttpUrl] = None, + wait_for_model: Optional[bool] = None, + use_gpu: Optional[bool] = None, + use_cache: Optional[bool] = None, + source_properties: Optional[List[str]] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorize_collection_name: bool = True, + ) -> _VectorConfigCreate: + """Create a named vector using the `text2vec_huggingface` model. + + See the [documentation](https://weaviate.io/developers/weaviate/model-providers/huggingface/embeddings) + for detailed usage. + + Args: + name: The name of the named vector. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + model: The model to use. Defaults to `None`, which uses the server-defined default. + passage_model: The passage model to use. Defaults to `None`, which uses the server-defined default. + query_model: The query model to use. Defaults to `None`, which uses the server-defined default. + endpoint_url: The endpoint URL to use. Defaults to `None`, which uses the server-defined default. + wait_for_model: Whether to wait for the model to be loaded. Defaults to `None`, which uses the server-defined default. + use_gpu: Whether to use the GPU. Defaults to `None`, which uses the server-defined default. + use_cache: Whether to use the cache. Defaults to `None`, which uses the server-defined default. + + Raises: + pydantic.ValidationError: If the arguments passed to the function are invalid. + It is important to note that some of these variables are mutually exclusive. + See the [documentation](https://weaviate.io/developers/weaviate/model-providers/huggingface/embeddings#vectorizer-parameters) for more details. + """ + return _VectorConfigCreate( + name=name, + source_properties=source_properties, + vectorizer=_Text2VecHuggingFaceConfig( + model=model, + passageModel=passage_model, + queryModel=query_model, + endpointURL=endpoint_url, + waitForModel=wait_for_model, + useGPU=use_gpu, + useCache=use_cache, + vectorizeClassName=vectorize_collection_name, + ), + vector_index_config=vector_index_config, + ) + + @staticmethod + def text2vec_google( + *, + name: Optional[str] = None, + project_id: str, + api_endpoint: Optional[str] = None, + model_id: Optional[str] = None, + title_property: Optional[str] = None, + source_properties: Optional[List[str]] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorize_collection_name: bool = True, + ) -> _VectorConfigCreate: + """Create a named vector using the `text2vec_palm` model. + + See the [documentation]https://weaviate.io/developers/weaviate/model-providers/google/embeddings) + for detailed usage. + + Args: + name: The name of the named vector. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + project_id: The project ID to use, REQUIRED. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + api_endpoint: The API endpoint to use without a leading scheme such as `http://`. Defaults to `None`, which uses the server-defined default + model_id: The model ID to use. Defaults to `None`, which uses the server-defined default. + title_property: The Weaviate property name for the `gecko-002` or `gecko-003` model to use as the title. + + Raises: + pydantic.ValidationError: If `api_endpoint` is not a valid URL. + """ + return _VectorConfigCreate( + name=name, + source_properties=source_properties, + vectorizer=_Text2VecGoogleConfig( + projectId=project_id, + apiEndpoint=api_endpoint, + modelId=model_id, + vectorizeClassName=vectorize_collection_name, + titleProperty=title_property, + ), + vector_index_config=vector_index_config, + ) + + @staticmethod + def text2vec_google_aistudio( + *, + name: Optional[str] = None, + model_id: Optional[str] = None, + title_property: Optional[str] = None, + source_properties: Optional[List[str]] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorize_collection_name: bool = True, + ) -> _VectorConfigCreate: + """Create a named vector using the `text2vec_palm` model. + + See the [documentation]https://weaviate.io/developers/weaviate/model-providers/google/embeddings) + for detailed usage. + + Args: + name: The name of the named vector. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + model_id: The model ID to use. Defaults to `None`, which uses the server-defined default. + title_property: The Weaviate property name for the `gecko-002` or `gecko-003` model to use as the title. + + Raises: + pydantic.ValidationError: If `api_endpoint` is not a valid URL. + """ + return _VectorConfigCreate( + name=name, + source_properties=source_properties, + vectorizer=_Text2VecGoogleConfig( + projectId=None, + apiEndpoint="generativelanguage.googleapis.com", + modelId=model_id, + vectorizeClassName=vectorize_collection_name, + titleProperty=title_property, + ), + vector_index_config=vector_index_config, + ) + + @staticmethod + def text2vec_transformers( + *, + name: Optional[str] = None, + pooling_strategy: Literal["masked_mean", "cls"] = "masked_mean", + inference_url: Optional[str] = None, + passage_inference_url: Optional[str] = None, + query_inference_url: Optional[str] = None, + source_properties: Optional[List[str]] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorize_collection_name: bool = True, + ) -> _VectorConfigCreate: + """Create a named vector using the `text2vec_transformers` model. + + See the [documentation](https://weaviate.io/developers/weaviate/model-providers/transformers/embeddings) + for detailed usage. + + Args: + name: The name of the named vector. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + pooling_strategy: The pooling strategy to use. Defaults to `masked_mean`. + inference_url: The inferenceUrl to use where API requests should go. You can use either this OR passage/query_inference_url. Defaults to `None`, which uses the server-defined default. + passage_inference_url: The inferenceUrl to use where passage API requests should go. You can use either this and query_inference_url OR inference_url. Defaults to `None`, which uses the server-defined default. + query_inference_url: The inferenceUrl to use where query API requests should go. You can use either this and passage_inference_url OR inference_url. Defaults to `None`, which uses the server-defined default. + """ + return _VectorConfigCreate( + name=name, + source_properties=source_properties, + vectorizer=_Text2VecTransformersConfig( + poolingStrategy=pooling_strategy, + vectorizeClassName=vectorize_collection_name, + inferenceUrl=inference_url, + passageInferenceUrl=passage_inference_url, + queryInferenceUrl=query_inference_url, + ), + vector_index_config=vector_index_config, + ) + + @staticmethod + def text2vec_jinaai( + *, + name: Optional[str] = None, + base_url: Optional[str] = None, + dimensions: Optional[int] = None, + model: Optional[Union[JinaModel, str]] = None, + source_properties: Optional[List[str]] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorize_collection_name: bool = True, + ) -> _VectorConfigCreate: + """Create a named vector using the `text2vec-jinaai` model. + + See the [documentation](https://weaviate.io/developers/weaviate/model-providers/jinaai/embeddings) for detailed usage. + + Args: + name: The name of the named vector. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + base_url: The base URL to send the vectorization requests to. Defaults to `None`, which uses the server-defined default. + dimensions: The number of dimensions for the generated embeddings. Defaults to `None`, which uses the server-defined default. + model: The model to use. Defaults to `None`, which uses the server-defined default. + """ + return _VectorConfigCreate( + name=name, + source_properties=source_properties, + vectorizer=_Text2VecJinaConfig( + baseURL=base_url, + dimensions=dimensions, + model=model, + vectorizeClassName=vectorize_collection_name, + ), + vector_index_config=vector_index_config, + ) + + @staticmethod + def multi2vec_jinaai( + *, + name: Optional[str] = None, + base_url: Optional[AnyHttpUrl] = None, + model: Optional[Union[JinaMultimodalModel, str]] = None, + dimensions: Optional[int] = None, + image_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, + text_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorize_collection_name: bool = True, + ) -> _VectorConfigCreate: + """Create a named vector using the `multi2vec_jinaai` model. + + See the [documentation](https://weaviate.io/developers/weaviate/model-providers/jinaai/embeddings-multimodal) + for detailed usage. + + Args: + name: The name of the named vector. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + model: The model to use. Defaults to `None`, which uses the server-defined default. + base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. + dimensions: The number of dimensions for the generated embeddings (only available for some models). Defaults to `None`, which uses the server-defined default. + image_fields: The image fields to use in vectorization. + text_fields: The text fields to use in vectorization. + + Raises: + pydantic.ValidationError: If `model` is not a valid value from the `JinaMultimodalModel` type. + """ + return _VectorConfigCreate( + name=name, + vectorizer=_Multi2VecJinaConfig( + baseURL=base_url, + model=model, + dimensions=dimensions, + vectorizeClassName=vectorize_collection_name, + imageFields=_map_multi2vec_fields(image_fields), + textFields=_map_multi2vec_fields(text_fields), + ), + vector_index_config=vector_index_config, + ) + + @staticmethod + def text2vec_voyageai( + *, + name: Optional[str] = None, + model: Optional[Union[VoyageModel, str]] = None, + base_url: Optional[str] = None, + truncate: Optional[bool] = None, + source_properties: Optional[List[str]] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorize_collection_name: bool = True, + ) -> _VectorConfigCreate: + """Create a named vector using the `text2vec-jinaai` model. + + See the [documentation](https://weaviate.io/developers/weaviate/model-providers/voyageai/embeddings) + for detailed usage. + + Args: + name: The name of the named vector. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + model: The model to use. Defaults to `None`, which uses the server-defined default. + See the + [documentation](https://weaviate.io/developers/weaviate/model-providers/voyageai/embeddings#available-models) for more details. + base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. + truncate: Whether to truncate the input texts to fit within the context length. Defaults to `None`, which uses the server-defined default. + """ + return _VectorConfigCreate( + name=name, + source_properties=source_properties, + vectorizer=_Text2VecVoyageConfig( + model=model, + vectorizeClassName=vectorize_collection_name, + baseURL=base_url, + truncate=truncate, + ), + vector_index_config=vector_index_config, + ) + + @staticmethod + def text2vec_weaviate( + *, + name: Optional[str] = None, + model: Optional[Union[WeaviateModel, str]] = None, + base_url: Optional[str] = None, + dimensions: Optional[int] = None, + source_properties: Optional[List[str]] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorize_collection_name: bool = True, + ) -> _VectorConfigCreate: + return _VectorConfigCreate( + name=name, + source_properties=source_properties, + vectorizer=_Text2VecWeaviateConfig( + model=model, + vectorizeClassName=vectorize_collection_name, + baseURL=base_url, + dimensions=dimensions, + ), + vector_index_config=vector_index_config, + ) + + @staticmethod + def text2vec_nvidia( + *, + name: Optional[str] = None, + model: Optional[str] = None, + base_url: Optional[str] = None, + truncate: Optional[bool] = None, + source_properties: Optional[List[str]] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorize_collection_name: bool = True, + ) -> _VectorConfigCreate: + """Create a named vector using the `text2vec-nvidia` model. + + See the [documentation](https://weaviate.io/developers/weaviate/model-providers/nvidia/embeddings) + for detailed usage. + + Args: + name: The name of the named vector. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + model: The model to use. Defaults to `None`, which uses the server-defined default. + See the + [documentation](https://weaviate.io/developers/weaviate/model-providers/nvidia/embeddings#available-models) for more details. + base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. + truncate: Whether to truncate the input texts to fit within the context length. Defaults to `None`, which uses the server-defined default. + """ + return _VectorConfigCreate( + name=name, + source_properties=source_properties, + vectorizer=_Text2VecNvidiaConfig( + model=model, + vectorizeClassName=vectorize_collection_name, + baseURL=base_url, + truncate=truncate, + ), + vector_index_config=vector_index_config, + ) + + +class _VectorsUpdate: + @staticmethod + def update( + *, + name: Optional[str] = None, + vector_index_config: Union[ + _VectorIndexConfigHNSWUpdate, + _VectorIndexConfigFlatUpdate, + _VectorIndexConfigDynamicUpdate, + ], + ) -> _VectorConfigUpdate: + """Update the vector index configuration of a named vector. + + This is the only update operation allowed currently. If you wish to change the vectorization configuration itself, you will have to + recreate the collection with the new configuration. + + Args: + name: The name of the named vector. + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Reconfigure.VectorIndex` to create a vector index configuration. `None` by default + """ + return _VectorConfigUpdate( + name=name or "default", + vector_index_config=vector_index_config, + ) diff --git a/weaviate/collections/classes/data.py b/weaviate/collections/classes/data.py index e1cb291e2..d47f56ab3 100644 --- a/weaviate/collections/classes/data.py +++ b/weaviate/collections/classes/data.py @@ -1,9 +1,10 @@ +import uuid as uuid_package from dataclasses import dataclass from typing import Any, Generic, List, Optional, Union -from typing_extensions import TypeVar, TypeAlias -from weaviate.types import BEACON, UUID, VECTORS -import uuid as uuid_package +from typing_extensions import TypeAlias, TypeVar + +from weaviate.types import BEACON, UUID, VECTORS @dataclass diff --git a/weaviate/collections/classes/filters.py b/weaviate/collections/classes/filters.py index c9832ef0b..933b13851 100644 --- a/weaviate/collections/classes/filters.py +++ b/weaviate/collections/classes/filters.py @@ -1,18 +1,16 @@ from datetime import datetime from enum import Enum from typing import List, Optional, Sequence, Union -from typing_extensions import TypeAlias -from pydantic import Field -from weaviate.collections.classes.types import GeoCoordinate +from pydantic import Field +from typing_extensions import TypeAlias -from weaviate.collections.classes.types import _WeaviateInput -from weaviate.types import UUID +from weaviate.collections.classes.types import GeoCoordinate, _WeaviateInput +from weaviate.exceptions import WeaviateInvalidInputError from weaviate.proto.v1 import base_pb2 +from weaviate.types import UUID from weaviate.util import get_valid_uuid -from weaviate.exceptions import WeaviateInvalidInputError - class _Operator(str, Enum): EQUAL = "Equal" diff --git a/weaviate/collections/classes/generative.py b/weaviate/collections/classes/generative.py index b33787cea..4dbc62c76 100644 --- a/weaviate/collections/classes/generative.py +++ b/weaviate/collections/classes/generative.py @@ -7,9 +7,9 @@ from pydantic import AnyHttpUrl, AnyUrl, BaseModel, Field from weaviate.collections.classes.config import ( + AWSService, GenerativeSearches, _EnumLikeStr, - AWSService, ) from weaviate.exceptions import WeaviateInvalidInputError from weaviate.proto.v1.base_pb2 import TextArray @@ -26,12 +26,14 @@ GenerativeNvidia, GenerativeOllama, GenerativeOpenAI, + GenerativeSearch, GenerativeXAI, +) +from weaviate.proto.v1.generative_pb2 import ( GenerativeProvider as GenerativeProviderGRPC, - GenerativeSearch, ) -from weaviate.util import parse_blob from weaviate.types import BLOB_INPUT +from weaviate.util import parse_blob def _parse_anyhttpurl(url: Optional[AnyHttpUrl]) -> Optional[str]: diff --git a/weaviate/collections/classes/grpc.py b/weaviate/collections/classes/grpc.py index 752c8aea4..4d06de1ce 100644 --- a/weaviate/collections/classes/grpc.py +++ b/weaviate/collections/classes/grpc.py @@ -2,6 +2,7 @@ from enum import Enum, auto from typing import ( ClassVar, + Dict, Generic, List, Literal, @@ -10,18 +11,17 @@ Sequence, Type, Union, - Dict, cast, ) -from typing_extensions import TypeGuard, TypeVar from pydantic import ConfigDict, Field +from typing_extensions import TypeGuard, TypeVar from weaviate.collections.classes.types import _WeaviateInput from weaviate.exceptions import WeaviateInvalidInputError from weaviate.proto.v1 import base_search_pb2 from weaviate.str_enum import BaseEnum -from weaviate.types import INCLUDE_VECTOR, UUID, NUMBER +from weaviate.types import INCLUDE_VECTOR, NUMBER, UUID from weaviate.util import _ServerVersion diff --git a/weaviate/collections/classes/internal.py b/weaviate/collections/classes/internal.py index 08c305d5d..ea8bf2692 100644 --- a/weaviate/collections/classes/internal.py +++ b/weaviate/collections/classes/internal.py @@ -15,14 +15,13 @@ Union, cast, ) -from typing_extensions import deprecated -from typing_extensions import TypeAlias +from typing_extensions import TypeAlias, deprecated if sys.version_info < (3, 9): - from typing_extensions import Annotated, get_type_hints, get_origin, get_args + from typing_extensions import Annotated, get_args, get_origin, get_type_hints else: - from typing import Annotated, get_type_hints, get_origin, get_args + from typing import Annotated, get_args, get_origin, get_type_hints from weaviate.collections.classes.generative import ( _GenerativeConfigRuntime, @@ -32,33 +31,35 @@ _to_text_array, ) from weaviate.collections.classes.grpc import ( - QueryNested, - _QueryReference, - _QueryReferenceMultiTarget, - GroupBy, - MetadataQuery, METADATA, PROPERTIES, REFERENCES, + GroupBy, + MetadataQuery, + QueryNested, Rerank, + _QueryReference, + _QueryReferenceMultiTarget, ) from weaviate.collections.classes.types import ( - Properties, - References, IReferences, - TReferences, M, P, + Properties, R, + References, TProperties, + TReferences, WeaviateProperties, _WeaviateInput, ) -from weaviate.exceptions import WeaviateInvalidInputError, WeaviateUnsupportedFeatureError -from weaviate.util import _to_beacons, _ServerVersion +from weaviate.exceptions import ( + WeaviateInvalidInputError, + WeaviateUnsupportedFeatureError, +) +from weaviate.proto.v1 import generative_pb2, search_get_pb2 from weaviate.types import INCLUDE_VECTOR, UUID, UUIDS - -from weaviate.proto.v1 import search_get_pb2, generative_pb2 +from weaviate.util import _ServerVersion, _to_beacons @dataclass diff --git a/weaviate/collections/classes/types.py b/weaviate/collections/classes/types.py index 00fdff391..d0031b81c 100644 --- a/weaviate/collections/classes/types.py +++ b/weaviate/collections/classes/types.py @@ -1,10 +1,9 @@ import datetime import uuid as uuid_package - from typing import Any, Dict, Mapping, Optional, Sequence, Type, Union, get_origin -from typing_extensions import TypeAlias, TypeVar, is_typeddict from pydantic import BaseModel, ConfigDict, Field +from typing_extensions import TypeAlias, TypeVar, is_typeddict from weaviate.exceptions import InvalidDataModelError diff --git a/weaviate/collections/cluster/async_.py b/weaviate/collections/cluster/async_.py index 20ed5cdd2..d0601731d 100644 --- a/weaviate/collections/cluster/async_.py +++ b/weaviate/collections/cluster/async_.py @@ -1,6 +1,6 @@ +from weaviate.collections.cluster.executor import _ClusterExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync -from weaviate.collections.cluster.executor import _ClusterExecutor @executor.wrap("async") diff --git a/weaviate/collections/cluster/async_.pyi b/weaviate/collections/cluster/async_.pyi index 26e3c6217..debf89953 100644 --- a/weaviate/collections/cluster/async_.pyi +++ b/weaviate/collections/cluster/async_.pyi @@ -1,9 +1,9 @@ from typing import Generic, List, Literal, Optional, Union, overload from httpx import Response +from weaviate.cluster.types import Verbosity +from weaviate.collections.classes.cluster import Node, Shards, Stats, _ConvertFromREST from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType -from weaviate.cluster.types import Verbosity -from weaviate.collections.classes.cluster import Node, Shards, _ConvertFromREST, Stats from weaviate.exceptions import EmptyResponseError from weaviate.util import _capitalize_first_letter, _decode_json_response_dict from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/cluster/executor.py b/weaviate/collections/cluster/executor.py index bd9bb3872..91c55cce1 100644 --- a/weaviate/collections/cluster/executor.py +++ b/weaviate/collections/cluster/executor.py @@ -1,15 +1,14 @@ from typing import Generic, List, Literal, Optional, Union, overload from httpx import Response -from weaviate.connect import executor -from weaviate.connect.v4 import ConnectionType from weaviate.cluster.types import Verbosity -from weaviate.collections.classes.cluster import Node, Shards, _ConvertFromREST, Stats +from weaviate.collections.classes.cluster import Node, Shards, Stats, _ConvertFromREST +from weaviate.connect import executor +from weaviate.connect.v4 import ConnectionType from weaviate.exceptions import ( EmptyResponseError, ) - from weaviate.util import _capitalize_first_letter, _decode_json_response_dict diff --git a/weaviate/collections/cluster/sync.py b/weaviate/collections/cluster/sync.py index 45e0ac1df..f803424d7 100644 --- a/weaviate/collections/cluster/sync.py +++ b/weaviate/collections/cluster/sync.py @@ -1,6 +1,6 @@ +from weaviate.collections.cluster.executor import _ClusterExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync -from weaviate.collections.cluster.executor import _ClusterExecutor @executor.wrap("sync") diff --git a/weaviate/collections/cluster/sync.pyi b/weaviate/collections/cluster/sync.pyi index 24ab5f255..ac1374816 100644 --- a/weaviate/collections/cluster/sync.pyi +++ b/weaviate/collections/cluster/sync.pyi @@ -1,9 +1,9 @@ from typing import Generic, List, Literal, Optional, Union, overload from httpx import Response +from weaviate.cluster.types import Verbosity +from weaviate.collections.classes.cluster import Node, Shards, Stats, _ConvertFromREST from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType -from weaviate.cluster.types import Verbosity -from weaviate.collections.classes.cluster import Node, Shards, _ConvertFromREST, Stats from weaviate.exceptions import EmptyResponseError from weaviate.util import _capitalize_first_letter, _decode_json_response_dict from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/collection/async_.py b/weaviate/collections/collection/async_.py index 5894db467..f12a33830 100644 --- a/weaviate/collections/collection/async_.py +++ b/weaviate/collections/collection/async_.py @@ -2,10 +2,9 @@ from dataclasses import asdict from typing import Generic, List, Literal, Optional, Type, Union, overload -from weaviate.collections.classes.cluster import Shard from weaviate.collections.aggregate import _AggregateCollectionAsync from weaviate.collections.backups import _CollectionBackupAsync -from weaviate.collections.cluster import _ClusterAsync +from weaviate.collections.classes.cluster import Shard from weaviate.collections.classes.config import ConsistencyLevel from weaviate.collections.classes.grpc import METADATA, PROPERTIES, REFERENCES from weaviate.collections.classes.internal import ( @@ -17,6 +16,7 @@ ) from weaviate.collections.classes.tenants import Tenant from weaviate.collections.classes.types import Properties, TProperties +from weaviate.collections.cluster import _ClusterAsync from weaviate.collections.config import _ConfigCollectionAsync from weaviate.collections.data import _DataCollectionAsync from weaviate.collections.generate import _GenerateCollectionAsync diff --git a/weaviate/collections/collection/base.py b/weaviate/collections/collection/base.py index 424def3f5..94a246f7c 100644 --- a/weaviate/collections/collection/base.py +++ b/weaviate/collections/collection/base.py @@ -1,4 +1,5 @@ from typing import Generic, Optional + from weaviate.collections.classes.config import ConsistencyLevel from weaviate.connect.v4 import ConnectionType from weaviate.util import _capitalize_first_letter diff --git a/weaviate/collections/collections/async_.pyi b/weaviate/collections/collections/async_.pyi index 3ecb9d1c1..d8d7e1521 100644 --- a/weaviate/collections/collections/async_.pyi +++ b/weaviate/collections/collections/async_.pyi @@ -1,18 +1,21 @@ from typing import Dict, List, Literal, Optional, Sequence, Type, Union, overload +from typing_extensions import deprecated + from weaviate.collections.classes.config import ( - _NamedVectorConfigCreate, CollectionConfig, CollectionConfigSimple, + Property, _GenerativeProvider, _InvertedIndexConfigCreate, _MultiTenancyConfigCreate, - _VectorIndexConfigCreate, - Property, - _ShardingConfigCreate, + _NamedVectorConfigCreate, _ReferencePropertyBase, _ReplicationConfigCreate, _RerankerProvider, + _ShardingConfigCreate, + _VectorConfigCreate, + _VectorIndexConfigCreate, _VectorizerConfigCreate, ) from weaviate.collections.classes.internal import References @@ -20,11 +23,61 @@ from weaviate.collections.classes.types import ( Properties, ) from weaviate.collections.collection import CollectionAsync - from weaviate.collections.collections.base import _CollectionsBase from weaviate.connect.v4 import ConnectionAsync class _CollectionsAsync(_CollectionsBase[ConnectionAsync]): + @overload + @deprecated( + 'Using the "vector_index_config" argument is deprecated. Instead, define the vector index for each specific vectorizer supplied to the "vectorizers_config" argument.' + ) + async def create( + self, + name: str, + *, + description: Optional[str] = None, + generative_config: Optional[_GenerativeProvider] = None, + inverted_index_config: Optional[_InvertedIndexConfigCreate] = None, + multi_tenancy_config: Optional[_MultiTenancyConfigCreate] = None, + properties: Optional[Sequence[Property]] = None, + references: Optional[List[_ReferencePropertyBase]] = None, + replication_config: Optional[_ReplicationConfigCreate] = None, + reranker_config: Optional[_RerankerProvider] = None, + sharding_config: Optional[_ShardingConfigCreate] = None, + vector_index_config: _VectorIndexConfigCreate, + vectorizer_config: Optional[ + Union[_VectorizerConfigCreate, List[_NamedVectorConfigCreate]] + ] = None, + vector_config: Optional[Union[_VectorConfigCreate, List[_VectorConfigCreate]]] = None, + data_model_properties: Optional[Type[Properties]] = None, + data_model_references: Optional[Type[References]] = None, + skip_argument_validation: bool = False, + ) -> CollectionAsync[Properties, References]: ... + @overload + @deprecated( + 'Using the "vectorizer_config" argument is deprecated. Instead, use the "vectorizers_config" argument.' + ) + async def create( + self, + name: str, + *, + description: Optional[str] = None, + generative_config: Optional[_GenerativeProvider] = None, + inverted_index_config: Optional[_InvertedIndexConfigCreate] = None, + multi_tenancy_config: Optional[_MultiTenancyConfigCreate] = None, + properties: Optional[Sequence[Property]] = None, + references: Optional[List[_ReferencePropertyBase]] = None, + replication_config: Optional[_ReplicationConfigCreate] = None, + reranker_config: Optional[_RerankerProvider] = None, + sharding_config: Optional[_ShardingConfigCreate] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorizer_config: Union[_VectorizerConfigCreate, List[_NamedVectorConfigCreate]], + vector_config: Optional[Union[_VectorConfigCreate, List[_VectorConfigCreate]]] = None, + data_model_properties: Optional[Type[Properties]] = None, + data_model_references: Optional[Type[References]] = None, + skip_argument_validation: bool = False, + ) -> CollectionAsync[Properties, References]: ... + @overload async def create( self, name: str, @@ -42,6 +95,7 @@ class _CollectionsAsync(_CollectionsBase[ConnectionAsync]): vectorizer_config: Optional[ Union[_VectorizerConfigCreate, List[_NamedVectorConfigCreate]] ] = None, + vector_config: Optional[Union[_VectorConfigCreate, List[_VectorConfigCreate]]] = None, data_model_properties: Optional[Type[Properties]] = None, data_model_references: Optional[Type[References]] = None, skip_argument_validation: bool = False, diff --git a/weaviate/collections/collections/base.py b/weaviate/collections/collections/base.py index 111231d6c..6e8dc0502 100644 --- a/weaviate/collections/collections/base.py +++ b/weaviate/collections/collections/base.py @@ -14,7 +14,7 @@ from weaviate.collections.classes.types import ( Properties, ) -from weaviate.collections.collection import CollectionAsync, Collection +from weaviate.collections.collection import Collection, CollectionAsync from weaviate.collections.collections.executor import _CollectionsExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType diff --git a/weaviate/collections/collections/executor.py b/weaviate/collections/collections/executor.py index 477f9568d..c50468616 100644 --- a/weaviate/collections/collections/executor.py +++ b/weaviate/collections/collections/executor.py @@ -15,19 +15,20 @@ from pydantic import ValidationError from weaviate.collections.classes.config import ( - _NamedVectorConfigCreate, CollectionConfig, CollectionConfigSimple, + Property, _CollectionConfigCreate, _GenerativeProvider, _InvertedIndexConfigCreate, _MultiTenancyConfigCreate, - _VectorIndexConfigCreate, - Property, - _ShardingConfigCreate, + _NamedVectorConfigCreate, _ReferencePropertyBase, _ReplicationConfigCreate, _RerankerProvider, + _ShardingConfigCreate, + _VectorConfigCreate, + _VectorIndexConfigCreate, _VectorizerConfigCreate, ) from weaviate.collections.classes.config_methods import ( @@ -41,11 +42,11 @@ _check_properties_generic, _check_references_generic, ) -from weaviate.collections.collection import CollectionAsync, Collection +from weaviate.collections.collection import Collection, CollectionAsync from weaviate.connect import executor from weaviate.connect.v4 import ( - ConnectionType, ConnectionAsync, + ConnectionType, _ExpectedStatusCodes, ) from weaviate.exceptions import WeaviateInvalidInputError @@ -158,6 +159,7 @@ def create( vectorizer_config: Optional[ Union[_VectorizerConfigCreate, List[_NamedVectorConfigCreate]] ] = None, + vector_config: Optional[Union[_VectorConfigCreate, List[_VectorConfigCreate]]] = None, data_model_properties: Optional[Type[Properties]] = None, data_model_references: Optional[Type[References]] = None, skip_argument_validation: bool = False, @@ -188,8 +190,9 @@ def create( references: The references of the objects in the collection. replication_config: The configuration for Weaviate's replication strategy. sharding_config: The configuration for Weaviate's sharding strategy. - vector_index_config: The configuration for Weaviate's default vector index. - vectorizer_config: The configuration for Weaviate's default vectorizer or a list of named vectorizers. + vector_index_config (DEPRECATED use `vector_config`): The configuration for Weaviate's default vector index. + vectorizer_config (DEPRECATED use `vector_config`): The configuration for Weaviate's default vectorizer or a list of named vectorizers. + vector_config: The configuration(s) for the vectorizer(s) to use for the collection. data_model_properties: The generic class that you want to use to represent the properties of objects in this collection. See the `get` method for more information. data_model_references: The generic class that you want to use to represent the references of objects in this collection. See the `get` method for more information. skip_argument_validation: If arguments to functions such as near_vector should be validated. Disable this if you need to squeeze out some extra performance. @@ -219,6 +222,7 @@ def create( reranker_config=reranker_config, sharding_config=sharding_config, vectorizer_config=vectorizer_config, + vector_config=vector_config, vector_index_config=vector_index_config, ) except ValidationError as e: diff --git a/weaviate/collections/collections/sync.py b/weaviate/collections/collections/sync.py index 7abf0701c..0e89475ba 100644 --- a/weaviate/collections/collections/sync.py +++ b/weaviate/collections/collections/sync.py @@ -1,8 +1,9 @@ from typing import Optional, Type + +from weaviate.collections.classes.config import CollectionConfig from weaviate.collections.classes.internal import Properties, References -from weaviate.collections.collections.base import _CollectionsBase from weaviate.collections.collection.sync import Collection -from weaviate.collections.classes.config import CollectionConfig +from weaviate.collections.collections.base import _CollectionsBase from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/collections/sync.pyi b/weaviate/collections/collections/sync.pyi index 80988f15a..a6d92e313 100644 --- a/weaviate/collections/collections/sync.pyi +++ b/weaviate/collections/collections/sync.pyi @@ -1,18 +1,21 @@ from typing import Dict, List, Literal, Optional, Sequence, Type, Union, overload +from typing_extensions import deprecated + from weaviate.collections.classes.config import ( - _NamedVectorConfigCreate, CollectionConfig, CollectionConfigSimple, + Property, _GenerativeProvider, _InvertedIndexConfigCreate, _MultiTenancyConfigCreate, - _VectorIndexConfigCreate, - Property, - _ShardingConfigCreate, + _NamedVectorConfigCreate, _ReferencePropertyBase, _ReplicationConfigCreate, _RerankerProvider, + _ShardingConfigCreate, + _VectorConfigCreate, + _VectorIndexConfigCreate, _VectorizerConfigCreate, ) from weaviate.collections.classes.internal import References @@ -20,11 +23,61 @@ from weaviate.collections.classes.types import ( Properties, ) from weaviate.collections.collection import Collection - from weaviate.collections.collections.base import _CollectionsBase from weaviate.connect.v4 import ConnectionSync class _Collections(_CollectionsBase[ConnectionSync]): + @overload + @deprecated( + 'Using the "vector_index_config" argument is deprecated. Instead, define the vector index for each specific vectorizer supplied to the "vector_config" argument.' + ) + def create( + self, + name: str, + *, + description: Optional[str] = None, + generative_config: Optional[_GenerativeProvider] = None, + inverted_index_config: Optional[_InvertedIndexConfigCreate] = None, + multi_tenancy_config: Optional[_MultiTenancyConfigCreate] = None, + properties: Optional[Sequence[Property]] = None, + references: Optional[List[_ReferencePropertyBase]] = None, + replication_config: Optional[_ReplicationConfigCreate] = None, + reranker_config: Optional[_RerankerProvider] = None, + sharding_config: Optional[_ShardingConfigCreate] = None, + vector_index_config: _VectorIndexConfigCreate, + vectorizer_config: Optional[ + Union[_VectorizerConfigCreate, List[_NamedVectorConfigCreate]] + ] = None, + vector_config: Optional[Union[_VectorConfigCreate, List[_VectorConfigCreate]]] = None, + data_model_properties: Optional[Type[Properties]] = None, + data_model_references: Optional[Type[References]] = None, + skip_argument_validation: bool = False, + ) -> Collection[Properties, References]: ... + @overload + @deprecated( + 'Using the "vectorizer_config" argument is deprecated. Instead, use the "vector_config" argument.' + ) + def create( + self, + name: str, + *, + description: Optional[str] = None, + generative_config: Optional[_GenerativeProvider] = None, + inverted_index_config: Optional[_InvertedIndexConfigCreate] = None, + multi_tenancy_config: Optional[_MultiTenancyConfigCreate] = None, + properties: Optional[Sequence[Property]] = None, + references: Optional[List[_ReferencePropertyBase]] = None, + replication_config: Optional[_ReplicationConfigCreate] = None, + reranker_config: Optional[_RerankerProvider] = None, + sharding_config: Optional[_ShardingConfigCreate] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + vectorizer_config: Union[_VectorizerConfigCreate, List[_NamedVectorConfigCreate]], + vector_config: Optional[Union[_VectorConfigCreate, List[_VectorConfigCreate]]] = None, + data_model_properties: Optional[Type[Properties]] = None, + data_model_references: Optional[Type[References]] = None, + skip_argument_validation: bool = False, + ) -> Collection[Properties, References]: ... + @overload def create( self, name: str, @@ -42,6 +95,7 @@ class _Collections(_CollectionsBase[ConnectionSync]): vectorizer_config: Optional[ Union[_VectorizerConfigCreate, List[_NamedVectorConfigCreate]] ] = None, + vector_config: Optional[Union[_VectorConfigCreate, List[_VectorConfigCreate]]] = None, data_model_properties: Optional[Type[Properties]] = None, data_model_references: Optional[Type[References]] = None, skip_argument_validation: bool = False, diff --git a/weaviate/collections/config/async_.py b/weaviate/collections/config/async_.py index 1f8eba861..b9ec4fbcf 100644 --- a/weaviate/collections/config/async_.py +++ b/weaviate/collections/config/async_.py @@ -1,6 +1,6 @@ +from weaviate.collections.config.executor import _ConfigCollectionExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync -from weaviate.collections.config.executor import _ConfigCollectionExecutor @executor.wrap("async") diff --git a/weaviate/collections/config/async_.pyi b/weaviate/collections/config/async_.pyi index 01370830a..381586404 100644 --- a/weaviate/collections/config/async_.pyi +++ b/weaviate/collections/config/async_.pyi @@ -3,24 +3,25 @@ from typing import Any, Dict, Generic, List, Literal, Optional, Tuple, Union, ca from httpx import Response from pydantic_core import ValidationError from weaviate.collections.classes.config import ( - _CollectionConfigUpdate, - _InvertedIndexConfigUpdate, - _ReplicationConfigUpdate, - _VectorIndexConfigFlatUpdate, - PropertyType, - Property, - ReferenceProperty, - _ReferencePropertyMultiTarget, - _VectorIndexConfigHNSWUpdate, CollectionConfig, CollectionConfigSimple, + Property, + PropertyType, + ReferenceProperty, ShardStatus, - _ShardStatus, ShardTypes, - _NamedVectorConfigUpdate, - _MultiTenancyConfigUpdate, + _CollectionConfigUpdate, _GenerativeProvider, + _InvertedIndexConfigUpdate, + _MultiTenancyConfigUpdate, + _NamedVectorConfigUpdate, + _ReferencePropertyMultiTarget, + _ReplicationConfigUpdate, _RerankerProvider, + _ShardStatus, + _VectorConfigUpdate, + _VectorIndexConfigFlatUpdate, + _VectorIndexConfigHNSWUpdate, ) from weaviate.collections.classes.config_methods import ( _collection_config_from_json, @@ -28,7 +29,7 @@ from weaviate.collections.classes.config_methods import ( ) from weaviate.collections.classes.config_vector_index import _VectorIndexConfigDynamicUpdate from weaviate.connect import executor -from weaviate.connect.v4 import _ExpectedStatusCodes, ConnectionAsync, ConnectionType +from weaviate.connect.v4 import ConnectionAsync, ConnectionType, _ExpectedStatusCodes from weaviate.exceptions import WeaviateInvalidInputError from weaviate.util import _decode_json_response_dict, _decode_json_response_list from weaviate.validator import _validate_input, _ValidateArgument @@ -64,6 +65,7 @@ class _ConfigCollectionAsync(_ConfigCollectionExecutor[ConnectionAsync]): List[_NamedVectorConfigUpdate], ] ] = None, + vector_config: Optional[Union[_VectorConfigUpdate, List[_VectorConfigUpdate]]] = None, generative_config: Optional[_GenerativeProvider] = None, reranker_config: Optional[_RerankerProvider] = None ) -> None: ... diff --git a/weaviate/collections/config/executor.py b/weaviate/collections/config/executor.py index 559419864..a3863a966 100644 --- a/weaviate/collections/config/executor.py +++ b/weaviate/collections/config/executor.py @@ -1,36 +1,50 @@ import asyncio -from typing import Any, Dict, Generic, List, Literal, Optional, Tuple, Union, cast, overload +from typing import ( + Any, + Dict, + Generic, + List, + Literal, + Optional, + Tuple, + Union, + cast, + overload, +) from httpx import Response from pydantic_core import ValidationError from weaviate.collections.classes.config import ( - _CollectionConfigUpdate, - _InvertedIndexConfigUpdate, - _ReplicationConfigUpdate, - _VectorIndexConfigFlatUpdate, - PropertyType, - Property, - ReferenceProperty, - _ReferencePropertyMultiTarget, - _VectorIndexConfigHNSWUpdate, CollectionConfig, CollectionConfigSimple, + Property, + PropertyType, + ReferenceProperty, ShardStatus, - _ShardStatus, ShardTypes, - _NamedVectorConfigUpdate, - _MultiTenancyConfigUpdate, + _CollectionConfigUpdate, _GenerativeProvider, + _InvertedIndexConfigUpdate, + _MultiTenancyConfigUpdate, + _NamedVectorConfigUpdate, + _ReferencePropertyMultiTarget, + _ReplicationConfigUpdate, _RerankerProvider, + _ShardStatus, + _VectorConfigUpdate, + _VectorIndexConfigFlatUpdate, + _VectorIndexConfigHNSWUpdate, ) from weaviate.collections.classes.config_methods import ( _collection_config_from_json, _collection_config_simple_from_json, ) -from weaviate.collections.classes.config_vector_index import _VectorIndexConfigDynamicUpdate +from weaviate.collections.classes.config_vector_index import ( + _VectorIndexConfigDynamicUpdate, +) from weaviate.connect import executor -from weaviate.connect.v4 import _ExpectedStatusCodes, ConnectionAsync, ConnectionType +from weaviate.connect.v4 import ConnectionAsync, ConnectionType, _ExpectedStatusCodes from weaviate.exceptions import ( WeaviateInvalidInputError, ) @@ -127,6 +141,7 @@ def update( List[_NamedVectorConfigUpdate], ] ] = None, + vector_config: Optional[Union[_VectorConfigUpdate, List[_VectorConfigUpdate]]] = None, generative_config: Optional[_GenerativeProvider] = None, reranker_config: Optional[_RerankerProvider] = None, ) -> executor.Result[None]: @@ -139,9 +154,12 @@ def update( inverted_index_config: Configuration for the inverted index. Use `Reconfigure.inverted_index` to generate one. replication_config: Configuration for the replication. Use `Reconfigure.replication` to generate one. reranker_config: Configuration for the reranker. Use `Reconfigure.replication` to generate one. - vector_index_config`: DEPRECATED USE `vectorizer_config` INSTEAD. Configuration for the vector index of the default single vector. Use `Reconfigure.vector_index` to generate one. + vector_index_config (DEPRECATED use `vector_config`): Configuration for the vector index of the default single vector. Use `Reconfigure.vector_index` to generate one. vectorizer_config: Configurations for the vector index (or indices) of your collection. - Use `Reconfigure.vector_index` if there is only one vectorizer and `Reconfigure.NamedVectors` if you have many named vectors to generate them. + Use `Reconfigure.vector_index` if using legacy vectorization and `Reconfigure.NamedVectors` if you have many named vectors to generate them. + Using this argument with a list of `Reconfigure.NamedVectors` is **DEPRECATED**. Use the `vector_config` argument instead in such a case. + vector_config: Configuration for the vector index (or indices) of your collection. + Use `Reconfigure.Vectors` for both single and multiple vectorizers. Supply a list to update many vectorizers at once. multi_tenancy_config: Configuration for multi-tenancy settings. Use `Reconfigure.multi_tenancy` to generate one. Only `auto_tenant_creation` is supported. @@ -157,6 +175,15 @@ def update( """ if vector_index_config is not None: _Warnings.vector_index_config_in_config_update() + if vectorizer_config is not None and not isinstance( + vectorizer_config, + ( + _VectorIndexConfigHNSWUpdate, + _VectorIndexConfigFlatUpdate, + _VectorIndexConfigDynamicUpdate, + ), + ): + _Warnings.vectorizer_config_in_config_update() try: config = _CollectionConfigUpdate( description=description, @@ -168,6 +195,7 @@ def update( multi_tenancy_config=multi_tenancy_config, generative_config=generative_config, reranker_config=reranker_config, + vector_config=vector_config, ) except ValidationError as e: raise WeaviateInvalidInputError("Invalid collection config update parameters.") from e @@ -222,7 +250,10 @@ def resp(schema: Dict[str, Any]) -> executor.Result[None]: vector_config: Dict[str, Any] = schema.get("vectorConfig", {}) if len(vector_config) > 0: - obj["vectorConfig"] = {key: modconf for key in vector_config.keys()} + obj["moduleConfig"] = { + list(conf["vectorizer"].keys()).pop(): modconf + for conf in vector_config.values() + } def inner_resp(res: Response) -> None: return None diff --git a/weaviate/collections/config/sync.py b/weaviate/collections/config/sync.py index b334e2d85..869c06eca 100644 --- a/weaviate/collections/config/sync.py +++ b/weaviate/collections/config/sync.py @@ -1,6 +1,6 @@ +from weaviate.collections.config.executor import _ConfigCollectionExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync -from weaviate.collections.config.executor import _ConfigCollectionExecutor @executor.wrap("sync") diff --git a/weaviate/collections/config/sync.pyi b/weaviate/collections/config/sync.pyi index 759c438d0..2dfb31308 100644 --- a/weaviate/collections/config/sync.pyi +++ b/weaviate/collections/config/sync.pyi @@ -3,24 +3,25 @@ from typing import Any, Dict, Generic, List, Literal, Optional, Tuple, Union, ca from httpx import Response from pydantic_core import ValidationError from weaviate.collections.classes.config import ( - _CollectionConfigUpdate, - _InvertedIndexConfigUpdate, - _ReplicationConfigUpdate, - _VectorIndexConfigFlatUpdate, - PropertyType, - Property, - ReferenceProperty, - _ReferencePropertyMultiTarget, - _VectorIndexConfigHNSWUpdate, CollectionConfig, CollectionConfigSimple, + Property, + PropertyType, + ReferenceProperty, ShardStatus, - _ShardStatus, ShardTypes, - _NamedVectorConfigUpdate, - _MultiTenancyConfigUpdate, + _CollectionConfigUpdate, _GenerativeProvider, + _InvertedIndexConfigUpdate, + _MultiTenancyConfigUpdate, + _NamedVectorConfigUpdate, + _ReferencePropertyMultiTarget, + _ReplicationConfigUpdate, _RerankerProvider, + _ShardStatus, + _VectorConfigUpdate, + _VectorIndexConfigFlatUpdate, + _VectorIndexConfigHNSWUpdate, ) from weaviate.collections.classes.config_methods import ( _collection_config_from_json, @@ -28,7 +29,7 @@ from weaviate.collections.classes.config_methods import ( ) from weaviate.collections.classes.config_vector_index import _VectorIndexConfigDynamicUpdate from weaviate.connect import executor -from weaviate.connect.v4 import _ExpectedStatusCodes, ConnectionAsync, ConnectionType +from weaviate.connect.v4 import ConnectionAsync, ConnectionType, _ExpectedStatusCodes from weaviate.exceptions import WeaviateInvalidInputError from weaviate.util import _decode_json_response_dict, _decode_json_response_list from weaviate.validator import _validate_input, _ValidateArgument @@ -62,6 +63,7 @@ class _ConfigCollection(_ConfigCollectionExecutor[ConnectionSync]): List[_NamedVectorConfigUpdate], ] ] = None, + vector_config: Optional[Union[_VectorConfigUpdate, List[_VectorConfigUpdate]]] = None, generative_config: Optional[_GenerativeProvider] = None, reranker_config: Optional[_RerankerProvider] = None ) -> None: ... diff --git a/weaviate/collections/data/async_.py b/weaviate/collections/data/async_.py index e0540b71b..c10157c13 100644 --- a/weaviate/collections/data/async_.py +++ b/weaviate/collections/data/async_.py @@ -1,9 +1,10 @@ from typing import Generic, Type -from weaviate.connect import executor + from weaviate.collections.classes.internal import Properties, TProperties +from weaviate.collections.classes.types import _check_properties_generic from weaviate.collections.data.executor import _DataCollectionExecutor +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync -from weaviate.collections.classes.types import _check_properties_generic @executor.wrap("async") diff --git a/weaviate/collections/data/async_.pyi b/weaviate/collections/data/async_.pyi index ff91261aa..28ffffedb 100644 --- a/weaviate/collections/data/async_.pyi +++ b/weaviate/collections/data/async_.pyi @@ -5,10 +5,10 @@ from typing import ( Any, Dict, Generic, - Optional, List, Literal, Mapping, + Optional, Sequence, Tuple, Type, @@ -17,41 +17,41 @@ from typing import ( overload, ) from httpx import Response +from weaviate.collections.batch.grpc_batch_delete import _BatchDeleteGRPC +from weaviate.collections.batch.grpc_batch_objects import _BatchGRPC +from weaviate.collections.batch.rest import _BatchREST from weaviate.collections.classes.batch import ( - DeleteManyObject, - _BatchObject, - _BatchReference, BatchObjectReturn, BatchReferenceReturn, + DeleteManyObject, DeleteManyReturn, + _BatchObject, + _BatchReference, ) from weaviate.collections.classes.config import ConsistencyLevel from weaviate.collections.classes.data import DataObject, DataReferences from weaviate.collections.classes.filters import _Filters from weaviate.collections.classes.internal import ( - _Reference, - ReferenceToMulti, - SingleReferenceInput, ReferenceInput, ReferenceInputs, + ReferenceToMulti, + SingleReferenceInput, + _Reference, ) from weaviate.collections.classes.types import ( GeoCoordinate, PhoneNumber, - _PhoneNumber, Properties, WeaviateField, + _PhoneNumber, ) from weaviate.connect import executor -from weaviate.connect.v4 import _ExpectedStatusCodes, ConnectionAsync, ConnectionType +from weaviate.connect.v4 import ConnectionAsync, ConnectionType, _ExpectedStatusCodes +from weaviate.exceptions import WeaviateInvalidInputError from weaviate.logger import logger from weaviate.types import BEACON, UUID, VECTORS from weaviate.util import _datetime_to_string, _get_vector_v4 from weaviate.validator import _validate_input, _ValidateArgument -from weaviate.collections.batch.grpc_batch_objects import _BatchGRPC -from weaviate.collections.batch.grpc_batch_delete import _BatchDeleteGRPC -from weaviate.collections.batch.rest import _BatchREST -from weaviate.exceptions import WeaviateInvalidInputError from weaviate.connect.v4 import ConnectionAsync from .executor import _DataCollectionExecutor diff --git a/weaviate/collections/data/executor.py b/weaviate/collections/data/executor.py index 306d44f5a..ab51efc15 100644 --- a/weaviate/collections/data/executor.py +++ b/weaviate/collections/data/executor.py @@ -5,10 +5,10 @@ Any, Dict, Generic, - Optional, List, Literal, Mapping, + Optional, Sequence, Tuple, Type, @@ -19,43 +19,42 @@ from httpx import Response +from weaviate.collections.batch.grpc_batch_delete import _BatchDeleteGRPC +from weaviate.collections.batch.grpc_batch_objects import _BatchGRPC +from weaviate.collections.batch.rest import _BatchREST from weaviate.collections.classes.batch import ( - DeleteManyObject, - _BatchObject, - _BatchReference, BatchObjectReturn, BatchReferenceReturn, + DeleteManyObject, DeleteManyReturn, + _BatchObject, + _BatchReference, ) from weaviate.collections.classes.config import ConsistencyLevel from weaviate.collections.classes.data import DataObject, DataReferences from weaviate.collections.classes.filters import _Filters from weaviate.collections.classes.internal import ( - _Reference, - ReferenceToMulti, - SingleReferenceInput, ReferenceInput, ReferenceInputs, + ReferenceToMulti, + SingleReferenceInput, + _Reference, ) from weaviate.collections.classes.types import ( GeoCoordinate, PhoneNumber, - _PhoneNumber, Properties, WeaviateField, + _PhoneNumber, ) from weaviate.connect import executor -from weaviate.connect.v4 import _ExpectedStatusCodes, ConnectionAsync, ConnectionType +from weaviate.connect.v4 import ConnectionAsync, ConnectionType, _ExpectedStatusCodes +from weaviate.exceptions import WeaviateInvalidInputError from weaviate.logger import logger from weaviate.types import BEACON, UUID, VECTORS from weaviate.util import _datetime_to_string, _get_vector_v4 from weaviate.validator import _validate_input, _ValidateArgument -from weaviate.collections.batch.grpc_batch_objects import _BatchGRPC -from weaviate.collections.batch.grpc_batch_delete import _BatchDeleteGRPC -from weaviate.collections.batch.rest import _BatchREST -from weaviate.exceptions import WeaviateInvalidInputError - class _DataCollectionExecutor(Generic[ConnectionType, Properties]): def __init__( diff --git a/weaviate/collections/data/sync.py b/weaviate/collections/data/sync.py index 87100551a..347538201 100644 --- a/weaviate/collections/data/sync.py +++ b/weaviate/collections/data/sync.py @@ -1,8 +1,9 @@ from typing import Generic, Type -from weaviate.connect import executor + from weaviate.collections.classes.internal import Properties, TProperties from weaviate.collections.classes.types import _check_properties_generic from weaviate.collections.data.executor import _DataCollectionExecutor +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/data/sync.pyi b/weaviate/collections/data/sync.pyi index 738c3ba8c..35bcaccf9 100644 --- a/weaviate/collections/data/sync.pyi +++ b/weaviate/collections/data/sync.pyi @@ -5,10 +5,10 @@ from typing import ( Any, Dict, Generic, - Optional, List, Literal, Mapping, + Optional, Sequence, Tuple, Type, @@ -17,41 +17,41 @@ from typing import ( overload, ) from httpx import Response +from weaviate.collections.batch.grpc_batch_delete import _BatchDeleteGRPC +from weaviate.collections.batch.grpc_batch_objects import _BatchGRPC +from weaviate.collections.batch.rest import _BatchREST from weaviate.collections.classes.batch import ( - DeleteManyObject, - _BatchObject, - _BatchReference, BatchObjectReturn, BatchReferenceReturn, + DeleteManyObject, DeleteManyReturn, + _BatchObject, + _BatchReference, ) from weaviate.collections.classes.config import ConsistencyLevel from weaviate.collections.classes.data import DataObject, DataReferences from weaviate.collections.classes.filters import _Filters from weaviate.collections.classes.internal import ( - _Reference, - ReferenceToMulti, - SingleReferenceInput, ReferenceInput, ReferenceInputs, + ReferenceToMulti, + SingleReferenceInput, + _Reference, ) from weaviate.collections.classes.types import ( GeoCoordinate, PhoneNumber, - _PhoneNumber, Properties, WeaviateField, + _PhoneNumber, ) from weaviate.connect import executor -from weaviate.connect.v4 import _ExpectedStatusCodes, ConnectionAsync, ConnectionType +from weaviate.connect.v4 import ConnectionAsync, ConnectionType, _ExpectedStatusCodes +from weaviate.exceptions import WeaviateInvalidInputError from weaviate.logger import logger from weaviate.types import BEACON, UUID, VECTORS from weaviate.util import _datetime_to_string, _get_vector_v4 from weaviate.validator import _validate_input, _ValidateArgument -from weaviate.collections.batch.grpc_batch_objects import _BatchGRPC -from weaviate.collections.batch.grpc_batch_delete import _BatchDeleteGRPC -from weaviate.collections.batch.rest import _BatchREST -from weaviate.exceptions import WeaviateInvalidInputError from weaviate.connect.v4 import ConnectionSync from .executor import _DataCollectionExecutor diff --git a/weaviate/collections/filters.py b/weaviate/collections/filters.py index 2cee8a8bc..1a80b2002 100644 --- a/weaviate/collections/filters.py +++ b/weaviate/collections/filters.py @@ -2,16 +2,16 @@ from typing import Any, Dict, List, Literal, Optional, cast, overload from weaviate.collections.classes.filters import ( + FilterValues, _CountRef, - _MultiTargetRef, - _SingleTargetRef, - _Filters, _FilterAnd, _FilterOr, + _Filters, + _FilterTargets, _FilterValue, _GeoCoordinateFilter, - FilterValues, - _FilterTargets, + _MultiTargetRef, + _SingleTargetRef, ) from weaviate.exceptions import WeaviateInvalidInputError from weaviate.proto.v1 import base_pb2 diff --git a/weaviate/collections/generate.py b/weaviate/collections/generate.py index e8122c19c..584f01016 100644 --- a/weaviate/collections/generate.py +++ b/weaviate/collections/generate.py @@ -1,22 +1,36 @@ from typing import Generic -from weaviate.collections.classes.types import TProperties, References - -from weaviate.collections.queries.bm25 import _BM25GenerateAsync, _BM25Generate +from weaviate.collections.classes.types import References, TProperties +from weaviate.collections.queries.bm25 import _BM25Generate, _BM25GenerateAsync from weaviate.collections.queries.fetch_objects import ( - _FetchObjectsGenerateAsync, _FetchObjectsGenerate, + _FetchObjectsGenerateAsync, ) from weaviate.collections.queries.fetch_objects_by_ids import ( - _FetchObjectsByIDsGenerateAsync, _FetchObjectsByIDsGenerate, + _FetchObjectsByIDsGenerateAsync, +) +from weaviate.collections.queries.hybrid import _HybridGenerate, _HybridGenerateAsync +from weaviate.collections.queries.near_image import ( + _NearImageGenerate, + _NearImageGenerateAsync, +) +from weaviate.collections.queries.near_media import ( + _NearMediaGenerate, + _NearMediaGenerateAsync, +) +from weaviate.collections.queries.near_object import ( + _NearObjectGenerate, + _NearObjectGenerateAsync, +) +from weaviate.collections.queries.near_text import ( + _NearTextGenerate, + _NearTextGenerateAsync, +) +from weaviate.collections.queries.near_vector import ( + _NearVectorGenerate, + _NearVectorGenerateAsync, ) -from weaviate.collections.queries.hybrid import _HybridGenerateAsync, _HybridGenerate -from weaviate.collections.queries.near_image import _NearImageGenerateAsync, _NearImageGenerate -from weaviate.collections.queries.near_media import _NearMediaGenerateAsync, _NearMediaGenerate -from weaviate.collections.queries.near_object import _NearObjectGenerateAsync, _NearObjectGenerate -from weaviate.collections.queries.near_text import _NearTextGenerateAsync, _NearTextGenerate -from weaviate.collections.queries.near_vector import _NearVectorGenerateAsync, _NearVectorGenerate class _GenerateCollectionAsync( diff --git a/weaviate/collections/grpc/aggregate.py b/weaviate/collections/grpc/aggregate.py index 7af1e8bba..fb1a6a997 100644 --- a/weaviate/collections/grpc/aggregate.py +++ b/weaviate/collections/grpc/aggregate.py @@ -2,10 +2,10 @@ from weaviate.collections.classes.config import ConsistencyLevel from weaviate.collections.classes.grpc import ( - TargetVectorJoinType, - NearVectorInputType, - Move, HybridVectorType, + Move, + NearVectorInputType, + TargetVectorJoinType, ) from weaviate.collections.grpc.shared import _BaseGRPC from weaviate.connect import executor diff --git a/weaviate/collections/grpc/query.py b/weaviate/collections/grpc/query.py index c9efb6ec1..00cb7ed66 100644 --- a/weaviate/collections/grpc/query.py +++ b/weaviate/collections/grpc/query.py @@ -18,21 +18,21 @@ from weaviate.collections.classes.config import ConsistencyLevel from weaviate.collections.classes.filters import _Filters from weaviate.collections.classes.grpc import ( - HybridFusion, - _QueryReferenceMultiTarget, - _MetadataQuery, - HybridVectorType, - Move, - QueryNested, - _QueryReference, PROPERTIES, PROPERTY, REFERENCE, REFERENCES, - _Sorting, + HybridFusion, + HybridVectorType, + Move, + NearVectorInputType, + QueryNested, Rerank, TargetVectorJoinType, - NearVectorInputType, + _MetadataQuery, + _QueryReference, + _QueryReferenceMultiTarget, + _Sorting, ) from weaviate.collections.classes.internal import ( _Generative, @@ -43,7 +43,7 @@ from weaviate.proto.v1 import base_search_pb2, search_get_pb2 from weaviate.types import NUMBER, UUID from weaviate.util import _ServerVersion -from weaviate.validator import _ValidateArgument, _validate_input +from weaviate.validator import _validate_input, _ValidateArgument # Can be found in the google.protobuf.internal.well_known_types.pyi stub file but is defined explicitly here for clarity. _PyValue: TypeAlias = Union[ diff --git a/weaviate/collections/grpc/shared.py b/weaviate/collections/grpc/shared.py index a9fb117e5..d76c60ddd 100644 --- a/weaviate/collections/grpc/shared.py +++ b/weaviate/collections/grpc/shared.py @@ -1,42 +1,48 @@ import struct import uuid as uuid_lib +from dataclasses import dataclass from typing import ( Any, Dict, List, Literal, Optional, + Tuple, Union, cast, - Tuple, get_args, ) -from dataclasses import dataclass + from typing_extensions import TypeGuard from weaviate.collections.classes.config import ConsistencyLevel from weaviate.collections.classes.grpc import ( - _ListOfVectorsQuery, - _MultiTargetVectorJoin, - _HybridNearText, - _HybridNearVector, HybridFusion, HybridVectorType, Move, - TargetVectorJoinType, NearVectorInputType, OneDimensionalVectorType, - TwoDimensionalVectorType, PrimitiveVectorType, + TargetVectorJoinType, + TwoDimensionalVectorType, + _HybridNearText, + _HybridNearVector, + _ListOfVectorsQuery, + _MultiTargetVectorJoin, ) from weaviate.exceptions import ( - WeaviateUnsupportedFeatureError, WeaviateInvalidInputError, + WeaviateUnsupportedFeatureError, ) -from weaviate.proto.v1 import base_search_pb2, base_pb2 +from weaviate.proto.v1 import base_pb2, base_search_pb2 from weaviate.types import NUMBER, UUID from weaviate.util import _get_vector_v4, _ServerVersion -from weaviate.validator import _is_valid, _ValidateArgument, _validate_input, _ExtraTypes +from weaviate.validator import ( + _ExtraTypes, + _is_valid, + _validate_input, + _ValidateArgument, +) UINT32_LEN = 4 UINT64_LEN = 8 diff --git a/weaviate/collections/iterator.py b/weaviate/collections/iterator.py index 9e57d38ba..6952d7be9 100644 --- a/weaviate/collections/iterator.py +++ b/weaviate/collections/iterator.py @@ -1,19 +1,30 @@ from dataclasses import dataclass -from typing import Any, AsyncIterable, AsyncIterator, Generic, Iterable, Iterator, List, Optional +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Generic, + Iterable, + Iterator, + List, + Optional, +) from uuid import UUID from weaviate.collections.classes.grpc import METADATA from weaviate.collections.classes.internal import ( - TReferences, - TProperties, + Object, ReturnProperties, ReturnReferences, - Object, + TProperties, + TReferences, +) +from weaviate.collections.queries.fetch_objects import ( + _FetchObjectsQuery, + _FetchObjectsQueryAsync, ) -from weaviate.collections.queries.fetch_objects import _FetchObjectsQuery, _FetchObjectsQueryAsync from weaviate.types import UUID as UUIDorStr - ITERATOR_CACHE_SIZE = 100 diff --git a/weaviate/collections/queries/base_executor.py b/weaviate/collections/queries/base_executor.py index bd139a15f..41d3f69c6 100644 --- a/weaviate/collections/queries/base_executor.py +++ b/weaviate/collections/queries/base_executor.py @@ -1,44 +1,55 @@ import datetime import uuid as uuid_lib -from typing import Any, Dict, Generic, List, Mapping, Optional, Sequence, Type, Union, cast +from typing import ( + Any, + Dict, + Generic, + List, + Mapping, + Optional, + Sequence, + Type, + Union, + cast, +) from typing_extensions import is_typeddict from weaviate.collections.classes.config import ConsistencyLevel from weaviate.collections.classes.grpc import ( - _QueryReference, - MetadataQuery, - _MetadataQuery, - QueryNested, METADATA, PROPERTIES, REFERENCES, + MetadataQuery, + QueryNested, + _MetadataQuery, + _QueryReference, ) from weaviate.collections.classes.internal import ( - GroupByObject, - MetadataReturn, - GroupByMetadataReturn, - GenerativeObject, - Object, - _extract_properties_from_data_model, - _extract_references_from_data_model, - GenerativeReturn, + CrossReferences, + GenerativeGroup, GenerativeGroupByReturn, - GenerativeSingle, GenerativeGrouped, GenerativeMetadata, - GroupByReturn, + GenerativeObject, + GenerativeReturn, + GenerativeSingle, Group, - GenerativeGroup, + GroupByMetadataReturn, + GroupByObject, + GroupByReturn, + MetadataReturn, + Object, QueryReturn, - _QueryOptions, ReturnProperties, ReturnReferences, - CrossReferences, WeaviateProperties, _CrossReference, + _extract_properties_from_data_model, + _extract_references_from_data_model, + _QueryOptions, ) -from weaviate.collections.classes.types import GeoCoordinate, _PhoneNumber, TReferences +from weaviate.collections.classes.types import GeoCoordinate, TReferences, _PhoneNumber from weaviate.collections.grpc.query import _QueryGRPC from weaviate.collections.grpc.shared import _ByteOps, _Unpack from weaviate.connect.v4 import ConnectionType diff --git a/weaviate/collections/queries/bm25/__init__.py b/weaviate/collections/queries/bm25/__init__.py index e8b3d3318..db0d536a4 100644 --- a/weaviate/collections/queries/bm25/__init__.py +++ b/weaviate/collections/queries/bm25/__init__.py @@ -1,5 +1,5 @@ -from .generate import _BM25GenerateAsync, _BM25Generate -from .query import _BM25QueryAsync, _BM25Query +from .generate import _BM25Generate, _BM25GenerateAsync +from .query import _BM25Query, _BM25QueryAsync __all__ = [ "_BM25GenerateAsync", diff --git a/weaviate/collections/queries/bm25/generate/async_.py b/weaviate/collections/queries/bm25/generate/async_.py index 140b28dda..3a11e36b5 100644 --- a/weaviate/collections/queries/bm25/generate/async_.py +++ b/weaviate/collections/queries/bm25/generate/async_.py @@ -1,8 +1,8 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References from weaviate.collections.queries.bm25.generate.executor import _BM25GenerateExecutor +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/queries/bm25/generate/async_.pyi b/weaviate/collections/queries/bm25/generate/async_.pyi index 1ef40bed3..c7d84bc62 100644 --- a/weaviate/collections/queries/bm25/generate/async_.pyi +++ b/weaviate/collections/queries/bm25/generate/async_.pyi @@ -1,22 +1,21 @@ from typing import Any, Generic, List, Literal, Optional, Type, Union, cast, overload from weaviate.collections.classes.filters import _Filters -from weaviate.collections.classes.grpc import GroupBy, Rerank, METADATA +from weaviate.collections.classes.grpc import METADATA, PROPERTIES, REFERENCES, GroupBy, Rerank from weaviate.collections.classes.internal import ( - GenerativeReturn, - GenerativeGroupByReturn, CrossReferences, + GenerativeGroupByReturn, + GenerativeReturn, GenerativeSearchReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, _Generative, - _GroupBy, _GenerativeConfigRuntime, - _SinglePrompt, + _GroupBy, _GroupedTask, + _QueryOptions, + _SinglePrompt, ) -from weaviate.collections.classes.grpc import PROPERTIES, REFERENCES -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType diff --git a/weaviate/collections/queries/bm25/generate/executor.py b/weaviate/collections/queries/bm25/generate/executor.py index a2ebc85fc..c17c2e1bc 100644 --- a/weaviate/collections/queries/bm25/generate/executor.py +++ b/weaviate/collections/queries/bm25/generate/executor.py @@ -1,23 +1,33 @@ from typing import Any, Generic, List, Literal, Optional, Type, Union, cast, overload from weaviate.collections.classes.filters import _Filters -from weaviate.collections.classes.grpc import GroupBy, Rerank, METADATA +from weaviate.collections.classes.grpc import ( + METADATA, + PROPERTIES, + REFERENCES, + GroupBy, + Rerank, +) from weaviate.collections.classes.internal import ( - GenerativeReturn, - GenerativeGroupByReturn, CrossReferences, + GenerativeGroupByReturn, + GenerativeReturn, GenerativeSearchReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, _Generative, - _GroupBy, _GenerativeConfigRuntime, - _SinglePrompt, + _GroupBy, _GroupedTask, + _QueryOptions, + _SinglePrompt, +) +from weaviate.collections.classes.types import ( + Properties, + References, + TProperties, + TReferences, ) -from weaviate.collections.classes.grpc import PROPERTIES, REFERENCES -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType diff --git a/weaviate/collections/queries/bm25/generate/sync.py b/weaviate/collections/queries/bm25/generate/sync.py index b995dd61c..f684ea6a0 100644 --- a/weaviate/collections/queries/bm25/generate/sync.py +++ b/weaviate/collections/queries/bm25/generate/sync.py @@ -1,8 +1,8 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References from weaviate.collections.queries.bm25.generate.executor import _BM25GenerateExecutor +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/queries/bm25/generate/sync.pyi b/weaviate/collections/queries/bm25/generate/sync.pyi index 1991abb3d..9ab28014e 100644 --- a/weaviate/collections/queries/bm25/generate/sync.pyi +++ b/weaviate/collections/queries/bm25/generate/sync.pyi @@ -1,22 +1,21 @@ from typing import Any, Generic, List, Literal, Optional, Type, Union, cast, overload from weaviate.collections.classes.filters import _Filters -from weaviate.collections.classes.grpc import GroupBy, Rerank, METADATA +from weaviate.collections.classes.grpc import METADATA, PROPERTIES, REFERENCES, GroupBy, Rerank from weaviate.collections.classes.internal import ( - GenerativeReturn, - GenerativeGroupByReturn, CrossReferences, + GenerativeGroupByReturn, + GenerativeReturn, GenerativeSearchReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, _Generative, - _GroupBy, _GenerativeConfigRuntime, - _SinglePrompt, + _GroupBy, _GroupedTask, + _QueryOptions, + _SinglePrompt, ) -from weaviate.collections.classes.grpc import PROPERTIES, REFERENCES -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType diff --git a/weaviate/collections/queries/bm25/query/async_.py b/weaviate/collections/queries/bm25/query/async_.py index da63fcc48..5addbb538 100644 --- a/weaviate/collections/queries/bm25/query/async_.py +++ b/weaviate/collections/queries/bm25/query/async_.py @@ -1,8 +1,8 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References from weaviate.collections.queries.bm25.query.executor import _BM25QueryExecutor +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/queries/bm25/query/async_.pyi b/weaviate/collections/queries/bm25/query/async_.pyi index be5da211b..62652201d 100644 --- a/weaviate/collections/queries/bm25/query/async_.pyi +++ b/weaviate/collections/queries/bm25/query/async_.pyi @@ -1,18 +1,17 @@ from typing import Any, Generic, List, Literal, Optional, Type, Union, cast, overload from weaviate.collections.classes.filters import _Filters -from weaviate.collections.classes.grpc import GroupBy, Rerank, METADATA +from weaviate.collections.classes.grpc import METADATA, PROPERTIES, REFERENCES, GroupBy, Rerank from weaviate.collections.classes.internal import ( - QuerySearchReturnType, - QueryReturn, CrossReferences, GroupByReturn, + QueryReturn, + QuerySearchReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, _GroupBy, + _QueryOptions, ) -from weaviate.collections.classes.grpc import PROPERTIES, REFERENCES -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType diff --git a/weaviate/collections/queries/bm25/query/executor.py b/weaviate/collections/queries/bm25/query/executor.py index b8da2f0ba..a530bd634 100644 --- a/weaviate/collections/queries/bm25/query/executor.py +++ b/weaviate/collections/queries/bm25/query/executor.py @@ -1,19 +1,29 @@ from typing import Any, Generic, List, Literal, Optional, Type, Union, cast, overload from weaviate.collections.classes.filters import _Filters -from weaviate.collections.classes.grpc import GroupBy, Rerank, METADATA +from weaviate.collections.classes.grpc import ( + METADATA, + PROPERTIES, + REFERENCES, + GroupBy, + Rerank, +) from weaviate.collections.classes.internal import ( - QuerySearchReturnType, - QueryReturn, CrossReferences, GroupByReturn, + QueryReturn, + QuerySearchReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, _GroupBy, + _QueryOptions, +) +from weaviate.collections.classes.types import ( + Properties, + References, + TProperties, + TReferences, ) -from weaviate.collections.classes.grpc import PROPERTIES, REFERENCES -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType diff --git a/weaviate/collections/queries/bm25/query/sync.py b/weaviate/collections/queries/bm25/query/sync.py index 9d93c459b..f942a7797 100644 --- a/weaviate/collections/queries/bm25/query/sync.py +++ b/weaviate/collections/queries/bm25/query/sync.py @@ -1,8 +1,8 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References from weaviate.collections.queries.bm25.query.executor import _BM25QueryExecutor +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/queries/bm25/query/sync.pyi b/weaviate/collections/queries/bm25/query/sync.pyi index 09571b972..0a945818c 100644 --- a/weaviate/collections/queries/bm25/query/sync.pyi +++ b/weaviate/collections/queries/bm25/query/sync.pyi @@ -1,18 +1,17 @@ from typing import Any, Generic, List, Literal, Optional, Type, Union, cast, overload from weaviate.collections.classes.filters import _Filters -from weaviate.collections.classes.grpc import GroupBy, Rerank, METADATA +from weaviate.collections.classes.grpc import METADATA, PROPERTIES, REFERENCES, GroupBy, Rerank from weaviate.collections.classes.internal import ( - QuerySearchReturnType, - QueryReturn, CrossReferences, GroupByReturn, + QueryReturn, + QuerySearchReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, _GroupBy, + _QueryOptions, ) -from weaviate.collections.classes.grpc import PROPERTIES, REFERENCES -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType diff --git a/weaviate/collections/queries/fetch_object_by_id/async_.py b/weaviate/collections/queries/fetch_object_by_id/async_.py index 45922be99..193707b57 100644 --- a/weaviate/collections/queries/fetch_object_by_id/async_.py +++ b/weaviate/collections/queries/fetch_object_by_id/async_.py @@ -2,9 +2,11 @@ Generic, ) -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References -from weaviate.collections.queries.fetch_object_by_id.executor import _FetchObjectByIDQueryExecutor +from weaviate.collections.queries.fetch_object_by_id.executor import ( + _FetchObjectByIDQueryExecutor, +) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/queries/fetch_object_by_id/async_.pyi b/weaviate/collections/queries/fetch_object_by_id/async_.pyi index 67e5fbc3d..c857594d3 100644 --- a/weaviate/collections/queries/fetch_object_by_id/async_.pyi +++ b/weaviate/collections/queries/fetch_object_by_id/async_.pyi @@ -1,16 +1,16 @@ from typing import Generic, Literal, Optional, Type, Union, cast, overload from weaviate.collections.classes.filters import Filter -from weaviate.collections.classes.grpc import MetadataQuery, PROPERTIES, REFERENCES +from weaviate.collections.classes.grpc import PROPERTIES, REFERENCES, MetadataQuery from weaviate.collections.classes.internal import ( - ObjectSingleReturn, CrossReferences, MetadataSingleObjectReturn, + ObjectSingleReturn, QuerySingleReturn, ReturnProperties, ReturnReferences, _QueryOptions, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType diff --git a/weaviate/collections/queries/fetch_object_by_id/executor.py b/weaviate/collections/queries/fetch_object_by_id/executor.py index de08d699f..8b47cb53f 100644 --- a/weaviate/collections/queries/fetch_object_by_id/executor.py +++ b/weaviate/collections/queries/fetch_object_by_id/executor.py @@ -3,17 +3,22 @@ from weaviate.collections.classes.filters import ( Filter, ) -from weaviate.collections.classes.grpc import MetadataQuery, PROPERTIES, REFERENCES +from weaviate.collections.classes.grpc import PROPERTIES, REFERENCES, MetadataQuery from weaviate.collections.classes.internal import ( - ObjectSingleReturn, CrossReferences, MetadataSingleObjectReturn, + ObjectSingleReturn, QuerySingleReturn, ReturnProperties, ReturnReferences, _QueryOptions, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import ( + Properties, + References, + TProperties, + TReferences, +) from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType diff --git a/weaviate/collections/queries/fetch_object_by_id/sync.py b/weaviate/collections/queries/fetch_object_by_id/sync.py index c403cbff0..0133bee74 100644 --- a/weaviate/collections/queries/fetch_object_by_id/sync.py +++ b/weaviate/collections/queries/fetch_object_by_id/sync.py @@ -2,9 +2,11 @@ Generic, ) -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References -from weaviate.collections.queries.fetch_object_by_id.executor import _FetchObjectByIDQueryExecutor +from weaviate.collections.queries.fetch_object_by_id.executor import ( + _FetchObjectByIDQueryExecutor, +) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/queries/fetch_object_by_id/sync.pyi b/weaviate/collections/queries/fetch_object_by_id/sync.pyi index ebcdb84ff..54b89aed2 100644 --- a/weaviate/collections/queries/fetch_object_by_id/sync.pyi +++ b/weaviate/collections/queries/fetch_object_by_id/sync.pyi @@ -1,16 +1,16 @@ from typing import Generic, Literal, Optional, Type, Union, cast, overload from weaviate.collections.classes.filters import Filter -from weaviate.collections.classes.grpc import MetadataQuery, PROPERTIES, REFERENCES +from weaviate.collections.classes.grpc import PROPERTIES, REFERENCES, MetadataQuery from weaviate.collections.classes.internal import ( - ObjectSingleReturn, CrossReferences, MetadataSingleObjectReturn, + ObjectSingleReturn, QuerySingleReturn, ReturnProperties, ReturnReferences, _QueryOptions, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType diff --git a/weaviate/collections/queries/fetch_objects/__init__.py b/weaviate/collections/queries/fetch_objects/__init__.py index d569bbcec..29f68f680 100644 --- a/weaviate/collections/queries/fetch_objects/__init__.py +++ b/weaviate/collections/queries/fetch_objects/__init__.py @@ -1,5 +1,5 @@ -from .generate import _FetchObjectsGenerateAsync, _FetchObjectsGenerate -from .query import _FetchObjectsQueryAsync, _FetchObjectsQuery +from .generate import _FetchObjectsGenerate, _FetchObjectsGenerateAsync +from .query import _FetchObjectsQuery, _FetchObjectsQueryAsync __all__ = [ "_FetchObjectsGenerate", diff --git a/weaviate/collections/queries/fetch_objects/generate/async_.py b/weaviate/collections/queries/fetch_objects/generate/async_.py index 89ba9bd46..b570a8f38 100644 --- a/weaviate/collections/queries/fetch_objects/generate/async_.py +++ b/weaviate/collections/queries/fetch_objects/generate/async_.py @@ -1,10 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References from weaviate.collections.queries.fetch_objects.generate.executor import ( _FetchObjectsGenerateExecutor, ) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/queries/fetch_objects/generate/async_.pyi b/weaviate/collections/queries/fetch_objects/generate/async_.pyi index 1a34cdc3b..8eba99bfb 100644 --- a/weaviate/collections/queries/fetch_objects/generate/async_.pyi +++ b/weaviate/collections/queries/fetch_objects/generate/async_.pyi @@ -1,25 +1,24 @@ from typing import Any, Generic, List, Literal, Optional, Type, Union, cast, overload from weaviate.collections.classes.filters import _Filters -from weaviate.collections.classes.grpc import METADATA, Sorting +from weaviate.collections.classes.grpc import METADATA, PROPERTIES, REFERENCES, Sorting from weaviate.collections.classes.internal import ( - GenerativeReturnType, - GenerativeReturn, CrossReferences, + GenerativeReturn, + GenerativeReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, _Generative, _GenerativeConfigRuntime, - _SinglePrompt, _GroupedTask, + _QueryOptions, + _SinglePrompt, ) -from weaviate.collections.classes.grpc import PROPERTIES, REFERENCES -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor -from weaviate.connect.v4 import ConnectionType from weaviate.connect import executor +from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import UUID, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, UUID from weaviate.connect.v4 import ConnectionAsync from .executor import _FetchObjectsGenerateExecutor diff --git a/weaviate/collections/queries/fetch_objects/generate/executor.py b/weaviate/collections/queries/fetch_objects/generate/executor.py index 9ca71e314..919eaf03d 100644 --- a/weaviate/collections/queries/fetch_objects/generate/executor.py +++ b/weaviate/collections/queries/fetch_objects/generate/executor.py @@ -1,26 +1,30 @@ from typing import Any, Generic, List, Literal, Optional, Type, Union, cast, overload from weaviate.collections.classes.filters import _Filters -from weaviate.collections.classes.grpc import METADATA, Sorting +from weaviate.collections.classes.grpc import METADATA, PROPERTIES, REFERENCES, Sorting from weaviate.collections.classes.internal import ( - GenerativeReturnType, - GenerativeReturn, CrossReferences, + GenerativeReturn, + GenerativeReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, _Generative, _GenerativeConfigRuntime, - _SinglePrompt, _GroupedTask, + _QueryOptions, + _SinglePrompt, +) +from weaviate.collections.classes.types import ( + Properties, + References, + TProperties, + TReferences, ) -from weaviate.collections.classes.grpc import PROPERTIES, REFERENCES -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor -from weaviate.connect.v4 import ConnectionType from weaviate.connect import executor +from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import UUID, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, UUID class _FetchObjectsGenerateExecutor( diff --git a/weaviate/collections/queries/fetch_objects/generate/sync.py b/weaviate/collections/queries/fetch_objects/generate/sync.py index e824e65d9..2723d05a5 100644 --- a/weaviate/collections/queries/fetch_objects/generate/sync.py +++ b/weaviate/collections/queries/fetch_objects/generate/sync.py @@ -1,10 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References from weaviate.collections.queries.fetch_objects.generate.executor import ( _FetchObjectsGenerateExecutor, ) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/queries/fetch_objects/generate/sync.pyi b/weaviate/collections/queries/fetch_objects/generate/sync.pyi index f63cdc321..2c7705fc3 100644 --- a/weaviate/collections/queries/fetch_objects/generate/sync.pyi +++ b/weaviate/collections/queries/fetch_objects/generate/sync.pyi @@ -1,25 +1,24 @@ from typing import Any, Generic, List, Literal, Optional, Type, Union, cast, overload from weaviate.collections.classes.filters import _Filters -from weaviate.collections.classes.grpc import METADATA, Sorting +from weaviate.collections.classes.grpc import METADATA, PROPERTIES, REFERENCES, Sorting from weaviate.collections.classes.internal import ( - GenerativeReturnType, - GenerativeReturn, CrossReferences, + GenerativeReturn, + GenerativeReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, _Generative, _GenerativeConfigRuntime, - _SinglePrompt, _GroupedTask, + _QueryOptions, + _SinglePrompt, ) -from weaviate.collections.classes.grpc import PROPERTIES, REFERENCES -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor -from weaviate.connect.v4 import ConnectionType from weaviate.connect import executor +from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import UUID, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, UUID from weaviate.connect.v4 import ConnectionSync from .executor import _FetchObjectsGenerateExecutor diff --git a/weaviate/collections/queries/fetch_objects/query/async_.py b/weaviate/collections/queries/fetch_objects/query/async_.py index 110968086..f7facd6cf 100644 --- a/weaviate/collections/queries/fetch_objects/query/async_.py +++ b/weaviate/collections/queries/fetch_objects/query/async_.py @@ -1,8 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References -from weaviate.collections.queries.fetch_objects.query.executor import _FetchObjectsQueryExecutor +from weaviate.collections.queries.fetch_objects.query.executor import ( + _FetchObjectsQueryExecutor, +) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/queries/fetch_objects/query/async_.pyi b/weaviate/collections/queries/fetch_objects/query/async_.pyi index 4b06790f5..2f50d4e11 100644 --- a/weaviate/collections/queries/fetch_objects/query/async_.pyi +++ b/weaviate/collections/queries/fetch_objects/query/async_.pyi @@ -1,21 +1,20 @@ from typing import Any, Generic, Literal, Optional, Type, Union, cast, overload from weaviate.collections.classes.filters import _Filters -from weaviate.collections.classes.grpc import METADATA, Sorting +from weaviate.collections.classes.grpc import METADATA, PROPERTIES, REFERENCES, Sorting from weaviate.collections.classes.internal import ( - QueryReturnType, + CrossReferences, QueryReturn, + QueryReturnType, ReturnProperties, ReturnReferences, - CrossReferences, _QueryOptions, ) -from weaviate.collections.classes.grpc import PROPERTIES, REFERENCES -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor -from weaviate.connect.v4 import ConnectionType from weaviate.connect import executor +from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import UUID, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, UUID from weaviate.connect.v4 import ConnectionAsync from .executor import _FetchObjectsQueryExecutor diff --git a/weaviate/collections/queries/fetch_objects/query/executor.py b/weaviate/collections/queries/fetch_objects/query/executor.py index be12b753e..739c20736 100644 --- a/weaviate/collections/queries/fetch_objects/query/executor.py +++ b/weaviate/collections/queries/fetch_objects/query/executor.py @@ -1,22 +1,26 @@ from typing import Any, Generic, Literal, Optional, Type, Union, cast, overload from weaviate.collections.classes.filters import _Filters -from weaviate.collections.classes.grpc import METADATA, Sorting +from weaviate.collections.classes.grpc import METADATA, PROPERTIES, REFERENCES, Sorting from weaviate.collections.classes.internal import ( - QueryReturnType, + CrossReferences, QueryReturn, + QueryReturnType, ReturnProperties, ReturnReferences, - CrossReferences, _QueryOptions, ) -from weaviate.collections.classes.grpc import PROPERTIES, REFERENCES -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import ( + Properties, + References, + TProperties, + TReferences, +) from weaviate.collections.queries.base_executor import _BaseExecutor -from weaviate.connect.v4 import ConnectionType from weaviate.connect import executor +from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import UUID, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, UUID class _FetchObjectsQueryExecutor( diff --git a/weaviate/collections/queries/fetch_objects/query/sync.py b/weaviate/collections/queries/fetch_objects/query/sync.py index a0fcf513f..3faf31cbf 100644 --- a/weaviate/collections/queries/fetch_objects/query/sync.py +++ b/weaviate/collections/queries/fetch_objects/query/sync.py @@ -1,8 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References -from weaviate.collections.queries.fetch_objects.query.executor import _FetchObjectsQueryExecutor +from weaviate.collections.queries.fetch_objects.query.executor import ( + _FetchObjectsQueryExecutor, +) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/queries/fetch_objects/query/sync.pyi b/weaviate/collections/queries/fetch_objects/query/sync.pyi index 8f9efc23e..77aedaa30 100644 --- a/weaviate/collections/queries/fetch_objects/query/sync.pyi +++ b/weaviate/collections/queries/fetch_objects/query/sync.pyi @@ -1,21 +1,20 @@ from typing import Any, Generic, Literal, Optional, Type, Union, cast, overload from weaviate.collections.classes.filters import _Filters -from weaviate.collections.classes.grpc import METADATA, Sorting +from weaviate.collections.classes.grpc import METADATA, PROPERTIES, REFERENCES, Sorting from weaviate.collections.classes.internal import ( - QueryReturnType, + CrossReferences, QueryReturn, + QueryReturnType, ReturnProperties, ReturnReferences, - CrossReferences, _QueryOptions, ) -from weaviate.collections.classes.grpc import PROPERTIES, REFERENCES -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor -from weaviate.connect.v4 import ConnectionType from weaviate.connect import executor +from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import UUID, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, UUID from weaviate.connect.v4 import ConnectionSync from .executor import _FetchObjectsQueryExecutor diff --git a/weaviate/collections/queries/fetch_objects_by_ids/__init__.py b/weaviate/collections/queries/fetch_objects_by_ids/__init__.py index 4cf61115f..ae057ac27 100644 --- a/weaviate/collections/queries/fetch_objects_by_ids/__init__.py +++ b/weaviate/collections/queries/fetch_objects_by_ids/__init__.py @@ -1,5 +1,5 @@ -from .generate import _FetchObjectsByIDsGenerateAsync, _FetchObjectsByIDsGenerate -from .query import _FetchObjectsByIDsQueryAsync, _FetchObjectsByIDsQuery +from .generate import _FetchObjectsByIDsGenerate, _FetchObjectsByIDsGenerateAsync +from .query import _FetchObjectsByIDsQuery, _FetchObjectsByIDsQueryAsync __all__ = [ "_FetchObjectsByIDsGenerate", diff --git a/weaviate/collections/queries/fetch_objects_by_ids/generate/async_.py b/weaviate/collections/queries/fetch_objects_by_ids/generate/async_.py index 8fed6f2fa..4f58576b9 100644 --- a/weaviate/collections/queries/fetch_objects_by_ids/generate/async_.py +++ b/weaviate/collections/queries/fetch_objects_by_ids/generate/async_.py @@ -1,10 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References from weaviate.collections.queries.fetch_objects_by_ids.generate.executor import ( _FetchObjectsByIDsGenerateExecutor, ) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/queries/fetch_objects_by_ids/generate/async_.pyi b/weaviate/collections/queries/fetch_objects_by_ids/generate/async_.pyi index 03decb013..6556a1ac1 100644 --- a/weaviate/collections/queries/fetch_objects_by_ids/generate/async_.pyi +++ b/weaviate/collections/queries/fetch_objects_by_ids/generate/async_.pyi @@ -1,24 +1,24 @@ -from typing import Any, Generic, List, Literal, Iterable, Optional, Type, Union, cast, overload +from typing import Any, Generic, Iterable, List, Literal, Optional, Type, Union, cast, overload from weaviate.collections.classes.filters import Filter -from weaviate.collections.classes.grpc import METADATA, Sorting, PROPERTIES, REFERENCES +from weaviate.collections.classes.grpc import METADATA, PROPERTIES, REFERENCES, Sorting from weaviate.collections.classes.internal import ( - GenerativeReturnType, - GenerativeReturn, CrossReferences, + GenerativeReturn, + GenerativeReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, _Generative, _GenerativeConfigRuntime, - _SinglePrompt, _GroupedTask, + _QueryOptions, + _SinglePrompt, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync, ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import UUID, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, UUID from weaviate.connect.v4 import ConnectionAsync from .executor import _FetchObjectsByIDsGenerateExecutor diff --git a/weaviate/collections/queries/fetch_objects_by_ids/generate/executor.py b/weaviate/collections/queries/fetch_objects_by_ids/generate/executor.py index b003780f0..da4380a33 100644 --- a/weaviate/collections/queries/fetch_objects_by_ids/generate/executor.py +++ b/weaviate/collections/queries/fetch_objects_by_ids/generate/executor.py @@ -1,26 +1,41 @@ -from typing import Any, Generic, List, Literal, Iterable, Optional, Type, Union, cast, overload +from typing import ( + Any, + Generic, + Iterable, + List, + Literal, + Optional, + Type, + Union, + cast, + overload, +) from weaviate.collections.classes.filters import Filter -from weaviate.collections.classes.grpc import METADATA, Sorting, PROPERTIES, REFERENCES +from weaviate.collections.classes.grpc import METADATA, PROPERTIES, REFERENCES, Sorting from weaviate.collections.classes.internal import ( - GenerativeReturnType, - GenerativeReturn, CrossReferences, + GenerativeReturn, + GenerativeReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, _Generative, _GenerativeConfigRuntime, - _SinglePrompt, _GroupedTask, + _QueryOptions, + _SinglePrompt, +) +from weaviate.collections.classes.types import ( + Properties, + References, + TProperties, + TReferences, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync, ConnectionType - from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import UUID, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, UUID class _FetchObjectsByIDsGenerateExecutor( diff --git a/weaviate/collections/queries/fetch_objects_by_ids/generate/sync.py b/weaviate/collections/queries/fetch_objects_by_ids/generate/sync.py index 3e927639e..86a34b4da 100644 --- a/weaviate/collections/queries/fetch_objects_by_ids/generate/sync.py +++ b/weaviate/collections/queries/fetch_objects_by_ids/generate/sync.py @@ -1,10 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References from weaviate.collections.queries.fetch_objects_by_ids.generate.executor import ( _FetchObjectsByIDsGenerateExecutor, ) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/queries/fetch_objects_by_ids/generate/sync.pyi b/weaviate/collections/queries/fetch_objects_by_ids/generate/sync.pyi index 96f3a3877..3c523396c 100644 --- a/weaviate/collections/queries/fetch_objects_by_ids/generate/sync.pyi +++ b/weaviate/collections/queries/fetch_objects_by_ids/generate/sync.pyi @@ -1,24 +1,24 @@ -from typing import Any, Generic, List, Literal, Iterable, Optional, Type, Union, cast, overload +from typing import Any, Generic, Iterable, List, Literal, Optional, Type, Union, cast, overload from weaviate.collections.classes.filters import Filter -from weaviate.collections.classes.grpc import METADATA, Sorting, PROPERTIES, REFERENCES +from weaviate.collections.classes.grpc import METADATA, PROPERTIES, REFERENCES, Sorting from weaviate.collections.classes.internal import ( - GenerativeReturnType, - GenerativeReturn, CrossReferences, + GenerativeReturn, + GenerativeReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, _Generative, _GenerativeConfigRuntime, - _SinglePrompt, _GroupedTask, + _QueryOptions, + _SinglePrompt, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync, ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import UUID, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, UUID from weaviate.connect.v4 import ConnectionSync from .executor import _FetchObjectsByIDsGenerateExecutor diff --git a/weaviate/collections/queries/fetch_objects_by_ids/query/async_.py b/weaviate/collections/queries/fetch_objects_by_ids/query/async_.py index 3fcd18e22..fbff17545 100644 --- a/weaviate/collections/queries/fetch_objects_by_ids/query/async_.py +++ b/weaviate/collections/queries/fetch_objects_by_ids/query/async_.py @@ -1,10 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References from weaviate.collections.queries.fetch_objects_by_ids.query.executor import ( _FetchObjectsByIDsQueryExecutor, ) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/queries/fetch_objects_by_ids/query/async_.pyi b/weaviate/collections/queries/fetch_objects_by_ids/query/async_.pyi index 3914eacbc..4ab2b8991 100644 --- a/weaviate/collections/queries/fetch_objects_by_ids/query/async_.pyi +++ b/weaviate/collections/queries/fetch_objects_by_ids/query/async_.pyi @@ -1,20 +1,20 @@ -from typing import Any, Generic, Literal, Iterable, Optional, Type, Union, cast, overload +from typing import Any, Generic, Iterable, Literal, Optional, Type, Union, cast, overload from weaviate.collections.classes.filters import Filter -from weaviate.collections.classes.grpc import METADATA, Sorting, PROPERTIES, REFERENCES +from weaviate.collections.classes.grpc import METADATA, PROPERTIES, REFERENCES, Sorting from weaviate.collections.classes.internal import ( - QueryReturnType, - QueryReturn, CrossReferences, + QueryReturn, + QueryReturnType, ReturnProperties, ReturnReferences, _QueryOptions, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync, ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import UUID, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, UUID from weaviate.connect.v4 import ConnectionAsync from .executor import _FetchObjectsByIDsQueryExecutor diff --git a/weaviate/collections/queries/fetch_objects_by_ids/query/executor.py b/weaviate/collections/queries/fetch_objects_by_ids/query/executor.py index 7cbf44650..668d9852e 100644 --- a/weaviate/collections/queries/fetch_objects_by_ids/query/executor.py +++ b/weaviate/collections/queries/fetch_objects_by_ids/query/executor.py @@ -1,22 +1,36 @@ -from typing import Any, Generic, Literal, Iterable, Optional, Type, Union, cast, overload +from typing import ( + Any, + Generic, + Iterable, + Literal, + Optional, + Type, + Union, + cast, + overload, +) from weaviate.collections.classes.filters import Filter -from weaviate.collections.classes.grpc import METADATA, Sorting, PROPERTIES, REFERENCES +from weaviate.collections.classes.grpc import METADATA, PROPERTIES, REFERENCES, Sorting from weaviate.collections.classes.internal import ( - QueryReturnType, - QueryReturn, CrossReferences, + QueryReturn, + QueryReturnType, ReturnProperties, ReturnReferences, _QueryOptions, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import ( + Properties, + References, + TProperties, + TReferences, +) from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync, ConnectionType - from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import UUID, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, UUID class _FetchObjectsByIDsQueryExecutor( diff --git a/weaviate/collections/queries/fetch_objects_by_ids/query/sync.py b/weaviate/collections/queries/fetch_objects_by_ids/query/sync.py index 2b9a3176f..4dc6bca8b 100644 --- a/weaviate/collections/queries/fetch_objects_by_ids/query/sync.py +++ b/weaviate/collections/queries/fetch_objects_by_ids/query/sync.py @@ -1,10 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References from weaviate.collections.queries.fetch_objects_by_ids.query.executor import ( _FetchObjectsByIDsQueryExecutor, ) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/queries/fetch_objects_by_ids/query/sync.pyi b/weaviate/collections/queries/fetch_objects_by_ids/query/sync.pyi index 45109690a..00ab51a64 100644 --- a/weaviate/collections/queries/fetch_objects_by_ids/query/sync.pyi +++ b/weaviate/collections/queries/fetch_objects_by_ids/query/sync.pyi @@ -1,20 +1,20 @@ -from typing import Any, Generic, Literal, Iterable, Optional, Type, Union, cast, overload +from typing import Any, Generic, Iterable, Literal, Optional, Type, Union, cast, overload from weaviate.collections.classes.filters import Filter -from weaviate.collections.classes.grpc import METADATA, Sorting, PROPERTIES, REFERENCES +from weaviate.collections.classes.grpc import METADATA, PROPERTIES, REFERENCES, Sorting from weaviate.collections.classes.internal import ( - QueryReturnType, - QueryReturn, CrossReferences, + QueryReturn, + QueryReturnType, ReturnProperties, ReturnReferences, _QueryOptions, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync, ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import UUID, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, UUID from weaviate.connect.v4 import ConnectionSync from .executor import _FetchObjectsByIDsQueryExecutor diff --git a/weaviate/collections/queries/hybrid/__init__.py b/weaviate/collections/queries/hybrid/__init__.py index 6f2236d9b..d4067bc51 100644 --- a/weaviate/collections/queries/hybrid/__init__.py +++ b/weaviate/collections/queries/hybrid/__init__.py @@ -1,5 +1,5 @@ -from .generate import _HybridGenerateAsync, _HybridGenerate -from .query import _HybridQueryAsync, _HybridQuery +from .generate import _HybridGenerate, _HybridGenerateAsync +from .query import _HybridQuery, _HybridQueryAsync __all__ = [ "_HybridGenerate", diff --git a/weaviate/collections/queries/hybrid/generate/async_.py b/weaviate/collections/queries/hybrid/generate/async_.py index b864b345b..8d14a5a1f 100644 --- a/weaviate/collections/queries/hybrid/generate/async_.py +++ b/weaviate/collections/queries/hybrid/generate/async_.py @@ -1,8 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References -from weaviate.collections.queries.hybrid.generate.executor import _HybridGenerateExecutor +from weaviate.collections.queries.hybrid.generate.executor import ( + _HybridGenerateExecutor, +) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/queries/hybrid/generate/async_.pyi b/weaviate/collections/queries/hybrid/generate/async_.pyi index 31fe581e9..d457d90a2 100644 --- a/weaviate/collections/queries/hybrid/generate/async_.pyi +++ b/weaviate/collections/queries/hybrid/generate/async_.pyi @@ -2,35 +2,35 @@ from typing import Any, Generic, List, Literal, Optional, Type, Union, cast, ove from weaviate.collections.classes.filters import _Filters from weaviate.collections.classes.grpc import ( METADATA, + PROPERTIES, + REFERENCES, GroupBy, HybridFusion, - Rerank, HybridVectorType, + Rerank, TargetVectorJoinType, - PROPERTIES, - REFERENCES, ) from weaviate.collections.classes.internal import ( - GenerativeSearchReturnType, - GenerativeReturn, - GenerativeGroupByReturn, CrossReferences, - _Generative, + GenerativeGroupByReturn, + GenerativeReturn, + GenerativeSearchReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, - _GroupBy, + _Generative, _GenerativeConfigRuntime, - _SinglePrompt, + _GroupBy, _GroupedTask, + _QueryOptions, + _SinglePrompt, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.exceptions import WeaviateUnsupportedFeatureError from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import NUMBER, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, NUMBER from weaviate.connect.v4 import ConnectionAsync from .executor import _HybridGenerateExecutor diff --git a/weaviate/collections/queries/hybrid/generate/executor.py b/weaviate/collections/queries/hybrid/generate/executor.py index 7136894ea..9496534bf 100644 --- a/weaviate/collections/queries/hybrid/generate/executor.py +++ b/weaviate/collections/queries/hybrid/generate/executor.py @@ -5,35 +5,40 @@ ) from weaviate.collections.classes.grpc import ( METADATA, + PROPERTIES, + REFERENCES, GroupBy, HybridFusion, - Rerank, HybridVectorType, + Rerank, TargetVectorJoinType, - PROPERTIES, - REFERENCES, ) from weaviate.collections.classes.internal import ( - GenerativeSearchReturnType, - GenerativeReturn, - GenerativeGroupByReturn, CrossReferences, - _Generative, + GenerativeGroupByReturn, + GenerativeReturn, + GenerativeSearchReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, - _GroupBy, + _Generative, _GenerativeConfigRuntime, - _SinglePrompt, + _GroupBy, _GroupedTask, + _QueryOptions, + _SinglePrompt, +) +from weaviate.collections.classes.types import ( + Properties, + References, + TProperties, + TReferences, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.exceptions import WeaviateUnsupportedFeatureError from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import NUMBER, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, NUMBER class _HybridGenerateExecutor( diff --git a/weaviate/collections/queries/hybrid/generate/sync.py b/weaviate/collections/queries/hybrid/generate/sync.py index 25d8831ce..efe22c890 100644 --- a/weaviate/collections/queries/hybrid/generate/sync.py +++ b/weaviate/collections/queries/hybrid/generate/sync.py @@ -1,8 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References -from weaviate.collections.queries.hybrid.generate.executor import _HybridGenerateExecutor +from weaviate.collections.queries.hybrid.generate.executor import ( + _HybridGenerateExecutor, +) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/queries/hybrid/generate/sync.pyi b/weaviate/collections/queries/hybrid/generate/sync.pyi index 762041a56..c3efc1281 100644 --- a/weaviate/collections/queries/hybrid/generate/sync.pyi +++ b/weaviate/collections/queries/hybrid/generate/sync.pyi @@ -2,35 +2,35 @@ from typing import Any, Generic, List, Literal, Optional, Type, Union, cast, ove from weaviate.collections.classes.filters import _Filters from weaviate.collections.classes.grpc import ( METADATA, + PROPERTIES, + REFERENCES, GroupBy, HybridFusion, - Rerank, HybridVectorType, + Rerank, TargetVectorJoinType, - PROPERTIES, - REFERENCES, ) from weaviate.collections.classes.internal import ( - GenerativeSearchReturnType, - GenerativeReturn, - GenerativeGroupByReturn, CrossReferences, - _Generative, + GenerativeGroupByReturn, + GenerativeReturn, + GenerativeSearchReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, - _GroupBy, + _Generative, _GenerativeConfigRuntime, - _SinglePrompt, + _GroupBy, _GroupedTask, + _QueryOptions, + _SinglePrompt, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.exceptions import WeaviateUnsupportedFeatureError from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import NUMBER, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, NUMBER from weaviate.connect.v4 import ConnectionSync from .executor import _HybridGenerateExecutor diff --git a/weaviate/collections/queries/hybrid/query/async_.py b/weaviate/collections/queries/hybrid/query/async_.py index ad398b3f9..cc3636936 100644 --- a/weaviate/collections/queries/hybrid/query/async_.py +++ b/weaviate/collections/queries/hybrid/query/async_.py @@ -1,8 +1,8 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References from weaviate.collections.queries.hybrid.query.executor import _HybridQueryExecutor +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/queries/hybrid/query/async_.pyi b/weaviate/collections/queries/hybrid/query/async_.pyi index a6dbf267a..6991956ab 100644 --- a/weaviate/collections/queries/hybrid/query/async_.pyi +++ b/weaviate/collections/queries/hybrid/query/async_.pyi @@ -6,27 +6,27 @@ from weaviate.collections.classes.grpc import ( REFERENCES, GroupBy, HybridFusion, - Rerank, HybridVectorType, + Rerank, TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - QuerySearchReturnType, - QueryReturn, - GroupByReturn, CrossReferences, + GroupByReturn, + QueryReturn, + QuerySearchReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, _GroupBy, + _QueryOptions, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.exceptions import WeaviateUnsupportedFeatureError from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import NUMBER, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, NUMBER from weaviate.connect.v4 import ConnectionAsync from .executor import _HybridQueryExecutor diff --git a/weaviate/collections/queries/hybrid/query/executor.py b/weaviate/collections/queries/hybrid/query/executor.py index b44b242e2..a181c83fc 100644 --- a/weaviate/collections/queries/hybrid/query/executor.py +++ b/weaviate/collections/queries/hybrid/query/executor.py @@ -9,27 +9,32 @@ REFERENCES, GroupBy, HybridFusion, - Rerank, HybridVectorType, + Rerank, TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - QuerySearchReturnType, - QueryReturn, - GroupByReturn, CrossReferences, + GroupByReturn, + QueryReturn, + QuerySearchReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, _GroupBy, + _QueryOptions, +) +from weaviate.collections.classes.types import ( + Properties, + References, + TProperties, + TReferences, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.exceptions import WeaviateUnsupportedFeatureError from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import NUMBER, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, NUMBER class _HybridQueryExecutor( diff --git a/weaviate/collections/queries/hybrid/query/sync.py b/weaviate/collections/queries/hybrid/query/sync.py index 00a7eb448..f3378f76c 100644 --- a/weaviate/collections/queries/hybrid/query/sync.py +++ b/weaviate/collections/queries/hybrid/query/sync.py @@ -1,8 +1,8 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References from weaviate.collections.queries.hybrid.query.executor import _HybridQueryExecutor +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/queries/hybrid/query/sync.pyi b/weaviate/collections/queries/hybrid/query/sync.pyi index ba330d802..69e9c5f3d 100644 --- a/weaviate/collections/queries/hybrid/query/sync.pyi +++ b/weaviate/collections/queries/hybrid/query/sync.pyi @@ -6,27 +6,27 @@ from weaviate.collections.classes.grpc import ( REFERENCES, GroupBy, HybridFusion, - Rerank, HybridVectorType, + Rerank, TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - QuerySearchReturnType, - QueryReturn, - GroupByReturn, CrossReferences, + GroupByReturn, + QueryReturn, + QuerySearchReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, _GroupBy, + _QueryOptions, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.exceptions import WeaviateUnsupportedFeatureError from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import NUMBER, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, NUMBER from weaviate.connect.v4 import ConnectionSync from .executor import _HybridQueryExecutor diff --git a/weaviate/collections/queries/near_image/__init__.py b/weaviate/collections/queries/near_image/__init__.py index fb6cce717..905ee9e49 100644 --- a/weaviate/collections/queries/near_image/__init__.py +++ b/weaviate/collections/queries/near_image/__init__.py @@ -1,6 +1,5 @@ -from .generate import _NearImageGenerateAsync, _NearImageGenerate -from .query import _NearImageQueryAsync, _NearImageQuery - +from .generate import _NearImageGenerate, _NearImageGenerateAsync +from .query import _NearImageQuery, _NearImageQueryAsync __all__ = [ "_NearImageGenerate", diff --git a/weaviate/collections/queries/near_image/generate/async_.py b/weaviate/collections/queries/near_image/generate/async_.py index 3f4a93e64..a1bdc71f2 100644 --- a/weaviate/collections/queries/near_image/generate/async_.py +++ b/weaviate/collections/queries/near_image/generate/async_.py @@ -1,8 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References -from weaviate.collections.queries.near_image.generate.executor import _NearImageGenerateExecutor +from weaviate.collections.queries.near_image.generate.executor import ( + _NearImageGenerateExecutor, +) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/queries/near_image/generate/async_.pyi b/weaviate/collections/queries/near_image/generate/async_.pyi index 9b2516060..978a31ad4 100644 --- a/weaviate/collections/queries/near_image/generate/async_.pyi +++ b/weaviate/collections/queries/near_image/generate/async_.pyi @@ -5,30 +5,30 @@ from weaviate.collections.classes.grpc import ( PROPERTIES, REFERENCES, GroupBy, - Rerank, NearMediaType, + Rerank, TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - _Generative, - _GroupBy, - GenerativeSearchReturnType, - GenerativeReturn, - GenerativeGroupByReturn, CrossReferences, + GenerativeGroupByReturn, + GenerativeReturn, + GenerativeSearchReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, + _Generative, _GenerativeConfigRuntime, - _SinglePrompt, + _GroupBy, _GroupedTask, + _QueryOptions, + _SinglePrompt, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import BLOB_INPUT, NUMBER, INCLUDE_VECTOR +from weaviate.types import BLOB_INPUT, INCLUDE_VECTOR, NUMBER from weaviate.util import parse_blob from weaviate.connect.v4 import ConnectionAsync from .executor import _NearImageGenerateExecutor diff --git a/weaviate/collections/queries/near_image/generate/executor.py b/weaviate/collections/queries/near_image/generate/executor.py index 890be77fa..ff5acef08 100644 --- a/weaviate/collections/queries/near_image/generate/executor.py +++ b/weaviate/collections/queries/near_image/generate/executor.py @@ -8,30 +8,35 @@ PROPERTIES, REFERENCES, GroupBy, - Rerank, NearMediaType, + Rerank, TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - _Generative, - _GroupBy, - GenerativeSearchReturnType, - GenerativeReturn, - GenerativeGroupByReturn, CrossReferences, + GenerativeGroupByReturn, + GenerativeReturn, + GenerativeSearchReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, + _Generative, _GenerativeConfigRuntime, - _SinglePrompt, + _GroupBy, _GroupedTask, + _QueryOptions, + _SinglePrompt, +) +from weaviate.collections.classes.types import ( + Properties, + References, + TProperties, + TReferences, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import BLOB_INPUT, NUMBER, INCLUDE_VECTOR +from weaviate.types import BLOB_INPUT, INCLUDE_VECTOR, NUMBER from weaviate.util import parse_blob diff --git a/weaviate/collections/queries/near_image/generate/sync.py b/weaviate/collections/queries/near_image/generate/sync.py index ea2751ff9..e8439227b 100644 --- a/weaviate/collections/queries/near_image/generate/sync.py +++ b/weaviate/collections/queries/near_image/generate/sync.py @@ -1,8 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References -from weaviate.collections.queries.near_image.generate.executor import _NearImageGenerateExecutor +from weaviate.collections.queries.near_image.generate.executor import ( + _NearImageGenerateExecutor, +) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/queries/near_image/generate/sync.pyi b/weaviate/collections/queries/near_image/generate/sync.pyi index 52891a12d..132847778 100644 --- a/weaviate/collections/queries/near_image/generate/sync.pyi +++ b/weaviate/collections/queries/near_image/generate/sync.pyi @@ -5,30 +5,30 @@ from weaviate.collections.classes.grpc import ( PROPERTIES, REFERENCES, GroupBy, - Rerank, NearMediaType, + Rerank, TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - _Generative, - _GroupBy, - GenerativeSearchReturnType, - GenerativeReturn, - GenerativeGroupByReturn, CrossReferences, + GenerativeGroupByReturn, + GenerativeReturn, + GenerativeSearchReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, + _Generative, _GenerativeConfigRuntime, - _SinglePrompt, + _GroupBy, _GroupedTask, + _QueryOptions, + _SinglePrompt, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import BLOB_INPUT, NUMBER, INCLUDE_VECTOR +from weaviate.types import BLOB_INPUT, INCLUDE_VECTOR, NUMBER from weaviate.util import parse_blob from weaviate.connect.v4 import ConnectionSync from .executor import _NearImageGenerateExecutor diff --git a/weaviate/collections/queries/near_image/query/async_.py b/weaviate/collections/queries/near_image/query/async_.py index 6c7855d79..eba4f199b 100644 --- a/weaviate/collections/queries/near_image/query/async_.py +++ b/weaviate/collections/queries/near_image/query/async_.py @@ -1,8 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References -from weaviate.collections.queries.near_image.query.executor import _NearImageQueryExecutor +from weaviate.collections.queries.near_image.query.executor import ( + _NearImageQueryExecutor, +) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/queries/near_image/query/async_.pyi b/weaviate/collections/queries/near_image/query/async_.pyi index 6ad8a2ec9..8e691f4df 100644 --- a/weaviate/collections/queries/near_image/query/async_.pyi +++ b/weaviate/collections/queries/near_image/query/async_.pyi @@ -5,26 +5,26 @@ from weaviate.collections.classes.grpc import ( PROPERTIES, REFERENCES, GroupBy, - Rerank, NearMediaType, + Rerank, TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - _GroupBy, - QueryReturn, - GroupByReturn, CrossReferences, + GroupByReturn, + QueryReturn, QuerySearchReturnType, ReturnProperties, ReturnReferences, + _GroupBy, _QueryOptions, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import BLOB_INPUT, NUMBER, INCLUDE_VECTOR +from weaviate.types import BLOB_INPUT, INCLUDE_VECTOR, NUMBER from weaviate.util import parse_blob from weaviate.connect.v4 import ConnectionAsync from .executor import _NearImageQueryExecutor diff --git a/weaviate/collections/queries/near_image/query/executor.py b/weaviate/collections/queries/near_image/query/executor.py index ca0a4b9d6..288be4538 100644 --- a/weaviate/collections/queries/near_image/query/executor.py +++ b/weaviate/collections/queries/near_image/query/executor.py @@ -8,26 +8,31 @@ PROPERTIES, REFERENCES, GroupBy, - Rerank, NearMediaType, + Rerank, TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - _GroupBy, - QueryReturn, - GroupByReturn, CrossReferences, + GroupByReturn, + QueryReturn, QuerySearchReturnType, ReturnProperties, ReturnReferences, + _GroupBy, _QueryOptions, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import ( + Properties, + References, + TProperties, + TReferences, +) from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import BLOB_INPUT, NUMBER, INCLUDE_VECTOR +from weaviate.types import BLOB_INPUT, INCLUDE_VECTOR, NUMBER from weaviate.util import parse_blob diff --git a/weaviate/collections/queries/near_image/query/sync.py b/weaviate/collections/queries/near_image/query/sync.py index 729a9148f..0ee278b3a 100644 --- a/weaviate/collections/queries/near_image/query/sync.py +++ b/weaviate/collections/queries/near_image/query/sync.py @@ -1,8 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References -from weaviate.collections.queries.near_image.query.executor import _NearImageQueryExecutor +from weaviate.collections.queries.near_image.query.executor import ( + _NearImageQueryExecutor, +) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/queries/near_image/query/sync.pyi b/weaviate/collections/queries/near_image/query/sync.pyi index a73e7fdaf..9d4f160f2 100644 --- a/weaviate/collections/queries/near_image/query/sync.pyi +++ b/weaviate/collections/queries/near_image/query/sync.pyi @@ -5,26 +5,26 @@ from weaviate.collections.classes.grpc import ( PROPERTIES, REFERENCES, GroupBy, - Rerank, NearMediaType, + Rerank, TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - _GroupBy, - QueryReturn, - GroupByReturn, CrossReferences, + GroupByReturn, + QueryReturn, QuerySearchReturnType, ReturnProperties, ReturnReferences, + _GroupBy, _QueryOptions, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import BLOB_INPUT, NUMBER, INCLUDE_VECTOR +from weaviate.types import BLOB_INPUT, INCLUDE_VECTOR, NUMBER from weaviate.util import parse_blob from weaviate.connect.v4 import ConnectionSync from .executor import _NearImageQueryExecutor diff --git a/weaviate/collections/queries/near_media/__init__.py b/weaviate/collections/queries/near_media/__init__.py index 6bbd5a6ad..1e2cde7ba 100644 --- a/weaviate/collections/queries/near_media/__init__.py +++ b/weaviate/collections/queries/near_media/__init__.py @@ -1,5 +1,5 @@ -from .generate import _NearMediaGenerateAsync, _NearMediaGenerate -from .query import _NearMediaQueryAsync, _NearMediaQuery +from .generate import _NearMediaGenerate, _NearMediaGenerateAsync +from .query import _NearMediaQuery, _NearMediaQueryAsync __all__ = [ "_NearMediaGenerate", diff --git a/weaviate/collections/queries/near_media/generate/async_.py b/weaviate/collections/queries/near_media/generate/async_.py index fd3911199..215940fbb 100644 --- a/weaviate/collections/queries/near_media/generate/async_.py +++ b/weaviate/collections/queries/near_media/generate/async_.py @@ -1,8 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References -from weaviate.collections.queries.near_media.generate.executor import _NearMediaGenerateExecutor +from weaviate.collections.queries.near_media.generate.executor import ( + _NearMediaGenerateExecutor, +) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/queries/near_media/generate/async_.pyi b/weaviate/collections/queries/near_media/generate/async_.pyi index f596e4e2d..6821b4b94 100644 --- a/weaviate/collections/queries/near_media/generate/async_.pyi +++ b/weaviate/collections/queries/near_media/generate/async_.pyi @@ -5,30 +5,30 @@ from weaviate.collections.classes.grpc import ( PROPERTIES, REFERENCES, GroupBy, - Rerank, NearMediaType, + Rerank, TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - _Generative, - _GroupBy, - GenerativeSearchReturnType, - GenerativeReturn, - GenerativeGroupByReturn, CrossReferences, + GenerativeGroupByReturn, + GenerativeReturn, + GenerativeSearchReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, + _Generative, _GenerativeConfigRuntime, - _SinglePrompt, + _GroupBy, _GroupedTask, + _QueryOptions, + _SinglePrompt, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import BLOB_INPUT, NUMBER, INCLUDE_VECTOR +from weaviate.types import BLOB_INPUT, INCLUDE_VECTOR, NUMBER from weaviate.util import parse_blob from weaviate.connect.v4 import ConnectionAsync from .executor import _NearMediaGenerateExecutor diff --git a/weaviate/collections/queries/near_media/generate/executor.py b/weaviate/collections/queries/near_media/generate/executor.py index aa29f6390..f6f2925c5 100644 --- a/weaviate/collections/queries/near_media/generate/executor.py +++ b/weaviate/collections/queries/near_media/generate/executor.py @@ -8,30 +8,35 @@ PROPERTIES, REFERENCES, GroupBy, - Rerank, NearMediaType, + Rerank, TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - _Generative, - _GroupBy, - GenerativeSearchReturnType, - GenerativeReturn, - GenerativeGroupByReturn, CrossReferences, + GenerativeGroupByReturn, + GenerativeReturn, + GenerativeSearchReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, + _Generative, _GenerativeConfigRuntime, - _SinglePrompt, + _GroupBy, _GroupedTask, + _QueryOptions, + _SinglePrompt, +) +from weaviate.collections.classes.types import ( + Properties, + References, + TProperties, + TReferences, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import BLOB_INPUT, NUMBER, INCLUDE_VECTOR +from weaviate.types import BLOB_INPUT, INCLUDE_VECTOR, NUMBER from weaviate.util import parse_blob diff --git a/weaviate/collections/queries/near_media/generate/sync.py b/weaviate/collections/queries/near_media/generate/sync.py index 3dcdb5131..b6348f66c 100644 --- a/weaviate/collections/queries/near_media/generate/sync.py +++ b/weaviate/collections/queries/near_media/generate/sync.py @@ -1,8 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References -from weaviate.collections.queries.near_media.generate.executor import _NearMediaGenerateExecutor +from weaviate.collections.queries.near_media.generate.executor import ( + _NearMediaGenerateExecutor, +) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/queries/near_media/generate/sync.pyi b/weaviate/collections/queries/near_media/generate/sync.pyi index 302dccd76..2ec00faa1 100644 --- a/weaviate/collections/queries/near_media/generate/sync.pyi +++ b/weaviate/collections/queries/near_media/generate/sync.pyi @@ -5,30 +5,30 @@ from weaviate.collections.classes.grpc import ( PROPERTIES, REFERENCES, GroupBy, - Rerank, NearMediaType, + Rerank, TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - _Generative, - _GroupBy, - GenerativeSearchReturnType, - GenerativeReturn, - GenerativeGroupByReturn, CrossReferences, + GenerativeGroupByReturn, + GenerativeReturn, + GenerativeSearchReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, + _Generative, _GenerativeConfigRuntime, - _SinglePrompt, + _GroupBy, _GroupedTask, + _QueryOptions, + _SinglePrompt, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import BLOB_INPUT, NUMBER, INCLUDE_VECTOR +from weaviate.types import BLOB_INPUT, INCLUDE_VECTOR, NUMBER from weaviate.util import parse_blob from weaviate.connect.v4 import ConnectionSync from .executor import _NearMediaGenerateExecutor diff --git a/weaviate/collections/queries/near_media/query/async_.py b/weaviate/collections/queries/near_media/query/async_.py index 014468dcc..444273958 100644 --- a/weaviate/collections/queries/near_media/query/async_.py +++ b/weaviate/collections/queries/near_media/query/async_.py @@ -1,8 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References -from weaviate.collections.queries.near_media.query.executor import _NearMediaQueryExecutor +from weaviate.collections.queries.near_media.query.executor import ( + _NearMediaQueryExecutor, +) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/queries/near_media/query/async_.pyi b/weaviate/collections/queries/near_media/query/async_.pyi index d56cbff3d..ada2f099f 100644 --- a/weaviate/collections/queries/near_media/query/async_.pyi +++ b/weaviate/collections/queries/near_media/query/async_.pyi @@ -5,26 +5,26 @@ from weaviate.collections.classes.grpc import ( PROPERTIES, REFERENCES, GroupBy, - Rerank, NearMediaType, + Rerank, TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - _GroupBy, - QueryReturn, - GroupByReturn, CrossReferences, + GroupByReturn, + QueryReturn, QuerySearchReturnType, ReturnProperties, ReturnReferences, + _GroupBy, _QueryOptions, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import BLOB_INPUT, NUMBER, INCLUDE_VECTOR +from weaviate.types import BLOB_INPUT, INCLUDE_VECTOR, NUMBER from weaviate.util import parse_blob from weaviate.connect.v4 import ConnectionAsync from .executor import _NearMediaQueryExecutor diff --git a/weaviate/collections/queries/near_media/query/executor.py b/weaviate/collections/queries/near_media/query/executor.py index cbc39c42d..15092e835 100644 --- a/weaviate/collections/queries/near_media/query/executor.py +++ b/weaviate/collections/queries/near_media/query/executor.py @@ -8,26 +8,31 @@ PROPERTIES, REFERENCES, GroupBy, - Rerank, NearMediaType, + Rerank, TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - _GroupBy, - QueryReturn, - GroupByReturn, CrossReferences, + GroupByReturn, + QueryReturn, QuerySearchReturnType, ReturnProperties, ReturnReferences, + _GroupBy, _QueryOptions, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import ( + Properties, + References, + TProperties, + TReferences, +) from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import BLOB_INPUT, NUMBER, INCLUDE_VECTOR +from weaviate.types import BLOB_INPUT, INCLUDE_VECTOR, NUMBER from weaviate.util import parse_blob diff --git a/weaviate/collections/queries/near_media/query/sync.py b/weaviate/collections/queries/near_media/query/sync.py index 36627956e..d0d5066b6 100644 --- a/weaviate/collections/queries/near_media/query/sync.py +++ b/weaviate/collections/queries/near_media/query/sync.py @@ -1,8 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References -from weaviate.collections.queries.near_media.query.executor import _NearMediaQueryExecutor +from weaviate.collections.queries.near_media.query.executor import ( + _NearMediaQueryExecutor, +) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/queries/near_media/query/sync.pyi b/weaviate/collections/queries/near_media/query/sync.pyi index fc56fbf9b..a84fa7be2 100644 --- a/weaviate/collections/queries/near_media/query/sync.pyi +++ b/weaviate/collections/queries/near_media/query/sync.pyi @@ -5,26 +5,26 @@ from weaviate.collections.classes.grpc import ( PROPERTIES, REFERENCES, GroupBy, - Rerank, NearMediaType, + Rerank, TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - _GroupBy, - QueryReturn, - GroupByReturn, CrossReferences, + GroupByReturn, + QueryReturn, QuerySearchReturnType, ReturnProperties, ReturnReferences, + _GroupBy, _QueryOptions, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import BLOB_INPUT, NUMBER, INCLUDE_VECTOR +from weaviate.types import BLOB_INPUT, INCLUDE_VECTOR, NUMBER from weaviate.util import parse_blob from weaviate.connect.v4 import ConnectionSync from .executor import _NearMediaQueryExecutor diff --git a/weaviate/collections/queries/near_object/__init__.py b/weaviate/collections/queries/near_object/__init__.py index 7836a72e0..96c249cb9 100644 --- a/weaviate/collections/queries/near_object/__init__.py +++ b/weaviate/collections/queries/near_object/__init__.py @@ -1,5 +1,5 @@ -from .generate import _NearObjectGenerateAsync, _NearObjectGenerate -from .query import _NearObjectQueryAsync, _NearObjectQuery +from .generate import _NearObjectGenerate, _NearObjectGenerateAsync +from .query import _NearObjectQuery, _NearObjectQueryAsync __all__ = [ "_NearObjectGenerate", diff --git a/weaviate/collections/queries/near_object/generate/async_.py b/weaviate/collections/queries/near_object/generate/async_.py index 2fb4e7818..d8521bc36 100644 --- a/weaviate/collections/queries/near_object/generate/async_.py +++ b/weaviate/collections/queries/near_object/generate/async_.py @@ -1,8 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References -from weaviate.collections.queries.near_object.generate.executor import _NearObjectGenerateExecutor +from weaviate.collections.queries.near_object.generate.executor import ( + _NearObjectGenerateExecutor, +) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/queries/near_object/generate/async_.pyi b/weaviate/collections/queries/near_object/generate/async_.pyi index 99c868c3c..71d8b5a47 100644 --- a/weaviate/collections/queries/near_object/generate/async_.pyi +++ b/weaviate/collections/queries/near_object/generate/async_.pyi @@ -9,25 +9,25 @@ from weaviate.collections.classes.grpc import ( TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - _Generative, - _GroupBy, - GenerativeSearchReturnType, - GenerativeReturn, - GenerativeGroupByReturn, CrossReferences, + GenerativeGroupByReturn, + GenerativeReturn, + GenerativeSearchReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, + _Generative, _GenerativeConfigRuntime, - _SinglePrompt, + _GroupBy, _GroupedTask, + _QueryOptions, + _SinglePrompt, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import NUMBER, INCLUDE_VECTOR, UUID +from weaviate.types import INCLUDE_VECTOR, NUMBER, UUID from weaviate.connect.v4 import ConnectionAsync from .executor import _NearObjectGenerateExecutor diff --git a/weaviate/collections/queries/near_object/generate/executor.py b/weaviate/collections/queries/near_object/generate/executor.py index dd2928e3c..b80c82725 100644 --- a/weaviate/collections/queries/near_object/generate/executor.py +++ b/weaviate/collections/queries/near_object/generate/executor.py @@ -12,25 +12,30 @@ TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - _Generative, - _GroupBy, - GenerativeSearchReturnType, - GenerativeReturn, - GenerativeGroupByReturn, CrossReferences, + GenerativeGroupByReturn, + GenerativeReturn, + GenerativeSearchReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, + _Generative, _GenerativeConfigRuntime, - _SinglePrompt, + _GroupBy, _GroupedTask, + _QueryOptions, + _SinglePrompt, +) +from weaviate.collections.classes.types import ( + Properties, + References, + TProperties, + TReferences, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import NUMBER, INCLUDE_VECTOR, UUID +from weaviate.types import INCLUDE_VECTOR, NUMBER, UUID class _NearObjectGenerateExecutor( diff --git a/weaviate/collections/queries/near_object/generate/sync.py b/weaviate/collections/queries/near_object/generate/sync.py index a0041f583..5edc5121f 100644 --- a/weaviate/collections/queries/near_object/generate/sync.py +++ b/weaviate/collections/queries/near_object/generate/sync.py @@ -1,8 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References -from weaviate.collections.queries.near_object.generate.executor import _NearObjectGenerateExecutor +from weaviate.collections.queries.near_object.generate.executor import ( + _NearObjectGenerateExecutor, +) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/queries/near_object/generate/sync.pyi b/weaviate/collections/queries/near_object/generate/sync.pyi index 37fb8c2ba..73c44ca6d 100644 --- a/weaviate/collections/queries/near_object/generate/sync.pyi +++ b/weaviate/collections/queries/near_object/generate/sync.pyi @@ -9,25 +9,25 @@ from weaviate.collections.classes.grpc import ( TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - _Generative, - _GroupBy, - GenerativeSearchReturnType, - GenerativeReturn, - GenerativeGroupByReturn, CrossReferences, + GenerativeGroupByReturn, + GenerativeReturn, + GenerativeSearchReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, + _Generative, _GenerativeConfigRuntime, - _SinglePrompt, + _GroupBy, _GroupedTask, + _QueryOptions, + _SinglePrompt, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import NUMBER, INCLUDE_VECTOR, UUID +from weaviate.types import INCLUDE_VECTOR, NUMBER, UUID from weaviate.connect.v4 import ConnectionSync from .executor import _NearObjectGenerateExecutor diff --git a/weaviate/collections/queries/near_object/query/async_.py b/weaviate/collections/queries/near_object/query/async_.py index 1ca83c567..1f4fe79ee 100644 --- a/weaviate/collections/queries/near_object/query/async_.py +++ b/weaviate/collections/queries/near_object/query/async_.py @@ -1,8 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References -from weaviate.collections.queries.near_object.query.executor import _NearObjectQueryExecutor +from weaviate.collections.queries.near_object.query.executor import ( + _NearObjectQueryExecutor, +) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/queries/near_object/query/async_.pyi b/weaviate/collections/queries/near_object/query/async_.pyi index 31ac81b39..af8749d67 100644 --- a/weaviate/collections/queries/near_object/query/async_.pyi +++ b/weaviate/collections/queries/near_object/query/async_.pyi @@ -9,22 +9,22 @@ from weaviate.collections.classes.grpc import ( TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - _GroupBy, - QuerySearchReturnType, + CrossReferences, + GroupByReturn, QueryNearMediaReturnType, QueryReturn, - GroupByReturn, - CrossReferences, + QuerySearchReturnType, ReturnProperties, ReturnReferences, + _GroupBy, _QueryOptions, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import NUMBER, INCLUDE_VECTOR, UUID +from weaviate.types import INCLUDE_VECTOR, NUMBER, UUID from weaviate.connect.v4 import ConnectionAsync from .executor import _NearObjectQueryExecutor diff --git a/weaviate/collections/queries/near_object/query/executor.py b/weaviate/collections/queries/near_object/query/executor.py index b69e1178c..e6163957c 100644 --- a/weaviate/collections/queries/near_object/query/executor.py +++ b/weaviate/collections/queries/near_object/query/executor.py @@ -12,22 +12,27 @@ TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - _GroupBy, - QuerySearchReturnType, + CrossReferences, + GroupByReturn, QueryNearMediaReturnType, QueryReturn, - GroupByReturn, - CrossReferences, + QuerySearchReturnType, ReturnProperties, ReturnReferences, + _GroupBy, _QueryOptions, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import ( + Properties, + References, + TProperties, + TReferences, +) from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import NUMBER, INCLUDE_VECTOR, UUID +from weaviate.types import INCLUDE_VECTOR, NUMBER, UUID class _NearObjectQueryExecutor( diff --git a/weaviate/collections/queries/near_object/query/sync.py b/weaviate/collections/queries/near_object/query/sync.py index 7ddf203fc..ed60d9f38 100644 --- a/weaviate/collections/queries/near_object/query/sync.py +++ b/weaviate/collections/queries/near_object/query/sync.py @@ -1,8 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References -from weaviate.collections.queries.near_object.query.executor import _NearObjectQueryExecutor +from weaviate.collections.queries.near_object.query.executor import ( + _NearObjectQueryExecutor, +) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/queries/near_object/query/sync.pyi b/weaviate/collections/queries/near_object/query/sync.pyi index 9d315f90e..399a904b7 100644 --- a/weaviate/collections/queries/near_object/query/sync.pyi +++ b/weaviate/collections/queries/near_object/query/sync.pyi @@ -9,22 +9,22 @@ from weaviate.collections.classes.grpc import ( TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - _GroupBy, - QuerySearchReturnType, + CrossReferences, + GroupByReturn, QueryNearMediaReturnType, QueryReturn, - GroupByReturn, - CrossReferences, + QuerySearchReturnType, ReturnProperties, ReturnReferences, + _GroupBy, _QueryOptions, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import NUMBER, INCLUDE_VECTOR, UUID +from weaviate.types import INCLUDE_VECTOR, NUMBER, UUID from weaviate.connect.v4 import ConnectionSync from .executor import _NearObjectQueryExecutor diff --git a/weaviate/collections/queries/near_text/__init__.py b/weaviate/collections/queries/near_text/__init__.py index 7373bdf79..d614457c6 100644 --- a/weaviate/collections/queries/near_text/__init__.py +++ b/weaviate/collections/queries/near_text/__init__.py @@ -1,5 +1,5 @@ -from .generate import _NearTextGenerateAsync, _NearTextGenerate -from .query import _NearTextQueryAsync, _NearTextQuery +from .generate import _NearTextGenerate, _NearTextGenerateAsync +from .query import _NearTextQuery, _NearTextQueryAsync __all__ = [ "_NearTextGenerate", diff --git a/weaviate/collections/queries/near_text/generate/async_.py b/weaviate/collections/queries/near_text/generate/async_.py index ba7c06494..06fdb8832 100644 --- a/weaviate/collections/queries/near_text/generate/async_.py +++ b/weaviate/collections/queries/near_text/generate/async_.py @@ -1,8 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References -from weaviate.collections.queries.near_text.generate.executor import _NearTextGenerateExecutor +from weaviate.collections.queries.near_text.generate.executor import ( + _NearTextGenerateExecutor, +) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/queries/near_text/generate/async_.pyi b/weaviate/collections/queries/near_text/generate/async_.pyi index d2120c4da..365f40a82 100644 --- a/weaviate/collections/queries/near_text/generate/async_.pyi +++ b/weaviate/collections/queries/near_text/generate/async_.pyi @@ -10,25 +10,25 @@ from weaviate.collections.classes.grpc import ( TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - _Generative, - _GroupBy, - GenerativeSearchReturnType, - GenerativeReturn, + CrossReferences, GenerativeGroupByReturn, + GenerativeReturn, + GenerativeSearchReturnType, ReturnProperties, ReturnReferences, - CrossReferences, - _QueryOptions, + _Generative, _GenerativeConfigRuntime, - _SinglePrompt, + _GroupBy, _GroupedTask, + _QueryOptions, + _SinglePrompt, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import NUMBER, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, NUMBER from weaviate.connect.v4 import ConnectionAsync from .executor import _NearTextGenerateExecutor diff --git a/weaviate/collections/queries/near_text/generate/executor.py b/weaviate/collections/queries/near_text/generate/executor.py index 4b09e0955..e3b52079c 100644 --- a/weaviate/collections/queries/near_text/generate/executor.py +++ b/weaviate/collections/queries/near_text/generate/executor.py @@ -13,25 +13,30 @@ TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - _Generative, - _GroupBy, - GenerativeSearchReturnType, - GenerativeReturn, + CrossReferences, GenerativeGroupByReturn, + GenerativeReturn, + GenerativeSearchReturnType, ReturnProperties, ReturnReferences, - CrossReferences, - _QueryOptions, + _Generative, _GenerativeConfigRuntime, - _SinglePrompt, + _GroupBy, _GroupedTask, + _QueryOptions, + _SinglePrompt, +) +from weaviate.collections.classes.types import ( + Properties, + References, + TProperties, + TReferences, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import NUMBER, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, NUMBER class _NearTextGenerateExecutor( diff --git a/weaviate/collections/queries/near_text/generate/sync.py b/weaviate/collections/queries/near_text/generate/sync.py index 741453cbd..9471f8de3 100644 --- a/weaviate/collections/queries/near_text/generate/sync.py +++ b/weaviate/collections/queries/near_text/generate/sync.py @@ -1,8 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References -from weaviate.collections.queries.near_text.generate.executor import _NearTextGenerateExecutor +from weaviate.collections.queries.near_text.generate.executor import ( + _NearTextGenerateExecutor, +) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/queries/near_text/generate/sync.pyi b/weaviate/collections/queries/near_text/generate/sync.pyi index 60dd7fe2c..7219a2ded 100644 --- a/weaviate/collections/queries/near_text/generate/sync.pyi +++ b/weaviate/collections/queries/near_text/generate/sync.pyi @@ -10,25 +10,25 @@ from weaviate.collections.classes.grpc import ( TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - _Generative, - _GroupBy, - GenerativeSearchReturnType, - GenerativeReturn, + CrossReferences, GenerativeGroupByReturn, + GenerativeReturn, + GenerativeSearchReturnType, ReturnProperties, ReturnReferences, - CrossReferences, - _QueryOptions, + _Generative, _GenerativeConfigRuntime, - _SinglePrompt, + _GroupBy, _GroupedTask, + _QueryOptions, + _SinglePrompt, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import NUMBER, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, NUMBER from weaviate.connect.v4 import ConnectionSync from .executor import _NearTextGenerateExecutor diff --git a/weaviate/collections/queries/near_text/query/async_.py b/weaviate/collections/queries/near_text/query/async_.py index bcdafe09b..621cdaf8f 100644 --- a/weaviate/collections/queries/near_text/query/async_.py +++ b/weaviate/collections/queries/near_text/query/async_.py @@ -1,8 +1,8 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References from weaviate.collections.queries.near_text.query.executor import _NearTextQueryExecutor +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/queries/near_text/query/async_.pyi b/weaviate/collections/queries/near_text/query/async_.pyi index be6b0df70..7844a0992 100644 --- a/weaviate/collections/queries/near_text/query/async_.pyi +++ b/weaviate/collections/queries/near_text/query/async_.pyi @@ -10,21 +10,21 @@ from weaviate.collections.classes.grpc import ( TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - _GroupBy, - QueryReturn, - GroupByReturn, CrossReferences, + GroupByReturn, + QueryReturn, QuerySearchReturnType, ReturnProperties, ReturnReferences, + _GroupBy, _QueryOptions, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import NUMBER, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, NUMBER from weaviate.connect.v4 import ConnectionAsync from .executor import _NearTextQueryExecutor diff --git a/weaviate/collections/queries/near_text/query/executor.py b/weaviate/collections/queries/near_text/query/executor.py index cd2553040..fdc05e559 100644 --- a/weaviate/collections/queries/near_text/query/executor.py +++ b/weaviate/collections/queries/near_text/query/executor.py @@ -13,21 +13,26 @@ TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - _GroupBy, - QueryReturn, - GroupByReturn, CrossReferences, + GroupByReturn, + QueryReturn, QuerySearchReturnType, ReturnProperties, ReturnReferences, + _GroupBy, _QueryOptions, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import ( + Properties, + References, + TProperties, + TReferences, +) from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import NUMBER, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, NUMBER class _NearTextQueryExecutor( diff --git a/weaviate/collections/queries/near_text/query/sync.py b/weaviate/collections/queries/near_text/query/sync.py index 065909f2e..5391c53b2 100644 --- a/weaviate/collections/queries/near_text/query/sync.py +++ b/weaviate/collections/queries/near_text/query/sync.py @@ -1,8 +1,8 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References from weaviate.collections.queries.near_text.query.executor import _NearTextQueryExecutor +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/queries/near_text/query/sync.pyi b/weaviate/collections/queries/near_text/query/sync.pyi index 53fa8fc41..fd574f590 100644 --- a/weaviate/collections/queries/near_text/query/sync.pyi +++ b/weaviate/collections/queries/near_text/query/sync.pyi @@ -10,21 +10,21 @@ from weaviate.collections.classes.grpc import ( TargetVectorJoinType, ) from weaviate.collections.classes.internal import ( - _GroupBy, - QueryReturn, - GroupByReturn, CrossReferences, + GroupByReturn, + QueryReturn, QuerySearchReturnType, ReturnProperties, ReturnReferences, + _GroupBy, _QueryOptions, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import NUMBER, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, NUMBER from weaviate.connect.v4 import ConnectionSync from .executor import _NearTextQueryExecutor diff --git a/weaviate/collections/queries/near_vector/__init__.py b/weaviate/collections/queries/near_vector/__init__.py index bc7419a77..5f54a2f10 100644 --- a/weaviate/collections/queries/near_vector/__init__.py +++ b/weaviate/collections/queries/near_vector/__init__.py @@ -1,5 +1,5 @@ -from .generate import _NearVectorGenerateAsync, _NearVectorGenerate -from .query import _NearVectorQueryAsync, _NearVectorQuery +from .generate import _NearVectorGenerate, _NearVectorGenerateAsync +from .query import _NearVectorQuery, _NearVectorQueryAsync __all__ = [ "_NearVectorGenerate", diff --git a/weaviate/collections/queries/near_vector/generate/async_.py b/weaviate/collections/queries/near_vector/generate/async_.py index f977daa8d..5c2fbf4b3 100644 --- a/weaviate/collections/queries/near_vector/generate/async_.py +++ b/weaviate/collections/queries/near_vector/generate/async_.py @@ -1,8 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References -from weaviate.collections.queries.near_vector.generate.executor import _NearVectorGenerateExecutor +from weaviate.collections.queries.near_vector.generate.executor import ( + _NearVectorGenerateExecutor, +) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/queries/near_vector/generate/async_.pyi b/weaviate/collections/queries/near_vector/generate/async_.pyi index 8fc08f863..a048918c1 100644 --- a/weaviate/collections/queries/near_vector/generate/async_.pyi +++ b/weaviate/collections/queries/near_vector/generate/async_.pyi @@ -5,30 +5,30 @@ from weaviate.collections.classes.grpc import ( PROPERTIES, REFERENCES, GroupBy, + NearVectorInputType, Rerank, TargetVectorJoinType, - NearVectorInputType, ) from weaviate.collections.classes.internal import ( - _Generative, - GenerativeSearchReturnType, - GenerativeReturn, - GenerativeGroupByReturn, CrossReferences, - _GroupBy, + GenerativeGroupByReturn, + GenerativeReturn, + GenerativeSearchReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, + _Generative, _GenerativeConfigRuntime, - _SinglePrompt, + _GroupBy, _GroupedTask, + _QueryOptions, + _SinglePrompt, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import NUMBER, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, NUMBER from weaviate.connect.v4 import ConnectionAsync from .executor import _NearVectorGenerateExecutor diff --git a/weaviate/collections/queries/near_vector/generate/executor.py b/weaviate/collections/queries/near_vector/generate/executor.py index 3e89ea620..736b11edd 100644 --- a/weaviate/collections/queries/near_vector/generate/executor.py +++ b/weaviate/collections/queries/near_vector/generate/executor.py @@ -8,30 +8,35 @@ PROPERTIES, REFERENCES, GroupBy, + NearVectorInputType, Rerank, TargetVectorJoinType, - NearVectorInputType, ) from weaviate.collections.classes.internal import ( - _Generative, - GenerativeSearchReturnType, - GenerativeReturn, - GenerativeGroupByReturn, CrossReferences, - _GroupBy, + GenerativeGroupByReturn, + GenerativeReturn, + GenerativeSearchReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, + _Generative, _GenerativeConfigRuntime, - _SinglePrompt, + _GroupBy, _GroupedTask, + _QueryOptions, + _SinglePrompt, +) +from weaviate.collections.classes.types import ( + Properties, + References, + TProperties, + TReferences, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import NUMBER, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, NUMBER class _NearVectorGenerateExecutor( diff --git a/weaviate/collections/queries/near_vector/generate/sync.py b/weaviate/collections/queries/near_vector/generate/sync.py index 742d16bc6..f99a91362 100644 --- a/weaviate/collections/queries/near_vector/generate/sync.py +++ b/weaviate/collections/queries/near_vector/generate/sync.py @@ -1,8 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References -from weaviate.collections.queries.near_vector.generate.executor import _NearVectorGenerateExecutor +from weaviate.collections.queries.near_vector.generate.executor import ( + _NearVectorGenerateExecutor, +) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/queries/near_vector/generate/sync.pyi b/weaviate/collections/queries/near_vector/generate/sync.pyi index 5950aef7d..d6060c33c 100644 --- a/weaviate/collections/queries/near_vector/generate/sync.pyi +++ b/weaviate/collections/queries/near_vector/generate/sync.pyi @@ -5,30 +5,30 @@ from weaviate.collections.classes.grpc import ( PROPERTIES, REFERENCES, GroupBy, + NearVectorInputType, Rerank, TargetVectorJoinType, - NearVectorInputType, ) from weaviate.collections.classes.internal import ( - _Generative, - GenerativeSearchReturnType, - GenerativeReturn, - GenerativeGroupByReturn, CrossReferences, - _GroupBy, + GenerativeGroupByReturn, + GenerativeReturn, + GenerativeSearchReturnType, ReturnProperties, ReturnReferences, - _QueryOptions, + _Generative, _GenerativeConfigRuntime, - _SinglePrompt, + _GroupBy, _GroupedTask, + _QueryOptions, + _SinglePrompt, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import NUMBER, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, NUMBER from weaviate.connect.v4 import ConnectionSync from .executor import _NearVectorGenerateExecutor diff --git a/weaviate/collections/queries/near_vector/query/async_.py b/weaviate/collections/queries/near_vector/query/async_.py index a74bfa570..bbb4438bf 100644 --- a/weaviate/collections/queries/near_vector/query/async_.py +++ b/weaviate/collections/queries/near_vector/query/async_.py @@ -1,8 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References -from weaviate.collections.queries.near_vector.query.executor import _NearVectorQueryExecutor +from weaviate.collections.queries.near_vector.query.executor import ( + _NearVectorQueryExecutor, +) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/collections/queries/near_vector/query/async_.pyi b/weaviate/collections/queries/near_vector/query/async_.pyi index 48470c591..e104ae11a 100644 --- a/weaviate/collections/queries/near_vector/query/async_.pyi +++ b/weaviate/collections/queries/near_vector/query/async_.pyi @@ -5,26 +5,26 @@ from weaviate.collections.classes.grpc import ( PROPERTIES, REFERENCES, GroupBy, + NearVectorInputType, Rerank, TargetVectorJoinType, - NearVectorInputType, ) from weaviate.collections.classes.internal import ( - QuerySearchReturnType, - QueryReturn, - GroupByReturn, CrossReferences, - _GroupBy, + GroupByReturn, + QueryReturn, + QuerySearchReturnType, ReturnProperties, ReturnReferences, + _GroupBy, _QueryOptions, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import NUMBER, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, NUMBER from weaviate.connect.v4 import ConnectionAsync from .executor import _NearVectorQueryExecutor diff --git a/weaviate/collections/queries/near_vector/query/executor.py b/weaviate/collections/queries/near_vector/query/executor.py index 57b5e71e6..18b3cf2de 100644 --- a/weaviate/collections/queries/near_vector/query/executor.py +++ b/weaviate/collections/queries/near_vector/query/executor.py @@ -8,26 +8,31 @@ PROPERTIES, REFERENCES, GroupBy, + NearVectorInputType, Rerank, TargetVectorJoinType, - NearVectorInputType, ) from weaviate.collections.classes.internal import ( - QuerySearchReturnType, - QueryReturn, - GroupByReturn, CrossReferences, - _GroupBy, + GroupByReturn, + QueryReturn, + QuerySearchReturnType, ReturnProperties, ReturnReferences, + _GroupBy, _QueryOptions, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import ( + Properties, + References, + TProperties, + TReferences, +) from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import NUMBER, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, NUMBER class _NearVectorQueryExecutor( diff --git a/weaviate/collections/queries/near_vector/query/sync.py b/weaviate/collections/queries/near_vector/query/sync.py index e38d9883a..37a14a54b 100644 --- a/weaviate/collections/queries/near_vector/query/sync.py +++ b/weaviate/collections/queries/near_vector/query/sync.py @@ -1,8 +1,10 @@ from typing import Generic -from weaviate.connect import executor from weaviate.collections.classes.types import Properties, References -from weaviate.collections.queries.near_vector.query.executor import _NearVectorQueryExecutor +from weaviate.collections.queries.near_vector.query.executor import ( + _NearVectorQueryExecutor, +) +from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/collections/queries/near_vector/query/sync.pyi b/weaviate/collections/queries/near_vector/query/sync.pyi index 5ca902c83..8398ff45a 100644 --- a/weaviate/collections/queries/near_vector/query/sync.pyi +++ b/weaviate/collections/queries/near_vector/query/sync.pyi @@ -5,26 +5,26 @@ from weaviate.collections.classes.grpc import ( PROPERTIES, REFERENCES, GroupBy, + NearVectorInputType, Rerank, TargetVectorJoinType, - NearVectorInputType, ) from weaviate.collections.classes.internal import ( - QuerySearchReturnType, - QueryReturn, - GroupByReturn, CrossReferences, - _GroupBy, + GroupByReturn, + QueryReturn, + QuerySearchReturnType, ReturnProperties, ReturnReferences, + _GroupBy, _QueryOptions, ) -from weaviate.collections.classes.types import Properties, TProperties, References, TReferences +from weaviate.collections.classes.types import Properties, References, TProperties, TReferences from weaviate.collections.queries.base_executor import _BaseExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionType from weaviate.proto.v1.search_get_pb2 import SearchReply -from weaviate.types import NUMBER, INCLUDE_VECTOR +from weaviate.types import INCLUDE_VECTOR, NUMBER from weaviate.connect.v4 import ConnectionSync from .executor import _NearVectorQueryExecutor diff --git a/weaviate/collections/query.py b/weaviate/collections/query.py index 5e4875e09..8d5fb2e2d 100644 --- a/weaviate/collections/query.py +++ b/weaviate/collections/query.py @@ -1,23 +1,37 @@ from typing import Generic -from weaviate.collections.classes.types import TProperties, References - -from weaviate.collections.queries.bm25 import _BM25QueryAsync, _BM25Query +from weaviate.collections.classes.types import References, TProperties +from weaviate.collections.queries.bm25 import _BM25Query, _BM25QueryAsync from weaviate.collections.queries.fetch_object_by_id import ( - _FetchObjectByIDQueryAsync, _FetchObjectByIDQuery, + _FetchObjectByIDQueryAsync, +) +from weaviate.collections.queries.fetch_objects import ( + _FetchObjectsQuery, + _FetchObjectsQueryAsync, ) from weaviate.collections.queries.fetch_objects_by_ids import ( - _FetchObjectsByIDsQueryAsync, _FetchObjectsByIDsQuery, + _FetchObjectsByIDsQueryAsync, +) +from weaviate.collections.queries.hybrid import _HybridQuery, _HybridQueryAsync +from weaviate.collections.queries.near_image import ( + _NearImageQuery, + _NearImageQueryAsync, +) +from weaviate.collections.queries.near_media import ( + _NearMediaQuery, + _NearMediaQueryAsync, +) +from weaviate.collections.queries.near_object import ( + _NearObjectQuery, + _NearObjectQueryAsync, +) +from weaviate.collections.queries.near_text import _NearTextQuery, _NearTextQueryAsync +from weaviate.collections.queries.near_vector import ( + _NearVectorQuery, + _NearVectorQueryAsync, ) -from weaviate.collections.queries.fetch_objects import _FetchObjectsQueryAsync, _FetchObjectsQuery -from weaviate.collections.queries.hybrid import _HybridQueryAsync, _HybridQuery -from weaviate.collections.queries.near_image import _NearImageQueryAsync, _NearImageQuery -from weaviate.collections.queries.near_media import _NearMediaQueryAsync, _NearMediaQuery -from weaviate.collections.queries.near_object import _NearObjectQueryAsync, _NearObjectQuery -from weaviate.collections.queries.near_text import _NearTextQueryAsync, _NearTextQuery -from weaviate.collections.queries.near_vector import _NearVectorQueryAsync, _NearVectorQuery class _QueryCollectionAsync( diff --git a/weaviate/collections/tenants/async_.py b/weaviate/collections/tenants/async_.py index d442df524..70a2f3b58 100644 --- a/weaviate/collections/tenants/async_.py +++ b/weaviate/collections/tenants/async_.py @@ -1,6 +1,6 @@ +from weaviate.collections.tenants.executor import _TenantsExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync -from weaviate.collections.tenants.executor import _TenantsExecutor @executor.wrap("async") diff --git a/weaviate/collections/tenants/async_.pyi b/weaviate/collections/tenants/async_.pyi index 6fe921fbb..7f46f7307 100644 --- a/weaviate/collections/tenants/async_.pyi +++ b/weaviate/collections/tenants/async_.pyi @@ -4,21 +4,21 @@ from typing import Any, Dict, Generic, List, Optional, Sequence, Union from httpx import Response from weaviate.collections.classes.tenants import ( Tenant, - TenantCreate, - TenantUpdate, TenantActivityStatus, + TenantCreate, TenantCreateActivityStatus, - TenantUpdateActivityStatus, TenantOutput, + TenantUpdate, + TenantUpdateActivityStatus, ) from weaviate.collections.grpc.tenants import _TenantsGRPC from weaviate.collections.tenants.types import ( TenantCreateInputType, - TenantUpdateInputType, TenantOutputType, + TenantUpdateInputType, ) from weaviate.connect import executor -from weaviate.connect.v4 import _ExpectedStatusCodes, ConnectionAsync, ConnectionType +from weaviate.connect.v4 import ConnectionAsync, ConnectionType, _ExpectedStatusCodes from weaviate.exceptions import WeaviateInvalidInputError from weaviate.proto.v1 import tenants_pb2 from weaviate.validator import _validate_input, _ValidateArgument diff --git a/weaviate/collections/tenants/executor.py b/weaviate/collections/tenants/executor.py index a94ab3453..5390292eb 100644 --- a/weaviate/collections/tenants/executor.py +++ b/weaviate/collections/tenants/executor.py @@ -6,26 +6,25 @@ from weaviate.collections.classes.tenants import ( Tenant, - TenantCreate, - TenantUpdate, TenantActivityStatus, + TenantCreate, TenantCreateActivityStatus, - TenantUpdateActivityStatus, TenantOutput, + TenantUpdate, + TenantUpdateActivityStatus, ) from weaviate.collections.grpc.tenants import _TenantsGRPC from weaviate.collections.tenants.types import ( TenantCreateInputType, - TenantUpdateInputType, TenantOutputType, + TenantUpdateInputType, ) from weaviate.connect import executor -from weaviate.connect.v4 import _ExpectedStatusCodes, ConnectionAsync, ConnectionType +from weaviate.connect.v4 import ConnectionAsync, ConnectionType, _ExpectedStatusCodes from weaviate.exceptions import WeaviateInvalidInputError from weaviate.proto.v1 import tenants_pb2 from weaviate.validator import _validate_input, _ValidateArgument - UPDATE_TENANT_BATCH_SIZE = 100 diff --git a/weaviate/collections/tenants/sync.py b/weaviate/collections/tenants/sync.py index 09437a9c9..89dd393e4 100644 --- a/weaviate/collections/tenants/sync.py +++ b/weaviate/collections/tenants/sync.py @@ -1,6 +1,6 @@ +from weaviate.collections.tenants.executor import _TenantsExecutor from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync -from weaviate.collections.tenants.executor import _TenantsExecutor @executor.wrap("sync") diff --git a/weaviate/collections/tenants/sync.pyi b/weaviate/collections/tenants/sync.pyi index 9c757438d..7f0ec89c7 100644 --- a/weaviate/collections/tenants/sync.pyi +++ b/weaviate/collections/tenants/sync.pyi @@ -4,21 +4,21 @@ from typing import Any, Dict, Generic, List, Optional, Sequence, Union from httpx import Response from weaviate.collections.classes.tenants import ( Tenant, - TenantCreate, - TenantUpdate, TenantActivityStatus, + TenantCreate, TenantCreateActivityStatus, - TenantUpdateActivityStatus, TenantOutput, + TenantUpdate, + TenantUpdateActivityStatus, ) from weaviate.collections.grpc.tenants import _TenantsGRPC from weaviate.collections.tenants.types import ( TenantCreateInputType, - TenantUpdateInputType, TenantOutputType, + TenantUpdateInputType, ) from weaviate.connect import executor -from weaviate.connect.v4 import _ExpectedStatusCodes, ConnectionAsync, ConnectionType +from weaviate.connect.v4 import ConnectionAsync, ConnectionType, _ExpectedStatusCodes from weaviate.exceptions import WeaviateInvalidInputError from weaviate.proto.v1 import tenants_pb2 from weaviate.validator import _validate_input, _ValidateArgument diff --git a/weaviate/collections/tenants/types.py b/weaviate/collections/tenants/types.py index 4c51ec9c1..75f5bfc53 100644 --- a/weaviate/collections/tenants/types.py +++ b/weaviate/collections/tenants/types.py @@ -1,4 +1,5 @@ from typing import Union + from weaviate.collections.classes.tenants import Tenant, TenantCreate, TenantUpdate TenantCreateInputType = Union[str, Tenant, TenantCreate] diff --git a/weaviate/connect/authentication.py b/weaviate/connect/authentication.py index de2d3f770..67f967980 100644 --- a/weaviate/connect/authentication.py +++ b/weaviate/connect/authentication.py @@ -3,18 +3,22 @@ from typing import Awaitable, Callable, Dict, List, Optional, Union import httpx -from authlib.integrations.httpx_client import OAuth2Client, AsyncOAuth2Client # type: ignore +from authlib.integrations.httpx_client import ( # type: ignore + AsyncOAuth2Client, + OAuth2Client, +) from weaviate.auth import ( - AuthCredentials, - AuthClientPassword, AuthBearerToken, AuthClientCredentials, + AuthClientPassword, + AuthCredentials, ) -from weaviate.exceptions import MissingScopeError, AuthenticationFailedError -from . import executor +from weaviate.exceptions import AuthenticationFailedError, MissingScopeError + from ..util import _decode_json_response_dict from ..warnings import _Warnings +from . import executor AUTH_DEFAULT_TIMEOUT = 5 OIDC_CONFIG = Dict[str, Union[str, List[str]]] diff --git a/weaviate/connect/base.py b/weaviate/connect/base.py index ecb3c156f..01798ec84 100644 --- a/weaviate/connect/base.py +++ b/weaviate/connect/base.py @@ -1,12 +1,12 @@ import datetime import os import time -from typing import Any, Dict, Mapping, Sequence, Tuple, TypeVar, Union, cast, Optional +from typing import Any, Dict, Mapping, Optional, Sequence, Tuple, TypeVar, Union, cast from urllib.parse import urlparse import grpc # type: ignore -from grpc import ssl_channel_credentials from grpc import Channel as SyncChannel +from grpc import ssl_channel_credentials from grpc.aio import Channel as AsyncChannel # type: ignore from pydantic import BaseModel, field_validator, model_validator diff --git a/weaviate/connect/executor.py b/weaviate/connect/executor.py index 7e7b309fa..4bbeda301 100644 --- a/weaviate/connect/executor.py +++ b/weaviate/connect/executor.py @@ -1,7 +1,19 @@ import inspect from functools import wraps from types import FunctionType -from typing import Awaitable, Callable, List, Literal, Tuple, TypeVar, Union, Any, overload, cast +from typing import ( + Any, + Awaitable, + Callable, + List, + Literal, + Tuple, + TypeVar, + Union, + cast, + overload, +) + from typing_extensions import ParamSpec R = TypeVar("R") diff --git a/weaviate/connect/helpers.py b/weaviate/connect/helpers.py index 0a3b1b0e7..fbc5fdae0 100644 --- a/weaviate/connect/helpers.py +++ b/weaviate/connect/helpers.py @@ -1,15 +1,16 @@ """Helper functions for creating new WeaviateClient or WeaviateAsyncClient instances in common scenarios.""" -from urllib.parse import urlparse from typing import Dict, Optional, Tuple -from typing_extensions import deprecated as typing_deprecated +from urllib.parse import urlparse + from deprecation import deprecated as docstring_deprecated +from typing_extensions import deprecated as typing_deprecated from weaviate.auth import AuthCredentials from weaviate.client import WeaviateAsyncClient, WeaviateClient from weaviate.config import AdditionalConfig from weaviate.connect.base import ConnectionParams, ProtocolParams -from weaviate.embedded import EmbeddedOptions, WEAVIATE_VERSION +from weaviate.embedded import WEAVIATE_VERSION, EmbeddedOptions from weaviate.validator import _validate_input, _ValidateArgument diff --git a/weaviate/connect/v4.py b/weaviate/connect/v4.py index 1fb116b22..13bd001b0 100644 --- a/weaviate/connect/v4.py +++ b/weaviate/connect/v4.py @@ -23,62 +23,65 @@ AsyncOAuth2Client, OAuth2Client, ) -from grpc import Channel as SyncChannel, RpcError, StatusCode, Call # type: ignore -from grpc.aio import Channel as AsyncChannel, AioRpcError # type: ignore +from grpc import Call, RpcError, StatusCode +from grpc import Channel as SyncChannel # type: ignore +from grpc.aio import AioRpcError +from grpc.aio import Channel as AsyncChannel # type: ignore from grpc_health.v1 import health_pb2 # type: ignore # from grpclib.client import Channel from httpx import ( AsyncClient, AsyncHTTPTransport, - HTTPTransport, Client, ConnectError, HTTPError, HTTPStatusError, + HTTPTransport, Limits, + Proxy, ReadError, ReadTimeout, RemoteProtocolError, RequestError, Response, - Proxy, Timeout, ) from weaviate import __version__ as client_version -from weaviate.auth import AuthCredentials, AuthApiKey, AuthClientCredentials -from weaviate.config import ConnectionConfig, Proxies, Timeout as TimeoutConfig +from weaviate.auth import AuthApiKey, AuthClientCredentials, AuthCredentials +from weaviate.config import ConnectionConfig, Proxies +from weaviate.config import Timeout as TimeoutConfig +from weaviate.connect import executor from weaviate.connect.authentication import _Auth from weaviate.connect.base import ( ConnectionParams, JSONPayload, _get_proxies, ) -from weaviate.connect import executor from weaviate.connect.event_loop import _EventLoopSingleton from weaviate.connect.integrations import _IntegrationConfig from weaviate.embedded import EmbeddedV4 from weaviate.exceptions import ( AuthenticationFailedError, + InsufficientPermissionsError, UnexpectedStatusCodeError, + WeaviateBatchError, WeaviateClosedClientError, WeaviateConnectionError, + WeaviateDeleteManyError, WeaviateGRPCUnavailableError, - WeaviateStartUpError, - WeaviateTimeoutError, - InsufficientPermissionsError, - WeaviateBatchError, WeaviateInvalidInputError, - WeaviateRetryError, WeaviateQueryError, - WeaviateDeleteManyError, + WeaviateRetryError, + WeaviateStartUpError, WeaviateTenantGetError, + WeaviateTimeoutError, ) from weaviate.proto.v1 import ( aggregate_pb2, - batch_pb2, batch_delete_pb2, + batch_pb2, search_get_pb2, tenants_pb2, weaviate_pb2_grpc, diff --git a/weaviate/debug/async_.pyi b/weaviate/debug/async_.pyi index 09951c136..0b61c9efa 100644 --- a/weaviate/debug/async_.pyi +++ b/weaviate/debug/async_.pyi @@ -2,7 +2,7 @@ from typing import Dict, Generic, Optional from httpx import Response from weaviate.classes.config import ConsistencyLevel from weaviate.connect import executor -from weaviate.connect.v4 import _ExpectedStatusCodes, ConnectionType +from weaviate.connect.v4 import ConnectionType, _ExpectedStatusCodes from weaviate.debug.types import DebugRESTObject from weaviate.types import UUID from weaviate.connect.v4 import ConnectionAsync diff --git a/weaviate/debug/executor.py b/weaviate/debug/executor.py index 1912e9ed5..818ead8a3 100644 --- a/weaviate/debug/executor.py +++ b/weaviate/debug/executor.py @@ -4,7 +4,7 @@ from weaviate.classes.config import ConsistencyLevel from weaviate.connect import executor -from weaviate.connect.v4 import _ExpectedStatusCodes, ConnectionType +from weaviate.connect.v4 import ConnectionType, _ExpectedStatusCodes from weaviate.debug.types import DebugRESTObject from weaviate.types import UUID diff --git a/weaviate/debug/sync.pyi b/weaviate/debug/sync.pyi index 92ca5525f..5ea399893 100644 --- a/weaviate/debug/sync.pyi +++ b/weaviate/debug/sync.pyi @@ -2,7 +2,7 @@ from typing import Dict, Generic, Optional from httpx import Response from weaviate.classes.config import ConsistencyLevel from weaviate.connect import executor -from weaviate.connect.v4 import _ExpectedStatusCodes, ConnectionType +from weaviate.connect.v4 import ConnectionType, _ExpectedStatusCodes from weaviate.debug.types import DebugRESTObject from weaviate.types import UUID from weaviate.connect.v4 import ConnectionSync diff --git a/weaviate/gql/aggregate.py b/weaviate/gql/aggregate.py index f1fc5fa07..1ad746750 100644 --- a/weaviate/gql/aggregate.py +++ b/weaviate/gql/aggregate.py @@ -4,11 +4,12 @@ from dataclasses import dataclass from typing import List, Optional -from weaviate.util import _capitalize_first_letter, file_encoder_b64, _sanitize_str +from weaviate.util import _capitalize_first_letter, _sanitize_str, file_encoder_b64 + from .filter import ( - Where, - GraphQL, Filter, + GraphQL, + MediaType, NearAudio, NearDepth, NearImage, @@ -18,7 +19,7 @@ NearThermal, NearVector, NearVideo, - MediaType, + Where, ) diff --git a/weaviate/gql/filter.py b/weaviate/gql/filter.py index 392aa7558..2dc7800d1 100644 --- a/weaviate/gql/filter.py +++ b/weaviate/gql/filter.py @@ -8,7 +8,7 @@ from typing import Any, Tuple, Union from weaviate.error_msgs import FILTER_BEACON_V14_CLS_NS_W -from weaviate.util import get_vector, _sanitize_str +from weaviate.util import _sanitize_str, get_vector VALUE_LIST_TYPES = { "valueStringList", diff --git a/weaviate/integrations.py b/weaviate/integrations.py index c38b4be84..0d7dc103b 100644 --- a/weaviate/integrations.py +++ b/weaviate/integrations.py @@ -1,6 +1,6 @@ from typing import List, Union -from weaviate.connect.integrations import _IntegrationConfig +from weaviate.connect.integrations import _IntegrationConfig from weaviate.connect.v4 import Connection diff --git a/weaviate/outputs/backup.py b/weaviate/outputs/backup.py index 3dc59cba1..61d42cdcc 100644 --- a/weaviate/outputs/backup.py +++ b/weaviate/outputs/backup.py @@ -1,4 +1,9 @@ -from weaviate.backup.backup import BackupStatus, BackupStatusReturn, BackupStorage, BackupReturn +from weaviate.backup.backup import ( + BackupReturn, + BackupStatus, + BackupStatusReturn, + BackupStorage, +) __all__ = [ "BackupStatus", diff --git a/weaviate/outputs/config.py b/weaviate/outputs/config.py index 527814027..d6c8ed230 100644 --- a/weaviate/outputs/config.py +++ b/weaviate/outputs/config.py @@ -6,7 +6,6 @@ GenerativeSearches, InvertedIndexConfig, MultiTenancyConfig, - ReplicationDeletionStrategy, PQConfig, PQEncoderConfig, PQEncoderDistribution, @@ -15,17 +14,18 @@ PropertyType, ReferencePropertyConfig, ReplicationConfig, - Rerankers, + ReplicationDeletionStrategy, RerankerConfig, + Rerankers, ShardingConfig, ShardStatus, ShardTypes, VectorDistances, - VectorIndexConfigHNSW, VectorIndexConfigFlat, + VectorIndexConfigHNSW, VectorIndexType, - Vectorizers, VectorizerConfig, + Vectorizers, ) __all__ = [ diff --git a/weaviate/outputs/data.py b/weaviate/outputs/data.py index 6683eac26..a5360f65e 100644 --- a/weaviate/outputs/data.py +++ b/weaviate/outputs/data.py @@ -1,9 +1,8 @@ -from weaviate.collections.classes.data import Error, RefError from weaviate.collections.classes.batch import ( DeleteManyObject, DeleteManyReturn, ) - +from weaviate.collections.classes.data import Error, RefError __all__ = [ "DeleteManyObject", diff --git a/weaviate/outputs/query.py b/weaviate/outputs/query.py index fb03d6f13..45c8001b0 100644 --- a/weaviate/outputs/query.py +++ b/weaviate/outputs/query.py @@ -1,36 +1,34 @@ from weaviate.collections.classes.filters import ( FilterByCreationTime, - FilterByProperty, FilterById, - FilterByUpdateTime, + FilterByProperty, FilterByRef, + FilterByUpdateTime, FilterReturn, ) from weaviate.collections.classes.grpc import ( - Sorting, + ListOfVectorsQuery, NearVectorInputType, + Sorting, TargetVectorJoinType, - ListOfVectorsQuery, ) - - from weaviate.collections.classes.internal import ( + GenerativeGroup, + GenerativeGroupByReturn, + GenerativeGroupByReturnType, GenerativeNearMediaReturnType, + GenerativeObject, + GenerativeReturn, GenerativeReturnType, - GenerativeGroupByReturnType, GenerativeSearchReturnType, + Group, + GroupByObject, + GroupByReturn, + GroupByReturnType, MetadataReturn, MetadataSingleObjectReturn, Object, ObjectSingleReturn, - GroupByObject, - GroupByReturn, - GroupByReturnType, - GenerativeObject, - GenerativeReturn, - GenerativeGroupByReturn, - GenerativeGroup, - Group, QueryNearMediaReturnType, QueryReturn, QueryReturnType, diff --git a/weaviate/outputs/rbac.py b/weaviate/outputs/rbac.py index 05c7b6709..8cb39b821 100644 --- a/weaviate/outputs/rbac.py +++ b/weaviate/outputs/rbac.py @@ -1,14 +1,14 @@ from weaviate.rbac.models import ( - PermissionsOutputType, BackupsPermissionOutput, ClusterPermissionOutput, CollectionsPermissionOutput, DataPermissionOutput, NodesPermissionOutput, - RolesPermissionOutput, - UsersPermissionOutput, + PermissionsOutputType, RoleScope, + RolesPermissionOutput, UserAssignment, + UsersPermissionOutput, ) __all__ = [ diff --git a/weaviate/outputs/users.py b/weaviate/outputs/users.py index ce4e71d8e..83d4d724b 100644 --- a/weaviate/outputs/users.py +++ b/weaviate/outputs/users.py @@ -1,3 +1,3 @@ -from weaviate.users.users import UserDB, UserTypes, OwnUser +from weaviate.users.users import OwnUser, UserDB, UserTypes __all__ = ["OwnUser", "UserDB", "UserTypes"] diff --git a/weaviate/rbac/async_.pyi b/weaviate/rbac/async_.pyi index 61253dc0f..0c9357a9d 100644 --- a/weaviate/rbac/async_.pyi +++ b/weaviate/rbac/async_.pyi @@ -1,19 +1,19 @@ import asyncio import json from typing import Dict, Generic, List, Optional, Sequence, Union, cast -from typing_extensions import deprecated from httpx import Response -from weaviate.connect.v4 import _ExpectedStatusCodes, ConnectionType, ConnectionAsync +from typing_extensions import deprecated from weaviate.connect import executor +from weaviate.connect.v4 import ConnectionAsync, ConnectionType, _ExpectedStatusCodes from weaviate.rbac.models import ( - _Permission, - PermissionsOutputType, PermissionsInputType, + PermissionsOutputType, Role, UserAssignment, UserTypes, WeaviatePermission, WeaviateRole, + _Permission, ) from weaviate.connect.v4 import ConnectionAsync from .executor import _RolesExecutor diff --git a/weaviate/rbac/executor.py b/weaviate/rbac/executor.py index 72bab3ff9..88d2ea9c8 100644 --- a/weaviate/rbac/executor.py +++ b/weaviate/rbac/executor.py @@ -1,21 +1,21 @@ import asyncio import json from typing import Dict, Generic, List, Optional, Sequence, Union, cast -from typing_extensions import deprecated from httpx import Response +from typing_extensions import deprecated -from weaviate.connect.v4 import _ExpectedStatusCodes, ConnectionType, ConnectionAsync from weaviate.connect import executor +from weaviate.connect.v4 import ConnectionAsync, ConnectionType, _ExpectedStatusCodes from weaviate.rbac.models import ( - _Permission, - PermissionsOutputType, PermissionsInputType, + PermissionsOutputType, Role, UserAssignment, UserTypes, WeaviatePermission, WeaviateRole, + _Permission, ) diff --git a/weaviate/rbac/models.py b/weaviate/rbac/models.py index 6a0b054d3..2a49724f1 100644 --- a/weaviate/rbac/models.py +++ b/weaviate/rbac/models.py @@ -1,7 +1,17 @@ from abc import abstractmethod from dataclasses import dataclass from enum import Enum -from typing import Dict, Generic, List, Optional, Sequence, Set, TypeVar, TypedDict, Union +from typing import ( + Dict, + Generic, + List, + Optional, + Sequence, + Set, + TypedDict, + TypeVar, + Union, +) from pydantic import BaseModel from typing_extensions import NotRequired @@ -9,8 +19,6 @@ from weaviate.cluster.types import Verbosity from weaviate.str_enum import BaseEnum from weaviate.util import _capitalize_first_letter - - from weaviate.warnings import _Warnings diff --git a/weaviate/rbac/sync.pyi b/weaviate/rbac/sync.pyi index 005a8840f..31ef4f7fa 100644 --- a/weaviate/rbac/sync.pyi +++ b/weaviate/rbac/sync.pyi @@ -1,19 +1,19 @@ import asyncio import json from typing import Dict, Generic, List, Optional, Sequence, Union, cast -from typing_extensions import deprecated from httpx import Response -from weaviate.connect.v4 import _ExpectedStatusCodes, ConnectionType, ConnectionAsync +from typing_extensions import deprecated from weaviate.connect import executor +from weaviate.connect.v4 import ConnectionAsync, ConnectionType, _ExpectedStatusCodes from weaviate.rbac.models import ( - _Permission, - PermissionsOutputType, PermissionsInputType, + PermissionsOutputType, Role, UserAssignment, UserTypes, WeaviatePermission, WeaviateRole, + _Permission, ) from weaviate.connect.v4 import ConnectionSync from .executor import _RolesExecutor diff --git a/weaviate/retry.py b/weaviate/retry.py index 4a417dc7b..23a419d4a 100644 --- a/weaviate/retry.py +++ b/weaviate/retry.py @@ -1,10 +1,10 @@ import asyncio import time from typing import Awaitable, Callable, cast -from typing_extensions import ParamSpec, TypeVar -from grpc import Call, StatusCode, RpcError # type: ignore +from grpc import Call, RpcError, StatusCode # type: ignore from grpc.aio import AioRpcError # type: ignore +from typing_extensions import ParamSpec, TypeVar from weaviate.exceptions import WeaviateRetryError from weaviate.logger import logger diff --git a/weaviate/str_enum.py b/weaviate/str_enum.py index 78e7f6c06..46371497f 100644 --- a/weaviate/str_enum.py +++ b/weaviate/str_enum.py @@ -1,7 +1,7 @@ # MetaEnum and BaseEnum are required to support `in` statements: # 'ALL' in ConsistencyLevel == True # 12345 in ConsistencyLevel == False -from enum import EnumMeta, Enum +from enum import Enum, EnumMeta from typing import Any diff --git a/weaviate/types.py b/weaviate/types.py index d47b73611..a9ed0a9ee 100644 --- a/weaviate/types.py +++ b/weaviate/types.py @@ -2,7 +2,7 @@ import uuid as uuid_package from io import BufferedReader from pathlib import Path -from typing import Dict, Union, Mapping, List, Sequence, Tuple +from typing import Dict, List, Mapping, Sequence, Tuple, Union DATE = datetime.datetime UUID = Union[str, uuid_package.UUID] diff --git a/weaviate/users/async_.py b/weaviate/users/async_.py index 1c11185bc..da908be1a 100644 --- a/weaviate/users/async_.py +++ b/weaviate/users/async_.py @@ -1,8 +1,8 @@ from weaviate.connect import executor from weaviate.connect.v4 import ConnectionAsync from weaviate.users.executor import ( - _UsersExecutor, _UsersDBExecutor, + _UsersExecutor, _UsersOIDCExecutor, ) diff --git a/weaviate/users/async_.pyi b/weaviate/users/async_.pyi index c9b49d088..b41f6ac51 100644 --- a/weaviate/users/async_.pyi +++ b/weaviate/users/async_.pyi @@ -1,10 +1,10 @@ from typing import Any, Dict, Generic, List, Literal, Optional, Union, cast, overload -from typing_extensions import deprecated from httpx import Response +from typing_extensions import deprecated from weaviate.connect import executor -from weaviate.connect.v4 import _ExpectedStatusCodes, ConnectionType -from weaviate.rbac.models import Role, RoleBase, WeaviateDBUserRoleNames, UserTypes -from weaviate.users.users import USER_TYPE_DB, USER_TYPE_OIDC, USER_TYPE, UserDB, OwnUser +from weaviate.connect.v4 import ConnectionType, _ExpectedStatusCodes +from weaviate.rbac.models import Role, RoleBase, UserTypes, WeaviateDBUserRoleNames +from weaviate.users.users import USER_TYPE, USER_TYPE_DB, USER_TYPE_OIDC, OwnUser, UserDB from weaviate.util import _decode_json_response_dict from weaviate.connect.v4 import ConnectionAsync from .executor import _BaseExecutor, _UsersExecutor, _UsersOIDCExecutor, _UsersDBExecutor diff --git a/weaviate/users/executor.py b/weaviate/users/executor.py index e2cedf847..6222ae13d 100644 --- a/weaviate/users/executor.py +++ b/weaviate/users/executor.py @@ -1,22 +1,22 @@ from typing import Any, Dict, Generic, List, Literal, Optional, Union, cast, overload -from typing_extensions import deprecated from httpx import Response +from typing_extensions import deprecated from weaviate.connect import executor -from weaviate.connect.v4 import _ExpectedStatusCodes, ConnectionType +from weaviate.connect.v4 import ConnectionType, _ExpectedStatusCodes from weaviate.rbac.models import ( Role, RoleBase, - WeaviateDBUserRoleNames, UserTypes, + WeaviateDBUserRoleNames, ) from weaviate.users.users import ( + USER_TYPE, USER_TYPE_DB, USER_TYPE_OIDC, - USER_TYPE, - UserDB, OwnUser, + UserDB, ) from weaviate.util import _decode_json_response_dict diff --git a/weaviate/users/sync.py b/weaviate/users/sync.py index 590d00c7e..5e11ad504 100644 --- a/weaviate/users/sync.py +++ b/weaviate/users/sync.py @@ -1,8 +1,8 @@ from weaviate.connect import executor from weaviate.connect.v4 import ConnectionSync from weaviate.users.executor import ( - _UsersExecutor, _UsersDBExecutor, + _UsersExecutor, _UsersOIDCExecutor, ) diff --git a/weaviate/users/sync.pyi b/weaviate/users/sync.pyi index 02b412a68..0f764ff7a 100644 --- a/weaviate/users/sync.pyi +++ b/weaviate/users/sync.pyi @@ -1,10 +1,10 @@ from typing import Any, Dict, Generic, List, Literal, Optional, Union, cast, overload -from typing_extensions import deprecated from httpx import Response +from typing_extensions import deprecated from weaviate.connect import executor -from weaviate.connect.v4 import _ExpectedStatusCodes, ConnectionType -from weaviate.rbac.models import Role, RoleBase, WeaviateDBUserRoleNames, UserTypes -from weaviate.users.users import USER_TYPE_DB, USER_TYPE_OIDC, USER_TYPE, UserDB, OwnUser +from weaviate.connect.v4 import ConnectionType, _ExpectedStatusCodes +from weaviate.rbac.models import Role, RoleBase, UserTypes, WeaviateDBUserRoleNames +from weaviate.users.users import USER_TYPE, USER_TYPE_DB, USER_TYPE_OIDC, OwnUser, UserDB from weaviate.util import _decode_json_response_dict from weaviate.connect.v4 import ConnectionSync from .executor import _BaseExecutor, _UsersExecutor, _UsersOIDCExecutor, _UsersDBExecutor diff --git a/weaviate/util.py b/weaviate/util.py index 874014374..d21d566ff 100644 --- a/weaviate/util.py +++ b/weaviate/util.py @@ -8,19 +8,19 @@ import re import uuid as uuid_lib from pathlib import Path -from typing import Union, Sequence, Any, Optional, List, Dict, Generator, Tuple, cast +from typing import Any, Dict, Generator, List, Optional, Sequence, Tuple, Union, cast import httpx import validators from weaviate.exceptions import ( + ResponseCannotBeDecodedError, SchemaValidationError, UnexpectedStatusCodeError, - ResponseCannotBeDecodedError, WeaviateInvalidInputError, WeaviateUnsupportedFeatureError, ) -from weaviate.types import BLOB_INPUT, NUMBER, UUIDS, TIME +from weaviate.types import BLOB_INPUT, NUMBER, TIME, UUIDS from weaviate.warnings import _Warnings PYPI_PACKAGE_URL = "https://pypi.org/pypi/weaviate-client/json" diff --git a/weaviate/warnings.py b/weaviate/warnings.py index 49e764e39..12cdb6061 100644 --- a/weaviate/warnings.py +++ b/weaviate/warnings.py @@ -1,6 +1,6 @@ import warnings from datetime import datetime -from importlib.metadata import version, PackageNotFoundError +from importlib.metadata import PackageNotFoundError, version from typing import Any, Optional try: @@ -185,7 +185,7 @@ def palm_to_google_gen() -> None: def vector_index_config_in_config_update() -> None: warnings.warn( message="""Dep017: You are using the `vector_index_config` argument in the `collection.config.update()` method, which is deprecated. - Use the `vectorizer_config` argument instead. + Use the `vector_config` argument instead. """, category=DeprecationWarning, stacklevel=1, @@ -224,6 +224,16 @@ def deprecated_tenant_type(old: str, new: str) -> None: stacklevel=1, ) + @staticmethod + def vectorizer_config_in_config_update() -> None: + warnings.warn( + message="""Dep021: You are using the `vectorizer_config` argument in the `collection.config.update()` method with a collection with named vectors, which is deprecated. + Use the `vector_config` argument instead. + """, + category=DeprecationWarning, + stacklevel=1, + ) + @staticmethod def datetime_insertion_with_no_specified_timezone(date: datetime) -> None: warnings.warn( From d088596540e7d91810aa7bc83a19aed536642ba0 Mon Sep 17 00:00:00 2001 From: Tommy Smith Date: Mon, 28 Apr 2025 09:24:34 +0100 Subject: [PATCH 02/16] Update CI images to latest build on each branch --- .github/workflows/main.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index fdb3d401a..0b850d468 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -21,10 +21,10 @@ env: WEAVIATE_124: 1.24.26 WEAVIATE_125: 1.25.34 WEAVIATE_126: 1.26.17 - WEAVIATE_127: 1.27.18-00f6a84.amd64 - WEAVIATE_128: 1.28.13 - WEAVIATE_129: 1.29.4 - WEAVIATE_130: 1.30.1 + WEAVIATE_127: 1.27.20-c25f153 + WEAVIATE_128: 1.28.13-05231b9 + WEAVIATE_129: 1.29.4-b2fb2a5 + WEAVIATE_130: 1.30.1-08b31fa jobs: lint-and-format: From df10ec68dc63a24cb5e852fb9280d85add68c538 Mon Sep 17 00:00:00 2001 From: Tommy Smith Date: Mon, 28 Apr 2025 09:41:33 +0100 Subject: [PATCH 03/16] Change prop descr test to handle props sorted by name --- integration/test_collection_config.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/integration/test_collection_config.py b/integration/test_collection_config.py index 814f8e976..018b4e3db 100644 --- a/integration/test_collection_config.py +++ b/integration/test_collection_config.py @@ -1400,8 +1400,11 @@ def is_supported(): update() config = collection.config.get() - assert config.properties[0].description == "Name of the person" - assert config.properties[1].description == "Age of the person" + for prop in config.properties: + if prop.name == "name": + assert prop.description == "Name of the person" + elif prop.name == "age": + assert prop.description == "Age of the person" else: with pytest.raises(UnexpectedStatusCodeError): update() From 84a5a90dfc3894137e64cd2ed5d73515a245ab79 Mon Sep 17 00:00:00 2001 From: Tommy Smith Date: Mon, 28 Apr 2025 09:57:40 +0100 Subject: [PATCH 04/16] Make changes to pass unit tests of legacy vectorization --- test/collection/test_config.py | 16 ++++++++++------ weaviate/collections/classes/config.py | 23 +++++++++++++++++++---- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/test/collection/test_config.py b/test/collection/test_config.py index c63ff6e78..2d9a93ae7 100644 --- a/test/collection/test_config.py +++ b/test/collection/test_config.py @@ -21,8 +21,14 @@ ) DEFAULTS = { - "vectorizer": "none", - "vectorIndexType": "hnsw", + "vectorConfig": { + "default": { + "vectorIndexType": "hnsw", + "vectorizer": { + "none": {}, + }, + } + } } @@ -677,7 +683,7 @@ def test_config_with_default_vectorizer( ) -> None: config = _CollectionConfigCreate(name="test", vectorizer_config=vectorizer_config) assert config._to_dict() == { - **DEFAULTS, + "vectorIndexType": "hnsw", "vectorizer": vectorizer_config.vectorizer.value, "class": "Test", "moduleConfig": expected, @@ -786,7 +792,7 @@ def test_config_with_vectorizer_and_properties( name="test", properties=properties, vectorizer_config=vectorizer_config ) assert config._to_dict() == { - **DEFAULTS, + "vectorIndexType": "hnsw", "vectorizer": vectorizer_config.vectorizer.value, "class": "Test", "properties": expected_props, @@ -1060,7 +1066,6 @@ def test_config_with_generative( config = _CollectionConfigCreate(name="test", generative_config=generative_config) assert config._to_dict() == { **DEFAULTS, - "vectorizer": "none", "class": "Test", "moduleConfig": expected_mc, } @@ -1140,7 +1145,6 @@ def test_config_with_reranker( config = _CollectionConfigCreate(name="test", reranker_config=reranker_config) assert config._to_dict() == { **DEFAULTS, - "vectorizer": "none", "class": "Test", "moduleConfig": expected_mc, } diff --git a/weaviate/collections/classes/config.py b/weaviate/collections/classes/config.py index e83abfed6..d6288ea47 100644 --- a/weaviate/collections/classes/config.py +++ b/weaviate/collections/classes/config.py @@ -1975,11 +1975,13 @@ class _CollectionConfigCreate(_ConfigCreateModel): vectorIndexConfig: Optional[_VectorIndexConfigCreate] = Field( default=None, alias="vector_index_config" ) - vectorizerConfig: Optional[Union[_VectorizerConfigCreate, List[_NamedVectorConfigCreate]]] = ( - Field(default=_Vectorizer.none(), alias="vectorizer_config") + vectorizerConfig: Union[_VectorizerConfigCreate, List[_NamedVectorConfigCreate], None] = Field( + default=None, alias="vectorizer_config" ) - vectorConfig: Optional[Union[_VectorConfigCreate, List[_VectorConfigCreate]]] = Field( - default=_Vectors.none(), alias="vector_config" + vectorConfig: Union[_VectorConfigCreate, List[_VectorConfigCreate], None] = Field( + default=None, + alias="vector_config", + validate_default=True, ) generativeSearch: Optional[_GenerativeProvider] = Field(default=None, alias="generative_config") rerankerConfig: Optional[_RerankerProvider] = Field(default=None, alias="reranker_config") @@ -2001,6 +2003,19 @@ def validate_vector_names( raise ValueError(f"Vector config names must be unique. Found duplicates: {dups}") return v + @field_validator("vectorConfig", mode="after") + @classmethod + def inject_vector_config_none( + cls, + v: Union[_VectorConfigCreate, List[_VectorConfigCreate], None], + info: ValidationInfo, + ) -> Union[_VectorConfigCreate, List[_VectorConfigCreate], None]: + if v is None and info.data["vectorizerConfig"] is None: + return _VectorConfigCreate( + name="default", vectorizer=_VectorizerConfigCreate(vectorizer=Vectorizers.NONE) + ) + return v + @staticmethod def __add_to_module_config( return_dict: Dict[str, Any], addition_key: str, addition_val: Dict[str, Any] From 34e726482dd9ad1669812c69ea61c921c72f3fbd Mon Sep 17 00:00:00 2001 From: Tommy Smith Date: Mon, 28 Apr 2025 10:02:12 +0100 Subject: [PATCH 05/16] Alter specific tests for old versions with new syntax --- integration/test_collection.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/integration/test_collection.py b/integration/test_collection.py index 958baa54d..443e99961 100644 --- a/integration/test_collection.py +++ b/integration/test_collection.py @@ -465,7 +465,10 @@ def test_replace_overwrites_vector(collection_factory: CollectionFactory) -> Non collection.data.replace(properties={"name": "other name"}, uuid=uuid) obj = collection.query.fetch_object_by_id(uuid, include_vector=True) assert obj.properties["name"] == "other name" - assert "default" not in obj.vector + if collection._connection._weaviate_version.is_lower_than(1, 27, 0): + assert len(obj.vector["default"]) == 0 + else: + assert "default" not in obj.vector collection.data.replace(properties={"name": "real name"}, uuid=uuid, vector=[2, 3, 4]) obj = collection.query.fetch_object_by_id(uuid, include_vector=True) @@ -1174,13 +1177,16 @@ def test_near_text_error(collection_factory: CollectionFactory) -> None: def test_near_text_group_by_argument(collection_factory: CollectionFactory) -> None: + dummy = collection_factory("dummy") + if dummy._connection._weaviate_version.is_lower_than(1, 27, 0): + pytest.skip( + 'Vectors not passed to GroupByHit in servers for versions < 1.27.0. Therefore `assert "default" in ret.objects[i].vector` fails always.' + ) + collection = collection_factory( vector_config=Configure.Vectors.text2vec_contextionary(vectorize_collection_name=False), properties=[Property(name="value", data_type=DataType.TEXT)], ) - import json - - print(json.dumps(collection.config.get().to_dict(), indent=2)) batch_return = collection.data.insert_many( [ From 5301dcf29d1a8e79cd338ef75f2c68be1970f11b Mon Sep 17 00:00:00 2001 From: Tommy Smith Date: Mon, 28 Apr 2025 10:36:03 +0100 Subject: [PATCH 06/16] Add skip to test with resolved issue absent from previous vers --- integration/test_vectors.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/integration/test_vectors.py b/integration/test_vectors.py index 9fa03735c..7c1fe62ac 100644 --- a/integration/test_vectors.py +++ b/integration/test_vectors.py @@ -738,14 +738,16 @@ def test_include_vector_on_references( ) -> None: """Test include vector on reference.""" dummy = collection_factory() - if dummy._connection._weaviate_version.is_lower_than(1, 24, 0): - pytest.skip("Named vectorizers are only supported in Weaviate v1.24.0 and higher.") + if dummy._connection._weaviate_version.is_lower_than(1, 26, 0): + pytest.skip( + "https://github.com/weaviate/weaviate/issues/6279 was resolved in >1.26.0 only." + ) ref_collection = collection_factory( name="Target", - vector_config=[ - wvc.config.Configure.Vectors.none(name="bringYourOwn1"), - wvc.config.Configure.Vectors.none(name="bringYourOwn2"), + vectorizer_config=[ + wvc.config.Configure.NamedVectors.none(name="bringYourOwn1"), + wvc.config.Configure.NamedVectors.none(name="bringYourOwn2"), ], ) From cb9015ce224ed80d236dc8df870ef3f8336eb74e Mon Sep 17 00:00:00 2001 From: Tommy Smith Date: Wed, 25 Jun 2025 12:05:57 +0100 Subject: [PATCH 07/16] - Add `MultiVectors` factory - Allow `quantizer` at root of all `Vectors` and `MultiVectors` methods - Allow `encoding` also at root of all `MultiVectors` methods --- integration/conftest.py | 2 +- integration/test_collection.py | 98 +-- integration/test_vectors.py | 46 +- weaviate/classes/config.py | 6 +- weaviate/collections/classes/config.py | 326 +--------- .../classes/config_vector_index.py | 317 +++++++++- .../collections/classes/config_vectors.py | 585 +++++++++--------- 7 files changed, 711 insertions(+), 669 deletions(-) diff --git a/integration/conftest.py b/integration/conftest.py index e31d42b31..a1014a871 100644 --- a/integration/conftest.py +++ b/integration/conftest.py @@ -352,7 +352,7 @@ def _factory( collection = collection_factory( name=name, vectorizer_config=vectorizer_config, - vector_config=vector_config or Configure.Vectors.none(), + vector_config=vector_config or Configure.Vectors.self_provided(), properties=[ Property(name="text", data_type=DataType.TEXT), Property(name="content", data_type=DataType.TEXT), diff --git a/integration/test_collection.py b/integration/test_collection.py index f179acaf2..561dbd597 100644 --- a/integration/test_collection.py +++ b/integration/test_collection.py @@ -79,7 +79,7 @@ class TestInsert(TypedDict): dummy = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ) collection = collection_factory_get(dummy.name, TestInsert) uuid = collection.data.insert(properties=TestInsert(name="some name")) @@ -95,7 +95,7 @@ def test_insert_with_dict_generic( ) -> None: dummy = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ) collection = collection_factory_get(dummy.name, Dict[str, str]) uuid = collection.data.insert(properties={"name": "some name"}) @@ -108,7 +108,7 @@ def test_insert_with_dict_generic( def test_insert_with_no_generic(collection_factory: CollectionFactory) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ) uuid = collection.data.insert(properties={"name": "some name"}) objects = collection.query.fetch_objects() @@ -120,7 +120,7 @@ def test_insert_with_no_generic(collection_factory: CollectionFactory) -> None: def test_insert_with_consistency_level(collection_factory: CollectionFactory) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ).with_consistency_level(ConsistencyLevel.ALL) uuid = collection.data.insert(properties={"name": "some name"}) objects = collection.query.fetch_objects() @@ -142,7 +142,7 @@ def __init__(self) -> None: def test_delete_by_id(collection_factory: CollectionFactory) -> None: collection = collection_factory( - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ) uuid = collection.data.insert(properties={}) @@ -153,7 +153,7 @@ def test_delete_by_id(collection_factory: CollectionFactory) -> None: def test_delete_by_id_consistency_level(collection_factory: CollectionFactory) -> None: collection = collection_factory( - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ).with_consistency_level(ConsistencyLevel.ALL) uuid = collection.data.insert(properties={}) @@ -232,7 +232,7 @@ def test_insert_many( ) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ) if not should_error: ret = collection.data.insert_many(objects) @@ -266,7 +266,7 @@ def test_insert_many_all_error( ) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), multi_tenancy_config=Configure.multi_tenancy(True), ) with pytest.raises(WeaviateInsertManyAllFailedError) as e: @@ -286,7 +286,7 @@ class TestInsertManyWithTypedDict(TypedDict): dummy = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ) collection = collection_factory_get(dummy.name, TestInsertManyWithTypedDict) ret = collection.data.insert_many( @@ -304,7 +304,9 @@ class TestInsertManyWithTypedDict(TypedDict): def test_insert_many_with_refs(collection_factory: CollectionFactory) -> None: - ref_collection = collection_factory(name="target", vector_config=Configure.Vectors.none()) + ref_collection = collection_factory( + name="target", vector_config=Configure.Vectors.self_provided() + ) uuid_to1 = ref_collection.data.insert(properties={}) uuid_to2 = ref_collection.data.insert(properties={}) @@ -312,7 +314,7 @@ def test_insert_many_with_refs(collection_factory: CollectionFactory) -> None: name="source", properties=[Property(name="Name", data_type=DataType.TEXT)], references=[ReferenceProperty(name="ref_single", target_collection=ref_collection.name)], - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ) collection.config.add_reference( ReferenceProperty.MultiTarget( @@ -383,7 +385,7 @@ def test_insert_many_with_refs(collection_factory: CollectionFactory) -> None: def test_insert_many_error(collection_factory: CollectionFactory) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ) ret = collection.data.insert_many( [ @@ -409,7 +411,7 @@ def test_insert_many_error(collection_factory: CollectionFactory) -> None: def test_replace(collection_factory: CollectionFactory) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ) uuid = collection.data.insert(properties={"name": "some name"}) collection.data.replace(properties={"name": "other name"}, uuid=uuid) @@ -418,7 +420,9 @@ def test_replace(collection_factory: CollectionFactory) -> None: @pytest.mark.parametrize("to_uuids", [UUID3, [UUID3]]) def test_replace_with_refs(collection_factory: CollectionFactory, to_uuids: UUIDS) -> None: - ref_collection = collection_factory(name="target", vector_config=Configure.Vectors.none()) + ref_collection = collection_factory( + name="target", vector_config=Configure.Vectors.self_provided() + ) ref_collection.data.insert(properties={}, uuid=UUID1) ref_collection.data.insert(properties={}, uuid=UUID2) ref_collection.data.insert(properties={}, uuid=UUID3) @@ -427,7 +431,7 @@ def test_replace_with_refs(collection_factory: CollectionFactory, to_uuids: UUID name="source", properties=[Property(name="Name", data_type=DataType.TEXT)], references=[ReferenceProperty(name="ref", target_collection=ref_collection.name)], - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ) uuid = collection.data.insert( properties={"name": "some name"}, @@ -457,7 +461,7 @@ def test_replace_with_refs(collection_factory: CollectionFactory, to_uuids: UUID def test_replace_overwrites_vector(collection_factory: CollectionFactory) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ) uuid = collection.data.insert(properties={"name": "some name"}, vector=[1, 2, 3]) obj = collection.query.fetch_object_by_id(uuid, include_vector=True) @@ -480,7 +484,9 @@ def test_replace_overwrites_vector(collection_factory: CollectionFactory) -> Non @pytest.mark.parametrize("to_uuids", [UUID3, [UUID3]]) def test_update_with_refs(collection_factory: CollectionFactory, to_uuids: UUIDS) -> None: - ref_collection = collection_factory(name="target", vector_config=Configure.Vectors.none()) + ref_collection = collection_factory( + name="target", vector_config=Configure.Vectors.self_provided() + ) ref_collection.data.insert(properties={}, uuid=UUID1) ref_collection.data.insert(properties={}, uuid=UUID2) ref_collection.data.insert(properties={}, uuid=UUID3) @@ -489,7 +495,7 @@ def test_update_with_refs(collection_factory: CollectionFactory, to_uuids: UUIDS name="source", properties=[Property(name="Name", data_type=DataType.TEXT)], references=[ReferenceProperty(name="ref", target_collection=ref_collection.name)], - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ) uuid = collection.data.insert( properties={"name": "some name"}, @@ -533,7 +539,7 @@ def test_types(collection_factory: CollectionFactory, data_type: DataType, value name = "name" collection = collection_factory( properties=[Property(name=name, data_type=data_type)], - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ) uuid_object = collection.data.insert(properties={name: value}) @@ -550,7 +556,7 @@ def test_types(collection_factory: CollectionFactory, data_type: DataType, value def test_bm25(collection_factory: CollectionFactory) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ) res = collection.data.insert_many( @@ -567,7 +573,7 @@ def test_bm25(collection_factory: CollectionFactory) -> None: def test_bm25_group_by(collection_factory: CollectionFactory) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ) res = collection.data.insert_many( @@ -595,7 +601,7 @@ def test_bm25_group_by(collection_factory: CollectionFactory) -> None: def test_bm25_limit(collection_factory: CollectionFactory, limit: int) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT, tokenization=Tokenization.WORD)], - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ) res = collection.data.insert_many( @@ -613,7 +619,7 @@ def test_bm25_limit(collection_factory: CollectionFactory, limit: int) -> None: def test_bm25_offset(collection_factory: CollectionFactory, offset: int, expected: int) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT, tokenization=Tokenization.WORD)], - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ) res = collection.data.insert_many( @@ -632,7 +638,7 @@ def test_bm25_offset(collection_factory: CollectionFactory, offset: int, expecte def test_fetch_objects_offset(collection_factory: CollectionFactory, offset: int) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ) nr_objects = 5 @@ -647,7 +653,7 @@ def test_fetch_objects_offset(collection_factory: CollectionFactory, offset: int def test_fetch_objects_limit(collection_factory: CollectionFactory, limit: int) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ) for i in range(5): collection.data.insert({"Name": str(i)}) @@ -658,7 +664,7 @@ def test_fetch_objects_limit(collection_factory: CollectionFactory, limit: int) def test_search_after(collection_factory: CollectionFactory) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ) nr_objects = 10 @@ -674,7 +680,7 @@ def test_search_after(collection_factory: CollectionFactory) -> None: def test_auto_limit(collection_factory: CollectionFactory) -> None: collection = collection_factory( properties=[Property(name="Name", data_type=DataType.TEXT)], - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), inverted_index_config=Configure.inverted_index(), ) for _ in range(4): @@ -707,7 +713,7 @@ def test_query_properties(collection_factory: CollectionFactory) -> None: Property(name="Name", data_type=DataType.TEXT), Property(name="Age", data_type=DataType.INT), ], - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ) collection.data.insert({"Name": "rain", "Age": 1}) collection.data.insert({"Name": "sun", "Age": 2}) @@ -824,7 +830,7 @@ def test_near_object_group_by_argument(collection_factory: CollectionFactory) -> def test_multi_searches(collection_factory: CollectionFactory) -> None: collection = collection_factory( properties=[Property(name="name", data_type=DataType.TEXT)], - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ) collection.data.insert(properties={"name": "word"}) @@ -851,7 +857,7 @@ def test_multi_searches(collection_factory: CollectionFactory) -> None: def test_fetch_objects_with_limit(collection_factory: CollectionFactory) -> None: collection = collection_factory( - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), properties=[Property(name="name", data_type=DataType.TEXT)], ) @@ -864,7 +870,7 @@ def test_fetch_objects_with_limit(collection_factory: CollectionFactory) -> None def test_add_property(collection_factory: CollectionFactory) -> None: collection = collection_factory( - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), properties=[Property(name="name", data_type=DataType.TEXT)], ) uuid1 = collection.data.insert({"name": "first"}) @@ -919,7 +925,7 @@ def test_add_property_with_vectorizer(collection_factory: CollectionFactory) -> def test_add_reference(collection_factory: CollectionFactory) -> None: collection = collection_factory( - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), properties=[Property(name="name", data_type=DataType.TEXT)], ) uuid1 = collection.data.insert({"name": "first"}) @@ -941,7 +947,7 @@ def test_add_reference(collection_factory: CollectionFactory) -> None: def test_collection_config_get(collection_factory: CollectionFactory) -> None: collection = collection_factory( - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), properties=[ Property(name="name", data_type=DataType.TEXT), Property(name="age", data_type=DataType.INT), @@ -988,7 +994,7 @@ def test_return_properties_metadata_references_combos( include_vector: bool, ) -> None: collection = collection_factory( - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), properties=[ Property(name="name", data_type=DataType.TEXT), Property(name="age", data_type=DataType.INT), @@ -1064,7 +1070,7 @@ def test_insert_date_property( collection_factory: CollectionFactory, hours: int, minutes: int, sign: int ) -> None: collection = collection_factory( - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), properties=[Property(name="date", data_type=DataType.DATE)], ) @@ -1085,7 +1091,7 @@ def test_insert_date_property( def test_exist(collection_factory: CollectionFactory) -> None: collection = collection_factory( - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ) uuid1 = collection.data.insert({}) @@ -1098,7 +1104,7 @@ def test_return_list_properties(collection_factory: CollectionFactory) -> None: name_small = "TestReturnList" collection = collection_factory( name=name_small, - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), properties=[ Property(name="ints", data_type=DataType.INT_ARRAY), Property(name="floats", data_type=DataType.NUMBER_ARRAY), @@ -1171,7 +1177,7 @@ def test_near_text( def test_near_text_error(collection_factory: CollectionFactory) -> None: collection = collection_factory( - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ) with pytest.raises(ValueError): @@ -1402,7 +1408,7 @@ def test_return_properties_with_query_specific_typed_dict( collection_factory: CollectionFactory, which_case: int ) -> None: collection = collection_factory( - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), properties=[ Property(name="int_", data_type=DataType.INT), Property(name="ints", data_type=DataType.INT_ARRAY), @@ -1464,7 +1470,7 @@ class _Data(TypedDict): ints: List[int] collection = collection_factory( - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), properties=[ Property(name="int_", data_type=DataType.INT), Property(name="ints", data_type=DataType.INT_ARRAY), @@ -1489,7 +1495,7 @@ class _Data(TypedDict): int_: int collection = collection_factory( - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), properties=[ Property(name="int_", data_type=DataType.INT), Property(name="ints", data_type=DataType.INT_ARRAY), @@ -1510,7 +1516,7 @@ class _Data(TypedDict): def test_batch_with_arrays(collection_factory: CollectionFactory) -> None: collection = collection_factory( - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), properties=[ Property(name="texts", data_type=DataType.TEXT_ARRAY), Property(name="ints", data_type=DataType.INT_ARRAY), @@ -1576,7 +1582,7 @@ def test_sort( expected: List[int], ) -> None: collection = collection_factory( - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), properties=[ Property(name="age", data_type=DataType.INT), Property(name="name", data_type=DataType.TEXT), @@ -1602,7 +1608,7 @@ def test_sort( def test_optional_ref_returns(collection_factory: CollectionFactory) -> None: ref_collection = collection_factory( name="target", - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), properties=[Property(name="text", data_type=DataType.TEXT)], ) uuid_to1 = ref_collection.data.insert(properties={"text": "ref text"}) @@ -1612,7 +1618,7 @@ def test_optional_ref_returns(collection_factory: CollectionFactory) -> None: references=[ ReferenceProperty(name="ref", target_collection=ref_collection.name), ], - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), ) collection.data.insert({}, references={"ref": uuid_to1}) @@ -1631,7 +1637,7 @@ def test_return_properties_with_type_hint_generic( value: str, ) -> None: dummy = collection_factory( - vector_config=Configure.Vectors.none(), + vector_config=Configure.Vectors.self_provided(), properties=[ Property(name="name", data_type=DataType.TEXT), ], diff --git a/integration/test_vectors.py b/integration/test_vectors.py index ff7be37a4..5a2ed0454 100644 --- a/integration/test_vectors.py +++ b/integration/test_vectors.py @@ -51,8 +51,8 @@ def test_create_named_vectors( source_properties=["title", "content"], vectorize_collection_name=False, ), - wvc.config.Configure.Vectors.none(name="bringYourOwn"), - wvc.config.Configure.Vectors.none(name="bringYourOwn2"), + wvc.config.Configure.Vectors.self_provided(name="bringYourOwn"), + wvc.config.Configure.Vectors.self_provided(name="bringYourOwn2"), ], ) @@ -92,7 +92,7 @@ def test_insert_many_add(collection_factory: CollectionFactory) -> None: wvc.config.Configure.Vectors.text2vec_contextionary( name="title", source_properties=["title"], vectorize_collection_name=False ), - wvc.config.Configure.Vectors.none(name="bringYourOwn"), + wvc.config.Configure.Vectors.self_provided(name="bringYourOwn"), ], ) @@ -118,7 +118,7 @@ def test_update(collection_factory: CollectionFactory) -> None: wvc.config.Property(name="content", data_type=wvc.config.DataType.TEXT), ], vector_config=[ - wvc.config.Configure.Vectors.none(name="bringYourOwn"), + wvc.config.Configure.Vectors.self_provided(name="bringYourOwn"), ], ) @@ -149,7 +149,7 @@ def test_replace(collection_factory: CollectionFactory) -> None: wvc.config.Property(name="content", data_type=wvc.config.DataType.TEXT), ], vector_config=[ - wvc.config.Configure.Vectors.none(name="bringYourOwn"), + wvc.config.Configure.Vectors.self_provided(name="bringYourOwn"), ], ) @@ -259,7 +259,7 @@ def test_batch_add(collection_factory: CollectionFactory) -> None: wvc.config.Configure.Vectors.text2vec_contextionary( name="title", source_properties=["title"], vectorize_collection_name=False ), - wvc.config.Configure.Vectors.none(name="bringYourOwn"), + wvc.config.Configure.Vectors.self_provided(name="bringYourOwn"), ], ) uuid1 = uuid.uuid4() @@ -289,10 +289,10 @@ def test_named_vector_with_index_config(collection_factory: CollectionFactory) - vectorize_collection_name=False, vector_index_config=wvc.config.Configure.VectorIndex.flat( distance_metric=wvc.config.VectorDistances.HAMMING, - quantizer=wvc.config.Configure.VectorIndex.Quantizer.bq(rescore_limit=10), ), + quantizer=wvc.config.Configure.VectorIndex.Quantizer.bq(rescore_limit=10), ), - wvc.config.Configure.Vectors.none( + wvc.config.Configure.Vectors.self_provided( name="custom", ), wvc.config.Configure.Vectors.text2vec_contextionary( @@ -533,8 +533,8 @@ def test_named_vector_multi_target( collection = collection_factory( properties=[], vector_config=[ - wvc.config.Configure.Vectors.none(name="first"), - wvc.config.Configure.Vectors.none(name="second"), + wvc.config.Configure.Vectors.self_provided(name="first"), + wvc.config.Configure.Vectors.self_provided(name="second"), ], ) @@ -553,8 +553,8 @@ def test_named_vector_multi_target_vector_per_target(collection_factory: Collect collection = collection_factory( properties=[], vector_config=[ - wvc.config.Configure.Vectors.none(name="first"), - wvc.config.Configure.Vectors.none(name="second"), + wvc.config.Configure.Vectors.self_provided(name="first"), + wvc.config.Configure.Vectors.self_provided(name="second"), ], ) @@ -575,8 +575,8 @@ def test_multi_query_error_no_target_vector(collection_factory: CollectionFactor collection = collection_factory( properties=[], vector_config=[ - wvc.config.Configure.Vectors.none(name="first"), - wvc.config.Configure.Vectors.none(name="second"), + wvc.config.Configure.Vectors.self_provided(name="first"), + wvc.config.Configure.Vectors.self_provided(name="second"), ], ) @@ -622,8 +622,8 @@ def test_same_target_vector_multiple_input( collection = collection_factory( properties=[], vector_config=[ - wvc.config.Configure.Vectors.none(name="first"), - wvc.config.Configure.Vectors.none(name="second"), + wvc.config.Configure.Vectors.self_provided(name="first"), + wvc.config.Configure.Vectors.self_provided(name="second"), ], ) @@ -674,8 +674,8 @@ def test_same_target_vector_multiple_input_combinations( collection = collection_factory( properties=[], vector_config=[ - wvc.config.Configure.Vectors.none(name="first"), - wvc.config.Configure.Vectors.none(name="second"), + wvc.config.Configure.Vectors.self_provided(name="first"), + wvc.config.Configure.Vectors.self_provided(name="second"), ], ) @@ -700,8 +700,8 @@ def test_deprecated_syntax(collection_factory: CollectionFactory): collection = collection_factory( properties=[], vector_config=[ - wvc.config.Configure.Vectors.none(name="first"), - wvc.config.Configure.Vectors.none(name="second"), + wvc.config.Configure.Vectors.self_provided(name="first"), + wvc.config.Configure.Vectors.self_provided(name="second"), ], ) @@ -782,7 +782,7 @@ def test_colbert_vectors_byov(collection_factory: CollectionFactory) -> None: ) ], vector_config=[ - wvc.config.Configure.Vectors.none( + wvc.config.Configure.Vectors.self_provided( name="colbert", vector_index_config=wvc.config.Configure.VectorIndex.hnsw( multi_vector=wvc.config.Configure.VectorIndex.MultiVector.multi_vector( @@ -790,7 +790,7 @@ def test_colbert_vectors_byov(collection_factory: CollectionFactory) -> None: ) ), ), - wvc.config.Configure.Vectors.none( + wvc.config.Configure.Vectors.self_provided( name="regular", ), ], @@ -885,7 +885,7 @@ def test_colbert_vectors_jinaai(collection_factory: CollectionFactory) -> None: ) ], vector_config=[ - wvc.config.Configure.Vectors.text2colbert_jinaai( + wvc.config.Configure.MultiVectors.text2colbert_jinaai( name="colbert", ) ], diff --git a/weaviate/classes/config.py b/weaviate/classes/config.py index f6d0dcc04..651818de3 100644 --- a/weaviate/classes/config.py +++ b/weaviate/classes/config.py @@ -3,7 +3,6 @@ ConsistencyLevel, DataType, GenerativeSearches, - MultiVectorAggregation, PQEncoderDistribution, PQEncoderType, Property, @@ -15,7 +14,10 @@ Tokenization, VectorDistances, ) -from weaviate.collections.classes.config_vector_index import VectorFilterStrategy +from weaviate.collections.classes.config_vector_index import ( + MultiVectorAggregation, + VectorFilterStrategy, +) from weaviate.collections.classes.config_vectorizers import Multi2VecField, Vectorizers from weaviate.connect.integrations import Integrations diff --git a/weaviate/collections/classes/config.py b/weaviate/collections/classes/config.py index f1f8449c8..7753ec1e1 100644 --- a/weaviate/collections/classes/config.py +++ b/weaviate/collections/classes/config.py @@ -32,19 +32,18 @@ _NamedVectorsUpdate, ) from weaviate.collections.classes.config_vector_index import ( + PQEncoderDistribution, + PQEncoderType, VectorFilterStrategy, - _EncodingConfigCreate, - _MultiVectorConfigCreate, - _MuveraConfigCreate, - _QuantizerConfigCreate, + _BQConfigUpdate, + _PQConfigUpdate, + _PQEncoderConfigUpdate, + _SQConfigUpdate, + _VectorIndex, _VectorIndexConfigCreate, - _VectorIndexConfigDynamicCreate, _VectorIndexConfigDynamicUpdate, - _VectorIndexConfigFlatCreate, _VectorIndexConfigFlatUpdate, - _VectorIndexConfigHNSWCreate, _VectorIndexConfigHNSWUpdate, - _VectorIndexConfigSkipCreate, _VectorIndexConfigUpdate, ) from weaviate.collections.classes.config_vector_index import ( @@ -62,6 +61,7 @@ Vectorizers as VectorizersAlias, ) from weaviate.collections.classes.config_vectors import ( + _MultiVectors, _VectorConfigCreate, _VectorConfigUpdate, _Vectors, @@ -246,124 +246,6 @@ class ReplicationDeletionStrategy(str, BaseEnum): TIME_BASED_RESOLUTION = "TimeBasedResolution" -class PQEncoderType(str, BaseEnum): - """Type of the PQ encoder. - - Attributes: - KMEANS: K-means encoder. - TILE: Tile encoder. - """ - - KMEANS = "kmeans" - TILE = "tile" - - -class PQEncoderDistribution(str, BaseEnum): - """Distribution of the PQ encoder. - - Attributes: - LOG_NORMAL: Log-normal distribution. - NORMAL: Normal distribution. - """ - - LOG_NORMAL = "log-normal" - NORMAL = "normal" - - -class MultiVectorAggregation(str, BaseEnum): - """Aggregation type to use for multivector indices. - - Attributes: - MAX_SIM: Maximum similarity. - """ - - MAX_SIM = "maxSim" - - -class _PQEncoderConfigCreate(_ConfigCreateModel): - type_: Optional[PQEncoderType] = Field(serialization_alias="type") - distribution: Optional[PQEncoderDistribution] - - -class _PQEncoderConfigUpdate(_ConfigUpdateModel): - type_: Optional[PQEncoderType] - distribution: Optional[PQEncoderDistribution] - - def merge_with_existing(self, schema: Dict[str, Any]) -> Dict[str, Any]: - """Must be done manually since Pydantic does not work well with type and type_. - - Errors shadowing type occur if we want to use type as a field name. - """ - if self.type_ is not None: - schema["type"] = str(self.type_.value) - if self.distribution is not None: - schema["distribution"] = str(self.distribution.value) - return schema - - -class _PQConfigCreate(_QuantizerConfigCreate): - bitCompression: Optional[bool] = Field(default=None) - centroids: Optional[int] - encoder: _PQEncoderConfigCreate - segments: Optional[int] - trainingLimit: Optional[int] - - @staticmethod - def quantizer_name() -> str: - return "pq" - - -class _BQConfigCreate(_QuantizerConfigCreate): - cache: Optional[bool] - rescoreLimit: Optional[int] - - @staticmethod - def quantizer_name() -> str: - return "bq" - - -class _SQConfigCreate(_QuantizerConfigCreate): - cache: Optional[bool] - rescoreLimit: Optional[int] - trainingLimit: Optional[int] - - @staticmethod - def quantizer_name() -> str: - return "sq" - - -class _PQConfigUpdate(_QuantizerConfigUpdate): - bitCompression: Optional[bool] = Field(default=None) - centroids: Optional[int] - enabled: Optional[bool] - segments: Optional[int] - trainingLimit: Optional[int] - encoder: Optional[_PQEncoderConfigUpdate] - - @staticmethod - def quantizer_name() -> str: - return "pq" - - -class _BQConfigUpdate(_QuantizerConfigUpdate): - enabled: Optional[bool] - rescoreLimit: Optional[int] - - @staticmethod - def quantizer_name() -> str: - return "bq" - - -class _SQConfigUpdate(_QuantizerConfigUpdate): - enabled: Optional[bool] - rescoreLimit: Optional[int] - trainingLimit: Optional[int] - - @staticmethod - def quantizer_name() -> str: - return "sq" - - class _ShardingConfigCreate(_ConfigCreateModel): virtualPerPhysical: Optional[int] desiredCount: Optional[int] @@ -2125,197 +2007,6 @@ def __add_props( ret_dict["properties"] = existing_props -class _VectorIndexMultivectorEncoding: - @staticmethod - def muvera( - ksim: Optional[int] = None, - dprojections: Optional[int] = None, - repetitions: Optional[int] = None, - ) -> _EncodingConfigCreate: - return _MuveraConfigCreate( - enabled=True, - ksim=ksim, - dprojections=dprojections, - repetitions=repetitions, - ) - - -class _VectorIndexMultiVector: - Encoding = _VectorIndexMultivectorEncoding - - @staticmethod - def multi_vector( - encoding: Optional[_EncodingConfigCreate] = None, - aggregation: Optional[MultiVectorAggregation] = None, - ) -> _MultiVectorConfigCreate: - return _MultiVectorConfigCreate( - encoding=encoding if encoding is not None else None, - aggregation=aggregation.value if aggregation is not None else None, - ) - - -class _VectorIndexQuantizer: - @staticmethod - def pq( - bit_compression: Optional[bool] = None, - centroids: Optional[int] = None, - encoder_distribution: Optional[PQEncoderDistribution] = None, - encoder_type: Optional[PQEncoderType] = None, - segments: Optional[int] = None, - training_limit: Optional[int] = None, - ) -> _PQConfigCreate: - """Create a `_PQConfigCreate` object to be used when defining the product quantization (PQ) configuration of Weaviate. - - Use this method when defining the `quantizer` argument in the `vector_index` configuration. - - Args: - See [the docs](https://weaviate.io/developers/weaviate/concepts/vector-index#hnsw-with-compression) for a more detailed view! - """ # noqa: D417 (missing argument descriptions in the docstring) - if bit_compression is not None: - _Warnings.bit_compression_in_pq_config() - return _PQConfigCreate( - centroids=centroids, - segments=segments, - trainingLimit=training_limit, - encoder=_PQEncoderConfigCreate(type_=encoder_type, distribution=encoder_distribution), - ) - - @staticmethod - def bq( - cache: Optional[bool] = None, - rescore_limit: Optional[int] = None, - ) -> _BQConfigCreate: - """Create a `_BQConfigCreate` object to be used when defining the binary quantization (BQ) configuration of Weaviate. - - Use this method when defining the `quantizer` argument in the `vector_index` configuration. Note that the arguments have no effect for HNSW. - - Args: - See [the docs](https://weaviate.io/developers/weaviate/concepts/vector-index#binary-quantization) for a more detailed view! - """ # noqa: D417 (missing argument descriptions in the docstring) - return _BQConfigCreate( - cache=cache, - rescoreLimit=rescore_limit, - ) - - @staticmethod - def sq( - cache: Optional[bool] = None, - rescore_limit: Optional[int] = None, - training_limit: Optional[int] = None, - ) -> _SQConfigCreate: - """Create a `_SQConfigCreate` object to be used when defining the scalar quantization (SQ) configuration of Weaviate. - - Use this method when defining the `quantizer` argument in the `vector_index` configuration. Note that the arguments have no effect for HNSW. - - Args: - See [the docs](https://weaviate.io/developers/weaviate/concepts/vector-index#binary-quantization) for a more detailed view! - """ # noqa: D417 (missing argument descriptions in the docstring) - return _SQConfigCreate( - cache=cache, - rescoreLimit=rescore_limit, - trainingLimit=training_limit, - ) - - -class _VectorIndex: - MultiVector = _VectorIndexMultiVector - Quantizer = _VectorIndexQuantizer - - @staticmethod - def none() -> _VectorIndexConfigSkipCreate: - """Create a `_VectorIndexConfigSkipCreate` object to be used when configuring Weaviate to not index your vectors. - - Use this method when defining the `vector_index_config` argument in `collections.create()`. - """ - return _VectorIndexConfigSkipCreate( - distance=None, - quantizer=None, - multivector=None, - ) - - @staticmethod - def hnsw( - cleanup_interval_seconds: Optional[int] = None, - distance_metric: Optional[VectorDistances] = None, - dynamic_ef_factor: Optional[int] = None, - dynamic_ef_max: Optional[int] = None, - dynamic_ef_min: Optional[int] = None, - ef: Optional[int] = None, - ef_construction: Optional[int] = None, - filter_strategy: Optional[VectorFilterStrategy] = None, - flat_search_cutoff: Optional[int] = None, - max_connections: Optional[int] = None, - vector_cache_max_objects: Optional[int] = None, - quantizer: Optional[_QuantizerConfigCreate] = None, - multi_vector: Optional[_MultiVectorConfigCreate] = None, - ) -> _VectorIndexConfigHNSWCreate: - """Create a `_VectorIndexConfigHNSWCreate` object to be used when defining the HNSW vector index configuration of Weaviate. - - Use this method when defining the `vector_index_config` argument in `collections.create()`. - - Args: - See [the docs](https://weaviate.io/developers/weaviate/configuration/indexes#how-to-configure-hnsw) for a more detailed view! - """ # noqa: D417 (missing argument descriptions in the docstring) - return _VectorIndexConfigHNSWCreate( - cleanupIntervalSeconds=cleanup_interval_seconds, - distance=distance_metric, - dynamicEfMin=dynamic_ef_min, - dynamicEfMax=dynamic_ef_max, - dynamicEfFactor=dynamic_ef_factor, - efConstruction=ef_construction, - ef=ef, - filterStrategy=filter_strategy, - flatSearchCutoff=flat_search_cutoff, - maxConnections=max_connections, - vectorCacheMaxObjects=vector_cache_max_objects, - quantizer=quantizer, - multivector=multi_vector, - ) - - @staticmethod - def flat( - distance_metric: Optional[VectorDistances] = None, - vector_cache_max_objects: Optional[int] = None, - quantizer: Optional[_BQConfigCreate] = None, - ) -> _VectorIndexConfigFlatCreate: - """Create a `_VectorIndexConfigFlatCreate` object to be used when defining the FLAT vector index configuration of Weaviate. - - Use this method when defining the `vector_index_config` argument in `collections.create()`. - - Args: - See [the docs](https://weaviate.io/developers/weaviate/configuration/indexes#how-to-configure-hnsw) for a more detailed view! - """ # noqa: D417 (missing argument descriptions in the docstring) - return _VectorIndexConfigFlatCreate( - distance=distance_metric, - vectorCacheMaxObjects=vector_cache_max_objects, - quantizer=quantizer, - multivector=None, - ) - - @staticmethod - def dynamic( - distance_metric: Optional[VectorDistances] = None, - threshold: Optional[int] = None, - hnsw: Optional[_VectorIndexConfigHNSWCreate] = None, - flat: Optional[_VectorIndexConfigFlatCreate] = None, - ) -> _VectorIndexConfigDynamicCreate: - """Create a `_VectorIndexConfigDynamicCreate` object to be used when defining the DYNAMIC vector index configuration of Weaviate. - - Use this method when defining the `vector_index_config` argument in `collections.create()`. - - Args: - See [the docs](https://weaviate.io/developers/weaviate/configuration/indexes#how-to-configure-hnsw) for a more detailed view! - """ # noqa: D417 (missing argument descriptions in the docstring) - return _VectorIndexConfigDynamicCreate( - distance=distance_metric, - threshold=threshold, - hnsw=hnsw, - flat=flat, - quantizer=None, - multivector=None, - ) - - class Configure: """Use this factory class to generate the correct object for use when using the `collections.create()` method. E.g., `.multi_tenancy()` will return a `MultiTenancyConfigCreate` object to be used in the `multi_tenancy_config` argument. @@ -2329,6 +2020,7 @@ class Configure: VectorIndex = _VectorIndex NamedVectors = _NamedVectors Vectors = _Vectors + MultiVectors = _MultiVectors @staticmethod def inverted_index( diff --git a/weaviate/collections/classes/config_vector_index.py b/weaviate/collections/classes/config_vector_index.py index 89ac4cd7e..1f74ae1c1 100644 --- a/weaviate/collections/classes/config_vector_index.py +++ b/weaviate/collections/classes/config_vector_index.py @@ -11,6 +11,8 @@ _QuantizerConfigUpdate, ) from weaviate.collections.classes.config_vectorizers import VectorDistances +from weaviate.str_enum import BaseEnum +from weaviate.warnings import _Warnings class VectorFilterStrategy(str, Enum): @@ -42,7 +44,7 @@ class _MultiVectorConfigCreateBase(_ConfigCreateModel): enabled: bool = Field(default=True) -class _EncodingConfigCreate(_MultiVectorConfigCreateBase): +class _MultiVectorEncodingConfigCreate(_MultiVectorConfigCreateBase): enabled: bool = Field(default=True) @staticmethod @@ -50,7 +52,7 @@ class _EncodingConfigCreate(_MultiVectorConfigCreateBase): def encoding_name() -> str: ... -class _MuveraConfigCreate(_EncodingConfigCreate): +class _MuveraConfigCreate(_MultiVectorEncodingConfigCreate): ksim: Optional[int] dprojections: Optional[int] repetitions: Optional[int] @@ -61,7 +63,7 @@ def encoding_name() -> str: class _MultiVectorConfigCreate(_MultiVectorConfigCreateBase): - encoding: Optional[_EncodingConfigCreate] = Field(exclude=True) + encoding: Optional[_MultiVectorEncodingConfigCreate] = Field(exclude=True) aggregation: Optional[str] @@ -180,3 +182,312 @@ class _VectorIndexConfigDynamicUpdate(_VectorIndexConfigUpdate): @staticmethod def vector_index_type() -> VectorIndexType: return VectorIndexType.DYNAMIC + + +class PQEncoderType(str, BaseEnum): + """Type of the PQ encoder. + + Attributes: + KMEANS: K-means encoder. + TILE: Tile encoder. + """ + + KMEANS = "kmeans" + TILE = "tile" + + +class PQEncoderDistribution(str, BaseEnum): + """Distribution of the PQ encoder. + + Attributes: + LOG_NORMAL: Log-normal distribution. + NORMAL: Normal distribution. + """ + + LOG_NORMAL = "log-normal" + NORMAL = "normal" + + +class MultiVectorAggregation(str, BaseEnum): + """Aggregation type to use for multivector indices. + + Attributes: + MAX_SIM: Maximum similarity. + """ + + MAX_SIM = "maxSim" + + +class _PQEncoderConfigCreate(_ConfigCreateModel): + type_: Optional[PQEncoderType] = Field(serialization_alias="type") + distribution: Optional[PQEncoderDistribution] + + +class _PQEncoderConfigUpdate(_ConfigUpdateModel): + type_: Optional[PQEncoderType] + distribution: Optional[PQEncoderDistribution] + + def merge_with_existing(self, schema: Dict[str, Any]) -> Dict[str, Any]: + """Must be done manually since Pydantic does not work well with type and type_. + + Errors shadowing type occur if we want to use type as a field name. + """ + if self.type_ is not None: + schema["type"] = str(self.type_.value) + if self.distribution is not None: + schema["distribution"] = str(self.distribution.value) + return schema + + +class _PQConfigCreate(_QuantizerConfigCreate): + bitCompression: Optional[bool] = Field(default=None) + centroids: Optional[int] + encoder: _PQEncoderConfigCreate + segments: Optional[int] + trainingLimit: Optional[int] + + @staticmethod + def quantizer_name() -> str: + return "pq" + + +class _BQConfigCreate(_QuantizerConfigCreate): + cache: Optional[bool] + rescoreLimit: Optional[int] + + @staticmethod + def quantizer_name() -> str: + return "bq" + + +class _SQConfigCreate(_QuantizerConfigCreate): + cache: Optional[bool] + rescoreLimit: Optional[int] + trainingLimit: Optional[int] + + @staticmethod + def quantizer_name() -> str: + return "sq" + + +class _PQConfigUpdate(_QuantizerConfigUpdate): + bitCompression: Optional[bool] = Field(default=None) + centroids: Optional[int] + enabled: Optional[bool] + segments: Optional[int] + trainingLimit: Optional[int] + encoder: Optional[_PQEncoderConfigUpdate] + + @staticmethod + def quantizer_name() -> str: + return "pq" + + +class _BQConfigUpdate(_QuantizerConfigUpdate): + enabled: Optional[bool] + rescoreLimit: Optional[int] + + @staticmethod + def quantizer_name() -> str: + return "bq" + + +class _SQConfigUpdate(_QuantizerConfigUpdate): + enabled: Optional[bool] + rescoreLimit: Optional[int] + trainingLimit: Optional[int] + + @staticmethod + def quantizer_name() -> str: + return "sq" + + +class _VectorIndexMultivectorEncoding: + @staticmethod + def muvera( + ksim: Optional[int] = None, + dprojections: Optional[int] = None, + repetitions: Optional[int] = None, + ) -> _MultiVectorEncodingConfigCreate: + return _MuveraConfigCreate( + enabled=True, + ksim=ksim, + dprojections=dprojections, + repetitions=repetitions, + ) + + +class _VectorIndexMultiVector: + Encoding = _VectorIndexMultivectorEncoding + + @staticmethod + def multi_vector( + encoding: Optional[_MultiVectorEncodingConfigCreate] = None, + aggregation: Optional[MultiVectorAggregation] = None, + ) -> _MultiVectorConfigCreate: + return _MultiVectorConfigCreate( + encoding=encoding if encoding is not None else None, + aggregation=aggregation.value if aggregation is not None else None, + ) + + +class _VectorIndexQuantizer: + @staticmethod + def pq( + bit_compression: Optional[bool] = None, + centroids: Optional[int] = None, + encoder_distribution: Optional[PQEncoderDistribution] = None, + encoder_type: Optional[PQEncoderType] = None, + segments: Optional[int] = None, + training_limit: Optional[int] = None, + ) -> _PQConfigCreate: + """Create a `_PQConfigCreate` object to be used when defining the product quantization (PQ) configuration of Weaviate. + + Use this method when defining the `quantizer` argument in the `vector_index` configuration. + + Args: + See [the docs](https://weaviate.io/developers/weaviate/concepts/vector-index#hnsw-with-compression) for a more detailed view! + """ # noqa: D417 (missing argument descriptions in the docstring) + if bit_compression is not None: + _Warnings.bit_compression_in_pq_config() + return _PQConfigCreate( + centroids=centroids, + segments=segments, + trainingLimit=training_limit, + encoder=_PQEncoderConfigCreate(type_=encoder_type, distribution=encoder_distribution), + ) + + @staticmethod + def bq( + cache: Optional[bool] = None, + rescore_limit: Optional[int] = None, + ) -> _BQConfigCreate: + """Create a `_BQConfigCreate` object to be used when defining the binary quantization (BQ) configuration of Weaviate. + + Use this method when defining the `quantizer` argument in the `vector_index` configuration. Note that the arguments have no effect for HNSW. + + Args: + See [the docs](https://weaviate.io/developers/weaviate/concepts/vector-index#binary-quantization) for a more detailed view! + """ # noqa: D417 (missing argument descriptions in the docstring) + return _BQConfigCreate( + cache=cache, + rescoreLimit=rescore_limit, + ) + + @staticmethod + def sq( + cache: Optional[bool] = None, + rescore_limit: Optional[int] = None, + training_limit: Optional[int] = None, + ) -> _SQConfigCreate: + """Create a `_SQConfigCreate` object to be used when defining the scalar quantization (SQ) configuration of Weaviate. + + Use this method when defining the `quantizer` argument in the `vector_index` configuration. Note that the arguments have no effect for HNSW. + + Args: + See [the docs](https://weaviate.io/developers/weaviate/concepts/vector-index#binary-quantization) for a more detailed view! + """ # noqa: D417 (missing argument descriptions in the docstring) + return _SQConfigCreate( + cache=cache, + rescoreLimit=rescore_limit, + trainingLimit=training_limit, + ) + + +class _VectorIndex: + MultiVector = _VectorIndexMultiVector + Quantizer = _VectorIndexQuantizer + + @staticmethod + def none() -> _VectorIndexConfigSkipCreate: + """Create a `_VectorIndexConfigSkipCreate` object to be used when configuring Weaviate to not index your vectors. + + Use this method when defining the `vector_index_config` argument in `collections.create()`. + """ + return _VectorIndexConfigSkipCreate( + distance=None, + quantizer=None, + multivector=None, + ) + + @staticmethod + def hnsw( + cleanup_interval_seconds: Optional[int] = None, + distance_metric: Optional[VectorDistances] = None, + dynamic_ef_factor: Optional[int] = None, + dynamic_ef_max: Optional[int] = None, + dynamic_ef_min: Optional[int] = None, + ef: Optional[int] = None, + ef_construction: Optional[int] = None, + filter_strategy: Optional[VectorFilterStrategy] = None, + flat_search_cutoff: Optional[int] = None, + max_connections: Optional[int] = None, + vector_cache_max_objects: Optional[int] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, + multi_vector: Optional[_MultiVectorConfigCreate] = None, + ) -> _VectorIndexConfigHNSWCreate: + """Create a `_VectorIndexConfigHNSWCreate` object to be used when defining the HNSW vector index configuration of Weaviate. + + Use this method when defining the `vector_index_config` argument in `collections.create()`. + + Args: + See [the docs](https://weaviate.io/developers/weaviate/configuration/indexes#how-to-configure-hnsw) for a more detailed view! + """ # noqa: D417 (missing argument descriptions in the docstring) + return _VectorIndexConfigHNSWCreate( + cleanupIntervalSeconds=cleanup_interval_seconds, + distance=distance_metric, + dynamicEfMin=dynamic_ef_min, + dynamicEfMax=dynamic_ef_max, + dynamicEfFactor=dynamic_ef_factor, + efConstruction=ef_construction, + ef=ef, + filterStrategy=filter_strategy, + flatSearchCutoff=flat_search_cutoff, + maxConnections=max_connections, + vectorCacheMaxObjects=vector_cache_max_objects, + quantizer=quantizer, + multivector=multi_vector, + ) + + @staticmethod + def flat( + distance_metric: Optional[VectorDistances] = None, + vector_cache_max_objects: Optional[int] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, + ) -> _VectorIndexConfigFlatCreate: + """Create a `_VectorIndexConfigFlatCreate` object to be used when defining the FLAT vector index configuration of Weaviate. + + Use this method when defining the `vector_index_config` argument in `collections.create()`. + + Args: + See [the docs](https://weaviate.io/developers/weaviate/configuration/indexes#how-to-configure-hnsw) for a more detailed view! + """ # noqa: D417 (missing argument descriptions in the docstring) + return _VectorIndexConfigFlatCreate( + distance=distance_metric, + vectorCacheMaxObjects=vector_cache_max_objects, + quantizer=quantizer, + multivector=None, + ) + + @staticmethod + def dynamic( + distance_metric: Optional[VectorDistances] = None, + threshold: Optional[int] = None, + hnsw: Optional[_VectorIndexConfigHNSWCreate] = None, + flat: Optional[_VectorIndexConfigFlatCreate] = None, + ) -> _VectorIndexConfigDynamicCreate: + """Create a `_VectorIndexConfigDynamicCreate` object to be used when defining the DYNAMIC vector index configuration of Weaviate. + + Use this method when defining the `vector_index_config` argument in `collections.create()`. + + Args: + See [the docs](https://weaviate.io/developers/weaviate/configuration/indexes#how-to-configure-hnsw) for a more detailed view! + """ # noqa: D417 (missing argument descriptions in the docstring) + return _VectorIndexConfigDynamicCreate( + distance=distance_metric, + threshold=threshold, + hnsw=hnsw, + flat=flat, + quantizer=None, + multivector=None, + ) diff --git a/weaviate/collections/classes/config_vectors.py b/weaviate/collections/classes/config_vectors.py index fcc66cb2a..1d9c26b15 100644 --- a/weaviate/collections/classes/config_vectors.py +++ b/weaviate/collections/classes/config_vectors.py @@ -1,8 +1,6 @@ from typing import Any, Dict, List, Literal, Optional, Union -from deprecation import deprecated as docstring_deprecated from pydantic import AnyHttpUrl, Field -from typing_extensions import deprecated as typing_deprecated from weaviate.collections.classes.config_base import ( _ConfigCreateModel, @@ -11,6 +9,9 @@ ) from weaviate.collections.classes.config_vector_index import ( VectorIndexType, + _MultiVectorEncodingConfigCreate, + _QuantizerConfigCreate, + _VectorIndex, _VectorIndexConfigCreate, _VectorIndexConfigDynamicUpdate, _VectorIndexConfigFlatUpdate, @@ -63,8 +64,6 @@ _VectorizerCustomConfig, ) -from ...warnings import _Warnings - class _VectorConfigCreate(_ConfigCreateModel): name: Optional[str] @@ -96,89 +95,130 @@ class _VectorConfigUpdate(_ConfigUpdateModel): vectorIndexConfig: _VectorIndexConfigUpdate = Field(..., alias="vector_index_config") -class _Vectors: +class _IndexWrappers: + @staticmethod + def single( + vector_index_config: Optional[_VectorIndexConfigCreate], + quantizer: Optional[_QuantizerConfigCreate], + ) -> Optional[_VectorIndexConfigCreate]: + if quantizer is not None: + if vector_index_config is None: + vector_index_config = _VectorIndex.hnsw(quantizer=quantizer) + else: + vector_index_config.quantizer = quantizer + return vector_index_config + + @staticmethod + def multi( + vector_index_config: Optional[_VectorIndexConfigCreate], + encoding: Optional[_MultiVectorEncodingConfigCreate], + quantizer: Optional[_QuantizerConfigCreate], + ) -> Optional[_VectorIndexConfigCreate]: + if encoding is not None: + if vector_index_config is None: + vector_index_config = _VectorIndex.hnsw( + multi_vector=_VectorIndex.MultiVector.multi_vector(encoding=encoding) + ) + else: + vector_index_config.multivector = _VectorIndex.MultiVector.multi_vector( + encoding=encoding + ) + return _IndexWrappers.single(vector_index_config, quantizer) + + +class _MultiVectors: @staticmethod - def none( + def text2colbert_jinaai( *, name: Optional[str] = None, + encoding: Optional[_MultiVectorEncodingConfigCreate] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, + dimensions: Optional[int] = None, + model: Optional[str] = None, + source_properties: Optional[List[str]] = None, vector_index_config: Optional[_VectorIndexConfigCreate] = None, - ): - """Create a named vector using no vectorizer. You will need to provide the vectors yourself. + vectorize_collection_name: bool = True, + ) -> _VectorConfigCreate: + """Create a multi-vector using the `text2colbert_jinaai` module. + + See the [documentation](https://weaviate.io/developers/weaviate/model-providers/jinaai/colbert) for detailed usage. Args: - name: The name of the named vector. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + name: The name of the vector. + encoding: The type of multi-vector encoding to use in the vector index. Defaults to `None`, which uses the server-defined default. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. + dimensions: Number of dimensions. Applicable to v3 OpenAI models only. Defaults to `None`, which uses the server-defined default. + model: The model to use. Defaults to `None`, which uses the server-defined default. + encoding: The type of multi-vector encoding to use in the vector index. Defaults to `None`, which uses the server-defined default. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. """ return _VectorConfigCreate( name=name, - vectorizer=_VectorizerConfigCreate(vectorizer=Vectorizers.NONE), - vector_index_config=vector_index_config, + source_properties=source_properties, + vector_index_config=_IndexWrappers.multi(vector_index_config, encoding, quantizer), + vectorizer=_Text2ColbertJinaAIConfig( + model=model, dimensions=dimensions, vectorizeClassName=vectorize_collection_name + ), ) + +class _Vectors: @staticmethod - def custom( + def self_provided( *, name: Optional[str] = None, - module_name: str, - module_config: Optional[Dict[str, Any]] = None, - source_properties: Optional[List[str]] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, vector_index_config: Optional[_VectorIndexConfigCreate] = None, - ) -> _VectorConfigCreate: - """Create a named vector using no vectorizer. You will need to provide the vectors yourself. + ): + """Create a vector using no vectorizer. You will need to provide the vectors yourself. Args: - name: The name of the named vector. - module_name: The name of the custom module to use. - module_config: The configuration of the custom module to use. - source_properties: Which properties should be included when vectorizing. By default all text properties are included. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default """ return _VectorConfigCreate( name=name, - source_properties=source_properties, - vectorizer=_VectorizerCustomConfig( - vectorizer=_EnumLikeStr(module_name), module_config=module_config - ), - vector_index_config=vector_index_config, + vectorizer=_VectorizerConfigCreate(vectorizer=Vectorizers.NONE), + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod - def text2colbert_jinaai( + def custom( *, name: Optional[str] = None, - dimensions: Optional[int] = None, - model: Optional[str] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, + module_name: str, + module_config: Optional[Dict[str, Any]] = None, source_properties: Optional[List[str]] = None, vector_index_config: Optional[_VectorIndexConfigCreate] = None, - vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a named vector using the `text2colbert_jinaai` module. - - See the [documentation](https://weaviate.io/developers/weaviate/model-providers/jinaai/colbert) - for detailed usage. + """Create a vector using a custom module that is not currently supported by the SDK. Args: - name: The name of the named vector. + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. + module_name: The name of the custom module to use. + module_config: The configuration of the custom module to use. source_properties: Which properties should be included when vectorizing. By default all text properties are included. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default - vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. - vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. - model: The model to use. Defaults to `None`, which uses the server-defined default. - dimensions: Number of dimensions. Applicable to v3 OpenAI models only. Defaults to `None`, which uses the server-defined default. + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default """ return _VectorConfigCreate( name=name, source_properties=source_properties, - vector_index_config=vector_index_config, - vectorizer=_Text2ColbertJinaAIConfig( - model=model, dimensions=dimensions, vectorizeClassName=vectorize_collection_name + vectorizer=_VectorizerCustomConfig( + vectorizer=_EnumLikeStr(module_name), module_config=module_config ), + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod def text2vec_cohere( *, name: Optional[str] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, base_url: Optional[AnyHttpUrl] = None, model: Optional[Union[CohereModel, str]] = None, truncate: Optional[CohereTruncation] = None, @@ -186,20 +226,20 @@ def text2vec_cohere( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a named vector using the `text2vec_cohere` model. + """Create a vector using the `text2vec_cohere` model. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/cohere/embeddings) for detailed usage. Args: - name: The name of the named vector. - source_properties: Which properties should be included when vectorizing. By default all text properties are included. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default - vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. + base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. model: The model to use. Defaults to `None`, which uses the server-defined default. truncate: The truncation strategy to use. Defaults to `None`, which uses the server-defined default. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. - base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. Raises: pydantic.ValidationError: If `model` is not a valid value from the `CohereModel` type or if `truncate` is not a valid value from the `CohereTruncation` type. @@ -213,13 +253,14 @@ def text2vec_cohere( truncate=truncate, vectorizeClassName=vectorize_collection_name, ), - vector_index_config=vector_index_config, + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod def multi2vec_cohere( *, name: Optional[str] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, base_url: Optional[AnyHttpUrl] = None, image_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, model: Optional[Union[CohereMultimodalModel, str]] = None, @@ -228,20 +269,21 @@ def multi2vec_cohere( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a named vector using the `multi2vec_cohere` model. + """Create a vector using the `multi2vec_cohere` model. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/cohere/embeddings-multimodal) for detailed usage. Args: - name: The name of the named vector. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default - vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. - model: The model to use. Defaults to `None`, which uses the server-defined default. - truncate: The truncation strategy to use. Defaults to `None`, which uses the server-defined default. + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. image_fields: The image fields to use in vectorization. + model: The model to use. Defaults to `None`, which uses the server-defined default. text_fields: The text fields to use in vectorization. + truncate: The truncation strategy to use. Defaults to `None`, which uses the server-defined default. + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. Raises: 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. @@ -256,26 +298,28 @@ def multi2vec_cohere( imageFields=_map_multi2vec_fields(image_fields), textFields=_map_multi2vec_fields(text_fields), ), - vector_index_config=vector_index_config, + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod def text2vec_contextionary( *, name: Optional[str] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, source_properties: Optional[List[str]] = None, vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a named vector using the `text2vec_contextionary` model. + """Create a vector using the `text2vec_contextionary` model. See the [documentation](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/text2vec-contextionary) for detailed usage. Args: - name: The name of the named vector. + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. source_properties: Which properties should be included when vectorizing. By default all text properties are included. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. """ return _VectorConfigCreate( @@ -284,31 +328,33 @@ def text2vec_contextionary( vectorizer=_Text2VecContextionaryConfig( vectorizeClassName=vectorize_collection_name, ), - vector_index_config=vector_index_config, + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod def text2vec_databricks( *, name: Optional[str] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, endpoint: str, instruction: Optional[str] = None, source_properties: Optional[List[str]] = None, vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a named vector using the `text2vec-databricks` model. + """Create a vector using the `text2vec-databricks` model. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/databricks/embeddings) for detailed usage. Args: - name: The name of the named vector. - source_properties: Which properties should be included when vectorizing. By default all text properties are included. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default - vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. endpoint: The endpoint to use. instruction: The instruction strategy to use. Defaults to `None`, which uses the server-defined default. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. """ return _VectorConfigCreate( name=name, @@ -318,30 +364,32 @@ def text2vec_databricks( instruction=instruction, vectorizeClassName=vectorize_collection_name, ), - vector_index_config=vector_index_config, + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod def text2vec_mistral( *, name: Optional[str] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, base_url: Optional[AnyHttpUrl] = None, model: Optional[str] = None, source_properties: Optional[List[str]] = None, vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a named vector using the `text2vec-mistral` model. + """Create a vector using the `text2vec-mistral` model. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/mistral/embeddings) for detailed usage. Args: - name: The name of the named vector. + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. model: The model to use. Defaults to `None`, which uses the server-defined default. source_properties: Which properties should be included when vectorizing. By default all text properties are included. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. """ return _VectorConfigCreate( @@ -352,33 +400,35 @@ def text2vec_mistral( model=model, vectorizeClassName=vectorize_collection_name, ), - vector_index_config=vector_index_config, + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod def text2vec_ollama( *, name: Optional[str] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, api_endpoint: Optional[str] = None, model: Optional[str] = None, source_properties: Optional[List[str]] = None, vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a named vector using the `text2vec-ollama` model. + """Create a vector using the `text2vec-ollama` model. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/ollama/embeddings) for detailed usage. Args: - name: The name of the named vector. - source_properties: Which properties should be included when vectorizing. By default all text properties are included. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default - vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. - model: The model to use. Defaults to `None`, which uses the server-defined default. - vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. api_endpoint: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. Docker users may need to specify an alias, such as `http://host.docker.internal:11434` so that the container can access the host machine. + model: The model to use. Defaults to `None`, which uses the server-defined default. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + """ return _VectorConfigCreate( @@ -389,13 +439,14 @@ def text2vec_ollama( model=model, vectorizeClassName=vectorize_collection_name, ), - vector_index_config=vector_index_config, + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod def text2vec_openai( *, name: Optional[str] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, base_url: Optional[AnyHttpUrl] = None, dimensions: Optional[int] = None, model: Optional[Union[OpenAIModel, str]] = None, @@ -405,22 +456,22 @@ def text2vec_openai( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a named vector using the `text2vec_openai` model. + """Create a vector using the `text2vec_openai` model. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/openai/embeddings) for detailed usage. Args: - name: The name of the named vector. - source_properties: Which properties should be included when vectorizing. By default all text properties are included. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default - vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. + base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. + dimensions: Number of dimensions. Applicable to v3 OpenAI models only. Defaults to `None`, which uses the server-defined default. model: The model to use. Defaults to `None`, which uses the server-defined default. model_version: The model version to use. Defaults to `None`, which uses the server-defined default. type_: The type of model to use. Defaults to `None`, which uses the server-defined default. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. - base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. - dimensions: Number of dimensions. Applicable to v3 OpenAI models only. Defaults to `None`, which uses the server-defined default. Raises: pydantic.ValidationError: If `type_` is not a valid value from the `OpenAIType` type. @@ -436,34 +487,36 @@ def text2vec_openai( vectorizeClassName=vectorize_collection_name, dimensions=dimensions, ), - vector_index_config=vector_index_config, + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod def text2vec_aws( *, - region: str, name: Optional[str] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, endpoint: Optional[str] = None, model: Optional[Union[AWSModel, str]] = None, + region: str, service: Union[AWSService, str] = "bedrock", source_properties: Optional[List[str]] = None, vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a named vector using the `text2vec_aws` model. + """Create a vector using the `text2vec_aws` model. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/aws/embeddings) for detailed usage. Args: - name: The name of the named vector. - region: The AWS region to run the model from, REQUIRED. + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. endpoint: The endpoint to use. Defaults to `None`, which uses the server-defined default. model: The model to use. + region: The AWS region to run the model from, REQUIRED. service: The AWS service to use. Defaults to `bedrock`. source_properties: Which properties should be included when vectorizing. By default all text properties are included. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. """ return _VectorConfigCreate( @@ -476,13 +529,14 @@ def text2vec_aws( service=service, vectorizeClassName=vectorize_collection_name, ), - vector_index_config=vector_index_config, + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod def img2vec_neural( *, name: Optional[str] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, image_fields: List[str], vector_index_config: Optional[_VectorIndexConfigCreate] = None, ) -> _VectorConfigCreate: @@ -492,9 +546,10 @@ def img2vec_neural( for detailed usage. Args: - name: The name of the named vector. + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. image_fields: The image fields to use. This is a required field and must match the property fields of the collection that are defined as `DataType.BLOB`. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default Raises: pydantic.ValidationError: If `image_fields` is not a `list`. @@ -502,31 +557,34 @@ def img2vec_neural( return _VectorConfigCreate( name=name, vectorizer=_Img2VecNeuralConfig(imageFields=image_fields), - vector_index_config=vector_index_config, + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod def multi2vec_clip( *, name: Optional[str] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, inference_url: Optional[str] = None, image_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, text_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a named vector using the `multi2vec_clip` model. + """Create a vector using the `multi2vec_clip` model. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/transformers/embeddings-multimodal) for detailed usage. Args: - name: The name of the named vector. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default - vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. + inference_url: The inference url to use where API requests should go. Defaults to `None`, which uses the server-defined default. image_fields: The image fields to use in vectorization. text_fields: The text fields to use in vectorization. - inference_url: The inference url to use where API requests should go. Defaults to `None`, which uses the server-defined default. + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + """ return _VectorConfigCreate( name=name, @@ -536,100 +594,43 @@ def multi2vec_clip( vectorizeClassName=vectorize_collection_name, inferenceUrl=inference_url, ), - vector_index_config=vector_index_config, - ) - - @staticmethod - @docstring_deprecated( - deprecated_in="4.9.0", - details=""" -This method is deprecated and will be removed in Q2 '25. Please use :meth:`~weaviate.collections.classes.config._NamedVectors.multi2vec_google` instead. -""", - ) - @typing_deprecated( - "This method is deprecated and will be removed in Q2 '25. Please use `multi2vec_google` instead." - ) - def multi2vec_palm( - *, - name: Optional[str] = None, - vector_index_config: Optional[_VectorIndexConfigCreate] = None, - vectorize_collection_name: bool = True, - location: str, - project_id: str, - image_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, - text_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, - video_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, - dimensions: Optional[int] = None, - video_interval_seconds: Optional[int] = None, - model_id: Optional[str] = None, - ) -> _VectorConfigCreate: - """Create a named vector using the `multi2vec_palm` model. - - See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings-multimodal) - for detailed usage. - - Args: - name: The name of the named vector. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default - vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. - location: Where the model runs. REQUIRED. - project_id: The project ID to use, REQUIRED. - image_fields: The image fields to use in vectorization. - text_fields: The text fields to use in vectorization. - video_fields: The video fields to use in vectorization. - dimensions: The number of dimensions to use. Defaults to `None`, which uses the server-defined default. - video_interval_seconds: Length of a video interval. Defaults to `None`, which uses the server-defined default. - model_id: The model ID to use. Defaults to `None`, which uses the server-defined default. - """ - _Warnings.palm_to_google_m2v() - return _VectorConfigCreate( - name=name, - vectorizer=_Multi2VecGoogleConfig( - projectId=project_id, - location=location, - imageFields=_map_multi2vec_fields(image_fields), - textFields=_map_multi2vec_fields(text_fields), - videoFields=_map_multi2vec_fields(video_fields), - dimensions=dimensions, - modelId=model_id, - videoIntervalSeconds=video_interval_seconds, - vectorizeClassName=vectorize_collection_name, - ), - vector_index_config=vector_index_config, + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod def multi2vec_google( *, name: Optional[str] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, + dimensions: Optional[int] = None, + image_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, location: str, + model_id: Optional[str] = None, project_id: str, - image_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, text_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, video_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, - dimensions: Optional[int] = None, video_interval_seconds: Optional[int] = None, - model_id: Optional[str] = None, vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a named vector using the `multi2vec_google` model. + """Create a vector using the `multi2vec_google` model. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings-multimodal) for detailed usage. Args: - name: The name of the named vector. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default - vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. + dimensions: The number of dimensions to use. Defaults to `None`, which uses the server-defined default. + image_fields: The image fields to use in vectorization. location: Where the model runs. REQUIRED. + model_id: The model ID to use. Defaults to `None`, which uses the server-defined default. project_id: The project ID to use, REQUIRED. - image_fields: The image fields to use in vectorization. text_fields: The text fields to use in vectorization. video_fields: The video fields to use in vectorization. - dimensions: The number of dimensions to use. Defaults to `None`, which uses the server-defined default. video_interval_seconds: Length of a video interval. Defaults to `None`, which uses the server-defined default. - model_id: The model ID to use. Defaults to `None`, which uses the server-defined default. + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. """ return _VectorConfigCreate( name=name, @@ -644,13 +645,14 @@ def multi2vec_google( videoIntervalSeconds=video_interval_seconds, vectorizeClassName=vectorize_collection_name, ), - vector_index_config=vector_index_config, + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod def multi2vec_bind( *, name: Optional[str] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, audio_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, depth_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, image_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, @@ -661,13 +663,14 @@ def multi2vec_bind( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a named vector using the `multi2vec_bind` model. + """Create a vector using the `multi2vec_bind` model. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/imagebind/embeddings-multimodal) for detailed usage. Args: - name: The name of the named vector. + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. audio_fields: The audio fields to use in vectorization. depth_fields: The depth fields to use in vectorization. image_fields: The image fields to use in vectorization. @@ -675,7 +678,7 @@ def multi2vec_bind( text_fields: The text fields to use in vectorization. thermal_fields: The thermal fields to use in vectorization. video_fields: The video fields to use in vectorization. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. """ return _VectorConfigCreate( @@ -690,36 +693,39 @@ def multi2vec_bind( videoFields=_map_multi2vec_fields(video_fields), vectorizeClassName=vectorize_collection_name, ), - vector_index_config=vector_index_config, + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod def multi2vec_voyageai( *, name: Optional[str] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, base_url: Optional[AnyHttpUrl] = None, + image_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, model: Optional[Union[VoyageMultimodalModel, str]] = None, - truncation: Optional[bool] = None, output_encoding: Optional[str] = None, - image_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, text_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, + truncation: Optional[bool] = None, vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a named vector using the `multi2vec_voyageai` model. + """Create a vector using the `multi2vec_voyageai` model. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/voyageai/embeddings-multimodal) for detailed usage. Args: - name: The name of the named vector. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default - vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. - model: The model to use. Defaults to `None`, which uses the server-defined default. - truncation: The truncation strategy to use. Defaults to `None`, which uses the server-defined default. + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. image_fields: The image fields to use in vectorization. + model: The model to use. Defaults to `None`, which uses the server-defined default. + output_encoding: The output encoding to use. Defaults to `None`, which uses the server-defined default. text_fields: The text fields to use in vectorization. + truncation: The truncation strategy to use. Defaults to `None`, which uses the server-defined default. + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. Raises: pydantic.ValidationError: If `model` is not a valid value from the `VoyageaiMultimodalModel` type. @@ -735,36 +741,39 @@ def multi2vec_voyageai( imageFields=_map_multi2vec_fields(image_fields), textFields=_map_multi2vec_fields(text_fields), ), - vector_index_config=vector_index_config, + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod def multi2vec_nvidia( *, name: Optional[str] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, base_url: Optional[AnyHttpUrl] = None, + image_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, model: Optional[str] = None, - truncation: Optional[bool] = None, output_encoding: Optional[str] = None, - image_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, text_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, + truncation: Optional[bool] = None, vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a named vector using the `multi2vec_nvidia` model. + """Create a vector using the `multi2vec_nvidia` model. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/nvidia/embeddings-multimodal) for detailed usage. Args: - name: The name of the named vector. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default - vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. - model: The model to use. Defaults to `None`, which uses the server-defined default. - truncation: The truncation strategy to use. Defaults to `None`, which uses the server-defined default. + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. image_fields: The image fields to use in vectorization. + model: The model to use. Defaults to `None`, which uses the server-defined default. + output_encoding: The output encoding to use. Defaults to `None`, which uses the server-defined default. text_fields: The text fields to use in vectorization. + truncation: The truncation strategy to use. Defaults to `None`, which uses the server-defined default. + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. Raises: pydantic.ValidationError: If `model` is not a valid value from the `NvidiaMultimodalModel` type. @@ -780,27 +789,29 @@ def multi2vec_nvidia( imageFields=_map_multi2vec_fields(image_fields), textFields=_map_multi2vec_fields(text_fields), ), - vector_index_config=vector_index_config, + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod def ref2vec_centroid( *, name: Optional[str] = None, - reference_properties: List[str], + quantizer: Optional[_QuantizerConfigCreate] = None, method: Literal["mean"] = "mean", + reference_properties: List[str], vector_index_config: Optional[_VectorIndexConfigCreate] = None, ) -> _VectorConfigCreate: - """Create a named vector using the `ref2vec_centroid` model. + """Create a vector using the `ref2vec_centroid` model. See the [documentation](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/text2vec-gpt4all) for detailed usage. Args: - name: The name of the named vector. - reference_properties: The reference properties to use in vectorization, REQUIRED. + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. method: The method to use. Defaults to `mean`. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + reference_properties: The reference properties to use in vectorization, REQUIRED. + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default """ return _VectorConfigCreate( name=name, @@ -808,36 +819,38 @@ def ref2vec_centroid( referenceProperties=reference_properties, method=method, ), - vector_index_config=vector_index_config, + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod def text2vec_azure_openai( *, name: Optional[str] = None, - resource_name: str, - deployment_id: str, + quantizer: Optional[_QuantizerConfigCreate] = None, base_url: Optional[AnyHttpUrl] = None, + deployment_id: str, dimensions: Optional[int] = None, model: Optional[str] = None, + resource_name: str, source_properties: Optional[List[str]] = None, vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a named vector using the `text2vec_azure_openai` model. + """Create a vector using the `text2vec_azure_openai` model. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/openai-azure/embeddings) for detailed usage. Args: - name: The name of the named vector. - resource_name: The resource name to use, REQUIRED. - deployment_id: The deployment ID to use, REQUIRED. + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. + deployment_id: The deployment ID to use, REQUIRED. dimensions: The dimensionality of the vectors. Defaults to `None`, which uses the server-defined default. model: The model to use. Defaults to `None`, which uses the server-defined default. + resource_name: The resource name to use, REQUIRED. source_properties: Which properties should be included when vectorizing. By default all text properties are included. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. """ return _VectorConfigCreate( @@ -851,26 +864,28 @@ def text2vec_azure_openai( deploymentId=deployment_id, vectorizeClassName=vectorize_collection_name, ), - vector_index_config=vector_index_config, + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod def text2vec_gpt4all( *, name: Optional[str] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, source_properties: Optional[List[str]] = None, vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a named vector using the `text2vec_gpt4all` model. + """Create a vector using the `text2vec_gpt4all` model. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/gpt4all/embeddings) for detailed usage. Args: - name: The name of the named vector. + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. source_properties: Which properties should be included when vectorizing. By default all text properties are included. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. """ return _VectorConfigCreate( @@ -879,17 +894,18 @@ def text2vec_gpt4all( vectorizer=_Text2VecGPT4AllConfig( vectorizeClassName=vectorize_collection_name, ), - vector_index_config=vector_index_config, + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod def text2vec_huggingface( *, name: Optional[str] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, + endpoint_url: Optional[AnyHttpUrl] = None, model: Optional[str] = None, passage_model: Optional[str] = None, query_model: Optional[str] = None, - endpoint_url: Optional[AnyHttpUrl] = None, wait_for_model: Optional[bool] = None, use_gpu: Optional[bool] = None, use_cache: Optional[bool] = None, @@ -897,23 +913,24 @@ def text2vec_huggingface( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a named vector using the `text2vec_huggingface` model. + """Create a vector using the `text2vec_huggingface` model. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/huggingface/embeddings) for detailed usage. Args: - name: The name of the named vector. - source_properties: Which properties should be included when vectorizing. By default all text properties are included. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default - vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. + endpoint_url: The endpoint URL to use. Defaults to `None`, which uses the server-defined default. model: The model to use. Defaults to `None`, which uses the server-defined default. passage_model: The passage model to use. Defaults to `None`, which uses the server-defined default. query_model: The query model to use. Defaults to `None`, which uses the server-defined default. - endpoint_url: The endpoint URL to use. Defaults to `None`, which uses the server-defined default. wait_for_model: Whether to wait for the model to be loaded. Defaults to `None`, which uses the server-defined default. use_gpu: Whether to use the GPU. Defaults to `None`, which uses the server-defined default. use_cache: Whether to use the cache. Defaults to `None`, which uses the server-defined default. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. Raises: pydantic.ValidationError: If the arguments passed to the function are invalid. @@ -933,36 +950,37 @@ def text2vec_huggingface( useCache=use_cache, vectorizeClassName=vectorize_collection_name, ), - vector_index_config=vector_index_config, + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod def text2vec_google( *, name: Optional[str] = None, - project_id: str, + quantizer: Optional[_QuantizerConfigCreate] = None, api_endpoint: Optional[str] = None, model_id: Optional[str] = None, + project_id: str, title_property: Optional[str] = None, source_properties: Optional[List[str]] = None, vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a named vector using the `text2vec_palm` model. + """Create a vector using the `text2vec_palm` model. See the [documentation]https://weaviate.io/developers/weaviate/model-providers/google/embeddings) for detailed usage. Args: - name: The name of the named vector. - source_properties: Which properties should be included when vectorizing. By default all text properties are included. - project_id: The project ID to use, REQUIRED. - source_properties: Which properties should be included when vectorizing. By default all text properties are included. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default - vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. api_endpoint: The API endpoint to use without a leading scheme such as `http://`. Defaults to `None`, which uses the server-defined default model_id: The model ID to use. Defaults to `None`, which uses the server-defined default. + project_id: The project ID to use, REQUIRED. title_property: The Weaviate property name for the `gecko-002` or `gecko-003` model to use as the title. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. Raises: pydantic.ValidationError: If `api_endpoint` is not a valid URL. @@ -977,32 +995,33 @@ def text2vec_google( vectorizeClassName=vectorize_collection_name, titleProperty=title_property, ), - vector_index_config=vector_index_config, + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod def text2vec_google_aistudio( *, name: Optional[str] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, model_id: Optional[str] = None, title_property: Optional[str] = None, source_properties: Optional[List[str]] = None, vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a named vector using the `text2vec_palm` model. + """Create a vector using the `text2vec_palm` model. See the [documentation]https://weaviate.io/developers/weaviate/model-providers/google/embeddings) for detailed usage. Args: - name: The name of the named vector. - source_properties: Which properties should be included when vectorizing. By default all text properties are included. - source_properties: Which properties should be included when vectorizing. By default all text properties are included. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default - vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. model_id: The model ID to use. Defaults to `None`, which uses the server-defined default. title_property: The Weaviate property name for the `gecko-002` or `gecko-003` model to use as the title. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. Raises: pydantic.ValidationError: If `api_endpoint` is not a valid URL. @@ -1017,35 +1036,37 @@ def text2vec_google_aistudio( vectorizeClassName=vectorize_collection_name, titleProperty=title_property, ), - vector_index_config=vector_index_config, + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod def text2vec_transformers( *, name: Optional[str] = None, - pooling_strategy: Literal["masked_mean", "cls"] = "masked_mean", + quantizer: Optional[_QuantizerConfigCreate] = None, inference_url: Optional[str] = None, passage_inference_url: Optional[str] = None, + pooling_strategy: Literal["masked_mean", "cls"] = "masked_mean", query_inference_url: Optional[str] = None, source_properties: Optional[List[str]] = None, vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a named vector using the `text2vec_transformers` model. + """Create a vector using the `text2vec_transformers` model. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/transformers/embeddings) for detailed usage. Args: - name: The name of the named vector. - source_properties: Which properties should be included when vectorizing. By default all text properties are included. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default - vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. - pooling_strategy: The pooling strategy to use. Defaults to `masked_mean`. + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. inference_url: The inferenceUrl to use where API requests should go. You can use either this OR passage/query_inference_url. Defaults to `None`, which uses the server-defined default. passage_inference_url: The inferenceUrl to use where passage API requests should go. You can use either this and query_inference_url OR inference_url. Defaults to `None`, which uses the server-defined default. + pooling_strategy: The pooling strategy to use. Defaults to `masked_mean`. query_inference_url: The inferenceUrl to use where query API requests should go. You can use either this and passage_inference_url OR inference_url. Defaults to `None`, which uses the server-defined default. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. """ return _VectorConfigCreate( name=name, @@ -1057,13 +1078,14 @@ def text2vec_transformers( passageInferenceUrl=passage_inference_url, queryInferenceUrl=query_inference_url, ), - vector_index_config=vector_index_config, + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod def text2vec_jinaai( *, name: Optional[str] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, base_url: Optional[str] = None, dimensions: Optional[int] = None, model: Optional[Union[JinaModel, str]] = None, @@ -1071,18 +1093,19 @@ def text2vec_jinaai( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a named vector using the `text2vec-jinaai` model. + """Create a vector using the `text2vec-jinaai` model. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/jinaai/embeddings) for detailed usage. Args: - name: The name of the named vector. - source_properties: Which properties should be included when vectorizing. By default all text properties are included. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default - vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. base_url: The base URL to send the vectorization requests to. Defaults to `None`, which uses the server-defined default. dimensions: The number of dimensions for the generated embeddings. Defaults to `None`, which uses the server-defined default. model: The model to use. Defaults to `None`, which uses the server-defined default. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. """ return _VectorConfigCreate( name=name, @@ -1093,35 +1116,37 @@ def text2vec_jinaai( model=model, vectorizeClassName=vectorize_collection_name, ), - vector_index_config=vector_index_config, + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod def multi2vec_jinaai( *, name: Optional[str] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, base_url: Optional[AnyHttpUrl] = None, - model: Optional[Union[JinaMultimodalModel, str]] = None, dimensions: Optional[int] = None, image_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, + model: Optional[Union[JinaMultimodalModel, str]] = None, text_fields: Optional[Union[List[str], List[Multi2VecField]]] = None, vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a named vector using the `multi2vec_jinaai` model. + """Create a vector using the `multi2vec_jinaai` model. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/jinaai/embeddings-multimodal) for detailed usage. Args: - name: The name of the named vector. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default - vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. - model: The model to use. Defaults to `None`, which uses the server-defined default. + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. dimensions: The number of dimensions for the generated embeddings (only available for some models). Defaults to `None`, which uses the server-defined default. image_fields: The image fields to use in vectorization. + model: The model to use. Defaults to `None`, which uses the server-defined default. text_fields: The text fields to use in vectorization. + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. Raises: pydantic.ValidationError: If `model` is not a valid value from the `JinaMultimodalModel` type. @@ -1136,35 +1161,37 @@ def multi2vec_jinaai( imageFields=_map_multi2vec_fields(image_fields), textFields=_map_multi2vec_fields(text_fields), ), - vector_index_config=vector_index_config, + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod def text2vec_voyageai( *, name: Optional[str] = None, - model: Optional[Union[VoyageModel, str]] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, base_url: Optional[str] = None, + model: Optional[Union[VoyageModel, str]] = None, truncate: Optional[bool] = None, source_properties: Optional[List[str]] = None, vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a named vector using the `text2vec-jinaai` model. + """Create a vector using the `text2vec-jinaai` model. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/voyageai/embeddings) for detailed usage. Args: - name: The name of the named vector. - source_properties: Which properties should be included when vectorizing. By default all text properties are included. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default - vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. + base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. model: The model to use. Defaults to `None`, which uses the server-defined default. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/voyageai/embeddings#available-models) for more details. - base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. truncate: Whether to truncate the input texts to fit within the context length. Defaults to `None`, which uses the server-defined default. + source_properties: Which properties should be included when vectorizing. By default all text properties are included. + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default + vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. """ return _VectorConfigCreate( name=name, @@ -1175,16 +1202,17 @@ def text2vec_voyageai( baseURL=base_url, truncate=truncate, ), - vector_index_config=vector_index_config, + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod def text2vec_weaviate( *, name: Optional[str] = None, - model: Optional[Union[WeaviateModel, str]] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, base_url: Optional[str] = None, dimensions: Optional[int] = None, + model: Optional[Union[WeaviateModel, str]] = None, source_properties: Optional[List[str]] = None, vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, @@ -1198,34 +1226,37 @@ def text2vec_weaviate( baseURL=base_url, dimensions=dimensions, ), - vector_index_config=vector_index_config, + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @staticmethod def text2vec_nvidia( *, name: Optional[str] = None, - model: Optional[str] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, base_url: Optional[str] = None, + model: Optional[str] = None, truncate: Optional[bool] = None, source_properties: Optional[List[str]] = None, vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a named vector using the `text2vec-nvidia` model. + """Create a vector using the `text2vec-nvidia` model. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/nvidia/embeddings) for detailed usage. Args: - name: The name of the named vector. + name: The name of the vector. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. + base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. source_properties: Which properties should be included when vectorizing. By default all text properties are included. - vector_index_config: The configuration for Weaviate's vector index. Use wvc.config.Configure.VectorIndex to create a vector index configuration. None by default + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. model: The model to use. Defaults to `None`, which uses the server-defined default. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/nvidia/embeddings#available-models) for more details. - base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default. + truncate: Whether to truncate the input texts to fit within the context length. Defaults to `None`, which uses the server-defined default. """ return _VectorConfigCreate( @@ -1237,7 +1268,7 @@ def text2vec_nvidia( baseURL=base_url, truncate=truncate, ), - vector_index_config=vector_index_config, + vector_index_config=_IndexWrappers.single(vector_index_config, quantizer), ) @@ -1252,13 +1283,13 @@ def update( _VectorIndexConfigDynamicUpdate, ], ) -> _VectorConfigUpdate: - """Update the vector index configuration of a named vector. + """Update the vector index configuration of a vector. This is the only update operation allowed currently. If you wish to change the vectorization configuration itself, you will have to recreate the collection with the new configuration. Args: - name: The name of the named vector. + name: The name of the vector. vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Reconfigure.VectorIndex` to create a vector index configuration. `None` by default """ return _VectorConfigUpdate( From e4ae748f7fb446c1b75a386ee67d374c01a398da Mon Sep 17 00:00:00 2001 From: Tommy Smith Date: Wed, 25 Jun 2025 13:14:33 +0100 Subject: [PATCH 08/16] Update CI tags to latest patch --- .github/workflows/main.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 5ff97a62f..5311faa24 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -20,11 +20,11 @@ concurrency: env: WEAVIATE_125: 1.25.34 WEAVIATE_126: 1.26.17 - WEAVIATE_127: 1.27.14 - WEAVIATE_128: 1.28.8 - WEAVIATE_129: 1.29.1 - WEAVIATE_130: 1.30.1 - WEAVIATE_131: 1.31.1 + WEAVIATE_127: 1.27.27 + WEAVIATE_128: 1.28.16 + WEAVIATE_129: 1.29.8 + WEAVIATE_130: 1.30.9 + WEAVIATE_131: 1.31.2 jobs: lint-and-format: From e5c65bf6b3b394f60e0ddb99b41f7f0fbbebb308 Mon Sep 17 00:00:00 2001 From: Tommy Smith Date: Thu, 26 Jun 2025 14:30:29 +0100 Subject: [PATCH 09/16] Rename `.text2colbert_jinaa()` to `text2vec_jinaai()` --- integration/test_collection_config.py | 12 ++++++------ integration/test_vectors.py | 2 +- weaviate/collections/classes/config_vectors.py | 2 +- weaviate/collections/classes/grpc.py | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/integration/test_collection_config.py b/integration/test_collection_config.py index 3ecb6faef..25280836f 100644 --- a/integration/test_collection_config.py +++ b/integration/test_collection_config.py @@ -1426,8 +1426,8 @@ def test_config_multi_vector_enabled( collection = collection_factory( ports=(8086, 50057), properties=[Property(name="name", data_type=DataType.TEXT)], - vectorizer_config=[ - Configure.NamedVectors.text2colbert_jinaai( + vector_config=[ + Configure.MultiVectors.text2vec_jinaai( name="vec", vectorize_collection_name=False, vector_index_config=Configure.VectorIndex.hnsw( @@ -1476,8 +1476,8 @@ def test_config_muvera_enabled( collection = collection_factory( ports=(8086, 50057), properties=[Property(name="name", data_type=DataType.TEXT)], - vectorizer_config=[ - Configure.NamedVectors.text2colbert_jinaai( + vector_config=[ + Configure.Vectors.text2vec_jinaai( name="vec", vectorize_collection_name=False, vector_index_config=Configure.VectorIndex.hnsw( @@ -1509,8 +1509,8 @@ def test_config_muvera_disabled( collection = collection_factory( ports=(8086, 50057), properties=[Property(name="name", data_type=DataType.TEXT)], - vectorizer_config=[ - Configure.NamedVectors.text2colbert_jinaai( + vector_config=[ + Configure.MultiVectors.text2vec_jinaai( name="vec", vectorize_collection_name=False, vector_index_config=Configure.VectorIndex.hnsw( diff --git a/integration/test_vectors.py b/integration/test_vectors.py index 5a2ed0454..ed7e47351 100644 --- a/integration/test_vectors.py +++ b/integration/test_vectors.py @@ -885,7 +885,7 @@ def test_colbert_vectors_jinaai(collection_factory: CollectionFactory) -> None: ) ], vector_config=[ - wvc.config.Configure.MultiVectors.text2colbert_jinaai( + wvc.config.Configure.MultiVectors.text2vec_jinaai( name="colbert", ) ], diff --git a/weaviate/collections/classes/config_vectors.py b/weaviate/collections/classes/config_vectors.py index 1d9c26b15..dca946feb 100644 --- a/weaviate/collections/classes/config_vectors.py +++ b/weaviate/collections/classes/config_vectors.py @@ -128,7 +128,7 @@ def multi( class _MultiVectors: @staticmethod - def text2colbert_jinaai( + def text2vec_jinaai( *, name: Optional[str] = None, encoding: Optional[_MultiVectorEncodingConfigCreate] = None, diff --git a/weaviate/collections/classes/grpc.py b/weaviate/collections/classes/grpc.py index 0a593ac27..03f43e56a 100644 --- a/weaviate/collections/classes/grpc.py +++ b/weaviate/collections/classes/grpc.py @@ -290,9 +290,9 @@ def and_() -> BM25OperatorOptions: OneDimensionalVectorType = Sequence[NUMBER] -"""Represents a one-dimensional vector, e.g. one produced by `text2vec-jinaai`""" +"""Represents a one-dimensional vector, e.g. one produced by the `Configure.Vectors.text2vec_jinaai()` module""" TwoDimensionalVectorType = Sequence[Sequence[NUMBER]] -"""Represents a two-dimensional vector, e.g. one produced by `text2colbert-jinaai""" +"""Represents a two-dimensional vector, e.g. one produced by the `Configure.MultiVectors.text2vec_jinaai()` module""" PrimitiveVectorType = Union[OneDimensionalVectorType, TwoDimensionalVectorType] From d2ed94d88bfd5e49d0e525fcba7febfe9f1236c7 Mon Sep 17 00:00:00 2001 From: Tommy Smith Date: Fri, 27 Jun 2025 11:09:10 +0100 Subject: [PATCH 10/16] Add warnings for all deprecated syntax --- integration/test_client.py | 6 +- .../classes/config_vector_index.py | 62 ++++++++++++++++++- .../collections/classes/config_vectors.py | 61 +++++++++--------- weaviate/collections/collections/executor.py | 5 ++ weaviate/warnings.py | 34 +++++++++- 5 files changed, 133 insertions(+), 35 deletions(-) diff --git a/integration/test_client.py b/integration/test_client.py index cb9bda516..cd368d794 100644 --- a/integration/test_client.py +++ b/integration/test_client.py @@ -1,4 +1,4 @@ -from typing import Callable, Generator, Tuple, Union +from typing import Callable, Generator, Optional, Tuple, Union import pytest from _pytest.fixtures import SubRequest @@ -28,7 +28,7 @@ @pytest.fixture(scope="module") def client_factory() -> Generator[Callable[[int, int], weaviate.WeaviateClient], None, None]: - client: weaviate.WeaviateClient = None + client: Optional[weaviate.WeaviateClient] = None def maker(http: int, grpc: int) -> weaviate.WeaviateClient: nonlocal client @@ -593,7 +593,7 @@ async def test_async_client_with_extra_options() -> None: def test_client_error_for_wcs_without_auth() -> None: with pytest.raises(weaviate.exceptions.AuthenticationFailedError) as e: - weaviate.connect_to_wcs(cluster_url=WCS_URL, auth_credentials=None) + weaviate.connect_to_wcs(cluster_url=WCS_URL, auth_credentials=None) # pyright: ignore assert "wvc.init.Auth.api_key" in e.value.message diff --git a/weaviate/collections/classes/config_vector_index.py b/weaviate/collections/classes/config_vector_index.py index 1f74ae1c1..bc9c3b85b 100644 --- a/weaviate/collections/classes/config_vector_index.py +++ b/weaviate/collections/classes/config_vector_index.py @@ -1,8 +1,9 @@ from abc import abstractmethod from enum import Enum -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, overload from pydantic import Field +from typing_extensions import deprecated from weaviate.collections.classes.config_base import ( _ConfigCreateModel, @@ -320,11 +321,30 @@ def muvera( class _VectorIndexMultiVector: Encoding = _VectorIndexMultivectorEncoding + @deprecated( + 'Using the "encoding" argument is deprecated. Instead, specify it at the top-level when creating your `vector_config`' + ) + @overload + @staticmethod + def multi_vector( + encoding: _MultiVectorEncodingConfigCreate, + aggregation: Optional[MultiVectorAggregation] = None, + ) -> _MultiVectorConfigCreate: ... + + @overload + @staticmethod + def multi_vector( + encoding: Optional[_MultiVectorEncodingConfigCreate] = None, + aggregation: Optional[MultiVectorAggregation] = None, + ) -> _MultiVectorConfigCreate: ... + @staticmethod def multi_vector( encoding: Optional[_MultiVectorEncodingConfigCreate] = None, aggregation: Optional[MultiVectorAggregation] = None, ) -> _MultiVectorConfigCreate: + if encoding is not None: + _Warnings.encoding_in_multi_vector_config() return _MultiVectorConfigCreate( encoding=encoding if encoding is not None else None, aggregation=aggregation.value if aggregation is not None else None, @@ -410,6 +430,46 @@ def none() -> _VectorIndexConfigSkipCreate: multivector=None, ) + @overload + @staticmethod + @deprecated( + 'Using the "quantizer" argument is deprecated. Instead, specify it at the top-level when creating your `vector_config` with `Vectors.module()`' + ) + def hnsw( + cleanup_interval_seconds: Optional[int] = None, + distance_metric: Optional[VectorDistances] = None, + dynamic_ef_factor: Optional[int] = None, + dynamic_ef_max: Optional[int] = None, + dynamic_ef_min: Optional[int] = None, + ef: Optional[int] = None, + ef_construction: Optional[int] = None, + filter_strategy: Optional[VectorFilterStrategy] = None, + flat_search_cutoff: Optional[int] = None, + max_connections: Optional[int] = None, + vector_cache_max_objects: Optional[int] = None, + *, + quantizer: _QuantizerConfigCreate, + multi_vector: Optional[_MultiVectorConfigCreate] = None, + ) -> _VectorIndexConfigHNSWCreate: ... + + @overload + @staticmethod + def hnsw( + cleanup_interval_seconds: Optional[int] = None, + distance_metric: Optional[VectorDistances] = None, + dynamic_ef_factor: Optional[int] = None, + dynamic_ef_max: Optional[int] = None, + dynamic_ef_min: Optional[int] = None, + ef: Optional[int] = None, + ef_construction: Optional[int] = None, + filter_strategy: Optional[VectorFilterStrategy] = None, + flat_search_cutoff: Optional[int] = None, + max_connections: Optional[int] = None, + vector_cache_max_objects: Optional[int] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, + multi_vector: Optional[_MultiVectorConfigCreate] = None, + ) -> _VectorIndexConfigHNSWCreate: ... + @staticmethod def hnsw( cleanup_interval_seconds: Optional[int] = None, diff --git a/weaviate/collections/classes/config_vectors.py b/weaviate/collections/classes/config_vectors.py index dca946feb..39bbe3d49 100644 --- a/weaviate/collections/classes/config_vectors.py +++ b/weaviate/collections/classes/config_vectors.py @@ -120,9 +120,12 @@ def multi( multi_vector=_VectorIndex.MultiVector.multi_vector(encoding=encoding) ) else: - vector_index_config.multivector = _VectorIndex.MultiVector.multi_vector( - encoding=encoding - ) + if vector_index_config.multivector is None: + vector_index_config.multivector = _VectorIndex.MultiVector.multi_vector( + encoding=encoding + ) + else: + vector_index_config.multivector.encoding = encoding return _IndexWrappers.single(vector_index_config, quantizer) @@ -139,7 +142,7 @@ def text2vec_jinaai( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a multi-vector using the `text2colbert_jinaai` module. + """Create a multi-vector using the `text2colbert-jinaai` module. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/jinaai/colbert) for detailed usage. @@ -226,7 +229,7 @@ def text2vec_cohere( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a vector using the `text2vec_cohere` model. + """Create a vector using the `text2vec-cohere` module. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/cohere/embeddings) for detailed usage. @@ -269,7 +272,7 @@ def multi2vec_cohere( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a vector using the `multi2vec_cohere` model. + """Create a vector using the `multi2vec_cohere` module. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/cohere/embeddings-multimodal) for detailed usage. @@ -310,7 +313,7 @@ def text2vec_contextionary( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a vector using the `text2vec_contextionary` model. + """Create a vector using the `text2vec_contextionary` module. See the [documentation](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/text2vec-contextionary) for detailed usage. @@ -342,7 +345,7 @@ def text2vec_databricks( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a vector using the `text2vec-databricks` model. + """Create a vector using the `text2vec-databricks` module. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/databricks/embeddings) for detailed usage. @@ -378,7 +381,7 @@ def text2vec_mistral( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a vector using the `text2vec-mistral` model. + """Create a vector using the `text2vec-mistral` module. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/mistral/embeddings) for detailed usage. @@ -414,7 +417,7 @@ def text2vec_ollama( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a vector using the `text2vec-ollama` model. + """Create a vector using the `text2vec-ollama` module. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/ollama/embeddings) for detailed usage. @@ -456,7 +459,7 @@ def text2vec_openai( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a vector using the `text2vec_openai` model. + """Create a vector using the `text2vec-openai` module. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/openai/embeddings) for detailed usage. @@ -503,7 +506,7 @@ def text2vec_aws( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a vector using the `text2vec_aws` model. + """Create a vector using the `text2vec-aws` module. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/aws/embeddings) for detailed usage. @@ -540,7 +543,7 @@ def img2vec_neural( image_fields: List[str], vector_index_config: Optional[_VectorIndexConfigCreate] = None, ) -> _VectorConfigCreate: - """Create a `Img2VecNeuralConfig` object for use when vectorizing using the `img2vec-neural` model. + """Create a vector using the `img2vec-neural` module. See the [documentation](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/img2vec-neural) for detailed usage. @@ -571,7 +574,7 @@ def multi2vec_clip( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a vector using the `multi2vec_clip` model. + """Create a vector using the `multi2vec-clip` module. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/transformers/embeddings-multimodal) for detailed usage. @@ -613,7 +616,7 @@ def multi2vec_google( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a vector using the `multi2vec_google` model. + """Create a vector using the `multi2vec-google` module. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings-multimodal) for detailed usage. @@ -663,7 +666,7 @@ def multi2vec_bind( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a vector using the `multi2vec_bind` model. + """Create a vector using the `multi2vec-bind` module. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/imagebind/embeddings-multimodal) for detailed usage. @@ -710,7 +713,7 @@ def multi2vec_voyageai( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a vector using the `multi2vec_voyageai` model. + """Create a vector using the `multi2vec-voyageai` module. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/voyageai/embeddings-multimodal) for detailed usage. @@ -758,7 +761,7 @@ def multi2vec_nvidia( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a vector using the `multi2vec_nvidia` model. + """Create a vector using the `multi2vec-nvidia` module. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/nvidia/embeddings-multimodal) for detailed usage. @@ -801,7 +804,7 @@ def ref2vec_centroid( reference_properties: List[str], vector_index_config: Optional[_VectorIndexConfigCreate] = None, ) -> _VectorConfigCreate: - """Create a vector using the `ref2vec_centroid` model. + """Create a vector using the `ref2vec-centroid` module. See the [documentation](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/text2vec-gpt4all) for detailed usage. @@ -836,7 +839,7 @@ def text2vec_azure_openai( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a vector using the `text2vec_azure_openai` model. + """Create a vector using the `text2vec-openai` module running with Azure. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/openai-azure/embeddings) for detailed usage. @@ -876,7 +879,7 @@ def text2vec_gpt4all( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a vector using the `text2vec_gpt4all` model. + """Create a vector using the `text2vec-gpt4all` module. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/gpt4all/embeddings) for detailed usage. @@ -913,7 +916,7 @@ def text2vec_huggingface( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a vector using the `text2vec_huggingface` model. + """Create a vector using the `text2vec-huggingface` module. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/huggingface/embeddings) for detailed usage. @@ -966,7 +969,7 @@ def text2vec_google( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a vector using the `text2vec_palm` model. + """Create a vector using the `text2vec-google` model. See the [documentation]https://weaviate.io/developers/weaviate/model-providers/google/embeddings) for detailed usage. @@ -1009,7 +1012,7 @@ def text2vec_google_aistudio( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a vector using the `text2vec_palm` model. + """Create a vector using the `text2vec-google` model. See the [documentation]https://weaviate.io/developers/weaviate/model-providers/google/embeddings) for detailed usage. @@ -1052,7 +1055,7 @@ def text2vec_transformers( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a vector using the `text2vec_transformers` model. + """Create a vector using the `text2vec-transformers` module. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/transformers/embeddings) for detailed usage. @@ -1093,7 +1096,7 @@ def text2vec_jinaai( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a vector using the `text2vec-jinaai` model. + """Create a vector using the `text2vec-jinaai` module. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/jinaai/embeddings) for detailed usage. @@ -1132,7 +1135,7 @@ def multi2vec_jinaai( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a vector using the `multi2vec_jinaai` model. + """Create a vector using the `multi2vec-jinaai` module. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/jinaai/embeddings-multimodal) for detailed usage. @@ -1176,7 +1179,7 @@ def text2vec_voyageai( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a vector using the `text2vec-jinaai` model. + """Create a vector using the `text2vec-voyageai` module. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/voyageai/embeddings) for detailed usage. @@ -1241,7 +1244,7 @@ def text2vec_nvidia( vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: - """Create a vector using the `text2vec-nvidia` model. + """Create a vector using the `text2vec-nvidia` module. See the [documentation](https://weaviate.io/developers/weaviate/model-providers/nvidia/embeddings) for detailed usage. diff --git a/weaviate/collections/collections/executor.py b/weaviate/collections/collections/executor.py index c9de9a53d..61b243cd6 100644 --- a/weaviate/collections/collections/executor.py +++ b/weaviate/collections/collections/executor.py @@ -52,6 +52,7 @@ from weaviate.exceptions import WeaviateInvalidInputError from weaviate.util import _capitalize_first_letter, _decode_json_response_dict from weaviate.validator import _validate_input, _ValidateArgument +from weaviate.warnings import _Warnings CollectionType = TypeVar("CollectionType", Collection, CollectionAsync) @@ -211,6 +212,10 @@ def create( raise WeaviateInvalidInputError( "Named vectorizers are only supported in Weaviate v1.24.0 and higher" ) + if vectorizer_config is not None: + _Warnings.vectorizer_config_in_config_create() + if vector_index_config is not None: + _Warnings.vector_index_config_in_config_create() try: config = _CollectionConfigCreate( description=description, diff --git a/weaviate/warnings.py b/weaviate/warnings.py index 12cdb6061..86957d97d 100644 --- a/weaviate/warnings.py +++ b/weaviate/warnings.py @@ -219,7 +219,7 @@ def batch_results_objects_all_responses_attribute() -> None: @staticmethod def deprecated_tenant_type(old: str, new: str) -> None: warnings.warn( - message=f"""Dep020: The tenant status {old} is deprecated and will be removed by Q1 2025. Please use {new} instead.""", + message=f"""Dep021: The tenant status {old} is deprecated and will be removed by Q1 2025. Please use {new} instead.""", category=DeprecationWarning, stacklevel=1, ) @@ -227,13 +227,43 @@ def deprecated_tenant_type(old: str, new: str) -> None: @staticmethod def vectorizer_config_in_config_update() -> None: warnings.warn( - message="""Dep021: You are using the `vectorizer_config` argument in the `collection.config.update()` method with a collection with named vectors, which is deprecated. + message="""Dep022: You are using the `vectorizer_config` argument in the `collection.config.update()` method with a collection with named vectors, which is deprecated. Use the `vector_config` argument instead. """, category=DeprecationWarning, stacklevel=1, ) + @staticmethod + def vectorizer_config_in_config_create() -> None: + warnings.warn( + message="""Dep022: You are using the `vectorizer_config` argument in the `collection.config.create()`, which is deprecated. + Use the `vector_config` argument instead. + """, + category=DeprecationWarning, + stacklevel=1, + ) + + @staticmethod + def vector_index_config_in_config_create() -> None: + warnings.warn( + message="""Dep023: You are using the `vector_index_config` argument in the `collection.config.create()`, which is deprecated. + Use the `vector_config` argument instead defining `vector_index_config` as a sub-argument. + """, + category=DeprecationWarning, + stacklevel=1, + ) + + @staticmethod + def encoding_in_multi_vector_config() -> None: + warnings.warn( + message="""Dep024: You are using the `encoding` argument in the `Configure.VectorIndex.MultiVector.multi_vector()`, which is deprecated. + Use the `encoding` argument inside `Configure.MultiVector.module()` instead. + """, + category=DeprecationWarning, + stacklevel=1, + ) + @staticmethod def datetime_insertion_with_no_specified_timezone(date: datetime) -> None: warnings.warn( From 1ac08a7c9f8ebb4b47faf2aed15aa3de68738f49 Mon Sep 17 00:00:00 2001 From: Tommy Smith Date: Fri, 27 Jun 2025 13:56:53 +0100 Subject: [PATCH 11/16] Response to review comments - Add `multi_vector_config` arg to `MultiVectors` methods - Add deprs warnings if `multi_vector` - Update tests to use new syntax --- integration/test_collection_config.py | 14 +-- integration/test_vectors.py | 8 +- .../classes/config_vector_index.py | 8 +- .../collections/classes/config_vectors.py | 103 +++++++++++++++--- weaviate/warnings.py | 26 +++-- 5 files changed, 116 insertions(+), 43 deletions(-) diff --git a/integration/test_collection_config.py b/integration/test_collection_config.py index 25280836f..7531ef299 100644 --- a/integration/test_collection_config.py +++ b/integration/test_collection_config.py @@ -1430,9 +1430,6 @@ def test_config_multi_vector_enabled( Configure.MultiVectors.text2vec_jinaai( name="vec", vectorize_collection_name=False, - vector_index_config=Configure.VectorIndex.hnsw( - multi_vector=Configure.VectorIndex.MultiVector.multi_vector() - ), ) ], ) @@ -1477,14 +1474,10 @@ def test_config_muvera_enabled( ports=(8086, 50057), properties=[Property(name="name", data_type=DataType.TEXT)], vector_config=[ - Configure.Vectors.text2vec_jinaai( + Configure.MultiVectors.text2vec_jinaai( name="vec", vectorize_collection_name=False, - vector_index_config=Configure.VectorIndex.hnsw( - multi_vector=Configure.VectorIndex.MultiVector.multi_vector( - encoding=Configure.VectorIndex.MultiVector.Encoding.muvera() - ) - ), + encoding=Configure.VectorIndex.MultiVector.Encoding.muvera(), ) ], ) @@ -1513,9 +1506,6 @@ def test_config_muvera_disabled( Configure.MultiVectors.text2vec_jinaai( name="vec", vectorize_collection_name=False, - vector_index_config=Configure.VectorIndex.hnsw( - multi_vector=Configure.VectorIndex.MultiVector.multi_vector() - ), ) ], ) diff --git a/integration/test_vectors.py b/integration/test_vectors.py index ed7e47351..b2bf83bf0 100644 --- a/integration/test_vectors.py +++ b/integration/test_vectors.py @@ -782,12 +782,10 @@ def test_colbert_vectors_byov(collection_factory: CollectionFactory) -> None: ) ], vector_config=[ - wvc.config.Configure.Vectors.self_provided( + wvc.config.Configure.MultiVectors.self_provided( name="colbert", - vector_index_config=wvc.config.Configure.VectorIndex.hnsw( - multi_vector=wvc.config.Configure.VectorIndex.MultiVector.multi_vector( - aggregation=wvc.config.MultiVectorAggregation.MAX_SIM - ) + multi_vector_config=wvc.config.Configure.VectorIndex.MultiVector.multi_vector( + aggregation=wvc.config.MultiVectorAggregation.MAX_SIM ), ), wvc.config.Configure.Vectors.self_provided( diff --git a/weaviate/collections/classes/config_vector_index.py b/weaviate/collections/classes/config_vector_index.py index bc9c3b85b..d4f583184 100644 --- a/weaviate/collections/classes/config_vector_index.py +++ b/weaviate/collections/classes/config_vector_index.py @@ -433,7 +433,7 @@ def none() -> _VectorIndexConfigSkipCreate: @overload @staticmethod @deprecated( - 'Using the "quantizer" argument is deprecated. Instead, specify it at the top-level when creating your `vector_config` with `Vectors.module()`' + 'Using the "multi_vector" argument is deprecated. Instead, specify it at the top-level in `multi_vector_index_config` when creating your `vector_config` with `MultiVectors.module()`' ) def hnsw( cleanup_interval_seconds: Optional[int] = None, @@ -448,8 +448,8 @@ def hnsw( max_connections: Optional[int] = None, vector_cache_max_objects: Optional[int] = None, *, - quantizer: _QuantizerConfigCreate, - multi_vector: Optional[_MultiVectorConfigCreate] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, + multi_vector: _MultiVectorConfigCreate, ) -> _VectorIndexConfigHNSWCreate: ... @overload @@ -493,6 +493,8 @@ def hnsw( Args: See [the docs](https://weaviate.io/developers/weaviate/configuration/indexes#how-to-configure-hnsw) for a more detailed view! """ # noqa: D417 (missing argument descriptions in the docstring) + if multi_vector is not None: + _Warnings.multi_vector_in_hnsw_config() return _VectorIndexConfigHNSWCreate( cleanupIntervalSeconds=cleanup_interval_seconds, distance=distance_metric, diff --git a/weaviate/collections/classes/config_vectors.py b/weaviate/collections/classes/config_vectors.py index 39bbe3d49..5354d6cd7 100644 --- a/weaviate/collections/classes/config_vectors.py +++ b/weaviate/collections/classes/config_vectors.py @@ -9,12 +9,15 @@ ) from weaviate.collections.classes.config_vector_index import ( VectorIndexType, + _MultiVectorConfigCreate, _MultiVectorEncodingConfigCreate, _QuantizerConfigCreate, - _VectorIndex, _VectorIndexConfigCreate, + _VectorIndexConfigDynamicCreate, _VectorIndexConfigDynamicUpdate, + _VectorIndexConfigFlatCreate, _VectorIndexConfigFlatUpdate, + _VectorIndexConfigHNSWCreate, _VectorIndexConfigHNSWUpdate, _VectorIndexConfigUpdate, ) @@ -96,6 +99,37 @@ class _VectorConfigUpdate(_ConfigUpdateModel): class _IndexWrappers: + @staticmethod + def __hnsw( + *, + quantizer: Optional[_QuantizerConfigCreate] = None, + multivector: Optional[_MultiVectorConfigCreate] = None, + ) -> _VectorIndexConfigHNSWCreate: + return _VectorIndexConfigHNSWCreate( + cleanupIntervalSeconds=None, + distance=None, + dynamicEfMin=None, + dynamicEfMax=None, + dynamicEfFactor=None, + efConstruction=None, + ef=None, + filterStrategy=None, + flatSearchCutoff=None, + maxConnections=None, + vectorCacheMaxObjects=None, + quantizer=quantizer, + multivector=multivector, + ) + + @staticmethod + def __flat(*, quantizer: Optional[_QuantizerConfigCreate]) -> _VectorIndexConfigFlatCreate: + return _VectorIndexConfigFlatCreate( + distance=None, + vectorCacheMaxObjects=None, + quantizer=quantizer, + multivector=None, + ) + @staticmethod def single( vector_index_config: Optional[_VectorIndexConfigCreate], @@ -103,33 +137,66 @@ def single( ) -> Optional[_VectorIndexConfigCreate]: if quantizer is not None: if vector_index_config is None: - vector_index_config = _VectorIndex.hnsw(quantizer=quantizer) + vector_index_config = _IndexWrappers.__hnsw(quantizer=quantizer) else: - vector_index_config.quantizer = quantizer + if isinstance(vector_index_config, _VectorIndexConfigDynamicCreate): + if vector_index_config.hnsw is None: + vector_index_config.hnsw = _IndexWrappers.__hnsw(quantizer=quantizer) + else: + vector_index_config.hnsw.quantizer = quantizer + if vector_index_config.flat is None: + vector_index_config.flat = _IndexWrappers.__flat(quantizer=quantizer) + else: + vector_index_config.flat.quantizer = quantizer + else: + vector_index_config.quantizer = quantizer return vector_index_config @staticmethod def multi( vector_index_config: Optional[_VectorIndexConfigCreate], - encoding: Optional[_MultiVectorEncodingConfigCreate], quantizer: Optional[_QuantizerConfigCreate], + multi_vector_config: Optional[_MultiVectorConfigCreate], + encoding: Optional[_MultiVectorEncodingConfigCreate], ) -> Optional[_VectorIndexConfigCreate]: + if multi_vector_config is None: + multi_vector_config = _MultiVectorConfigCreate(aggregation=None, encoding=None) if encoding is not None: - if vector_index_config is None: - vector_index_config = _VectorIndex.hnsw( - multi_vector=_VectorIndex.MultiVector.multi_vector(encoding=encoding) - ) - else: - if vector_index_config.multivector is None: - vector_index_config.multivector = _VectorIndex.MultiVector.multi_vector( - encoding=encoding - ) - else: - vector_index_config.multivector.encoding = encoding + multi_vector_config.encoding = encoding + if vector_index_config is None: + vector_index_config = _IndexWrappers.__hnsw(multivector=multi_vector_config) + else: + vector_index_config.multivector = multi_vector_config return _IndexWrappers.single(vector_index_config, quantizer) class _MultiVectors: + @staticmethod + def self_provided( + *, + name: Optional[str] = None, + encoding: Optional[_MultiVectorEncodingConfigCreate] = None, + quantizer: Optional[_QuantizerConfigCreate] = None, + multi_vector_config: Optional[_MultiVectorConfigCreate] = None, + vector_index_config: Optional[_VectorIndexConfigCreate] = None, + ): + """Create a multi-vector using no vectorizer. You will need to provide the vectors yourself. + + Args: + name: The name of the vector. + encoding: The type of multi-vector encoding to use in the vector index. Defaults to `None`, which uses the server-defined default. + quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied. + 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 + vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default + """ + return _VectorConfigCreate( + name=name, + vectorizer=_VectorizerConfigCreate(vectorizer=Vectorizers.NONE), + vector_index_config=_IndexWrappers.multi( + vector_index_config, quantizer, multi_vector_config, encoding + ), + ) + @staticmethod def text2vec_jinaai( *, @@ -139,6 +206,7 @@ def text2vec_jinaai( dimensions: Optional[int] = None, model: Optional[str] = None, source_properties: Optional[List[str]] = None, + multi_vector_config: Optional[_MultiVectorConfigCreate] = None, vector_index_config: Optional[_VectorIndexConfigCreate] = None, vectorize_collection_name: bool = True, ) -> _VectorConfigCreate: @@ -154,13 +222,16 @@ def text2vec_jinaai( model: The model to use. Defaults to `None`, which uses the server-defined default. encoding: The type of multi-vector encoding to use in the vector index. Defaults to `None`, which uses the server-defined default. source_properties: Which properties should be included when vectorizing. By default all text properties are included. + 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 vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`. """ return _VectorConfigCreate( name=name, source_properties=source_properties, - vector_index_config=_IndexWrappers.multi(vector_index_config, encoding, quantizer), + vector_index_config=_IndexWrappers.multi( + vector_index_config, quantizer, multi_vector_config, encoding + ), vectorizer=_Text2ColbertJinaAIConfig( model=model, dimensions=dimensions, vectorizeClassName=vectorize_collection_name ), diff --git a/weaviate/warnings.py b/weaviate/warnings.py index 7b5131a84..5a2fd9277 100644 --- a/weaviate/warnings.py +++ b/weaviate/warnings.py @@ -173,10 +173,18 @@ def deprecated_tenant_type(old: str, new: str) -> None: stacklevel=1, ) + @staticmethod + def oidc_with_wcd_deprecated() -> None: + warnings.warn( + message="""Dep022: connecting to Weaviate Cloud (WCD) using OIDC is deprecated and will be removed in August 2025. Please use API keys instead.""", + category=DeprecationWarning, + stacklevel=1, + ) + @staticmethod def vectorizer_config_in_config_update() -> None: warnings.warn( - message="""Dep022: You are using the `vectorizer_config` argument in the `collection.config.update()` method with a collection with named vectors, which is deprecated. + message="""Dep023: You are using the `vectorizer_config` argument in the `collection.config.update()` method with a collection with named vectors, which is deprecated. Use the `vector_config` argument instead. """, category=DeprecationWarning, @@ -186,7 +194,7 @@ def vectorizer_config_in_config_update() -> None: @staticmethod def vectorizer_config_in_config_create() -> None: warnings.warn( - message="""Dep022: You are using the `vectorizer_config` argument in the `collection.config.create()`, which is deprecated. + message="""Dep024: You are using the `vectorizer_config` argument in `collection.config.create()`, which is deprecated. Use the `vector_config` argument instead. """, category=DeprecationWarning, @@ -196,7 +204,7 @@ def vectorizer_config_in_config_create() -> None: @staticmethod def vector_index_config_in_config_create() -> None: warnings.warn( - message="""Dep023: You are using the `vector_index_config` argument in the `collection.config.create()`, which is deprecated. + message="""Dep025: You are using the `vector_index_config` argument in `collection.config.create()`, which is deprecated. Use the `vector_config` argument instead defining `vector_index_config` as a sub-argument. """, category=DeprecationWarning, @@ -206,15 +214,19 @@ def vector_index_config_in_config_create() -> None: @staticmethod def encoding_in_multi_vector_config() -> None: warnings.warn( - message="""Dep024: You are using the `encoding` argument in the `Configure.VectorIndex.MultiVector.multi_vector()`, which is deprecated. - Use the `encoding` argument inside `Configure.MultiVector.module()` instead. + message="""Dep026: You are using the `encoding` argument in `Configure.VectorIndex.MultiVectors.multi_vector()`, which is deprecated. + Use the `encoding` argument inside `Configure.MultiVectors.module()` instead. """, + category=DeprecationWarning, + stacklevel=1, ) @staticmethod - def oidc_with_wcd_deprecated() -> None: + def multi_vector_in_hnsw_config() -> None: warnings.warn( - message="""Dep025: connecting to Weaviate Cloud (WCD) using OIDC is deprecated and will be removed in August 2025. Please use API keys instead.""", + message="""Dep027: You are using the `multi_vector` argument in `Configure.VectorIndex.hnsw()`, which is deprecated. + Use the `multi_vector` argument inside `Configure.MultiVectors.module()` instead. + """, category=DeprecationWarning, stacklevel=1, ) From f33d12b0231ad16e4136775c69261ebdcae06faa Mon Sep 17 00:00:00 2001 From: Tommy Smith Date: Mon, 30 Jun 2025 10:35:24 +0100 Subject: [PATCH 12/16] Update tests to reflect single vectors usage --- integration/test_vectors.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/integration/test_vectors.py b/integration/test_vectors.py index b2bf83bf0..35538ad30 100644 --- a/integration/test_vectors.py +++ b/integration/test_vectors.py @@ -117,9 +117,7 @@ def test_update(collection_factory: CollectionFactory) -> None: wvc.config.Property(name="title", data_type=wvc.config.DataType.TEXT), wvc.config.Property(name="content", data_type=wvc.config.DataType.TEXT), ], - vector_config=[ - wvc.config.Configure.Vectors.self_provided(name="bringYourOwn"), - ], + vector_config=wvc.config.Configure.Vectors.self_provided(name="bringYourOwn"), ) uuid = collection.data.insert( @@ -148,9 +146,7 @@ def test_replace(collection_factory: CollectionFactory) -> None: wvc.config.Property(name="title", data_type=wvc.config.DataType.TEXT), wvc.config.Property(name="content", data_type=wvc.config.DataType.TEXT), ], - vector_config=[ - wvc.config.Configure.Vectors.self_provided(name="bringYourOwn"), - ], + vector_config=wvc.config.Configure.Vectors.self_provided(name="bringYourOwn"), ) uuid = collection.data.insert( From 197928b88a6670d293e8bf40dc68e2075d0f8251 Mon Sep 17 00:00:00 2001 From: Tommy Smith Date: Mon, 30 Jun 2025 13:56:42 +0100 Subject: [PATCH 13/16] Fix vector config name passing when creating collections --- weaviate/collections/classes/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weaviate/collections/classes/config.py b/weaviate/collections/classes/config.py index 7753ec1e1..61f7b4763 100644 --- a/weaviate/collections/classes/config.py +++ b/weaviate/collections/classes/config.py @@ -1940,7 +1940,7 @@ def _to_dict(self) -> Dict[str, Any]: ret_dict["vectorIndexType"] = val.vector_index_type().value ret_dict[cls_field] = val._to_dict() elif isinstance(val, _VectorConfigCreate): - ret_dict["vectorConfig"] = {"default": val._to_dict()} + ret_dict["vectorConfig"] = {val.name or "default": val._to_dict()} elif ( isinstance(val, list) and len(val) > 0 From f4b3c2302be5aecb238140fce67591cb94a682dc Mon Sep 17 00:00:00 2001 From: Tommy Smith Date: Thu, 10 Jul 2025 13:09:07 +0100 Subject: [PATCH 14/16] Skip parsing vector to obj if it's empty --- weaviate/collections/queries/base_executor.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/weaviate/collections/queries/base_executor.py b/weaviate/collections/queries/base_executor.py index c03675784..12c481301 100644 --- a/weaviate/collections/queries/base_executor.py +++ b/weaviate/collections/queries/base_executor.py @@ -156,10 +156,15 @@ def __extract_vector_for_object( return {} if len(add_props.vector_bytes) > 0: - return {"default": _ByteOps.decode_float32s(add_props.vector_bytes)} + vec = _ByteOps.decode_float32s(add_props.vector_bytes) + if len(vec) == 0: + return {} + return {"default": vec} vecs: Dict[str, Union[List[float], List[List[float]]]] = {} for vec in add_props.vectors: + if len(vec.vector_bytes) == 0: + continue if vec.type == base_pb2.Vectors.VECTOR_TYPE_SINGLE_FP32: vecs[vec.name] = _Unpack.single(vec.vector_bytes) elif vec.type == base_pb2.Vectors.VECTOR_TYPE_MULTI_FP32: From 2a8aa52f43caac4ce2a37d4a448f946dd1cfb6ad Mon Sep 17 00:00:00 2001 From: Tommy Smith Date: Thu, 10 Jul 2025 14:02:30 +0100 Subject: [PATCH 15/16] Update CI images to latest patches --- .github/workflows/main.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 179ce53d8..c38add1ba 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -20,10 +20,10 @@ concurrency: env: WEAVIATE_125: 1.25.34 WEAVIATE_126: 1.26.17 - WEAVIATE_127: 1.27.14 - WEAVIATE_128: 1.28.8 - WEAVIATE_129: 1.29.8 - WEAVIATE_130: 1.30.9 + WEAVIATE_127: 1.27.27 + WEAVIATE_128: 1.28.16 + WEAVIATE_129: 1.29.9 + WEAVIATE_130: 1.30.11 WEAVIATE_131: 1.31.5 WEAVIATE_132: 1.32.0-rc.1-098c594 From a005f3411e25322b8a20fc730033a5ca1722ba0e Mon Sep 17 00:00:00 2001 From: Tommy Smith Date: Thu, 10 Jul 2025 14:25:34 +0100 Subject: [PATCH 16/16] Remove unneeded added parsing --- weaviate/collections/queries/base_executor.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/weaviate/collections/queries/base_executor.py b/weaviate/collections/queries/base_executor.py index 12c481301..e12d3e53d 100644 --- a/weaviate/collections/queries/base_executor.py +++ b/weaviate/collections/queries/base_executor.py @@ -157,14 +157,10 @@ def __extract_vector_for_object( if len(add_props.vector_bytes) > 0: vec = _ByteOps.decode_float32s(add_props.vector_bytes) - if len(vec) == 0: - return {} return {"default": vec} vecs: Dict[str, Union[List[float], List[List[float]]]] = {} for vec in add_props.vectors: - if len(vec.vector_bytes) == 0: - continue if vec.type == base_pb2.Vectors.VECTOR_TYPE_SINGLE_FP32: vecs[vec.name] = _Unpack.single(vec.vector_bytes) elif vec.type == base_pb2.Vectors.VECTOR_TYPE_MULTI_FP32: