nucliadb 6.8.1.post4939__py3-none-any.whl → 6.8.1.post4957__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.
Potentially problematic release.
This version of nucliadb might be problematic. Click here for more details.
- nucliadb/search/search/predict_proxy.py +10 -7
- {nucliadb-6.8.1.post4939.dist-info → nucliadb-6.8.1.post4957.dist-info}/METADATA +6 -6
- {nucliadb-6.8.1.post4939.dist-info → nucliadb-6.8.1.post4957.dist-info}/RECORD +6 -6
- {nucliadb-6.8.1.post4939.dist-info → nucliadb-6.8.1.post4957.dist-info}/WHEEL +0 -0
- {nucliadb-6.8.1.post4939.dist-info → nucliadb-6.8.1.post4957.dist-info}/entry_points.txt +0 -0
- {nucliadb-6.8.1.post4939.dist-info → nucliadb-6.8.1.post4957.dist-info}/top_level.txt +0 -0
|
@@ -88,6 +88,7 @@ async def predict_proxy(
|
|
|
88
88
|
predict_headers = predict.get_predict_headers(kbid)
|
|
89
89
|
user_headers = {k: v for k, v in headers.items() if k.capitalize() in ALLOWED_HEADERS}
|
|
90
90
|
|
|
91
|
+
metrics = AskMetrics()
|
|
91
92
|
# Proxy the request to predict API
|
|
92
93
|
predict_response = await predict.make_request(
|
|
93
94
|
method=method,
|
|
@@ -110,7 +111,8 @@ async def predict_proxy(
|
|
|
110
111
|
client_type=client_type,
|
|
111
112
|
origin=origin,
|
|
112
113
|
user_query=user_query,
|
|
113
|
-
|
|
114
|
+
is_ndjson_stream="json" in (media_type or ""),
|
|
115
|
+
metrics=metrics,
|
|
114
116
|
)
|
|
115
117
|
else:
|
|
116
118
|
streaming_generator = predict_response.content.iter_any()
|
|
@@ -121,7 +123,6 @@ async def predict_proxy(
|
|
|
121
123
|
media_type=media_type,
|
|
122
124
|
)
|
|
123
125
|
else:
|
|
124
|
-
metrics = AskMetrics()
|
|
125
126
|
with metrics.time(PREDICT_ANSWER_METRIC):
|
|
126
127
|
content = await predict_response.read()
|
|
127
128
|
|
|
@@ -173,7 +174,8 @@ async def chat_streaming_generator(
|
|
|
173
174
|
client_type: NucliaDBClientType,
|
|
174
175
|
origin: str,
|
|
175
176
|
user_query: str,
|
|
176
|
-
|
|
177
|
+
is_ndjson_stream: bool,
|
|
178
|
+
metrics: AskMetrics,
|
|
177
179
|
):
|
|
178
180
|
first = True
|
|
179
181
|
first_reasoning = True
|
|
@@ -181,12 +183,10 @@ async def chat_streaming_generator(
|
|
|
181
183
|
text_answer = ""
|
|
182
184
|
text_reasoning = ""
|
|
183
185
|
json_object = None
|
|
184
|
-
metrics = AskMetrics()
|
|
185
186
|
with metrics.time(PREDICT_ANSWER_METRIC):
|
|
186
187
|
async for chunk in predict_response.content:
|
|
187
188
|
yield chunk
|
|
188
|
-
|
|
189
|
-
if is_json:
|
|
189
|
+
if is_ndjson_stream:
|
|
190
190
|
try:
|
|
191
191
|
parsed_chunk = GenerativeChunk.model_validate_json(chunk).chunk
|
|
192
192
|
if first and isinstance(
|
|
@@ -214,8 +214,11 @@ async def chat_streaming_generator(
|
|
|
214
214
|
)
|
|
215
215
|
else:
|
|
216
216
|
text_answer += chunk.decode()
|
|
217
|
+
if first:
|
|
218
|
+
metrics.record_first_chunk_yielded()
|
|
219
|
+
first = False
|
|
217
220
|
|
|
218
|
-
if
|
|
221
|
+
if is_ndjson_stream is False and chunk: # Ensure chunk is not empty before decoding
|
|
219
222
|
# If response is text the status_code comes at the last chunk of data
|
|
220
223
|
last_chunk = chunk.decode()
|
|
221
224
|
if last_chunk[-1] == "0":
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nucliadb
|
|
3
|
-
Version: 6.8.1.
|
|
3
|
+
Version: 6.8.1.post4957
|
|
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.8.1.
|
|
23
|
-
Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.8.1.
|
|
24
|
-
Requires-Dist: nucliadb-protos>=6.8.1.
|
|
25
|
-
Requires-Dist: nucliadb-models>=6.8.1.
|
|
26
|
-
Requires-Dist: nidx-protos>=6.8.1.
|
|
22
|
+
Requires-Dist: nucliadb-telemetry[all]>=6.8.1.post4957
|
|
23
|
+
Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.8.1.post4957
|
|
24
|
+
Requires-Dist: nucliadb-protos>=6.8.1.post4957
|
|
25
|
+
Requires-Dist: nucliadb-models>=6.8.1.post4957
|
|
26
|
+
Requires-Dist: nidx-protos>=6.8.1.post4957
|
|
27
27
|
Requires-Dist: nucliadb-admin-assets>=1.0.0.post1224
|
|
28
28
|
Requires-Dist: nuclia-models>=0.47.0
|
|
29
29
|
Requires-Dist: uvicorn[standard]
|
|
@@ -259,7 +259,7 @@ nucliadb/search/search/ingestion_agents.py,sha256=IK6yOPEF9rST_uoqspdVdPk0pldjDh
|
|
|
259
259
|
nucliadb/search/search/merge.py,sha256=XiRBsxhYPshPV7lZXD-9E259KZOPIf4I2tKosY0lPo4,22470
|
|
260
260
|
nucliadb/search/search/metrics.py,sha256=yodhoyn-smFdS7rKUn_XXNNXT93WqVdZj9F3TCbbQTI,4160
|
|
261
261
|
nucliadb/search/search/paragraphs.py,sha256=pNAEiYqJGGUVcEf7xf-PFMVqz0PX4Qb-WNG-_zPGN2o,7799
|
|
262
|
-
nucliadb/search/search/predict_proxy.py,sha256=
|
|
262
|
+
nucliadb/search/search/predict_proxy.py,sha256=fjy4HsIkv-CfiHIk9282Pp0DfLgl3939F-whYk4LnYI,10051
|
|
263
263
|
nucliadb/search/search/query.py,sha256=lYCesbUv-B7IyVFQoCCurcxl_Azc5nq3jtVQJ9tk1Ao,11552
|
|
264
264
|
nucliadb/search/search/rank_fusion.py,sha256=xZtXhbmKb_56gs73u6KkFm2efvTATOSMmpOV2wrAIqE,9613
|
|
265
265
|
nucliadb/search/search/rerankers.py,sha256=2LNC0I28EXriffMuBlOYzjQq0vCTjpCxaK29f852n3s,7473
|
|
@@ -379,8 +379,8 @@ nucliadb/writer/tus/local.py,sha256=7jYa_w9b-N90jWgN2sQKkNcomqn6JMVBOVeDOVYJHto,
|
|
|
379
379
|
nucliadb/writer/tus/s3.py,sha256=vu1BGg4VqJ_x2P1u2BxqPKlSfw5orT_a3R-Ln5oPUpU,8483
|
|
380
380
|
nucliadb/writer/tus/storage.py,sha256=ToqwjoYnjI4oIcwzkhha_MPxi-k4Jk3Lt55zRwaC1SM,2903
|
|
381
381
|
nucliadb/writer/tus/utils.py,sha256=MSdVbRsRSZVdkaum69_0wku7X3p5wlZf4nr6E0GMKbw,2556
|
|
382
|
-
nucliadb-6.8.1.
|
|
383
|
-
nucliadb-6.8.1.
|
|
384
|
-
nucliadb-6.8.1.
|
|
385
|
-
nucliadb-6.8.1.
|
|
386
|
-
nucliadb-6.8.1.
|
|
382
|
+
nucliadb-6.8.1.post4957.dist-info/METADATA,sha256=KGAf5k2C2lSS6oquvHBaWibun3KJxaxpK5ZORTH5FSg,4158
|
|
383
|
+
nucliadb-6.8.1.post4957.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
384
|
+
nucliadb-6.8.1.post4957.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
|
|
385
|
+
nucliadb-6.8.1.post4957.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
|
|
386
|
+
nucliadb-6.8.1.post4957.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|