nucliadb 6.3.4.post3751__py3-none-any.whl → 6.3.4.post3769__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.
@@ -314,7 +314,7 @@ class Processor:
314
314
  # index message
315
315
 
316
316
  if resource:
317
- if message.reindex:
317
+ if any(needs_reindex(m) for m in messages):
318
318
  # when reindexing, let's just generate full new index message
319
319
  # TODO - This should be improved in the future as it's not optimal for very large resources:
320
320
  # As of now, there are some API operations that require fully reindexing all the fields of a resource.
@@ -759,3 +759,26 @@ def has_vectors_operation(index_message: PBBrainResource) -> bool:
759
759
  if len(vectorset_sentences.sentences) > 0:
760
760
  return True
761
761
  return False
762
+
763
+
764
+ def needs_reindex(bm: writer_pb2.BrokerMessage) -> bool:
765
+ return bm.reindex or is_vectorset_migration_bm(bm)
766
+
767
+
768
+ def is_vectorset_migration_bm(bm: writer_pb2.BrokerMessage) -> bool:
769
+ """
770
+ This is a temporary solution to avoid duplicating paragraphs and text fields during vector migrations.
771
+ We need to reindex all the fields of a resource to avoid this issue.
772
+ TODO: Remove this when the index message generation logic has been decoupled into its own method.
773
+
774
+ Broker messages from semantic model migration task only contain the `field_vectors` field set.
775
+ """
776
+ return (
777
+ len(bm.field_vectors) > 0
778
+ and not bm.HasField("basic")
779
+ and len(bm.delete_fields) == 0
780
+ and len(bm.files) == 0
781
+ and len(bm.texts) == 0
782
+ and len(bm.conversations) == 0
783
+ and len(bm.links) == 0
784
+ )
@@ -436,6 +436,9 @@ class NotEnoughContextAskResult(AskResult):
436
436
  return the find results and the messages indicating that there is not enough
437
437
  context in the corpus to answer.
438
438
  """
439
+ status = AnswerStatusCode.NO_RETRIEVAL_DATA
440
+ yield self._ndjson_encode(StatusAskResponseItem(code=status.value, status=status.prettify()))
441
+ yield self._ndjson_encode(AnswerAskResponseItem(text=NOT_ENOUGH_CONTEXT_ANSWER))
439
442
  yield self._ndjson_encode(RetrievalAskResponseItem(results=self.main_results))
440
443
  if self.prequeries_results:
441
444
  yield self._ndjson_encode(
@@ -446,9 +449,6 @@ class NotEnoughContextAskResult(AskResult):
446
449
  }
447
450
  )
448
451
  )
449
- yield self._ndjson_encode(AnswerAskResponseItem(text=NOT_ENOUGH_CONTEXT_ANSWER))
450
- status = AnswerStatusCode.NO_RETRIEVAL_DATA
451
- yield self._ndjson_encode(StatusAskResponseItem(code=status.value, status=status.prettify()))
452
452
 
453
453
  async def json(self) -> str:
454
454
  prequeries = (
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nucliadb
3
- Version: 6.3.4.post3751
3
+ Version: 6.3.4.post3769
4
4
  Summary: NucliaDB
5
5
  Author-email: Nuclia <nucliadb@nuclia.com>
6
6
  License: AGPL
@@ -20,11 +20,11 @@ Classifier: Programming Language :: Python :: 3.12
20
20
  Classifier: Programming Language :: Python :: 3 :: Only
21
21
  Requires-Python: <4,>=3.9
22
22
  Description-Content-Type: text/markdown
23
- Requires-Dist: nucliadb-telemetry[all]>=6.3.4.post3751
24
- Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.3.4.post3751
25
- Requires-Dist: nucliadb-protos>=6.3.4.post3751
26
- Requires-Dist: nucliadb-models>=6.3.4.post3751
27
- Requires-Dist: nidx-protos>=6.3.4.post3751
23
+ Requires-Dist: nucliadb-telemetry[all]>=6.3.4.post3769
24
+ Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.3.4.post3769
25
+ Requires-Dist: nucliadb-protos>=6.3.4.post3769
26
+ Requires-Dist: nucliadb-models>=6.3.4.post3769
27
+ Requires-Dist: nidx-protos>=6.3.4.post3769
28
28
  Requires-Dist: nucliadb-admin-assets>=1.0.0.post1224
29
29
  Requires-Dist: nuclia-models>=0.24.2
30
30
  Requires-Dist: uvicorn
@@ -151,7 +151,7 @@ nucliadb/ingest/orm/processor/__init__.py,sha256=Aqd9wCNTvggkMkCY3WvoI8spdr94Jnq
151
151
  nucliadb/ingest/orm/processor/auditing.py,sha256=TeYhXGJRyQ7ROytbb2u8R0fIh_FYi3HgTu3S1ribY3U,4623
152
152
  nucliadb/ingest/orm/processor/data_augmentation.py,sha256=HpSU9olDHcTfECDYCsmm4yA-Hu0mBrd_zTtx50XDGFE,5164
153
153
  nucliadb/ingest/orm/processor/pgcatalog.py,sha256=f32PIEXWktWzGDws6Ffife37OAfrseP5IOti_Cb4ir8,3012
154
- nucliadb/ingest/orm/processor/processor.py,sha256=wjZmfJumypdGoKVB0BEJ51ha3xNRs1CzDZbFGj7z4_8,31668
154
+ nucliadb/ingest/orm/processor/processor.py,sha256=Tb87wm9Yqd4sS_x_wFTaIG3Tn3sznG8AuLCOanYhVDQ,32536
155
155
  nucliadb/ingest/orm/processor/sequence_manager.py,sha256=uqEphtI1Ir_yk9jRl2gPf7BlzzXWovbARY5MNZSBI_8,1704
156
156
  nucliadb/ingest/service/__init__.py,sha256=MME_G_ERxzJR6JW_hfE2qcfXpmpH1kdG-S0a-M0qRm8,2043
157
157
  nucliadb/ingest/service/exceptions.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
@@ -244,7 +244,7 @@ nucliadb/search/search/shards.py,sha256=OEtN1p9WX_cMX8t-myaafpmFAPTpUEOutR7z1sDu
244
244
  nucliadb/search/search/summarize.py,sha256=ksmYPubEQvAQgfPdZHfzB_rR19B2ci4IYZ6jLdHxZo8,4996
245
245
  nucliadb/search/search/utils.py,sha256=iF2tbBA56gRMJH1TlE2hMrqeXqjoeOPt4KgRdp2m9Ek,3313
246
246
  nucliadb/search/search/chat/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
247
- nucliadb/search/search/chat/ask.py,sha256=olZT08JVo3ZGDsDXkjvI2JTlqQln_o91HJzv0TKFQ7I,37244
247
+ nucliadb/search/search/chat/ask.py,sha256=4Vi4yxnhjToPHZUtdUkFNAEuI85QgkyBXQkcRX-a_vA,37244
248
248
  nucliadb/search/search/chat/exceptions.py,sha256=Siy4GXW2L7oPhIR86H3WHBhE9lkV4A4YaAszuGGUf54,1356
249
249
  nucliadb/search/search/chat/images.py,sha256=PA8VWxT5_HUGfW1ULhKTK46UBsVyINtWWqEM1ulzX1E,3095
250
250
  nucliadb/search/search/chat/prompt.py,sha256=Jnja-Ss7skgnnDY8BymVfdeYsFPnIQFL8tEvcRXTKUE,47356
@@ -354,8 +354,8 @@ nucliadb/writer/tus/local.py,sha256=7jYa_w9b-N90jWgN2sQKkNcomqn6JMVBOVeDOVYJHto,
354
354
  nucliadb/writer/tus/s3.py,sha256=vF0NkFTXiXhXq3bCVXXVV-ED38ECVoUeeYViP8uMqcU,8357
355
355
  nucliadb/writer/tus/storage.py,sha256=ToqwjoYnjI4oIcwzkhha_MPxi-k4Jk3Lt55zRwaC1SM,2903
356
356
  nucliadb/writer/tus/utils.py,sha256=MSdVbRsRSZVdkaum69_0wku7X3p5wlZf4nr6E0GMKbw,2556
357
- nucliadb-6.3.4.post3751.dist-info/METADATA,sha256=I5OpHocyVjeDMRw-Y-XC8yLWVqC9VQ4XHj0ITwxGr18,4291
358
- nucliadb-6.3.4.post3751.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
359
- nucliadb-6.3.4.post3751.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
360
- nucliadb-6.3.4.post3751.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
361
- nucliadb-6.3.4.post3751.dist-info/RECORD,,
357
+ nucliadb-6.3.4.post3769.dist-info/METADATA,sha256=3yi784IVKCq1hDA5dt7jxVLfDJ6P8kCcGxL38k64JZ4,4291
358
+ nucliadb-6.3.4.post3769.dist-info/WHEEL,sha256=L0N565qmK-3nM2eBoMNFszYJ_MTx03_tQ0CQu1bHLYo,91
359
+ nucliadb-6.3.4.post3769.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
360
+ nucliadb-6.3.4.post3769.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
361
+ nucliadb-6.3.4.post3769.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (77.0.3)
2
+ Generator: setuptools (78.0.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5