From f0b6a98fb5fca5dec0f691f12b36adb5072efbc2 Mon Sep 17 00:00:00 2001 From: Dirk Kulawiak Date: Mon, 5 Feb 2024 07:46:19 +0100 Subject: [PATCH 1/3] Add option to skip input parameter validation --- integration/conftest.py | 3 + integration/test_collection_get.py | 16 ++- test/collection/test_queries.py | 2 +- weaviate/collections/base.py | 3 +- weaviate/collections/collection.py | 44 ++++++--- weaviate/collections/collections.py | 24 +++-- weaviate/collections/data.py | 142 ++++++++++++++++----------- weaviate/collections/grpc/query.py | 133 ++++++++++++------------- weaviate/collections/queries/base.py | 20 ++-- 9 files changed, 225 insertions(+), 162 deletions(-) diff --git a/integration/conftest.py b/integration/conftest.py index 2fc1e639c..dc73bddf8 100644 --- a/integration/conftest.py +++ b/integration/conftest.py @@ -155,6 +155,7 @@ def __call__( name: str, data_model_props: Optional[Type[Properties]] = None, data_model_refs: Optional[Type[Properties]] = None, + skip_argument_validation: bool = False, ) -> Collection[Any, Any]: """Typing for fixture.""" ... @@ -169,6 +170,7 @@ def _factory( name: str, data_model_props: Optional[Type[Properties]] = None, data_model_refs: Optional[Type[Properties]] = None, + skip_argument_validation: bool = False, ) -> Collection[Any, Any]: nonlocal client_fixture, name_fixture name_fixture = _sanitize_collection_name(name) @@ -178,6 +180,7 @@ def _factory( name=name_fixture, data_model_properties=data_model_props, data_model_references=data_model_refs, + skip_argument_validation=skip_argument_validation, ) return collection diff --git a/integration/test_collection_get.py b/integration/test_collection_get.py index 7a45a4f9e..fdbf5a62b 100644 --- a/integration/test_collection_get.py +++ b/integration/test_collection_get.py @@ -6,7 +6,7 @@ from pydantic import BaseModel from pydantic.dataclasses import dataclass as pydantic_dataclass -from integration.conftest import CollectionFactoryGet +from integration.conftest import CollectionFactoryGet, CollectionFactory from weaviate.collections import Collection from weaviate.collections.data import _Data from weaviate.exceptions import InvalidDataModelException @@ -80,3 +80,17 @@ def test_get_with_wrong_generics( assert error.value.args[0] == WRONG_PROPERTIES_ERROR_MSG else: assert error.value.args[0] == WRONG_REFERENCES_ERROR_MSG + + +def test_get_with_skip_validation( + collection_factory_get: CollectionFactoryGet, collection_factory: CollectionFactory +) -> None: + collection_dummy = collection_factory() + + collection = collection_factory_get(collection_dummy.name, skip_argument_validation=True) + with pytest.raises(AttributeError): + collection.data.insert(properties=[]) + with pytest.raises(TypeError): + collection.query.bm25(query=5) # type: ignore + with pytest.raises(TypeError): + collection.query.near_vector(vector="test") # type: ignore diff --git a/test/collection/test_queries.py b/test/collection/test_queries.py index 4e1cd69a8..d40d94d2d 100644 --- a/test/collection/test_queries.py +++ b/test/collection/test_queries.py @@ -87,7 +87,7 @@ def _test_query(query: Callable) -> None: def test_bad_query_inputs(connection: ConnectionV4) -> None: - query = _QueryCollection(connection, "dummy", None, None, None, None) + query = _QueryCollection(connection, "dummy", None, None, None, None, True) # fetch_objects _test_query(lambda: query.fetch_objects(limit="thing")) _test_query(lambda: query.fetch_objects(offset="wrong")) diff --git a/weaviate/collections/base.py b/weaviate/collections/base.py index 27be72988..4cd5ed77c 100644 --- a/weaviate/collections/base.py +++ b/weaviate/collections/base.py @@ -20,10 +20,11 @@ class _CollectionBase: - def __init__(self, connection: ConnectionV4, name: str) -> None: + def __init__(self, connection: ConnectionV4, name: str, validate_arguments: bool) -> None: self._connection = connection self.name = _capitalize_first_letter(name) self.__cluster = _Cluster(connection) + self._validate_arguments = validate_arguments def shards(self) -> List[Shard]: """ diff --git a/weaviate/collections/collection.py b/weaviate/collections/collection.py index cf8273df4..040227bba 100644 --- a/weaviate/collections/collection.py +++ b/weaviate/collections/collection.py @@ -24,8 +24,8 @@ from weaviate.collections.iterator import _ObjectIterator from weaviate.collections.query import _GenerateCollection, _QueryCollection from weaviate.collections.tenants import _Tenants -from weaviate.validator import _validate_input, _ValidateArgument from weaviate.connect import ConnectionV4 +from weaviate.validator import _validate_input, _ValidateArgument class Collection(_CollectionBase, Generic[Properties, References]): @@ -60,12 +60,13 @@ def __init__( self, connection: ConnectionV4, name: str, + validate_arguments: bool, consistency_level: Optional[ConsistencyLevel] = None, tenant: Optional[str] = None, properties: Optional[Type[Properties]] = None, references: Optional[Type[References]] = None, ) -> None: - super().__init__(connection, name) + super().__init__(connection, name, validate_arguments) self.aggregate = _AggregateCollection( self._connection, self.name, consistency_level, tenant @@ -78,15 +79,27 @@ def __init__( self.config = _ConfigCollection(self._connection, self.name, tenant) """This namespace includes all the CRUD methods available to you when modifying the configuration of the collection in Weaviate.""" self.data = _DataCollection[Properties]( - connection, self.name, consistency_level, tenant, properties + connection, self.name, consistency_level, tenant, validate_arguments, properties ) """This namespace includes all the CUD methods available to you when modifying the data of the collection in Weaviate.""" self.generate = _GenerateCollection( - connection, self.name, consistency_level, tenant, properties, references + connection, + self.name, + consistency_level, + tenant, + properties, + references, + validate_arguments, ) """This namespace includes all the querying methods available to you when using Weaviate's generative capabilities.""" self.query = _QueryCollection[Properties, References]( - connection, self.name, consistency_level, tenant, properties, references + connection, + self.name, + consistency_level, + tenant, + properties, + references, + validate_arguments, ) """This namespace includes all the querying methods available to you when using Weaviate's standard query capabilities.""" self.tenants = _Tenants(connection, self.name) @@ -120,6 +133,7 @@ def with_tenant( return Collection[Properties, References]( self._connection, self.name, + self._validate_arguments, self.__consistency_level, tenant.name if isinstance(tenant, Tenant) else tenant, self.__properties, @@ -140,18 +154,20 @@ def with_consistency_level( `consistency_level` The consistency level to use. """ - _validate_input( - [ - _ValidateArgument( - expected=[ConsistencyLevel, None], - name="consistency_level", - value=consistency_level, - ) - ] - ) + if self._validate_arguments: + _validate_input( + [ + _ValidateArgument( + expected=[ConsistencyLevel, None], + name="consistency_level", + value=consistency_level, + ) + ] + ) return Collection[Properties, References]( self._connection, self.name, + self._validate_arguments, consistency_level, self.__tenant, self.__properties, diff --git a/weaviate/collections/collections.py b/weaviate/collections/collections.py index f457b3cf0..9565579e4 100644 --- a/weaviate/collections/collections.py +++ b/weaviate/collections/collections.py @@ -46,6 +46,7 @@ def create( vectorizer_config: Optional[_VectorizerConfigCreate] = None, data_model_properties: Optional[Type[Properties]] = None, data_model_references: Optional[Type[References]] = None, + skip_argument_validation: bool = False, ) -> Collection[Properties, References]: """Use this method to create a collection in Weaviate and immediately return a collection object. @@ -86,6 +87,8 @@ def create( 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. Raises: `weaviate.WeaviateConnectionError` @@ -113,13 +116,19 @@ def create( assert ( config.name == name ), f"Name of created collection ({name}) does not match given name ({config.name})" - return self.get(name, data_model_properties, data_model_references) + return self.get( + name, + data_model_properties, + data_model_references, + skip_argument_validation=skip_argument_validation, + ) def get( self, name: str, data_model_properties: Optional[Type[Properties]] = None, data_model_references: Optional[Type[References]] = None, + skip_argument_validation: bool = False, ) -> Collection[Properties, References]: """Use this method to return a collection object to be used when interacting with your Weaviate collection. @@ -136,22 +145,23 @@ def get( The generic class that you want to use to represent the objects of references in this collection when mutating objects through the `.query` namespace. The generic provided in this argument will propagate to the methods in `.query` and allow you to do `mypy` static type checking on your codebase. If you do not provide a generic, the methods in `.query` will return properties of referenced objects as `Dict[str, Any]`. - + `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. Raises: `weaviate.exceptions.InvalidDataModelException` If the data model is not a valid data model, i.e., it is not a `dict` nor a `TypedDict`. """ - _validate_input( - [_ValidateArgument(expected=[str], name="name", value=name)], - ) - _check_properties_generic(data_model_properties) - _check_references_generic(data_model_references) + if not skip_argument_validation: + _validate_input([_ValidateArgument(expected=[str], name="name", value=name)]) + _check_properties_generic(data_model_properties) + _check_references_generic(data_model_references) name = _capitalize_first_letter(name) return Collection[Properties, References]( self._connection, name, properties=data_model_properties, references=data_model_references, + validate_arguments=not skip_argument_validation, ) def delete(self, name: Union[str, List[str]]) -> None: diff --git a/weaviate/collections/data.py b/weaviate/collections/data.py index 5f911a25f..d6dac8647 100644 --- a/weaviate/collections/data.py +++ b/weaviate/collections/data.py @@ -46,7 +46,6 @@ WeaviateField, _check_properties_generic, ) -from weaviate.validator import _validate_input, _ValidateArgument from weaviate.connect import ConnectionV4 from weaviate.connect.v4 import _ExpectedStatusCodes from weaviate.exceptions import WeaviateInvalidInputError @@ -55,6 +54,7 @@ _datetime_to_string, get_vector, ) +from weaviate.validator import _validate_input, _ValidateArgument class _Data: @@ -64,11 +64,13 @@ def __init__( name: str, consistency_level: Optional[ConsistencyLevel], tenant: Optional[str], + validate_arguments: bool, ) -> None: self._connection = connection self.name = name self._consistency_level = consistency_level self._tenant = tenant + self._validate_arguments = validate_arguments self._batch_grpc = _BatchGRPC(connection, consistency_level) self._batch_delete_grpc = _BatchDeleteGRPC(connection, consistency_level) self._batch_rest = _BatchREST(connection, consistency_level) @@ -309,15 +311,21 @@ def __init__( name: str, consistency_level: Optional[ConsistencyLevel], tenant: Optional[str], + validate_arguments: bool, type_: Optional[Type[Properties]] = None, ): - super().__init__(connection, name, consistency_level, tenant) + super().__init__(connection, name, consistency_level, tenant, validate_arguments) self.__type = type_ def with_data_model(self, data_model: Type[TProperties]) -> "_DataCollection[TProperties]": _check_properties_generic(data_model) return _DataCollection[TProperties]( - self._connection, self.name, self._consistency_level, self._tenant, data_model + self._connection, + self.name, + self._consistency_level, + self._tenant, + self._validate_arguments, + data_model, ) def insert( @@ -346,14 +354,17 @@ def insert( `weaviate.exceptions.UnexpectedStatusCodeError`: If any unexpected error occurs during the insert operation, for example the given UUID already exists. """ - _validate_input( - [ - _ValidateArgument(expected=[UUID, None], name="uuid", value=uuid), - _ValidateArgument(expected=[Mapping], name="properties", value=properties), - _ValidateArgument(expected=[Mapping, None], name="references", value=references), - _ValidateArgument(expected=[Sequence, None], name="vector", value=vector), - ] - ) + if self._validate_arguments: + _validate_input( + [ + _ValidateArgument(expected=[UUID, None], name="uuid", value=uuid), + _ValidateArgument(expected=[Mapping], name="properties", value=properties), + _ValidateArgument( + expected=[Mapping, None], name="references", value=references + ), + _ValidateArgument(expected=[Sequence, None], name="vector", value=vector), + ], + ) props = self._serialize_props(properties) if properties is not None else {} refs = self._serialize_refs(references) if references is not None else {} weaviate_obj: Dict[str, Any] = { @@ -444,14 +455,17 @@ def replace( `weaviate.exceptions.WeaviateInsertInvalidPropertyError`: If a property is invalid. I.e., has name `id` or `vector`, which are reserved. """ - _validate_input( - [ - _ValidateArgument(expected=[UUID], name="uuid", value=uuid), - _ValidateArgument(expected=[Mapping], name="properties", value=properties), - _ValidateArgument(expected=[Mapping, None], name="references", value=references), - _ValidateArgument(expected=[Sequence, None], name="vector", value=vector), - ] - ) + if self._validate_arguments: + _validate_input( + [ + _ValidateArgument(expected=[UUID], name="uuid", value=uuid), + _ValidateArgument(expected=[Mapping], name="properties", value=properties), + _ValidateArgument( + expected=[Mapping, None], name="references", value=references + ), + _ValidateArgument(expected=[Sequence, None], name="vector", value=vector), + ] + ) props = self._serialize_props(properties) if properties is not None else {} refs = self._serialize_refs(references) if references is not None else {} weaviate_obj: Dict[str, Any] = { @@ -486,14 +500,19 @@ def update( `vector` The vector of the object. """ - _validate_input( - [ - _ValidateArgument(expected=[UUID], name="uuid", value=uuid), - _ValidateArgument(expected=[Mapping, None], name="properties", value=properties), - _ValidateArgument(expected=[Mapping, None], name="references", value=references), - _ValidateArgument(expected=[Sequence, None], name="vector", value=vector), - ] - ) + if self._validate_arguments: + _validate_input( + [ + _ValidateArgument(expected=[UUID], name="uuid", value=uuid), + _ValidateArgument( + expected=[Mapping, None], name="properties", value=properties + ), + _ValidateArgument( + expected=[Mapping, None], name="references", value=references + ), + _ValidateArgument(expected=[Sequence, None], name="vector", value=vector), + ], + ) props = self._serialize_props(properties) if properties is not None else {} refs = self._serialize_refs(references) if references is not None else {} weaviate_obj: Dict[str, Any] = {"class": self.name, "properties": {**props, **refs}} @@ -519,13 +538,16 @@ def reference_add(self, from_uuid: UUID, from_property: str, to: SingleReference `weaviate.UnexpectedStatusCodeError`: If Weaviate reports a non-OK status. """ - _validate_input( - [ - _ValidateArgument(expected=[UUID], name="from_uuid", value=from_uuid), - _ValidateArgument(expected=[str], name="from_property", value=from_property), - _ValidateArgument(expected=[UUID, ReferenceToMulti], name="references", value=to), - ] - ) + if self._validate_arguments: + _validate_input( + [ + _ValidateArgument(expected=[UUID], name="from_uuid", value=from_uuid), + _ValidateArgument(expected=[str], name="from_property", value=from_property), + _ValidateArgument( + expected=[UUID, ReferenceToMulti], name="references", value=to + ), + ], + ) if isinstance(to, ReferenceToMulti): ref = _Reference(target_collection=to.target_collection, uuids=to.uuids) else: @@ -564,13 +586,16 @@ def reference_delete( `to` The reference to delete, REQUIRED. """ - _validate_input( - [ - _ValidateArgument(expected=[UUID], name="from_uuid", value=from_uuid), - _ValidateArgument(expected=[str], name="from_property", value=from_property), - _ValidateArgument(expected=[UUID, ReferenceToMulti], name="references", value=to), - ] - ) + if self._validate_arguments: + _validate_input( + [ + _ValidateArgument(expected=[UUID], name="from_uuid", value=from_uuid), + _ValidateArgument(expected=[str], name="from_property", value=from_property), + _ValidateArgument( + expected=[UUID, ReferenceToMulti], name="references", value=to + ), + ] + ) if isinstance(to, ReferenceToMulti): ref = _Reference(target_collection=to.target_collection, uuids=to.uuids) else: @@ -588,23 +613,24 @@ def reference_replace(self, from_uuid: UUID, from_property: str, to: ReferenceIn `to` The reference to replace, REQUIRED. """ - _validate_input( - [ - _ValidateArgument(expected=[UUID], name="from_uuid", value=from_uuid), - _ValidateArgument(expected=[str], name="from_property", value=from_property), - _ValidateArgument( - expected=[ - UUID, - ReferenceToMulti, - List[str], - List[uuid_package.UUID], - List[UUID], - ], - name="references", - value=to, - ), - ] - ) + if self._validate_arguments: + _validate_input( + [ + _ValidateArgument(expected=[UUID], name="from_uuid", value=from_uuid), + _ValidateArgument(expected=[str], name="from_property", value=from_property), + _ValidateArgument( + expected=[ + UUID, + ReferenceToMulti, + List[str], + List[uuid_package.UUID], + List[UUID], + ], + name="references", + value=to, + ), + ] + ) if isinstance(to, ReferenceToMulti): ref = _Reference(target_collection=to.target_collection, uuids=to.uuids) else: diff --git a/weaviate/collections/grpc/query.py b/weaviate/collections/grpc/query.py index cd7fb2a42..846b03602 100644 --- a/weaviate/collections/grpc/query.py +++ b/weaviate/collections/grpc/query.py @@ -83,10 +83,12 @@ def __init__( name: str, tenant: Optional[str], consistency_level: Optional[ConsistencyLevel], + validate_arguments: bool, ): super().__init__(connection, consistency_level) self._name: str = name self._tenant = tenant + self._validate_arguments = validate_arguments self._return_props: Optional[Set[PROPERTY]] = None self._metadata: Optional[_MetadataQuery] = None @@ -131,7 +133,8 @@ def __init__( self._filters: Optional[_Filters] = None def __parse_sort(self, sort: Optional[_Sorting]) -> None: - _validate_input(_ValidateArgument([_Sorting, None], "sort", sort)) + if self._validate_arguments: + _validate_input(_ValidateArgument([_Sorting, None], "sort", sort)) if sort is None: self._sort = None @@ -152,40 +155,41 @@ def __parse_common( autocut: Optional[int] = None, group_by: Optional[_GroupBy] = None, ) -> None: - _validate_input( - [ - _ValidateArgument([int, None], "limit", limit), - _ValidateArgument([int, None], "offset", offset), - _ValidateArgument([uuid_lib.UUID, str, None], "after", after), - _ValidateArgument([_Filters, None], "filters", filters), - _ValidateArgument([_MetadataQuery, None], "metadata", metadata), - _ValidateArgument([_Generative, None], "generative", generative), - _ValidateArgument([Rerank, None], "rerank", rerank), - _ValidateArgument([int, None], "autocut", autocut), - _ValidateArgument([_GroupBy, None], "group_by", group_by), - _ValidateArgument( - [str, QueryNested, Sequence, None], "return_properties", return_properties - ), - _ValidateArgument( - [_QueryReference, Sequence, None], "return_references", return_references - ), - ] - ) - if isinstance(return_properties, Sequence): - for prop in return_properties: - _validate_input( + if self._validate_arguments: + _validate_input( + [ + _ValidateArgument([int, None], "limit", limit), + _ValidateArgument([int, None], "offset", offset), + _ValidateArgument([uuid_lib.UUID, str, None], "after", after), + _ValidateArgument([_Filters, None], "filters", filters), + _ValidateArgument([_MetadataQuery, None], "metadata", metadata), + _ValidateArgument([_Generative, None], "generative", generative), + _ValidateArgument([Rerank, None], "rerank", rerank), + _ValidateArgument([int, None], "autocut", autocut), + _ValidateArgument([_GroupBy, None], "group_by", group_by), + _ValidateArgument( + [str, QueryNested, Sequence, None], "return_properties", return_properties + ), _ValidateArgument( - expected=[str, QueryNested], name="return_properties", value=prop + [_QueryReference, Sequence, None], "return_references", return_references + ), + ] + ) + if isinstance(return_properties, Sequence): + for prop in return_properties: + _validate_input( + _ValidateArgument( + expected=[str, QueryNested], name="return_properties", value=prop + ) ) - ) - if isinstance(return_references, Sequence): - for ref in return_references: - _validate_input( - _ValidateArgument( - expected=[_QueryReference], name="return_references", value=ref + if isinstance(return_references, Sequence): + for ref in return_references: + _validate_input( + _ValidateArgument( + expected=[_QueryReference], name="return_references", value=ref + ) ) - ) self._limit = limit self._offset = offset @@ -210,24 +214,17 @@ def __parse_hybrid( properties: Optional[List[str]] = None, fusion_type: Optional[HybridFusion] = None, ) -> None: - if not isinstance(query, str): - raise WeaviateInvalidInputError(f"query must be of type str, but got {type(query)}") - if alpha is not None and not isinstance(alpha, float) and not isinstance(alpha, int): - raise WeaviateInvalidInputError( - f"alpha must be of type float or int, but got {type(alpha)}" - ) - if vector is not None and not isinstance(vector, list): - raise WeaviateInvalidInputError( - f"vector must be of type List[float], but got {type(vector)}" - ) - if properties is not None and not isinstance(properties, list): - raise WeaviateInvalidInputError( - f"properties must be of type List[str], but got {type(properties)}" - ) - if fusion_type is not None and not isinstance(fusion_type, HybridFusion): - raise WeaviateInvalidInputError( - f"fusion_type must be of type weaviate.classes.query.HybridFusion, but got {type(fusion_type)}." + if self._validate_arguments: + _validate_input( + [ + _ValidateArgument([str], "query", query), + _ValidateArgument([float, int, None], "alpha", alpha), + _ValidateArgument([List, None], "vector", vector), + _ValidateArgument([List, None], "properties", properties), + _ValidateArgument([HybridFusion, None], "fusion_type", fusion_type), + ] ) + self._hybrid_query = query self._hybrid_alpha = float(alpha) if alpha is not None else None self._hybrid_vector = vector @@ -243,11 +240,12 @@ def __parse_bm25( query: str, properties: Optional[List[str]] = None, ) -> None: - if not isinstance(query, str): - raise WeaviateInvalidInputError(f"query must be of type str, but got {type(query)}") - if properties is not None and not isinstance(properties, list): - raise WeaviateInvalidInputError( - f"properties must be of type List[str], but got {type(properties)}" + if self._validate_arguments: + _validate_input( + [ + _ValidateArgument([str], "query", query), + _ValidateArgument([List, None], "properties", properties), + ] ) self._bm25_query = query self._bm25_properties = properties @@ -257,22 +255,14 @@ def __parse_near_options( certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, ) -> None: - if ( - certainty is not None - and not isinstance(certainty, float) - and not isinstance(certainty, int) - ): - raise WeaviateInvalidInputError( - f"certainty must be of type float or int, but got {type(certainty)}" - ) - if ( - distance is not None - and not isinstance(distance, float) - and not isinstance(distance, int) - ): - raise WeaviateInvalidInputError( - f"distance must be of type float or int, but got {type(distance)}" + if self._validate_arguments: + _validate_input( + [ + _ValidateArgument([float, int, None], "certainty", certainty), + _ValidateArgument([float, int, None], "distance", distance), + ] ) + self._near_certainty = float(certainty) if certainty is not None else None self._near_distance = float(distance) if distance is not None else None @@ -378,10 +368,9 @@ def near_vector( return_properties: Optional[PROPERTIES] = None, return_references: Optional[REFERENCES] = None, ) -> search_get_pb2.SearchReply: - if not isinstance(near_vector, list): - raise WeaviateInvalidInputError( - f"near_vector must be of type List[float], but got {type(near_vector)}" - ) + if self._validate_arguments: + _validate_input(_ValidateArgument([List], "near_vector", near_vector)) + self._near_vector_vec = near_vector self.__parse_near_options(certainty, distance) self.__parse_common( diff --git a/weaviate/collections/queries/base.py b/weaviate/collections/queries/base.py index e54432f5b..b170cb818 100644 --- a/weaviate/collections/queries/base.py +++ b/weaviate/collections/queries/base.py @@ -78,6 +78,7 @@ def __init__( tenant: Optional[str], properties: Optional[Type[Properties]], references: Optional[Type[References]], + validate_arguments: bool, ): self.__connection = connection self._name = name @@ -85,6 +86,7 @@ def __init__( self.__consistency_level = consistency_level self._properties = properties self._references = references + self._validate_arguments = validate_arguments def _query(self) -> _QueryGRPC: if not self.__connection.is_connected(): @@ -94,6 +96,7 @@ def _query(self) -> _QueryGRPC: self._name, self.__tenant, self.__consistency_level, + validate_arguments=self._validate_arguments, ) def __extract_metadata_for_object( @@ -518,14 +521,15 @@ def _parse_return_properties( def _parse_return_metadata( self, return_metadata: Optional[METADATA], include_vector: bool ) -> Optional[_MetadataQuery]: - _validate_input( - [ - _ValidateArgument( - [Sequence[str], MetadataQuery, None], "return_metadata", return_metadata - ), - _ValidateArgument([bool], "include_vector", include_vector), - ] - ) + if self._validate_arguments: + _validate_input( + [ + _ValidateArgument( + [Sequence[str], MetadataQuery, None], "return_metadata", return_metadata + ), + _ValidateArgument([bool], "include_vector", include_vector), + ] + ) if return_metadata is None: ret_md = None elif isinstance(return_metadata, Sequence): From 68158e9af594b4f39dfe24f0ae8ddca9f6786cb9 Mon Sep 17 00:00:00 2001 From: Dirk Kulawiak Date: Mon, 5 Feb 2024 07:55:34 +0100 Subject: [PATCH 2/3] Free some space --- .github/workflows/main.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 10d971a19..07293845d 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -109,6 +109,8 @@ jobs: - run: | pip install -r requirements-devel.txt pip install . + - name: free space + run: sudo rm -rf /usr/local/lib/android - name: start weaviate run: /bin/bash ci/start_weaviate.sh ${{ matrix.versions.weaviate }} - name: Run integration tests with auth secrets @@ -158,6 +160,8 @@ jobs: - run: | pip install -r requirements-devel.txt pip install . + - name: free space + run: sudo rm -rf /usr/local/lib/android - name: start weaviate run: /bin/bash ci/start_weaviate.sh ${{ matrix.versions.weaviate }} - name: Run integration tests with auth secrets From 9fac31e42d9377c72c2927a35f2fad869bfe1550 Mon Sep 17 00:00:00 2001 From: Dirk Kulawiak Date: Mon, 5 Feb 2024 08:31:12 +0100 Subject: [PATCH 3/3] Free space in more pipelines --- .github/workflows/main.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 07293845d..310d3727d 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -260,6 +260,8 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 0 + - name: free space + run: sudo rm -rf /usr/local/lib/android - run: rm -r weaviate - name: start weaviate run: /bin/bash ci/start_weaviate.sh ${{ matrix.server }}