nucliadb 6.5.1.post4530__py3-none-any.whl → 6.5.1.post4535__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.
nucliadb/ingest/app.py CHANGED
@@ -176,7 +176,6 @@ async def main_subscriber_workers(): # pragma: no cover
176
176
 
177
177
  def setup_configuration(): # pragma: no cover
178
178
  setup_logging()
179
- assign_partitions(settings)
180
179
 
181
180
  errors.setup_error_handling(importlib.metadata.distribution("nucliadb").version)
182
181
 
@@ -188,9 +187,9 @@ def run_consumer() -> None: # pragma: no cover
188
187
  """
189
188
  Running:
190
189
  - main consumer
191
- - pull worker
192
190
  """
193
191
  setup_configuration()
192
+ assign_partitions(settings)
194
193
  asyncio.run(main_consumer())
195
194
 
196
195
 
@@ -19,7 +19,7 @@
19
19
  #
20
20
  import json
21
21
  from enum import Enum
22
- from typing import Any, Optional, Union
22
+ from typing import Any, AsyncIterable, Optional, Union
23
23
 
24
24
  import aiohttp
25
25
  from fastapi.datastructures import QueryParams
@@ -171,13 +171,21 @@ async def chat_streaming_generator(
171
171
  user_query: str,
172
172
  is_json: bool,
173
173
  ):
174
+ stream: AsyncIterable[bytes]
175
+ if is_json:
176
+ # ndjson: stream lines
177
+ stream = predict_response.content
178
+ else:
179
+ # plain text: stream chunks (last chunk is status)
180
+ stream = predict_response.content.iter_any()
181
+
174
182
  first = True
175
183
  status_code = AnswerStatusCode.ERROR.value
176
184
  text_answer = ""
177
185
  json_object = None
178
186
  metrics = AskMetrics()
179
187
  with metrics.time(PREDICT_ANSWER_METRIC):
180
- async for chunk in predict_response.content:
188
+ async for chunk in stream:
181
189
  if first:
182
190
  metrics.record_first_chunk_yielded()
183
191
  first = False
@@ -203,7 +211,7 @@ async def chat_streaming_generator(
203
211
 
204
212
  if is_json is False and chunk: # Ensure chunk is not empty before decoding
205
213
  # If response is text the status_code comes at the last chunk of data
206
- status_code = chunk.decode().split(".")[-1]
214
+ status_code = chunk.decode()
207
215
 
208
216
  audit_predict_proxy_endpoint(
209
217
  headers=predict_response.headers,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nucliadb
3
- Version: 6.5.1.post4530
3
+ Version: 6.5.1.post4535
4
4
  Summary: NucliaDB
5
5
  Author-email: Nuclia <nucliadb@nuclia.com>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -19,11 +19,11 @@ Classifier: Programming Language :: Python :: 3.12
19
19
  Classifier: Programming Language :: Python :: 3 :: Only
20
20
  Requires-Python: <4,>=3.9
21
21
  Description-Content-Type: text/markdown
22
- Requires-Dist: nucliadb-telemetry[all]>=6.5.1.post4530
23
- Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.5.1.post4530
24
- Requires-Dist: nucliadb-protos>=6.5.1.post4530
25
- Requires-Dist: nucliadb-models>=6.5.1.post4530
26
- Requires-Dist: nidx-protos>=6.5.1.post4530
22
+ Requires-Dist: nucliadb-telemetry[all]>=6.5.1.post4535
23
+ Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.5.1.post4535
24
+ Requires-Dist: nucliadb-protos>=6.5.1.post4535
25
+ Requires-Dist: nucliadb-models>=6.5.1.post4535
26
+ Requires-Dist: nidx-protos>=6.5.1.post4535
27
27
  Requires-Dist: nucliadb-admin-assets>=1.0.0.post1224
28
28
  Requires-Dist: nuclia-models>=0.24.2
29
29
  Requires-Dist: uvicorn[standard]
@@ -130,7 +130,7 @@ nucliadb/export_import/models.py,sha256=dbjScNkiMRv4X3Ktudy1JRliD25bfoDTy3JmEZgQ
130
130
  nucliadb/export_import/tasks.py,sha256=DWbdqY97ffoyfipelGXz3Jqz1iam6JCjQSh367Fc3NA,2947
131
131
  nucliadb/export_import/utils.py,sha256=XV3tJJdhgnVJRSj8AxZjgeipONtB107M185HVJmHp2Q,21626
132
132
  nucliadb/ingest/__init__.py,sha256=fsw3C38VP50km3R-nHL775LNGPpJ4JxqXJ2Ib1f5SqE,1011
133
- nucliadb/ingest/app.py,sha256=Heyd5TubnM6HOo4eQdjg-laedALu1vq96B0XJ5T5QUc,7400
133
+ nucliadb/ingest/app.py,sha256=qiPad2eWgudRdLq0tB0MQZOxOezXO7QBK_ZpPNKQZO0,7378
134
134
  nucliadb/ingest/partitions.py,sha256=2NIhMYbNT0TNBL6bX1UMSi7vxFGICstCKEqsB0TXHOE,2410
135
135
  nucliadb/ingest/processing.py,sha256=QmkHq-BU4vub7JRWe9VHvQ2DcAmT6-CzgFXuZxXhcBU,20953
136
136
  nucliadb/ingest/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -255,7 +255,7 @@ nucliadb/search/search/merge.py,sha256=XiRBsxhYPshPV7lZXD-9E259KZOPIf4I2tKosY0lP
255
255
  nucliadb/search/search/metrics.py,sha256=3I6IN0qDSmqIvUaWJmT3rt-Jyjs6LcvnKI8ZqCiuJPY,3501
256
256
  nucliadb/search/search/paragraphs.py,sha256=pNAEiYqJGGUVcEf7xf-PFMVqz0PX4Qb-WNG-_zPGN2o,7799
257
257
  nucliadb/search/search/pgcatalog.py,sha256=_AiyW6it66UX6BsZbM3-230IQhiEG4utoKYboviyOFI,16799
258
- nucliadb/search/search/predict_proxy.py,sha256=T4T6c1ZAbBCgPLy-6JoSlixy-0bAh6z0rNH1bMMy3bg,8631
258
+ nucliadb/search/search/predict_proxy.py,sha256=Q12I3VIAQqFgzBe9UeVEiAjUAdVT8NBfNDXWiP-pn1M,8858
259
259
  nucliadb/search/search/query.py,sha256=0qIQdt548L3jtKOyKo06aGJ73SLBxAW3N38_Hc1M3Uw,11528
260
260
  nucliadb/search/search/rank_fusion.py,sha256=xZtXhbmKb_56gs73u6KkFm2efvTATOSMmpOV2wrAIqE,9613
261
261
  nucliadb/search/search/rerankers.py,sha256=E2J1QdKAojqbhHM3KAyaOXKf6tJyETUxKs4tf_BEyqk,7472
@@ -375,8 +375,8 @@ nucliadb/writer/tus/local.py,sha256=7jYa_w9b-N90jWgN2sQKkNcomqn6JMVBOVeDOVYJHto,
375
375
  nucliadb/writer/tus/s3.py,sha256=vF0NkFTXiXhXq3bCVXXVV-ED38ECVoUeeYViP8uMqcU,8357
376
376
  nucliadb/writer/tus/storage.py,sha256=ToqwjoYnjI4oIcwzkhha_MPxi-k4Jk3Lt55zRwaC1SM,2903
377
377
  nucliadb/writer/tus/utils.py,sha256=MSdVbRsRSZVdkaum69_0wku7X3p5wlZf4nr6E0GMKbw,2556
378
- nucliadb-6.5.1.post4530.dist-info/METADATA,sha256=VLBiZFd6EuYQ_Fq7g-Ag7UsS95inA5Qul84WOIW4Dj0,4158
379
- nucliadb-6.5.1.post4530.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
380
- nucliadb-6.5.1.post4530.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
381
- nucliadb-6.5.1.post4530.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
382
- nucliadb-6.5.1.post4530.dist-info/RECORD,,
378
+ nucliadb-6.5.1.post4535.dist-info/METADATA,sha256=wteSYJa5ozYnzOo6LACfbeiiZY_xxYR1XdEfAx8nbO0,4158
379
+ nucliadb-6.5.1.post4535.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
380
+ nucliadb-6.5.1.post4535.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
381
+ nucliadb-6.5.1.post4535.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
382
+ nucliadb-6.5.1.post4535.dist-info/RECORD,,