nucliadb-utils 5.0.0.post941__py3-none-any.whl → 5.0.0.post944__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -523,3 +523,31 @@ async def async_batchify(async_iterable: AsyncIterable, batch_size: int):
523
523
  batch = []
524
524
  if batch:
525
525
  yield batch
526
+
527
+
528
+ class FilterOperator:
529
+ """
530
+ Filter operators for metadata queries.
531
+ https://docs.pinecone.io/guides/data/filter-with-metadata#metadata-query-language
532
+ """
533
+
534
+ EQUALS = "$eq"
535
+ NOT_EQUALS = "$ne"
536
+ GREATER_THAN = "$gt"
537
+ GREATER_THAN_OR_EQUAL = "$gte"
538
+ LESS_THAN = "$lt"
539
+ LESS_THAN_OR_EQUAL = "$lte"
540
+ IN = "$in"
541
+ NOT_IN = "$nin"
542
+ EXISTS = "$exists"
543
+
544
+
545
+ class LogicalOperator:
546
+ """
547
+ Logical operators for metadata queries.
548
+ https://docs.pinecone.io/guides/data/filter-with-metadata#metadata-query-language
549
+ """
550
+
551
+ AND = "$and"
552
+ OR = "$or"
553
+ NOT = "$not"
@@ -60,6 +60,14 @@ class PineconeRateLimitError(PineconeAPIError):
60
60
  pass
61
61
 
62
62
 
63
+ class MetadataTooLargeError(ValueError):
64
+ """
65
+ Raised when the metadata of a vector to be upserted is too large.
66
+ """
67
+
68
+ pass
69
+
70
+
63
71
  def raise_for_status(operation: str, response: httpx.Response):
64
72
  try:
65
73
  response.raise_for_status()
@@ -24,6 +24,8 @@ import pydantic
24
24
  from pydantic import BaseModel, Field, field_validator
25
25
  from typing_extensions import Annotated
26
26
 
27
+ from nucliadb_utils.aiopynecone.exceptions import MetadataTooLargeError
28
+
27
29
  KILO_BYTE = 1024
28
30
  MAX_METADATA_SIZE = 40 * KILO_BYTE
29
31
  MAX_INDEX_NAME_LENGTH = 45
@@ -71,7 +73,7 @@ class Vector(BaseModel):
71
73
  def validate_metadata_size(cls, value):
72
74
  json_value = json.dumps(value)
73
75
  if len(json_value) > MAX_METADATA_SIZE:
74
- raise ValueError("metadata size is too large")
76
+ raise MetadataTooLargeError(f"metadata size is too large: {len(json_value)} bytes")
75
77
  return value
76
78
 
77
79
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nucliadb_utils
3
- Version: 5.0.0.post941
3
+ Version: 5.0.0.post944
4
4
  Home-page: https://nuclia.com
5
5
  License: BSD
6
6
  Classifier: Development Status :: 4 - Beta
@@ -23,8 +23,8 @@ Requires-Dist: PyNaCl
23
23
  Requires-Dist: pyjwt >=2.4.0
24
24
  Requires-Dist: memorylru >=1.1.2
25
25
  Requires-Dist: mrflagly
26
- Requires-Dist: nucliadb-protos >=5.0.0.post941
27
- Requires-Dist: nucliadb-telemetry >=5.0.0.post941
26
+ Requires-Dist: nucliadb-protos >=5.0.0.post944
27
+ Requires-Dist: nucliadb-telemetry >=5.0.0.post944
28
28
  Provides-Extra: cache
29
29
  Requires-Dist: redis >=4.3.4 ; extra == 'cache'
30
30
  Requires-Dist: orjson >=3.6.7 ; extra == 'cache'
@@ -18,9 +18,9 @@ nucliadb_utils/store.py,sha256=kQ35HemE0v4_Qg6xVqNIJi8vSFAYQtwI3rDtMsNy62Y,890
18
18
  nucliadb_utils/transaction.py,sha256=mwcI3aIHAvU5KOGqd_Uz_d1XQzXhk_-NWY8NqU1lfb0,7307
19
19
  nucliadb_utils/utilities.py,sha256=trAez4j2TYYT5n1qpimyHOEAnsQqDqD2qCFgVSDi184,16747
20
20
  nucliadb_utils/aiopynecone/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
21
- nucliadb_utils/aiopynecone/client.py,sha256=JsFmHmPjs73JU3ZQY3LmrpOma4oBAhuXxIHgQ987Yp8,19464
22
- nucliadb_utils/aiopynecone/exceptions.py,sha256=hFhq-UEY4slqNWjObXr_LPnRf_AQ1vpcG4SF2XRFd1E,2873
23
- nucliadb_utils/aiopynecone/models.py,sha256=B_ihJhHZGp3ivQVUxhV49uoUnHe1PLDKxTgHNbHgSS0,2937
21
+ nucliadb_utils/aiopynecone/client.py,sha256=pl3WWGpjwoc-qzgDChuIE2LU7Mopu1aKL9iPHkr8QD0,20069
22
+ nucliadb_utils/aiopynecone/exceptions.py,sha256=EEE0XoGs1zIB5yOJ_fy6yoG4uIb4cWIawYdJeNe4eDo,3012
23
+ nucliadb_utils/aiopynecone/models.py,sha256=tUugQ-ACQAyT-lhsfLwKAOgb6ilLchLwZfnRV7xwFck,3047
24
24
  nucliadb_utils/audit/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
25
25
  nucliadb_utils/audit/audit.py,sha256=kpjiTLgWtLXA5DNgJcmeIaodel11Mz0Y-JfQt-yfhis,2641
26
26
  nucliadb_utils/audit/basic.py,sha256=LwCCvUAwy8LNzYdrw3NebxqNdUumCEyRQ244dJ93JfE,3190
@@ -64,8 +64,8 @@ nucliadb_utils/tests/indexing.py,sha256=YW2QhkhO9Q_8A4kKWJaWSvXvyQ_AiAwY1VylcfVQ
64
64
  nucliadb_utils/tests/local.py,sha256=7nuP8EFUAiA8ZH50R1iPV9EUXBySQxOanVm3Zht_e0g,1835
65
65
  nucliadb_utils/tests/nats.py,sha256=xqpww4jZjTKY9oPGlJdDJG67L3FIBQsa9qDHxILR8r8,7687
66
66
  nucliadb_utils/tests/s3.py,sha256=IdMxK_cNdSHLvO1u8BwsKFzD87Hk1MVPDZ57zx6h-rA,3656
67
- nucliadb_utils-5.0.0.post941.dist-info/METADATA,sha256=KvXDjN4ZbzwDj-QrqChx6mHzZqLvsNUzP4gNoUwQGyU,2073
68
- nucliadb_utils-5.0.0.post941.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
69
- nucliadb_utils-5.0.0.post941.dist-info/top_level.txt,sha256=fE3vJtALTfgh7bcAWcNhcfXkNPp_eVVpbKK-2IYua3E,15
70
- nucliadb_utils-5.0.0.post941.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
71
- nucliadb_utils-5.0.0.post941.dist-info/RECORD,,
67
+ nucliadb_utils-5.0.0.post944.dist-info/METADATA,sha256=5LUVJjFXK-iP4wwMuJ28VQ8_PAhFaDxeI0mb8ZM0c3s,2073
68
+ nucliadb_utils-5.0.0.post944.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
69
+ nucliadb_utils-5.0.0.post944.dist-info/top_level.txt,sha256=fE3vJtALTfgh7bcAWcNhcfXkNPp_eVVpbKK-2IYua3E,15
70
+ nucliadb_utils-5.0.0.post944.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
71
+ nucliadb_utils-5.0.0.post944.dist-info/RECORD,,